Rev 7508 | Rev 7663 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7360 | IgorA | 1 | use32 |
2 | org 0 |
||
3 | db 'MENUET01' |
||
7662 | IgorA | 4 | dd 1,start,i_end,mem,stacktop,file_name,sys_path |
7360 | IgorA | 5 | |
7365 | pavelyakov | 6 | include '../../macros.inc' |
7 | include '../../proc32.inc' |
||
8 | include '../../KOSfuncs.inc' |
||
9 | include '../../load_img.inc' |
||
10 | include '../../develop/libraries/libs-dev/libimg/libimg.inc' |
||
11 | include '../../develop/libraries/box_lib/trunk/box_lib.mac' |
||
7360 | IgorA | 12 | include 'lang.inc' |
13 | include 'cnc_editor.inc' |
||
14 | include '../../develop/info3ds/info_fun_float.inc' |
||
15 | |||
16 | @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load |
||
7662 | IgorA | 17 | caption db 'CNC editor 22.05.19',0 ;подпись окна |
7360 | IgorA | 18 | |
19 | run_file_70 FileInfoBlock |
||
20 | |||
21 | offs_last_timer dd 0 ;последний сдвиг показаный в функции таймера |
||
22 | |||
23 | IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 |
||
24 | image_data_toolbar dd 0 ;указатель на временную память. для нужен преобразования изображения |
||
25 | icon_tl_sys dd 0 ;указатель на память для хранения системных иконок |
||
26 | icon_toolbar dd 0 ;указатель на память для хранения иконок объектов |
||
27 | |||
28 | include 'wnd_point_coords.inc' |
||
29 | include 'wnd_scale.inc' |
||
30 | include 'wnd_new_file.inc' |
||
31 | |||
32 | align 4 |
||
33 | start: |
||
7662 | IgorA | 34 | ;--- copy cmd line --- |
35 | mov esi,file_name |
||
36 | mov edi,openfile_path |
||
37 | @@: |
||
38 | lodsd |
||
39 | or eax,eax |
||
40 | jz @f ;выход, если 0 |
||
41 | stosd |
||
42 | jmp @b |
||
43 | @@: |
||
44 | stosd |
||
45 | |||
7360 | IgorA | 46 | load_libraries l_libs_start,l_libs_end |
47 | ;проверка на сколько удачно загузилась библиотека |
||
48 | mov ebp,lib_0 |
||
49 | cmp dword [ebp+ll_struc_size-4],0 |
||
50 | jz @f |
||
51 | mcall SF_TERMINATE_PROCESS |
||
52 | @@: |
||
53 | mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors |
||
54 | mcall SF_SET_EVENTS_MASK,0xC0000027 |
||
55 | stdcall [OpenDialog_Init],OpenDialog_data ;подготовка диалога |
||
56 | |||
57 | stdcall [buf2d_create], buf_0 ;создание буфера |
||
58 | |||
59 | ;шрифт делаем до создания панели (для экономии указателя image_data_toolbar) |
||
60 | include_image_file '..\..\fs\kfar\trunk\font6x9.bmp', image_data_toolbar, buf_1.w,buf_1.h |
||
61 | stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;создаем буфер |
||
62 | stdcall mem.Free,[image_data_toolbar] ;освобождаем память |
||
63 | stdcall [buf2d_conv_24_to_8], buf_1,1 ;делаем буфер прозрачности 8 бит |
||
64 | stdcall [buf2d_convert_text_matrix], buf_1 |
||
65 | mov eax,[buf_1.h] |
||
66 | shr eax,8 |
||
67 | mov [font_h],eax |
||
68 | |||
69 | include_image_file 'toolbar.png', image_data_toolbar |
||
70 | |||
71 | mov dword[w_scr_t1.type],1 |
||
72 | stdcall dword[tl_data_init], tree1 |
||
73 | ;системные иконки 16*16 для tree_list |
||
74 | include_image_file 'tl_sys_16.png', icon_tl_sys |
||
75 | mov eax,dword[icon_tl_sys] |
||
76 | mov dword[tree1.data_img_sys],eax |
||
77 | |||
78 | include_image_file 'objects.png', icon_toolbar |
||
79 | mov eax,dword[icon_toolbar] |
||
80 | mov dword[tree1.data_img],eax |
||
81 | |||
82 | ;*** установка времени для таймера |
||
83 | mcall SF_SYSTEM_GET,SSF_TIME_COUNT |
||
84 | mov [last_time],eax |
||
85 | |||
7662 | IgorA | 86 | ;open file from cmd line |
87 | cmp dword[openfile_path],0 |
||
88 | je @f |
||
89 | call but_open_file.no_dlg |
||
90 | @@: |
||
7360 | IgorA | 91 | |
92 | align 4 |
||
93 | red_win: |
||
94 | call draw_window |
||
95 | |||
96 | align 4 |
||
97 | still: |
||
98 | mcall SF_SYSTEM_GET,SSF_TIME_COUNT |
||
99 | mov ebx,[last_time] |
||
100 | add ebx,10 ;задержка |
||
101 | cmp ebx,eax |
||
102 | jge @f |
||
103 | mov ebx,eax |
||
104 | @@: |
||
105 | sub ebx,eax |
||
106 | mcall SF_WAIT_EVENT_TIMEOUT |
||
107 | cmp eax,0 |
||
108 | jne @f |
||
109 | call timer_funct |
||
110 | jmp still |
||
111 | @@: |
||
112 | |||
113 | cmp al,1 |
||
114 | jz red_win |
||
115 | cmp al,2 |
||
116 | jz key |
||
117 | cmp al,3 |
||
118 | jz button |
||
119 | cmp al,6 |
||
120 | jne @f |
||
121 | mcall SF_THREAD_INFO,procinfo,-1 |
||
122 | cmp ax,word[procinfo.window_stack_position] |
||
123 | jne @f ;окно не активно |
||
124 | call mouse |
||
125 | @@: |
||
126 | jmp still |
||
127 | |||
128 | align 4 |
||
129 | mouse: |
||
130 | push eax ebx ecx |
||
131 | mcall SF_MOUSE_GET,SSF_BUTTON_EXT |
||
132 | bt eax,8 |
||
133 | jnc @f |
||
134 | ;mouse l. but. press |
||
135 | call mouse_left_d |
||
136 | jmp .end_l |
||
137 | @@: |
||
138 | ;bt eax,0 |
||
139 | ;jnc @f |
||
140 | ;mouse l. but. move |
||
141 | ;call mouse_left_m |
||
142 | ;jmp .end_l |
||
143 | ;@@: |
||
144 | bt eax,16 |
||
145 | jnc .end_l |
||
146 | ;mouse l. but. up |
||
147 | call mouse_left_u |
||
148 | ;jmp .end_l |
||
149 | .end_l: |
||
150 | bt eax,9 |
||
151 | jnc @f |
||
152 | ;mouse r. but. press |
||
153 | call mouse_right_d |
||
154 | ;jmp .end_r |
||
155 | @@: |
||
156 | ;bt eax,1 |
||
157 | ;jnc @f |
||
158 | ;mouse r. but. move |
||
159 | ;call mouse_right_m |
||
160 | ;jmp .end_r |
||
161 | ;@@: |
||
162 | ;.end_r: |
||
163 | |||
164 | call buf_get_mouse_coord |
||
165 | cmp eax,-1 |
||
166 | je .end0 |
||
167 | shl eax,1 |
||
168 | sub eax,[buf_0.w] |
||
169 | sar eax,1 |
||
170 | mov [mouse_prop_x],eax |
||
171 | stdcall [tl_node_get_data],tree1 |
||
172 | or eax,eax |
||
173 | jz .end0 |
||
174 | cmp [eax+Figure.OType],'Fig' |
||
175 | je @f |
||
176 | cmp [eax+Figure.OType],'Obj' |
||
177 | je .end1 |
||
178 | jmp .end0 |
||
179 | .end1: |
||
180 | mov eax,ObjData |
||
181 | @@: |
||
182 | mov ecx,eax |
||
183 | shl ebx,1 |
||
184 | sub ebx,[buf_0.h] |
||
185 | sar ebx,1 |
||
186 | mov [mouse_prop_y],ebx |
||
187 | |||
188 | mcall SF_MOUSE_GET,SSF_SCROLL_DATA |
||
189 | test ax,ax |
||
190 | jz .end0 |
||
191 | finit |
||
192 | fld qword[zoom_plus] |
||
193 | fld1 |
||
194 | fsubp |
||
195 | fld st0 ;for Y coord |
||
196 | |||
197 | ;for X coord |
||
198 | fild dword[mouse_prop_x] |
||
199 | fmulp st1,st0 |
||
200 | |||
201 | mov ebx,eax |
||
202 | test ax,0x8000 |
||
203 | jnz .decr |
||
204 | ;увеличение масштаба |
||
205 | fchs |
||
206 | fild dword[ecx+Figure.MCentrX] ;add old value |
||
207 | fmul qword[zoom_plus] |
||
208 | faddp |
||
209 | |||
210 | fld qword[ecx+Figure.MScale] |
||
211 | fmul qword[zoom_plus] |
||
212 | ;if (Figure.MScale>16.0) |
||
213 | ;... |
||
214 | jmp @f |
||
215 | .decr: |
||
216 | ;уменьшение масштаба |
||
217 | fild dword[ecx+Figure.MCentrX] ;add old value |
||
218 | fdiv qword[zoom_plus] |
||
219 | faddp |
||
220 | |||
221 | fld qword[ecx+Figure.MScale] |
||
222 | fdiv qword[zoom_plus] |
||
223 | fld1 |
||
224 | fcomp |
||
225 | fstsw ax |
||
226 | sahf |
||
227 | jbe @f |
||
228 | ;if (Figure.MScale<1.0) |
||
229 | ffree st0 |
||
230 | fincstp |
||
231 | ffree st0 |
||
232 | fincstp |
||
233 | fldz ;default Figure.MCentrX |
||
234 | fld1 ;default Figure.MScale |
||
235 | mov dword[ecx+Figure.MCentrY],0 |
||
236 | @@: |
||
237 | fstp qword[ecx+Figure.MScale] |
||
238 | fistp dword[ecx+Figure.MCentrX] |
||
239 | |||
240 | ;for Y coord |
||
241 | fild dword[mouse_prop_y] |
||
242 | fmulp st1,st0 |
||
243 | test bx,0x8000 |
||
244 | jnz .decr_y |
||
245 | ;увеличение масштаба |
||
246 | fild dword[ecx+Figure.MCentrY] ;add old value |
||
247 | fmul qword[zoom_plus] |
||
248 | faddp |
||
249 | jmp @f |
||
250 | .decr_y: |
||
251 | ;уменьшение масштаба |
||
252 | fchs |
||
253 | fild dword[ecx+Figure.MCentrY] ;add old value |
||
254 | fdiv qword[zoom_plus] |
||
255 | faddp |
||
256 | @@: |
||
257 | fistp dword[ecx+Figure.MCentrY] |
||
258 | |||
259 | mov dword[offs_last_timer],0 |
||
260 | .end0: |
||
261 | |||
262 | stdcall [tl_mouse], tree1 |
||
263 | pop ecx ebx eax |
||
264 | ret |
||
265 | |||
266 | ;output: |
||
267 | ; eax - buffer coord X (если курсор за буфером -1) |
||
268 | ; ebx - buffer coord Y (если курсор за буфером -1) |
||
269 | align 4 |
||
270 | proc buf_get_mouse_coord |
||
271 | mcall SF_MOUSE_GET,SSF_WINDOW_POSITION |
||
272 | cmp ax,word[buf_0.t] |
||
273 | jl .no_buf ;не попали в окно буфера по оси y |
||
274 | mov ebx,eax |
||
275 | shr ebx,16 |
||
276 | cmp bx,word[buf_0.l] |
||
277 | jl .no_buf ;не попали в окно буфера по оси x |
||
278 | |||
279 | and eax,0xffff ;оставляем координату y |
||
280 | sub ax,word[buf_0.t] |
||
281 | cmp eax,[buf_0.h] |
||
282 | jg .no_buf |
||
283 | sub bx,word[buf_0.l] |
||
284 | cmp ebx,[buf_0.w] |
||
285 | jg .no_buf |
||
286 | xchg eax,ebx |
||
287 | jmp .end_f |
||
288 | .no_buf: |
||
289 | xor eax,eax |
||
290 | not eax |
||
291 | xor ebx,ebx |
||
292 | not ebx |
||
293 | .end_f: |
||
294 | ret |
||
295 | endp |
||
296 | |||
297 | align 4 |
||
298 | proc timer_funct |
||
299 | pushad |
||
300 | mcall SF_SYSTEM_GET,SSF_TIME_COUNT |
||
301 | mov [last_time],eax |
||
302 | |||
303 | ;просматриваем выделенный блок данных |
||
304 | stdcall [tl_node_get_data],tree1 |
||
305 | or eax,eax |
||
306 | jz .end_f |
||
307 | cmp dword[offs_last_timer],eax |
||
308 | je .end_f |
||
309 | ;если выделенный блок данных не совпадает с последним запомненным |
||
310 | mov dword[offs_last_timer],eax |
||
311 | |||
312 | stdcall get_object_data,eax |
||
313 | or ecx,ecx |
||
314 | jz .end_oblo |
||
315 | stdcall draw_obj2d,ecx |
||
316 | stdcall [buf2d_draw], buf_0 |
||
317 | jmp .end_f |
||
318 | .end_oblo: |
||
319 | |||
320 | cmp [eax+Figure.OType],'Fig' |
||
321 | jne .end_fblo |
||
322 | stdcall draw_fig2d,eax |
||
323 | stdcall [buf2d_draw], buf_0 |
||
324 | jmp .end_f |
||
325 | .end_fblo: |
||
326 | |||
327 | .end_f: |
||
328 | |||
329 | popad |
||
330 | ret |
||
331 | endp |
||
332 | |||
333 | align 4 |
||
334 | draw_window: |
||
335 | pushad |
||
336 | mcall SF_REDRAW,SSF_BEGIN_DRAW |
||
337 | |||
338 | ; *** рисование главного окна (выполняется 1 раз при запуске) *** |
||
339 | mov edx,[sc.work] |
||
7441 | IgorA | 340 | or edx,0x33000000 |
7360 | IgorA | 341 | mov edi,caption |
342 | mcall SF_CREATE_WINDOW,(20 shl 16)+599,(20 shl 16)+415 |
||
343 | |||
344 | mcall SF_THREAD_INFO,procinfo,-1 |
||
345 | mov eax,dword[procinfo.box.height] |
||
346 | cmp eax,120 |
||
347 | jge @f |
||
348 | mov eax,120 ;min size |
||
349 | @@: |
||
350 | sub eax,65 |
||
351 | mov dword[tree1.box_height],eax |
||
352 | mov word[w_scr_t1.y_size],ax ;новые размеры скроллинга |
||
353 | mov ebx,dword[procinfo.box.width] |
||
354 | cmp ebx,270 |
||
355 | jge @f |
||
356 | mov ebx,270 |
||
357 | @@: |
||
358 | sub ebx,215 |
||
359 | cmp eax,dword[buf_0.h] ;смотрим размер буфера |
||
360 | jne @f |
||
361 | cmp ebx,dword[buf_0.w] |
||
362 | jne @f |
||
363 | jmp .end0 |
||
364 | @@: |
||
365 | stdcall [buf2d_resize],buf_0,ebx,eax,1 |
||
366 | mov eax,ObjData |
||
367 | mov ecx,[eax+Object.FigCount] |
||
368 | or ecx,ecx |
||
369 | jz .end0 |
||
370 | mov eax,[eax+Object.FigData] |
||
371 | xor edx,edx |
||
372 | .cycle0: |
||
373 | stdcall FigCalculateSizes,[eax+4*edx],0 |
||
374 | inc edx |
||
375 | loop .cycle0 |
||
376 | stdcall ObjCalculateScale,ObjData |
||
377 | mov dword[offs_last_timer],0 |
||
378 | call timer_funct |
||
379 | .end0: |
||
380 | |||
381 | ; *** создание кнопок на панель *** |
||
7441 | IgorA | 382 | mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3, [sc.work_button] |
7360 | IgorA | 383 | |
384 | add ebx,25 shl 16 |
||
7441 | IgorA | 385 | mcall ,,,4 ;open |
386 | add ebx,25 shl 16 |
||
387 | mcall ,,,5 ;save |
||
7360 | IgorA | 388 | |
389 | add ebx,30 shl 16 |
||
7441 | IgorA | 390 | mcall ,,,6 ;captions on off |
7360 | IgorA | 391 | |
392 | add ebx,25 shl 16 |
||
7441 | IgorA | 393 | mcall ,,,7 ;figure move up |
7360 | IgorA | 394 | add ebx,25 shl 16 |
7441 | IgorA | 395 | mcall ,,,8 ;figure move down |
7360 | IgorA | 396 | |
397 | add ebx,25 shl 16 |
||
7441 | IgorA | 398 | mcall ,,,9 ;sel points dlg |
7360 | IgorA | 399 | |
400 | add ebx,25 shl 16 |
||
7441 | IgorA | 401 | mcall ,,,10 ;sel points move up |
7360 | IgorA | 402 | add ebx,25 shl 16 |
7441 | IgorA | 403 | mcall ,,,11 ;sel points move down |
7360 | IgorA | 404 | |
405 | add ebx,25 shl 16 |
||
7441 | IgorA | 406 | mcall ,,,12 ;align sel points left |
7415 | IgorA | 407 | add ebx,25 shl 16 |
7441 | IgorA | 408 | mcall ,,,13 ;align sel points right |
7415 | IgorA | 409 | add ebx,25 shl 16 |
7441 | IgorA | 410 | mcall ,,,14 ;align sel points top |
7415 | IgorA | 411 | add ebx,25 shl 16 |
7441 | IgorA | 412 | mcall ,,,15 ;align sel points bottom |
7360 | IgorA | 413 | |
414 | add ebx,25 shl 16 |
||
7441 | IgorA | 415 | mcall ,,,16 ;copy to clipboard |
7415 | IgorA | 416 | add ebx,25 shl 16 |
7441 | IgorA | 417 | mcall ,,,17 ;paste from clipboard |
7360 | IgorA | 418 | |
419 | add ebx,25 shl 16 |
||
7441 | IgorA | 420 | mcall ,,,18 ;sel points del |
7360 | IgorA | 421 | |
422 | add ebx,30 shl 16 |
||
7441 | IgorA | 423 | mcall ,,,19 ;restore zoom |
7360 | IgorA | 424 | |
425 | add ebx,30 shl 16 |
||
7441 | IgorA | 426 | mcall ,,,20 ;.png |
7360 | IgorA | 427 | |
428 | add ebx,25 shl 16 |
||
7441 | IgorA | 429 | mcall ,,,21 ;options scale |
7360 | IgorA | 430 | |
431 | ; *** рисование иконок на кнопках *** |
||
432 | mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(7 shl 16)+7 ;icon new |
||
433 | |||
434 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
435 | add edx,(25 shl 16) ;icon open |
||
436 | int 0x40 |
||
437 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
438 | add edx,(25 shl 16) ;icon save |
||
439 | int 0x40 |
||
440 | |||
441 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
442 | add edx,(30 shl 16) ;captions on off |
||
443 | int 0x40 |
||
444 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
445 | add edx,(25 shl 16) ;figure move up |
||
446 | int 0x40 |
||
447 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
448 | add edx,(25 shl 16) ;figure move down |
||
449 | int 0x40 |
||
450 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
451 | add edx,(25 shl 16) ;sel points dlg |
||
452 | int 0x40 |
||
453 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
454 | add edx,(25 shl 16) ;sel points move up |
||
455 | int 0x40 |
||
456 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
457 | add edx,(25 shl 16) ;sel points move down |
||
458 | int 0x40 |
||
459 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
7415 | IgorA | 460 | add edx,(25 shl 16) ;aling sel points left |
461 | int 0x40 |
||
462 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
463 | add edx,(25 shl 16) ;aling sel points right |
||
464 | int 0x40 |
||
465 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
466 | add edx,(25 shl 16) ;aling sel points top |
||
467 | int 0x40 |
||
468 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
469 | add edx,(25 shl 16) ;aling sel points bottom |
||
470 | int 0x40 |
||
471 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
7360 | IgorA | 472 | add edx,(25 shl 16) ;copy to clipboard |
473 | int 0x40 |
||
474 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
475 | add edx,(25 shl 16) ;paste from clipboard |
||
476 | int 0x40 |
||
477 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
478 | add edx,(25 shl 16) ;sel points del |
||
479 | int 0x40 |
||
480 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
481 | add edx,(30 shl 16) ;restore zoom |
||
482 | int 0x40 |
||
483 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
484 | add edx,(30 shl 16) ;.png |
||
485 | int 0x40 |
||
486 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
487 | add edx,(25 shl 16) ;options scale |
||
488 | int 0x40 |
||
489 | |||
490 | mov dword[w_scr_t1.all_redraw],1 |
||
491 | stdcall [tl_draw], tree1 |
||
492 | stdcall [buf2d_draw], buf_0 |
||
493 | |||
494 | mcall SF_REDRAW,SSF_END_DRAW |
||
495 | popad |
||
496 | ret |
||
497 | |||
498 | align 4 |
||
499 | key: |
||
500 | mcall SF_GET_KEY |
||
501 | cmp dword[el_focus], tree1 |
||
502 | jne @f |
||
503 | stdcall [tl_key], tree1 |
||
504 | jmp .end0 |
||
505 | @@: |
||
506 | |||
507 | cmp ah,178 ;Up |
||
508 | jne @f |
||
509 | call but_selection_move_up |
||
510 | jmp .end0 |
||
511 | @@: |
||
512 | cmp ah,177 ;Down |
||
513 | jne @f |
||
514 | call but_selection_move_down |
||
515 | jmp .end0 |
||
516 | @@: |
||
517 | cmp ah,176 ;Left |
||
518 | jne @f |
||
519 | call but_selection_move_up |
||
520 | jmp .end0 |
||
521 | @@: |
||
522 | cmp ah,179 ;Right |
||
523 | jne @f |
||
524 | call but_selection_move_down |
||
525 | jmp .end0 |
||
526 | @@: |
||
527 | cmp ah,182 ;Delete |
||
528 | jne @f |
||
529 | call but_sel_points_del |
||
530 | jmp .end0 |
||
531 | @@: |
||
532 | |||
533 | mov ecx,eax |
||
534 | mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS |
||
535 | bt eax,2 ;left Ctrl |
||
536 | jc .key_Ctrl |
||
537 | bt eax,3 ;right Ctrl |
||
538 | jc .key_Ctrl |
||
539 | jmp .end0 |
||
540 | .key_Ctrl: |
||
541 | cmp ch,15 ;111 ;Ctrl+O |
||
542 | jne @f |
||
543 | call but_open_file |
||
544 | @@: |
||
545 | cmp ch,19 ;115 ;Ctrl+S |
||
546 | jne @f |
||
547 | call but_save_file |
||
548 | @@: |
||
549 | cmp ch,14 ;110 ;Ctrl+N |
||
550 | jne @f |
||
551 | call but_new_file |
||
552 | @@: |
||
553 | cmp ch,1 ;97 ;Ctrl+A |
||
554 | jne @f |
||
555 | call but_sel_points_all |
||
556 | @@: |
||
557 | .end0: |
||
558 | jmp still |
||
559 | |||
560 | |||
561 | align 4 |
||
562 | button: |
||
563 | mcall SF_GET_BUTTON |
||
564 | cmp ah,3 |
||
565 | jne @f |
||
566 | call but_new_file |
||
567 | jmp still |
||
568 | @@: |
||
569 | cmp ah,4 |
||
570 | jne @f |
||
571 | call but_open_file |
||
572 | jmp still |
||
573 | @@: |
||
574 | cmp ah,5 |
||
575 | jne @f |
||
576 | call but_save_file |
||
577 | jmp still |
||
578 | @@: |
||
579 | cmp ah,6 |
||
580 | jne @f |
||
581 | call but_captions_on_off |
||
582 | jmp still |
||
583 | @@: |
||
584 | cmp ah,7 |
||
585 | jne @f |
||
586 | call but_sel_figure_move_up |
||
587 | jmp still |
||
588 | @@: |
||
589 | cmp ah,8 |
||
590 | jne @f |
||
591 | call but_sel_figure_move_down |
||
592 | jmp still |
||
593 | @@: |
||
594 | cmp ah,9 |
||
595 | jne @f |
||
596 | call but_dlg_point_coords |
||
597 | jmp still |
||
598 | @@: |
||
599 | cmp ah,10 |
||
600 | jne @f |
||
601 | call but_sel_points_move_up |
||
602 | jmp still |
||
603 | @@: |
||
604 | cmp ah,11 |
||
605 | jne @f |
||
606 | call but_sel_points_move_down |
||
607 | jmp still |
||
608 | @@: |
||
609 | cmp ah,12 |
||
610 | jne @f |
||
7415 | IgorA | 611 | call but_sel_points_align_coord_xmin |
7360 | IgorA | 612 | jmp still |
613 | @@: |
||
614 | cmp ah,13 |
||
615 | jne @f |
||
7415 | IgorA | 616 | call but_sel_points_align_coord_xmax |
7360 | IgorA | 617 | jmp still |
618 | @@: |
||
619 | cmp ah,14 |
||
620 | jne @f |
||
7415 | IgorA | 621 | call but_sel_points_align_coord_ymax |
7360 | IgorA | 622 | jmp still |
623 | @@: |
||
624 | cmp ah,15 |
||
625 | jne @f |
||
7415 | IgorA | 626 | call but_sel_points_align_coord_ymin |
627 | @@: |
||
628 | cmp ah,16 |
||
629 | jne @f |
||
630 | call but_clipboard_copy_points |
||
631 | jmp still |
||
632 | @@: |
||
633 | cmp ah,17 |
||
634 | jne @f |
||
635 | call but_clipboard_paste_points |
||
636 | jmp still |
||
637 | @@: |
||
638 | cmp ah,18 |
||
639 | jne @f |
||
640 | call but_sel_points_del |
||
641 | jmp still |
||
642 | @@: |
||
643 | cmp ah,19 |
||
644 | jne @f |
||
7360 | IgorA | 645 | call but_restore_zoom |
646 | jmp still |
||
647 | @@: |
||
7415 | IgorA | 648 | cmp ah,20 |
7360 | IgorA | 649 | jne @f |
650 | call but_save_png |
||
651 | jmp still |
||
652 | @@: |
||
7415 | IgorA | 653 | cmp ah,21 |
7360 | IgorA | 654 | jne @f |
655 | call but_dlg_opt_scale |
||
656 | jmp still |
||
657 | @@: |
||
658 | |||
7415 | IgorA | 659 | ;cmp ah,22 |
7360 | IgorA | 660 | ;jne @f |
661 | ;call but_... |
||
662 | ;jmp still |
||
663 | ;@@: |
||
664 | cmp ah,1 |
||
665 | jne still |
||
666 | .exit: |
||
667 | stdcall [buf2d_delete],buf_0 |
||
668 | stdcall mem.Free,[image_data_toolbar] |
||
669 | stdcall mem.Free,[open_file_data] |
||
670 | mcall SF_TERMINATE_PROCESS |
||
671 | |||
672 | |||
673 | align 4 |
||
674 | but_new_file: |
||
675 | cmp byte[wnd_n_file],0 |
||
676 | jne .end_f |
||
677 | pushad |
||
678 | mcall SF_CREATE_THREAD,1,start_n_file,thread_n_file |
||
679 | popad |
||
680 | .end_f: |
||
681 | ret |
||
682 | |||
683 | align 4 |
||
684 | open_file_data dd 0 ;указатель на память для открытия файлов |
||
685 | open_file_size dd 0 ;размер открытого файла |
||
686 | |||
687 | align 4 |
||
688 | but_open_file: |
||
7662 | IgorA | 689 | copy_path open_dialog_name,communication_area_default_path,file_name,0 |
7360 | IgorA | 690 | pushad |
691 | mov [OpenDialog_data.type],0 |
||
692 | stdcall [OpenDialog_Start],OpenDialog_data |
||
693 | cmp [OpenDialog_data.status],2 |
||
694 | je .end_open_file |
||
695 | ;код при удачном открытии диалога |
||
7662 | IgorA | 696 | jmp .end0 |
697 | .no_dlg: ;если минуем диалог открытия файла |
||
698 | pushad |
||
699 | mov esi,openfile_path |
||
700 | stdcall str_len,esi |
||
701 | add esi,eax |
||
702 | @@: ;цикл для поиска начала имени файла |
||
703 | dec esi |
||
704 | cmp byte[esi],'/' |
||
705 | je @f |
||
706 | cmp byte[esi],0x5c ;'\' |
||
707 | je @f |
||
708 | cmp esi,openfile_path |
||
709 | jg @b |
||
710 | @@: |
||
711 | inc esi |
||
712 | stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;копируем имя файла в диалог сохранения |
||
713 | .end0: |
||
7360 | IgorA | 714 | |
715 | mov [run_file_70.Function], SSF_GET_INFO |
||
716 | mov [run_file_70.Position], 0 |
||
717 | mov [run_file_70.Flags], 0 |
||
718 | mov dword[run_file_70.Count], 0 |
||
719 | mov dword[run_file_70.Buffer], open_b |
||
720 | mov byte[run_file_70+20], 0 |
||
721 | mov dword[run_file_70.FileName], openfile_path |
||
722 | mcall SF_FILE,run_file_70 |
||
723 | |||
724 | mov ecx,dword[open_b+32] ;+32 qword: размер файла в байтах |
||
725 | inc ecx ;for text files |
||
726 | stdcall mem.ReAlloc,[open_file_data],ecx |
||
727 | mov [open_file_data],eax |
||
728 | dec ecx ;for text files |
||
729 | mov byte[eax+ecx],0 ;for text files |
||
730 | |||
731 | mov [run_file_70.Function], SSF_READ_FILE |
||
732 | mov [run_file_70.Position], 0 |
||
733 | mov [run_file_70.Flags], 0 |
||
734 | mov dword[run_file_70.Count], ecx |
||
735 | m2m dword[run_file_70.Buffer], dword[open_file_data] |
||
736 | mov byte[run_file_70+20], 0 |
||
737 | mov dword[run_file_70.FileName], openfile_path |
||
738 | mcall SF_FILE,run_file_70 ;загружаем файл изображения |
||
739 | test eax,eax |
||
740 | jnz .end_open_file |
||
741 | cmp ebx,0xffffffff |
||
742 | je .end_open_file |
||
743 | |||
744 | mov [open_file_size],ebx |
||
745 | mcall SF_SET_CAPTION,1,openfile_path |
||
746 | |||
747 | ;--- |
||
7508 | IgorA | 748 | and dword[tree1.style],not tl_cursor_pos_limited |
7360 | IgorA | 749 | stdcall FileInit,[open_file_data],[open_file_size] |
7508 | IgorA | 750 | or dword[tree1.style], tl_cursor_pos_limited |
7360 | IgorA | 751 | stdcall [buf2d_clear], buf_0, [buf_0.color] ;чистим буфер |
752 | stdcall [buf2d_draw], buf_0 ;обновляем буфер на экране |
||
753 | .end_open_file: |
||
754 | popad |
||
755 | ret |
||
756 | |||
757 | align 4 |
||
758 | proc but_save_file |
||
759 | locals |
||
760 | pCou dd ? |
||
761 | pData dd ? |
||
762 | endl |
||
763 | pushad |
||
764 | copy_path open_dialog_name,communication_area_default_path,file_name,0 |
||
765 | mov [OpenDialog_data.type],1 |
||
7662 | IgorA | 766 | stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1 ;.nc |
7360 | IgorA | 767 | stdcall [OpenDialog_Start],OpenDialog_data |
768 | cmp [OpenDialog_data.status],2 |
||
769 | je .end_save_file |
||
770 | ;код при удачном открытии диалога |
||
771 | |||
772 | ;*** определение примерного размера файла |
||
773 | call get_file_save_size |
||
774 | stdcall mem.ReAlloc,[open_file_data],ecx |
||
775 | mov [open_file_data],eax |
||
776 | mov [open_file_size],ecx |
||
777 | |||
778 | ;clear memory |
||
779 | mov edi,eax |
||
780 | xor eax,eax |
||
781 | shr ecx,2 |
||
782 | rep stosd |
||
783 | |||
784 | ;*** пишем информацию в память |
||
785 | mov edi,[open_file_data] |
||
786 | mov ebx,ObjData |
||
787 | mov edx,[ebx+Object.FigCount] |
||
788 | or edx,edx |
||
789 | jz .cycle1end |
||
790 | mov esi,[ebx+Object.FigData] |
||
791 | align 4 |
||
792 | .cycle1: ;цикл по фигурам |
||
793 | ;param 1 |
||
794 | mov eax,[esi] |
||
795 | or eax,eax |
||
796 | jz .err_save |
||
797 | mov eax,[eax+Figure.PoiCount] |
||
798 | mov [pCou],eax |
||
799 | or eax,eax |
||
800 | jnz @f |
||
801 | mov eax,[esi] |
||
802 | lea eax,[eax+Figure.Caption] |
||
803 | stdcall str_cat,edi,eax |
||
804 | stdcall str_len,edi |
||
805 | add edi,eax |
||
806 | stdcall str_cat,edi,txt_nl |
||
807 | @@: |
||
808 | cmp dword[pCou],0 |
||
809 | je .cycle2end |
||
810 | mov eax,[esi] |
||
811 | mov eax,[eax+Figure.PoiData] |
||
812 | mov [pData],eax |
||
813 | mov word[NumberSymbolsAD],8 |
||
814 | align 4 |
||
815 | .cycle2: ;цикл по точкам |
||
816 | stdcall str_cat,edi,txt_s_poi |
||
817 | ;param 1 |
||
818 | push edi esi |
||
819 | mov esi,[pData] |
||
820 | lea esi,[esi+Point.CoordX] |
||
821 | mov edi,Data_Double |
||
822 | movsd |
||
823 | movsd |
||
824 | pop esi edi |
||
825 | call DoubleFloat_to_String |
||
826 | call String_crop_0 |
||
827 | stdcall str_cat,edi,Data_String |
||
828 | stdcall str_cat,edi,txt_s_poi_Y |
||
829 | ;param 2 |
||
830 | push edi esi |
||
831 | mov esi,[pData] |
||
832 | lea esi,[esi+Point.CoordY] |
||
833 | mov edi,Data_Double |
||
834 | movsd |
||
835 | movsd |
||
836 | pop esi edi |
||
837 | call DoubleFloat_to_String |
||
838 | call String_crop_0 |
||
839 | stdcall str_cat,edi,Data_String |
||
840 | ; |
||
841 | stdcall str_cat,edi,txt_nl |
||
842 | add dword[pData],sizeof.Point |
||
843 | dec dword[pCou] |
||
844 | jnz .cycle2 |
||
845 | .cycle2end: |
||
846 | add esi,4 |
||
847 | dec edx |
||
848 | jnz .cycle1 |
||
849 | .cycle1end: |
||
850 | |||
851 | jmp @f |
||
852 | .err_save: |
||
853 | notify_window_run txt_err_save_txt_file_1 |
||
854 | @@: |
||
855 | |||
856 | ;*** определение параметров файла |
||
857 | mov edi,[open_file_data] |
||
858 | stdcall str_len,edi |
||
859 | ;;cmp eax,[open_file_size] |
||
860 | mov [run_file_70.Count],eax ;размер файла |
||
861 | |||
862 | ;*** сохраняем файл |
||
863 | mov [run_file_70.Function], SSF_CREATE_FILE |
||
864 | mov [run_file_70.Position], 0 |
||
865 | mov [run_file_70.Flags], 0 |
||
866 | mov ebx, dword[open_file_data] |
||
867 | mov [run_file_70.Buffer], ebx |
||
868 | mov byte[run_file_70+20], 0 |
||
869 | mov dword[run_file_70.FileName], openfile_path |
||
870 | mcall SF_FILE,run_file_70 |
||
871 | or eax,eax |
||
872 | jz .end_save_file |
||
873 | or ebx,ebx |
||
874 | jnz .end_save_file |
||
875 | ;сообщение о неудачном сохранении |
||
876 | notify_window_run txt_err_save_txt_file_0 |
||
877 | .end_save_file: |
||
878 | popad |
||
879 | ret |
||
880 | endp |
||
881 | |||
882 | ;output: |
||
883 | ; ecx - memory size for save file |
||
884 | align 4 |
||
885 | proc get_file_save_size uses eax ebx edx esi |
||
886 | mov ecx,100 ;title |
||
887 | mov ebx,ObjData |
||
888 | add ecx,50 ;object |
||
889 | mov edx,[ebx+Object.FigCount] |
||
890 | or edx,edx |
||
891 | jz .cycle1end |
||
892 | mov esi,[ebx+Object.FigData] |
||
893 | align 4 |
||
894 | .cycle1: ; цикл по фигурам |
||
895 | add ecx,80 ;figure |
||
896 | mov eax,[esi] |
||
897 | or eax,eax |
||
898 | jz @f |
||
899 | mov eax,[eax+Figure.PoiCount] |
||
900 | imul eax,70 |
||
901 | add ecx,eax ;points |
||
902 | @@: |
||
903 | add esi,4 |
||
904 | dec edx |
||
905 | jnz .cycle1 |
||
906 | .cycle1end: |
||
907 | ret |
||
908 | endp |
||
909 | |||
910 | align 4 |
||
911 | but_captions_on_off: |
||
912 | xor dword[opt_draw],1 |
||
913 | mov dword[offs_last_timer],0 ;для обновления по таймеру |
||
914 | ret |
||
915 | |||
916 | align 4 |
||
917 | but_sel_figure_move_up: |
||
918 | pushad |
||
919 | stdcall [tl_node_get_data],tree1 |
||
920 | or eax,eax |
||
921 | jz .end_fblo |
||
922 | cmp [eax+Figure.OType],'Fig' |
||
923 | jne .end_fblo |
||
924 | stdcall found_parent_obj,eax |
||
925 | or eax,eax |
||
926 | jz .end_f ;if not found |
||
927 | or ecx,ecx |
||
928 | jz .fig_is_0 ;если фигура в начале списка |
||
929 | mov ebx,[eax+Object.FigData] |
||
930 | mov edx,[ebx+4*ecx] ;передвигаемая фигура |
||
931 | mov edi,[ebx+4*ecx-4] |
||
932 | ;меняем фигуры местами |
||
933 | mov [ebx+4*ecx],edi |
||
934 | mov [ebx+4*ecx-4],edx |
||
935 | ;меняем фигуры в списке |
||
936 | stdcall [tl_node_move_up],tree1 |
||
937 | jmp .end_f |
||
938 | .fig_is_0: |
||
939 | notify_window_run txt_err_figure_is_0 |
||
940 | jmp .end_f |
||
941 | .end_fblo: |
||
942 | notify_window_run txt_err_no_figure_select |
||
943 | .end_f: |
||
944 | popad |
||
945 | ret |
||
946 | |||
947 | align 4 |
||
948 | but_save_png: |
||
949 | pushad |
||
950 | stdcall [tl_node_get_data],tree1 |
||
951 | or eax,eax |
||
952 | jz .end_save_file |
||
953 | |||
954 | stdcall get_object_data,eax |
||
955 | or ecx,ecx |
||
956 | jz .end_oblo |
||
957 | stdcall draw_obj2d_png,ecx |
||
958 | jmp .beg0 |
||
959 | .end_oblo: |
||
960 | |||
961 | ; cmp [eax+Figure.OType],'Fig' |
||
962 | ; jne .end_fblo |
||
963 | ; stdcall draw_fig2d_png,eax |
||
964 | ; jmp .beg0 |
||
965 | ; .end_fblo: |
||
966 | |||
967 | jmp .end_save_file |
||
968 | .beg0: |
||
969 | copy_path open_dialog_name,communication_area_default_path,file_name,0 |
||
970 | mov [OpenDialog_data.type],1 |
||
7662 | IgorA | 971 | stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.2 ;.png |
7360 | IgorA | 972 | stdcall [OpenDialog_Start],OpenDialog_data |
7662 | IgorA | 973 | cmp [OpenDialog_data.status],1 |
974 | jne .end_save_file |
||
7360 | IgorA | 975 | ;код при удачном открытии диалога |
976 | mov dword[png_data],0 |
||
977 | |||
978 | ;create image struct |
||
979 | stdcall [img_create], [buf_png.w], [buf_png.h], Image.bpp24 |
||
980 | mov ebx,eax |
||
981 | test eax,eax |
||
982 | jz @f |
||
983 | ;copy foto to image buffer |
||
984 | mov edi,[eax+Image.Data] |
||
985 | mov esi,[buf_png] |
||
986 | mov ecx,[buf_png.w] |
||
987 | mov edx,[buf_png.h] |
||
988 | imul ecx,edx |
||
989 | imul ecx,3 |
||
990 | shr ecx,2 ;OpenGL buffer align to 4 |
||
991 | rep movsd |
||
992 | |||
993 | ;encode image |
||
994 | stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0 |
||
995 | test eax,eax |
||
996 | jz @f |
||
997 | mov [png_data],eax |
||
998 | mov [png_size],ecx |
||
999 | @@: |
||
1000 | stdcall [img_destroy],ebx |
||
1001 | |||
1002 | ; заполняем структуру для сохранения файла |
||
1003 | mov ebx,run_file_70 |
||
1004 | mov dword[ebx],SSF_CREATE_FILE |
||
1005 | mov eax,[png_size] |
||
1006 | mov [ebx+12],eax ;file size |
||
1007 | mov eax,[png_data] |
||
1008 | mov [ebx+16],eax |
||
1009 | mov dword[ebx+FileInfoBlock.FileName], openfile_path |
||
1010 | |||
1011 | mcall SF_FILE,run_file_70 |
||
1012 | test eax,eax |
||
1013 | jnz .save_error |
||
1014 | ;notify_window_run openfile_path |
||
1015 | jmp @f |
||
1016 | .save_error: |
||
1017 | ;сообщение о неудачном сохранении |
||
1018 | notify_window_run txt_err_save_img_file |
||
1019 | @@: |
||
1020 | mcall SF_SYS_MISC, SSF_MEM_FREE, [png_data] |
||
1021 | .end_save_file: |
||
1022 | popad |
||
1023 | ret |
||
1024 | |||
1025 | ;description: |
||
1026 | ; выделенные точки сдвигаются вверх |
||
1027 | align 4 |
||
1028 | proc but_sel_points_move_up |
||
1029 | locals |
||
1030 | pObj dd ? |
||
1031 | pFig dd ? |
||
1032 | idFig dd ? |
||
1033 | endl |
||
1034 | pushad |
||
1035 | stdcall [tl_node_get_data],tree1 |
||
1036 | or eax,eax |
||
1037 | jz .no_point |
||
1038 | cmp [eax+Figure.OType],'Fig' |
||
1039 | jne .no_point |
||
1040 | |||
1041 | mov [pFig],eax |
||
1042 | stdcall sel_points_get_count,eax |
||
1043 | or eax,eax |
||
1044 | jz .no_point |
||
1045 | |||
1046 | stdcall found_parent_obj,[pFig] |
||
1047 | or eax,eax |
||
1048 | jz .end_f ;if not found |
||
1049 | mov [pObj],eax |
||
1050 | mov [idFig],ecx |
||
1051 | |||
1052 | ;проверяем выделенные точки |
||
1053 | mov eax,[pFig] |
||
1054 | mov ecx,[eax+Figure.PoiCount] |
||
1055 | or ecx,ecx |
||
1056 | jz .no_point |
||
1057 | mov ebx,[eax+Figure.PoiData] |
||
1058 | xor eax,eax |
||
1059 | .cycle0: |
||
1060 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1061 | jnc @f |
||
1062 | or eax,eax |
||
1063 | jz .point_is_0 |
||
1064 | stdcall point_move_up, [pObj],[pFig],[idFig],ebx;,eax |
||
1065 | @@: |
||
1066 | inc eax |
||
1067 | add ebx,sizeof.Point |
||
1068 | loop .cycle0 |
||
1069 | |||
1070 | ;для обновления по таймеру |
||
1071 | mov dword[offs_last_timer],0 |
||
1072 | jmp .end_f |
||
1073 | .point_is_0: |
||
1074 | notify_window_run txt_err_poi_is_0 |
||
1075 | jmp .end_f |
||
1076 | .no_point: |
||
1077 | notify_window_run txt_err_no_point_sel |
||
1078 | .end_f: |
||
1079 | popad |
||
1080 | ret |
||
1081 | endp |
||
1082 | |||
1083 | ;description: |
||
1084 | ; выделенные точки сдвигаются вниз |
||
1085 | align 4 |
||
1086 | proc but_sel_points_move_down |
||
1087 | locals |
||
1088 | pObj dd ? |
||
1089 | pFig dd ? |
||
1090 | idFig dd ? |
||
1091 | endl |
||
1092 | pushad |
||
1093 | stdcall [tl_node_get_data],tree1 |
||
1094 | or eax,eax |
||
1095 | jz .no_point |
||
1096 | cmp [eax+Figure.OType],'Fig' |
||
1097 | jne .no_point |
||
1098 | |||
1099 | mov [pFig],eax |
||
1100 | stdcall sel_points_get_count,eax |
||
1101 | or eax,eax |
||
1102 | jz .no_point |
||
1103 | |||
1104 | stdcall found_parent_obj,[pFig] |
||
1105 | or eax,eax |
||
1106 | jz .end_f ;if not found |
||
1107 | mov [pObj],eax |
||
1108 | mov [idFig],ecx |
||
1109 | |||
1110 | ;проверяем выделенные точки |
||
1111 | mov eax,[pFig] |
||
1112 | mov ecx,[eax+Figure.PoiCount] |
||
1113 | or ecx,ecx |
||
1114 | jz .no_point |
||
1115 | mov ebx,ecx |
||
1116 | dec ebx |
||
1117 | imul ebx,sizeof.Point |
||
1118 | add ebx,[eax+Figure.PoiData] |
||
1119 | .cycle0: |
||
1120 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1121 | jnc @f |
||
1122 | cmp ecx,[eax+Figure.PoiCount] |
||
1123 | je .point_is_last |
||
1124 | mov edi,ebx |
||
1125 | add edi,sizeof.Point |
||
1126 | stdcall point_move_up, [pObj],[pFig],[idFig],edi;,ecx |
||
1127 | @@: |
||
1128 | sub ebx,sizeof.Point |
||
1129 | loop .cycle0 |
||
1130 | |||
1131 | ;для обновления по таймеру |
||
1132 | mov dword[offs_last_timer],0 |
||
1133 | jmp .end_f |
||
1134 | .point_is_last: |
||
1135 | notify_window_run txt_err_poi_is_last |
||
1136 | jmp .end_f |
||
1137 | .no_point: |
||
1138 | notify_window_run txt_err_no_point_sel |
||
1139 | .end_f: |
||
1140 | popad |
||
1141 | ret |
||
1142 | endp |
||
1143 | |||
1144 | ;description: |
||
1145 | ; выделение выбранной точки сдвигается вверх |
||
1146 | align 4 |
||
1147 | proc but_selection_move_up |
||
1148 | locals |
||
1149 | pFig dd ? |
||
1150 | endl |
||
1151 | pushad |
||
1152 | stdcall [tl_node_get_data],tree1 |
||
1153 | or eax,eax |
||
1154 | jz .end_fblo |
||
1155 | cmp [eax+Figure.OType],'Fig' |
||
1156 | jne .end_fblo |
||
1157 | |||
1158 | mov [pFig],eax |
||
1159 | stdcall sel_points_get_count,eax |
||
1160 | cmp eax,1 |
||
1161 | jne .no_point |
||
1162 | |||
1163 | ;проверяем выделенные точки |
||
1164 | mov eax,[pFig] |
||
1165 | mov ecx,[eax+Figure.PoiCount] |
||
1166 | or ecx,ecx |
||
1167 | jz .no_point |
||
1168 | dec ecx |
||
1169 | jecxz .end_f |
||
1170 | mov ebx,[eax+Figure.PoiData] |
||
1171 | .cycle0: |
||
1172 | add ebx,sizeof.Point |
||
1173 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1174 | jnc @f |
||
1175 | btr dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1176 | bts dword[ebx+Point.Prop-sizeof.Point],PROP_BIT_SELECT |
||
1177 | xor ecx,ecx |
||
1178 | inc ecx ;ecx = 1 - for exit from cycle |
||
1179 | @@: |
||
1180 | loop .cycle0 |
||
1181 | |||
1182 | ;для обновления по таймеру |
||
1183 | mov dword[offs_last_timer],0 |
||
1184 | jmp .end_f |
||
1185 | .no_point: |
||
1186 | notify_window_run txt_err_no_point_sel_1 |
||
1187 | jmp .end_f |
||
1188 | .end_fblo: |
||
1189 | ;notify_window_run txt_err_no_figure_select |
||
1190 | .end_f: |
||
1191 | popad |
||
1192 | ret |
||
1193 | endp |
||
1194 | |||
1195 | ;description: |
||
1196 | ; выделение выбранной точки сдвигается вниз |
||
1197 | align 4 |
||
1198 | proc but_selection_move_down |
||
1199 | locals |
||
1200 | pFig dd ? |
||
1201 | endl |
||
1202 | pushad |
||
1203 | stdcall [tl_node_get_data],tree1 |
||
1204 | or eax,eax |
||
1205 | jz .end_fblo |
||
1206 | cmp [eax+Figure.OType],'Fig' |
||
1207 | jne .end_fblo |
||
1208 | |||
1209 | mov [pFig],eax |
||
1210 | stdcall sel_points_get_count,eax |
||
1211 | cmp eax,1 |
||
1212 | jne .no_point |
||
1213 | |||
1214 | ;проверяем выделенные точки |
||
1215 | mov eax,[pFig] |
||
1216 | mov ecx,[eax+Figure.PoiCount] |
||
1217 | or ecx,ecx |
||
1218 | jz .no_point |
||
1219 | dec ecx |
||
1220 | jecxz .end_f |
||
1221 | mov ebx,[eax+Figure.PoiData] |
||
1222 | .cycle0: |
||
1223 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1224 | jnc @f |
||
1225 | btr dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1226 | bts dword[ebx+Point.Prop+sizeof.Point],PROP_BIT_SELECT |
||
1227 | xor ecx,ecx |
||
1228 | inc ecx ;ecx = 1 - for exit from cycle |
||
1229 | @@: |
||
1230 | add ebx,sizeof.Point |
||
1231 | loop .cycle0 |
||
1232 | |||
1233 | ;для обновления по таймеру |
||
1234 | mov dword[offs_last_timer],0 |
||
1235 | jmp .end_f |
||
1236 | .no_point: |
||
1237 | notify_window_run txt_err_no_point_sel_1 |
||
1238 | jmp .end_f |
||
1239 | .end_fblo: |
||
1240 | ;notify_window_run txt_err_no_figure_select |
||
1241 | .end_f: |
||
1242 | popad |
||
1243 | ret |
||
1244 | endp |
||
1245 | |||
1246 | ;output: |
||
1247 | ; eax - couunt new points |
||
1248 | align 4 |
||
1249 | proc but_clipboard_copy_points uses ebx ecx edx edi esi |
||
1250 | locals |
||
1251 | pData dd 0 |
||
1252 | pBuf dd 0 |
||
1253 | endl |
||
1254 | stdcall [tl_node_get_data],tree1 |
||
1255 | or eax,eax |
||
1256 | jz .no_point |
||
1257 | cmp [eax+Figure.OType],'Fig' |
||
1258 | jne .no_point |
||
1259 | |||
1260 | mov ecx,[eax+Figure.PoiData] |
||
1261 | mov [pData],ecx |
||
1262 | mov ecx,[eax+Figure.PoiCount] |
||
1263 | stdcall sel_points_get_count,eax |
||
1264 | or eax,eax |
||
1265 | jz .no_point |
||
1266 | push eax |
||
1267 | imul eax,32 ;for string 'X___.________ Y___.________^^' |
||
1268 | stdcall mem.Alloc,eax |
||
1269 | mov [pBuf],eax |
||
1270 | |||
1271 | mov edx,eax |
||
1272 | mov dword[edx+4],0 ;text data |
||
1273 | mov dword[edx+8],1 ;code 866 |
||
1274 | add edx,12 ;system buffer header size |
||
1275 | mov dword[edx],0 |
||
1276 | mov word[NumberSymbolsAD],8 |
||
1277 | align 4 |
||
1278 | .cycle2: ;цикл по точкам |
||
1279 | mov esi,[pData] |
||
1280 | bt dword[esi+Point.Prop],PROP_BIT_SELECT |
||
1281 | jnc .end0 |
||
1282 | stdcall str_cat,edx,txt_s_poi |
||
1283 | ;param 1 |
||
1284 | add esi,Point.CoordX |
||
1285 | mov edi,Data_Double |
||
1286 | movsd |
||
1287 | movsd |
||
1288 | call DoubleFloat_to_String |
||
1289 | call String_crop_0 |
||
1290 | stdcall str_cat,edx,Data_String |
||
1291 | stdcall str_cat,edx,txt_s_poi_Y |
||
1292 | ;param 2 |
||
1293 | ;;mov esi,[pData] |
||
1294 | ;;lea esi,[esi+Point.CoordY] |
||
1295 | mov edi,Data_Double |
||
1296 | movsd |
||
1297 | movsd |
||
1298 | call DoubleFloat_to_String |
||
1299 | call String_crop_0 |
||
1300 | stdcall str_cat,edx,Data_String |
||
1301 | ; |
||
1302 | stdcall str_cat,edx,txt_nl |
||
1303 | .end0: |
||
1304 | add dword[pData],sizeof.Point |
||
1305 | loop .cycle2 |
||
1306 | .cycle2end: |
||
1307 | |||
1308 | mov edx,[pBuf] |
||
1309 | add edx,12 |
||
1310 | stdcall str_len,edx |
||
1311 | sub edx,12 |
||
1312 | mov [edx],eax |
||
1313 | add eax,12 |
||
1314 | mov ecx,eax |
||
1315 | mcall SF_CLIPBOARD,SSF_WRITE_CB ;,ecx,edx |
||
1316 | stdcall mem.Free,[pBuf] |
||
1317 | pop eax |
||
1318 | |||
1319 | .no_point: |
||
1320 | ret |
||
1321 | endp |
||
1322 | |||
1323 | ;output: |
||
1324 | ; eax - couunt new points |
||
1325 | align 4 |
||
1326 | proc but_clipboard_paste_points uses ebx ecx edx esi edi |
||
1327 | locals |
||
1328 | pFig dd ? |
||
1329 | nCount dd ? |
||
1330 | endl |
||
1331 | stdcall [tl_node_get_data],tree1 |
||
1332 | or eax,eax |
||
1333 | jz .end0 |
||
1334 | cmp [eax+Figure.OType],'Fig' |
||
1335 | jne .end0 |
||
1336 | |||
1337 | mov [pFig],eax |
||
1338 | |||
1339 | mcall SF_CLIPBOARD,SSF_GET_SLOT_COUNT |
||
1340 | cmp eax,1 |
||
1341 | jl .end0 |
||
1342 | |||
1343 | mov esi,eax |
||
1344 | .cycle0: ;обратный цикл по слотам |
||
1345 | dec esi ;номер текущего, проверяемого слота |
||
1346 | mcall SF_CLIPBOARD,SSF_READ_CB,esi |
||
1347 | cmp eax,1 |
||
1348 | je .end0 |
||
1349 | cmp eax,-1 |
||
1350 | je .end0 |
||
1351 | mov ecx,dword[eax] |
||
1352 | cmp ecx,5 ;min text size |
||
1353 | jl .end0 |
||
1354 | cmp dword[eax+4],0 ;text |
||
1355 | je @f |
||
1356 | cmp esi,1 |
||
1357 | jge .cycle0 ;если в буфере не текст, а слотов в буфере несколько, пробуем перейти к верхнему слоту |
||
1358 | jmp .end0 |
||
1359 | @@: |
||
1360 | |||
1361 | mov esi,eax |
||
1362 | add esi,12 ;смещение начала текста в буфере |
||
1363 | stdcall get_max_points |
||
1364 | or eax,eax |
||
1365 | jz .end_f |
||
1366 | mov [nCount],eax |
||
1367 | mov ebx,[pFig] |
||
1368 | mov edi,[ebx+Figure.PoiCount] |
||
1369 | add [ebx+Figure.PoiCount],eax |
||
1370 | add eax,edi |
||
1371 | imul eax,sizeof.Point |
||
1372 | stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax |
||
1373 | mov [ebx+Figure.PoiData],eax |
||
1374 | |||
1375 | mov ecx,edi |
||
1376 | mov edx,eax |
||
1377 | align 4 |
||
1378 | .cycle1: ;цикл для снятия выделения со старых точек |
||
1379 | btr dword[edx+Point.Prop],PROP_BIT_SELECT |
||
1380 | add edx,sizeof.Point |
||
1381 | loop .cycle1 |
||
1382 | |||
1383 | mov ecx,[nCount] |
||
1384 | imul edi,sizeof.Point |
||
1385 | add edi,eax |
||
1386 | finit |
||
1387 | align 4 |
||
1388 | .cycle2: ;цикл для добавления новых точек |
||
1389 | stdcall PointInit,edi |
||
1390 | or eax,eax |
||
1391 | jz .cycle2end |
||
1392 | bts dword[edi+Point.Prop],PROP_BIT_SELECT |
||
1393 | add edi,sizeof.Point |
||
1394 | loop .cycle2 |
||
1395 | .cycle2end: |
||
1396 | or ecx,ecx |
||
1397 | jz .end1 |
||
1398 | ;уменьшаем объем памяти выделенный для точек |
||
1399 | sub [ebx+Figure.PoiCount],ecx |
||
1400 | mov eax,[ebx+Figure.PoiCount] |
||
1401 | imul eax,sizeof.Point |
||
1402 | stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax |
||
1403 | mov [ebx+Figure.PoiData],eax |
||
1404 | .end1: |
||
1405 | stdcall found_parent_obj,ebx ;get figure number in ecx |
||
1406 | stdcall figure_update_coords,ObjData,ecx |
||
1407 | |||
1408 | mov eax,[nCount] |
||
1409 | mov dword[offs_last_timer],0 |
||
1410 | jmp .end_f |
||
1411 | .end0: |
||
1412 | xor eax,eax |
||
1413 | .end_f: |
||
1414 | ret |
||
1415 | endp |
||
1416 | |||
1417 | align 4 |
||
1418 | proc but_sel_points_del |
||
1419 | locals |
||
1420 | pFig dd ? |
||
1421 | nDel dd ? ;need delete |
||
1422 | endl |
||
1423 | pushad |
||
1424 | stdcall [tl_node_get_data],tree1 |
||
1425 | or eax,eax |
||
1426 | jz .no_point |
||
1427 | cmp [eax+Figure.OType],'Fig' |
||
1428 | jne .no_point |
||
1429 | |||
1430 | mov [pFig],eax |
||
1431 | stdcall sel_points_get_count,eax |
||
1432 | or eax,eax |
||
1433 | jz .no_point |
||
1434 | mov [nDel],eax |
||
1435 | |||
1436 | ;проверяем выделенные точки |
||
1437 | mov ebx,[pFig] |
||
1438 | mov ecx,[ebx+Figure.PoiCount] |
||
1439 | or ecx,ecx |
||
1440 | jz .no_point |
||
1441 | |||
1442 | cmp ecx,eax |
||
1443 | jle .no_all |
||
1444 | |||
1445 | stdcall found_parent_obj,[pFig] |
||
1446 | or eax,eax |
||
1447 | jz .end_f ;if not found |
||
1448 | mov edi,[ebx+Figure.PoiData] |
||
1449 | mov edx,[ebx+Figure.PoiCount] |
||
1450 | imul edx,sizeof.Point |
||
1451 | add edx,edi |
||
1452 | |||
1453 | .cycle0: ;1-я выделенная точка |
||
1454 | cmp edi,edx |
||
1455 | jge .end0 |
||
1456 | bt dword[edi+Point.Prop],PROP_BIT_SELECT |
||
1457 | jc .cycle0end |
||
1458 | add edi,sizeof.Point |
||
1459 | jmp .cycle0 |
||
1460 | .cycle0end: |
||
1461 | |||
1462 | mov esi,edi ;следущая 1-я не выделенная точка |
||
1463 | add esi,sizeof.Point |
||
1464 | .cycle1: |
||
1465 | cmp esi,edx |
||
1466 | jge .end0 |
||
1467 | bt dword[esi+Point.Prop],PROP_BIT_SELECT |
||
1468 | jnc .cycle1end |
||
1469 | add esi,sizeof.Point |
||
1470 | jmp .cycle1 |
||
1471 | .cycle1end: |
||
1472 | |||
1473 | mov ecx,sizeof.Point |
||
1474 | rep movsb ;замена выделенной точки |
||
1475 | bts dword[esi+Point.Prop-sizeof.Point],PROP_BIT_SELECT ;ставим выделение на точку, что-бы потом ее удалить |
||
1476 | |||
1477 | jmp .cycle0 |
||
1478 | .end0: |
||
1479 | |||
1480 | ;обновление памяти |
||
1481 | mov eax,[ebx+Figure.PoiCount] |
||
1482 | sub eax,[nDel] |
||
1483 | mov [ebx+Figure.PoiCount],eax |
||
1484 | imul eax,sizeof.Point |
||
1485 | stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax |
||
1486 | mov [ebx+Figure.PoiData],eax |
||
1487 | |||
1488 | ;перерасчет размеров фигуры |
||
1489 | stdcall found_parent_obj,ebx ;get figure number in ecx |
||
1490 | stdcall figure_update_coords,ObjData,ecx |
||
1491 | |||
1492 | ;для обновления по таймеру |
||
1493 | mov dword[offs_last_timer],0 |
||
1494 | jmp .end_f |
||
1495 | |||
1496 | .no_all: |
||
1497 | notify_window_run txt_err_no_point_del |
||
1498 | jmp .end_f |
||
1499 | .no_point: |
||
1500 | notify_window_run txt_err_no_point_sel |
||
1501 | .end_f: |
||
1502 | popad |
||
1503 | ret |
||
1504 | endp |
||
1505 | |||
1506 | align 4 |
||
1507 | proc but_sel_points_all uses eax ecx |
||
1508 | stdcall [tl_node_get_data],tree1 |
||
1509 | or eax,eax |
||
1510 | jz .no_point |
||
1511 | cmp [eax+Figure.OType],'Fig' |
||
1512 | jne .no_point |
||
1513 | |||
1514 | mov ecx,[eax+Figure.PoiCount] |
||
1515 | or ecx,ecx |
||
1516 | jz .no_point |
||
1517 | mov eax,[eax+Figure.PoiData] |
||
7415 | IgorA | 1518 | .cycle0: ;цикл для выделенния точек |
7360 | IgorA | 1519 | bts dword[eax+Point.Prop],PROP_BIT_SELECT |
1520 | add eax,sizeof.Point |
||
1521 | loop .cycle0 |
||
1522 | ;для обновления по таймеру |
||
1523 | mov dword[offs_last_timer],0 |
||
1524 | .no_point: |
||
1525 | ret |
||
1526 | endp |
||
1527 | |||
1528 | align 4 |
||
7415 | IgorA | 1529 | proc but_sel_points_align_coord_xmin |
1530 | pushad |
||
1531 | stdcall [tl_node_get_data],tree1 |
||
1532 | or eax,eax |
||
1533 | jz .no_point |
||
1534 | cmp [eax+Figure.OType],'Fig' |
||
1535 | jne .no_point |
||
1536 | |||
1537 | mov ebx,eax |
||
1538 | stdcall sel_points_get_count,eax |
||
1539 | cmp eax,1 |
||
1540 | jle .no_point |
||
1541 | mov ecx,[ebx+Figure.PoiCount] |
||
1542 | or ecx,ecx |
||
1543 | jz .no_point |
||
1544 | cmp eax,ecx |
||
1545 | je .no_point ;если выделенны все точки, что-бы не портить контур |
||
1546 | |||
1547 | mov edx,ecx |
||
1548 | imul edx,sizeof.Point |
||
1549 | mov ebx,[ebx+Figure.PoiData] |
||
1550 | add edx,ebx |
||
1551 | align 4 |
||
1552 | .cycle0: ;1-я выделенная точка |
||
1553 | cmp ebx,edx |
||
1554 | jge .no_point |
||
1555 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1556 | jc .cycle0end |
||
1557 | add ebx,sizeof.Point |
||
1558 | jmp .cycle0 |
||
1559 | .cycle0end: |
||
1560 | lea esi,[ebx+Point.CoordX] |
||
1561 | mov edi,Data_Double |
||
1562 | movsd |
||
1563 | movsd |
||
1564 | finit |
||
1565 | fld qword[Data_Double] |
||
1566 | align 4 |
||
1567 | .cycle1: ;цикл для нахождения min(Point.CoordX) |
||
1568 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1569 | jnc .no_sel |
||
1570 | fcom qword[ebx+Point.CoordX] |
||
1571 | fstsw ax |
||
1572 | sahf |
||
1573 | jbe .no_sel |
||
1574 | ;if (st0>Point.CoordX) |
||
1575 | ffree st0 |
||
1576 | fincstp |
||
1577 | fld qword[ebx+Point.CoordX] |
||
1578 | .no_sel: |
||
1579 | add ebx,sizeof.Point |
||
1580 | cmp ebx,edx |
||
1581 | jl .cycle1 |
||
1582 | fstp qword[Data_Double] |
||
1583 | align 4 |
||
1584 | .cycle2: ;цикл для присваивания всем Point.CoordX = min(Point.CoordX) |
||
1585 | sub edx,sizeof.Point |
||
1586 | bt dword[edx+Point.Prop],PROP_BIT_SELECT |
||
1587 | jnc @f |
||
1588 | mov esi,Data_Double |
||
1589 | lea edi,[edx+Point.CoordX] |
||
1590 | movsd |
||
1591 | movsd |
||
1592 | @@: |
||
1593 | loop .cycle2 |
||
1594 | ;для обновления по таймеру |
||
1595 | mov dword[offs_last_timer],0 |
||
1596 | .no_point: |
||
1597 | popad |
||
1598 | ret |
||
1599 | endp |
||
1600 | |||
1601 | align 4 |
||
1602 | proc but_sel_points_align_coord_ymin |
||
1603 | pushad |
||
1604 | stdcall [tl_node_get_data],tree1 |
||
1605 | or eax,eax |
||
1606 | jz .no_point |
||
1607 | cmp [eax+Figure.OType],'Fig' |
||
1608 | jne .no_point |
||
1609 | |||
1610 | mov ebx,eax |
||
1611 | stdcall sel_points_get_count,eax |
||
1612 | cmp eax,1 |
||
1613 | jle .no_point |
||
1614 | mov ecx,[ebx+Figure.PoiCount] |
||
1615 | or ecx,ecx |
||
1616 | jz .no_point |
||
1617 | cmp eax,ecx |
||
1618 | je .no_point ;если выделенны все точки, что-бы не портить контур |
||
1619 | |||
1620 | mov edx,ecx |
||
1621 | imul edx,sizeof.Point |
||
1622 | mov ebx,[ebx+Figure.PoiData] |
||
1623 | add edx,ebx |
||
1624 | align 4 |
||
1625 | .cycle0: ;1-я выделенная точка |
||
1626 | cmp ebx,edx |
||
1627 | jge .no_point |
||
1628 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1629 | jc .cycle0end |
||
1630 | add ebx,sizeof.Point |
||
1631 | jmp .cycle0 |
||
1632 | .cycle0end: |
||
1633 | lea esi,[ebx+Point.CoordY] |
||
1634 | mov edi,Data_Double |
||
1635 | movsd |
||
1636 | movsd |
||
1637 | finit |
||
1638 | fld qword[Data_Double] |
||
1639 | align 4 |
||
1640 | .cycle1: ;цикл для нахождения min(Point.CoordY) |
||
1641 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1642 | jnc .no_sel |
||
1643 | fcom qword[ebx+Point.CoordY] |
||
1644 | fstsw ax |
||
1645 | sahf |
||
1646 | jbe .no_sel |
||
1647 | ;if (st0>Point.CoordY) |
||
1648 | ffree st0 |
||
1649 | fincstp |
||
1650 | fld qword[ebx+Point.CoordY] |
||
1651 | .no_sel: |
||
1652 | add ebx,sizeof.Point |
||
1653 | cmp ebx,edx |
||
1654 | jl .cycle1 |
||
1655 | fstp qword[Data_Double] |
||
1656 | align 4 |
||
1657 | .cycle2: ;цикл для присваивания всем Point.CoordY = min(Point.CoordY) |
||
1658 | sub edx,sizeof.Point |
||
1659 | bt dword[edx+Point.Prop],PROP_BIT_SELECT |
||
1660 | jnc @f |
||
1661 | mov esi,Data_Double |
||
1662 | lea edi,[edx+Point.CoordY] |
||
1663 | movsd |
||
1664 | movsd |
||
1665 | @@: |
||
1666 | loop .cycle2 |
||
1667 | ;для обновления по таймеру |
||
1668 | mov dword[offs_last_timer],0 |
||
1669 | .no_point: |
||
1670 | popad |
||
1671 | ret |
||
1672 | endp |
||
1673 | |||
1674 | align 4 |
||
1675 | proc but_sel_points_align_coord_xmax |
||
1676 | pushad |
||
1677 | stdcall [tl_node_get_data],tree1 |
||
1678 | or eax,eax |
||
1679 | jz .no_point |
||
1680 | cmp [eax+Figure.OType],'Fig' |
||
1681 | jne .no_point |
||
1682 | |||
1683 | mov ebx,eax |
||
1684 | stdcall sel_points_get_count,eax |
||
1685 | cmp eax,1 |
||
1686 | jle .no_point |
||
1687 | mov ecx,[ebx+Figure.PoiCount] |
||
1688 | or ecx,ecx |
||
1689 | jz .no_point |
||
1690 | cmp eax,ecx |
||
1691 | je .no_point ;если выделенны все точки, что-бы не портить контур |
||
1692 | |||
1693 | mov edx,ecx |
||
1694 | imul edx,sizeof.Point |
||
1695 | mov ebx,[ebx+Figure.PoiData] |
||
1696 | add edx,ebx |
||
1697 | align 4 |
||
1698 | .cycle0: ;1-я выделенная точка |
||
1699 | cmp ebx,edx |
||
1700 | jge .no_point |
||
1701 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1702 | jc .cycle0end |
||
1703 | add ebx,sizeof.Point |
||
1704 | jmp .cycle0 |
||
1705 | .cycle0end: |
||
1706 | lea esi,[ebx+Point.CoordX] |
||
1707 | mov edi,Data_Double |
||
1708 | movsd |
||
1709 | movsd |
||
1710 | finit |
||
1711 | fld qword[Data_Double] |
||
1712 | align 4 |
||
1713 | .cycle1: ;цикл для нахождения max(Point.CoordX) |
||
1714 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1715 | jnc .no_sel |
||
1716 | fcom qword[ebx+Point.CoordX] |
||
1717 | fstsw ax |
||
1718 | sahf |
||
1719 | jae .no_sel |
||
1720 | ;if (st0 |
||
1721 | ffree st0 |
||
1722 | fincstp |
||
1723 | fld qword[ebx+Point.CoordX] |
||
1724 | .no_sel: |
||
1725 | add ebx,sizeof.Point |
||
1726 | cmp ebx,edx |
||
1727 | jl .cycle1 |
||
1728 | fstp qword[Data_Double] |
||
1729 | align 4 |
||
1730 | .cycle2: ;цикл для присваивания всем Point.CoordX = max(Point.CoordX) |
||
1731 | sub edx,sizeof.Point |
||
1732 | bt dword[edx+Point.Prop],PROP_BIT_SELECT |
||
1733 | jnc @f |
||
1734 | mov esi,Data_Double |
||
1735 | lea edi,[edx+Point.CoordX] |
||
1736 | movsd |
||
1737 | movsd |
||
1738 | @@: |
||
1739 | loop .cycle2 |
||
1740 | ;для обновления по таймеру |
||
1741 | mov dword[offs_last_timer],0 |
||
1742 | .no_point: |
||
1743 | popad |
||
1744 | ret |
||
1745 | endp |
||
1746 | |||
1747 | align 4 |
||
1748 | proc but_sel_points_align_coord_ymax |
||
1749 | pushad |
||
1750 | stdcall [tl_node_get_data],tree1 |
||
1751 | or eax,eax |
||
1752 | jz .no_point |
||
1753 | cmp [eax+Figure.OType],'Fig' |
||
1754 | jne .no_point |
||
1755 | |||
1756 | mov ebx,eax |
||
1757 | stdcall sel_points_get_count,eax |
||
1758 | cmp eax,1 |
||
1759 | jle .no_point |
||
1760 | mov ecx,[ebx+Figure.PoiCount] |
||
1761 | or ecx,ecx |
||
1762 | jz .no_point |
||
1763 | cmp eax,ecx |
||
1764 | je .no_point ;если выделенны все точки, что-бы не портить контур |
||
1765 | |||
1766 | mov edx,ecx |
||
1767 | imul edx,sizeof.Point |
||
1768 | mov ebx,[ebx+Figure.PoiData] |
||
1769 | add edx,ebx |
||
1770 | align 4 |
||
1771 | .cycle0: ;1-я выделенная точка |
||
1772 | cmp ebx,edx |
||
1773 | jge .no_point |
||
1774 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1775 | jc .cycle0end |
||
1776 | add ebx,sizeof.Point |
||
1777 | jmp .cycle0 |
||
1778 | .cycle0end: |
||
1779 | lea esi,[ebx+Point.CoordY] |
||
1780 | mov edi,Data_Double |
||
1781 | movsd |
||
1782 | movsd |
||
1783 | finit |
||
1784 | fld qword[Data_Double] |
||
1785 | align 4 |
||
1786 | .cycle1: ;цикл для нахождения max(Point.CoordY) |
||
1787 | bt dword[ebx+Point.Prop],PROP_BIT_SELECT |
||
1788 | jnc .no_sel |
||
1789 | fcom qword[ebx+Point.CoordY] |
||
1790 | fstsw ax |
||
1791 | sahf |
||
1792 | jae .no_sel |
||
1793 | ;if (st0 |
||
1794 | ffree st0 |
||
1795 | fincstp |
||
1796 | fld qword[ebx+Point.CoordY] |
||
1797 | .no_sel: |
||
1798 | add ebx,sizeof.Point |
||
1799 | cmp ebx,edx |
||
1800 | jl .cycle1 |
||
1801 | fstp qword[Data_Double] |
||
1802 | align 4 |
||
1803 | .cycle2: ;цикл для присваивания всем Point.CoordY = max(Point.CoordY) |
||
1804 | sub edx,sizeof.Point |
||
1805 | bt dword[edx+Point.Prop],PROP_BIT_SELECT |
||
1806 | jnc @f |
||
1807 | mov esi,Data_Double |
||
1808 | lea edi,[edx+Point.CoordY] |
||
1809 | movsd |
||
1810 | movsd |
||
1811 | @@: |
||
1812 | loop .cycle2 |
||
1813 | ;для обновления по таймеру |
||
1814 | mov dword[offs_last_timer],0 |
||
1815 | .no_point: |
||
1816 | popad |
||
1817 | ret |
||
1818 | endp |
||
1819 | |||
1820 | align 4 |
||
7360 | IgorA | 1821 | proc but_restore_zoom uses eax |
1822 | stdcall [tl_node_get_data],tree1 |
||
1823 | or eax,eax |
||
1824 | jz .end_f |
||
1825 | cmp [eax+Figure.OType],'Fig' |
||
1826 | je @f |
||
1827 | cmp [eax+Figure.OType],'Obj' |
||
1828 | je .end0 |
||
1829 | jmp .end_f |
||
1830 | .end0: |
||
1831 | mov eax,ObjData |
||
1832 | @@: |
||
1833 | finit |
||
1834 | fld1 |
||
1835 | fstp qword[eax+Figure.MScale] |
||
1836 | mov dword[eax+Figure.MCentrX],0 |
||
1837 | mov dword[eax+Figure.MCentrY],0 |
||
1838 | mov dword[offs_last_timer],0 |
||
1839 | .end_f: |
||
1840 | ret |
||
1841 | endp |
||
1842 | |||
1843 | align 4 |
||
1844 | but_sel_figure_move_down: |
||
1845 | pushad |
||
1846 | stdcall [tl_node_get_data],tree1 |
||
1847 | or eax,eax |
||
1848 | jz .end_fblo |
||
1849 | cmp [eax+Figure.OType],'Fig' |
||
1850 | jne .end_fblo |
||
1851 | stdcall found_parent_obj,eax |
||
1852 | or eax,eax |
||
1853 | jz .end_f ;if not found |
||
1854 | inc ecx |
||
1855 | cmp ecx,[eax+Object.FigCount] |
||
1856 | jge .fig_is_last ;если фигура в конце списка |
||
1857 | mov ebx,[eax+Object.FigData] |
||
1858 | mov edx,[ebx+4*ecx] ;передвигаемая фигура |
||
1859 | mov edi,[ebx+4*ecx-4] |
||
1860 | ;меняем фигуры местами |
||
1861 | mov [ebx+4*ecx],edi |
||
1862 | mov [ebx+4*ecx-4],edx |
||
1863 | ;меняем фигуры в списке |
||
1864 | stdcall [tl_node_move_down],tree1 |
||
1865 | jmp .end_f |
||
1866 | .fig_is_last: |
||
1867 | notify_window_run txt_err_figure_is_last |
||
1868 | jmp .end_f |
||
1869 | .end_fblo: |
||
1870 | notify_window_run txt_err_no_figure_select |
||
1871 | .end_f: |
||
1872 | popad |
||
1873 | ret |
||
1874 | |||
1875 | ;description: |
||
1876 | ; запуск окна создания/редактирования точки |
||
1877 | align 4 |
||
1878 | but_dlg_point_coords: |
||
1879 | cmp byte[wnd_run_prop],0 |
||
1880 | jne .end_f |
||
1881 | pushad |
||
1882 | stdcall [tl_node_get_data],tree1 |
||
1883 | or eax,eax |
||
1884 | jz .end_fblo |
||
1885 | cmp [eax+Figure.OType],'Fig' |
||
1886 | jne .end_fblo |
||
1887 | mov [wnd_pFig],eax ;фигура |
||
1888 | stdcall sel_points_get_count,eax |
||
1889 | cmp eax,1 |
||
1890 | jne .no_select_1 |
||
1891 | stdcall found_parent_obj,[wnd_pFig] |
||
1892 | or eax,eax |
||
1893 | jz .end0 ;if not found |
||
1894 | |||
1895 | mov [wnd_pObj],eax ;obj |
||
1896 | mov [wnd_FigN],ecx ;fig number |
||
1897 | stdcall sel_points_get_first,[wnd_pFig] |
||
1898 | mov [wnd_pPoi],eax |
||
1899 | mov edx,[wnd_pFig] |
||
1900 | sub eax,[edx+Figure.PoiData] |
||
1901 | xor edx,edx |
||
1902 | mov ecx,sizeof.Point |
||
1903 | div ecx |
||
1904 | jmp .end1 |
||
1905 | .no_select_1: |
||
1906 | or eax,eax |
||
1907 | jnz .end_fblo |
||
1908 | stdcall found_parent_obj,[wnd_pFig] |
||
1909 | or eax,eax |
||
1910 | jz .end0 ;if not found |
||
1911 | |||
1912 | mov [wnd_pObj],eax ;obj |
||
1913 | mov [wnd_FigN],ecx ;fig number |
||
1914 | xor eax,eax |
||
1915 | mov [wnd_pPoi],eax |
||
1916 | mov edx,[wnd_pFig] |
||
1917 | mov eax,[edx+Figure.PoiCount] |
||
1918 | .end1: |
||
1919 | mov [wnd_PoiN],eax |
||
1920 | mcall SF_CREATE_THREAD,1,start_prop,thread_coords |
||
1921 | jmp .end0 |
||
1922 | .end_fblo: |
||
1923 | notify_window_run txt_err_no_1_point_sel |
||
1924 | ;jmp @f |
||
1925 | ;.end_fblo: |
||
1926 | ;notify_window_run txt_err_... |
||
1927 | .end0: |
||
1928 | popad |
||
1929 | .end_f: |
||
1930 | ret |
||
1931 | |||
1932 | align 4 |
||
1933 | but_dlg_opt_scale: |
||
1934 | cmp byte[wnd_run_scale],0 |
||
1935 | jne .end_f |
||
1936 | pushad |
||
1937 | mcall SF_CREATE_THREAD,1,start_scale,thread_scale |
||
1938 | popad |
||
1939 | .end_f: |
||
1940 | ret |
||
1941 | |||
1942 | |||
1943 | |||
1944 | ;input: |
||
1945 | ; buf - указатель на строку, число должно быть в 10 или 16 ричном виде |
||
1946 | ;output: |
||
1947 | ; eax - число |
||
1948 | align 4 |
||
1949 | proc conv_str_to_int uses ebx ecx esi, buf:dword |
||
1950 | xor eax,eax |
||
1951 | xor ebx,ebx |
||
1952 | mov esi,[buf] |
||
1953 | |||
1954 | ;на случай если перед числом находятся пробелы |
||
1955 | @@: |
||
1956 | cmp byte[esi],' ' |
||
1957 | jne @f |
||
1958 | inc esi |
||
1959 | jmp @b |
||
1960 | @@: |
||
1961 | |||
1962 | ;определение отрицательных чисел |
||
1963 | xor ecx,ecx |
||
1964 | inc ecx |
||
1965 | cmp byte[esi],'-' |
||
1966 | jne @f |
||
1967 | dec ecx |
||
1968 | inc esi |
||
1969 | @@: |
||
1970 | |||
1971 | cmp word[esi],'0x' |
||
1972 | je .load_digit_16 |
||
1973 | |||
1974 | .load_digit_10: ;считывание 10-тичных цифр |
||
1975 | mov bl,byte[esi] |
||
1976 | cmp bl,'0' |
||
1977 | jl @f |
||
1978 | cmp bl,'9' |
||
1979 | jg @f |
||
1980 | sub bl,'0' |
||
1981 | imul eax,10 |
||
1982 | add eax,ebx |
||
1983 | inc esi |
||
1984 | jmp .load_digit_10 |
||
1985 | jmp @f |
||
1986 | |||
1987 | .load_digit_16: ;считывание 16-ричных цифр |
||
1988 | add esi,2 |
||
1989 | .cycle_16: |
||
1990 | mov bl,byte[esi] |
||
1991 | cmp bl,'0' |
||
1992 | jl @f |
||
1993 | cmp bl,'f' |
||
1994 | jg @f |
||
1995 | cmp bl,'9' |
||
1996 | jle .us1 |
||
1997 | cmp bl,'A' |
||
1998 | jl @f ;отсеиваем символы >'9' и <'A' |
||
1999 | .us1: ;составное условие |
||
2000 | cmp bl,'F' |
||
2001 | jle .us2 |
||
2002 | cmp bl,'a' |
||
2003 | jl @f ;отсеиваем символы >'F' и <'a' |
||
2004 | sub bl,32 ;переводим символы в верхний регистр, для упрощения их последущей обработки |
||
2005 | .us2: ;составное условие |
||
2006 | sub bl,'0' |
||
2007 | cmp bl,9 |
||
2008 | jle .cor1 |
||
2009 | sub bl,7 ;convert 'A' to '10' |
||
2010 | .cor1: |
||
2011 | shl eax,4 |
||
2012 | add eax,ebx |
||
2013 | inc esi |
||
2014 | jmp .cycle_16 |
||
2015 | @@: |
||
2016 | cmp ecx,0 ;если число отрицательное |
||
2017 | jne @f |
||
2018 | sub ecx,eax |
||
2019 | mov eax,ecx |
||
2020 | @@: |
||
2021 | ret |
||
2022 | endp |
||
2023 | |||
2024 | |||
2025 | ;данные для диалога открытия файлов |
||
2026 | align 4 |
||
2027 | OpenDialog_data: |
||
2028 | .type dd 0 ;0 - открыть, 1 - сохранить, 2 - выбрать дтректорию |
||
2029 | .procinfo dd procinfo ;+4 |
||
2030 | .com_area_name dd communication_area_name ;+8 |
||
2031 | .com_area dd 0 ;+12 |
||
2032 | .opendir_path dd plugin_path ;+16 |
||
2033 | .dir_default_path dd default_dir ;+20 |
||
2034 | .start_path dd file_name ;+24 путь к диалогу открытия файлов |
||
2035 | .draw_window dd draw_window ;+28 |
||
2036 | .status dd 0 ;+32 |
||
2037 | .openfile_path dd openfile_path ;+36 путь к открываемому файлу |
||
2038 | .filename_area dd filename_area ;+40 |
||
2039 | .filter_area dd Filter |
||
2040 | .x: |
||
2041 | .x_size dw 420 ;+48 ; Window X size |
||
2042 | .x_start dw 10 ;+50 ; Window X position |
||
2043 | .y: |
||
2044 | .y_size dw 320 ;+52 ; Window y size |
||
2045 | .y_start dw 10 ;+54 ; Window Y position |
||
2046 | |||
2047 | default_dir db '/rd/1',0 |
||
2048 | |||
2049 | communication_area_name: |
||
2050 | db 'FFFFFFFF_open_dialog',0 |
||
2051 | open_dialog_name: |
||
2052 | db 'opendial',0 |
||
2053 | communication_area_default_path: |
||
2054 | db '/rd/1/File managers/',0 |
||
2055 | |||
2056 | Filter: |
||
2057 | dd Filter.end - Filter ;.1 |
||
7662 | IgorA | 2058 | .1: db 'NC',0 |
2059 | .2: db 'PNG',0 |
||
7360 | IgorA | 2060 | .end: |
2061 | db 0 |
||
2062 | |||
2063 | |||
7662 | IgorA | 2064 | align 4 |
7360 | IgorA | 2065 | system_dir_0 db '/sys/lib/' |
2066 | lib_name_0 db 'proc_lib.obj',0 |
||
2067 | system_dir_1 db '/sys/lib/' |
||
2068 | lib_name_1 db 'libimg.obj',0 |
||
2069 | system_dir_2 db '/sys/lib/' |
||
2070 | lib_name_2 db 'buf2d.obj',0 |
||
2071 | system_dir_3 db '/sys/lib/' |
||
2072 | lib_name_3 db 'box_lib.obj',0 |
||
2073 | |||
7662 | IgorA | 2074 | head_f_i: |
2075 | if lang eq ru |
||
2076 | head_f_l db '"Системная ошибка',0 |
||
2077 | err_message_found_lib_0 db 'Не найдена библиотека ',39,'proc_lib.obj',39,'" -tE',0 |
||
2078 | err_message_import_0 db 'Ошибка при импорте библиотеки ',39,'proc_lib.obj',39,'" -tW',0 |
||
2079 | err_message_found_lib_1 db 'Не найдена библиотека ',39,'libimg.obj',39,'" -tE',0 |
||
2080 | err_message_import_1 db 'Ошибка при импорте библиотеки ',39,'libimg.obj',39,'" -tW',0 |
||
2081 | err_msg_found_lib_2 db 'Не найдена библиотека ',39,'buf2d.obj',39,'" -tE',0 |
||
2082 | err_msg_import_2 db 'Ошибка при импорте библиотеки ',39,'buf2d',39,'" -tW',0 |
||
2083 | err_msg_found_lib_3 db 'Не найдена библиотека ',39,'box_lib.obj',39,'" -tE',0 |
||
2084 | err_msg_import_3 db 'Ошибка при импорте библиотеки ',39,'box_lib',39,'" -tW',0 |
||
2085 | else |
||
2086 | head_f_l db '"System error',0 |
||
2087 | err_message_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,'" -tE',0 |
||
2088 | err_message_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,'" -tW',0 |
||
2089 | err_message_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,'" -tE',0 |
||
2090 | err_message_import_1 db 'Error on load import library ',39,'libimg.obj',39,'" -tW',0 |
||
2091 | err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'buf2d.obj',39,'" -tE',0 |
||
2092 | err_msg_import_2 db 'Error on load import library ',39,'buf2d',39,'" -tW',0 |
||
2093 | err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'box_lib.obj',39,'" -tE',0 |
||
2094 | err_msg_import_3 db 'Error on load import library ',39,'box_lib',39,'" -tW',0 |
||
2095 | end if |
||
2096 | |||
2097 | align 4 |
||
7360 | IgorA | 2098 | l_libs_start: |
2099 | lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ |
||
2100 | err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i |
||
2101 | lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ |
||
2102 | err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i |
||
2103 | lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\ |
||
2104 | err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i |
||
7662 | IgorA | 2105 | lib_3 l_libs lib_name_3, sys_path, file_name, system_dir_3,\ |
7360 | IgorA | 2106 | err_msg_found_lib_3, head_f_l, import_box_lib,err_msg_import_3,head_f_i |
2107 | l_libs_end: |
||
2108 | |||
2109 | align 4 |
||
2110 | import_libimg: |
||
2111 | dd alib_init1 |
||
2112 | img_is_img dd aimg_is_img |
||
2113 | img_info dd aimg_info |
||
2114 | img_from_file dd aimg_from_file |
||
2115 | img_to_file dd aimg_to_file |
||
2116 | img_from_rgb dd aimg_from_rgb |
||
2117 | img_to_rgb dd aimg_to_rgb |
||
2118 | img_to_rgb2 dd aimg_to_rgb2 |
||
2119 | img_decode dd aimg_decode |
||
2120 | img_encode dd aimg_encode |
||
2121 | img_create dd aimg_create |
||
2122 | img_destroy dd aimg_destroy |
||
2123 | img_destroy_layer dd aimg_destroy_layer |
||
2124 | img_count dd aimg_count |
||
2125 | img_lock_bits dd aimg_lock_bits |
||
2126 | img_unlock_bits dd aimg_unlock_bits |
||
2127 | img_flip dd aimg_flip |
||
2128 | img_flip_layer dd aimg_flip_layer |
||
2129 | img_rotate dd aimg_rotate |
||
2130 | img_rotate_layer dd aimg_rotate_layer |
||
2131 | img_draw dd aimg_draw |
||
2132 | |||
2133 | dd 0,0 |
||
2134 | alib_init1 db 'lib_init',0 |
||
2135 | aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение |
||
2136 | aimg_info db 'img_info',0 |
||
2137 | aimg_from_file db 'img_from_file',0 |
||
2138 | aimg_to_file db 'img_to_file',0 |
||
2139 | aimg_from_rgb db 'img_from_rgb',0 |
||
2140 | aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB |
||
2141 | aimg_to_rgb2 db 'img_to_rgb2',0 |
||
2142 | aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных |
||
2143 | aimg_encode db 'img_encode',0 |
||
2144 | aimg_create db 'img_create',0 |
||
2145 | aimg_destroy db 'img_destroy',0 |
||
2146 | aimg_destroy_layer db 'img_destroy_layer',0 |
||
2147 | aimg_count db 'img_count',0 |
||
2148 | aimg_lock_bits db 'img_lock_bits',0 |
||
2149 | aimg_unlock_bits db 'img_unlock_bits',0 |
||
2150 | aimg_flip db 'img_flip',0 |
||
2151 | aimg_flip_layer db 'img_flip_layer',0 |
||
2152 | aimg_rotate db 'img_rotate',0 |
||
2153 | aimg_rotate_layer db 'img_rotate_layer',0 |
||
2154 | aimg_draw db 'img_draw',0 |
||
2155 | |||
2156 | align 4 |
||
2157 | proclib_import: ;описание экспортируемых функций |
||
2158 | OpenDialog_Init dd aOpenDialog_Init |
||
2159 | OpenDialog_Start dd aOpenDialog_Start |
||
7662 | IgorA | 2160 | OpenDialog_Set_file_name dd aOpenDialog_Set_file_name |
2161 | OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext |
||
7360 | IgorA | 2162 | dd 0,0 |
2163 | aOpenDialog_Init db 'OpenDialog_init',0 |
||
2164 | aOpenDialog_Start db 'OpenDialog_start',0 |
||
7662 | IgorA | 2165 | aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 |
2166 | aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0 |
||
7360 | IgorA | 2167 | |
2168 | align 4 |
||
2169 | import_buf2d: |
||
2170 | init dd sz_init |
||
2171 | buf2d_create dd sz_buf2d_create |
||
2172 | buf2d_create_f_img dd sz_buf2d_create_f_img |
||
2173 | buf2d_clear dd sz_buf2d_clear |
||
2174 | buf2d_draw dd sz_buf2d_draw |
||
2175 | buf2d_delete dd sz_buf2d_delete |
||
2176 | buf2d_resize dd sz_buf2d_resize |
||
2177 | buf2d_line dd sz_buf2d_line |
||
2178 | buf2d_line_sm dd sz_buf2d_line_sm |
||
2179 | buf2d_rect_by_size dd sz_buf2d_rect_by_size |
||
2180 | buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size |
||
2181 | buf2d_circle dd sz_buf2d_circle |
||
2182 | buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 |
||
2183 | buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 |
||
2184 | buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 |
||
2185 | buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 |
||
2186 | buf2d_bit_blt dd sz_buf2d_bit_blt |
||
2187 | buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp |
||
2188 | buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha |
||
2189 | buf2d_curve_bezier dd sz_buf2d_curve_bezier |
||
2190 | buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix |
||
2191 | buf2d_draw_text dd sz_buf2d_draw_text |
||
2192 | buf2d_crop_color dd sz_buf2d_crop_color |
||
2193 | buf2d_flip_h dd sz_buf2d_flip_h |
||
2194 | buf2d_flip_v dd sz_buf2d_flip_v |
||
2195 | buf2d_offset_h dd sz_buf2d_offset_h |
||
2196 | buf2d_flood_fill dd sz_buf2d_flood_fill |
||
2197 | buf2d_set_pixel dd sz_buf2d_set_pixel |
||
2198 | dd 0,0 |
||
2199 | sz_init db 'lib_init',0 |
||
2200 | sz_buf2d_create db 'buf2d_create',0 |
||
2201 | sz_buf2d_create_f_img db 'buf2d_create_f_img',0 |
||
2202 | sz_buf2d_clear db 'buf2d_clear',0 |
||
2203 | sz_buf2d_draw db 'buf2d_draw',0 |
||
2204 | sz_buf2d_delete db 'buf2d_delete',0 |
||
2205 | sz_buf2d_resize db 'buf2d_resize',0 |
||
2206 | sz_buf2d_line db 'buf2d_line',0 |
||
2207 | sz_buf2d_line_sm db 'buf2d_line_sm',0 |
||
2208 | sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 |
||
2209 | sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 |
||
2210 | sz_buf2d_circle db 'buf2d_circle',0 |
||
2211 | sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 |
||
2212 | sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 |
||
2213 | sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 |
||
2214 | sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 |
||
2215 | sz_buf2d_bit_blt db 'buf2d_bit_blt',0 |
||
2216 | sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 |
||
2217 | sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 |
||
2218 | sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 |
||
2219 | sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 |
||
2220 | sz_buf2d_draw_text db 'buf2d_draw_text',0 |
||
2221 | sz_buf2d_crop_color db 'buf2d_crop_color',0 |
||
2222 | sz_buf2d_flip_h db 'buf2d_flip_h',0 |
||
2223 | sz_buf2d_flip_v db 'buf2d_flip_v',0 |
||
2224 | sz_buf2d_offset_h db 'buf2d_offset_h',0 |
||
2225 | sz_buf2d_flood_fill db 'buf2d_flood_fill',0 |
||
2226 | sz_buf2d_set_pixel db 'buf2d_set_pixel',0 |
||
2227 | |||
2228 | align 4 |
||
2229 | import_box_lib: |
||
2230 | dd sz_init1 |
||
2231 | |||
2232 | init_checkbox dd sz_Init_checkbox |
||
2233 | check_box_draw dd sz_Check_box_draw |
||
2234 | check_box_mouse dd sz_Check_box_mouse |
||
2235 | ;version_ch dd sz_Version_ch |
||
2236 | |||
2237 | option_box_draw dd sz_Option_box_draw |
||
2238 | option_box_mouse dd sz_Option_box_mouse |
||
2239 | ;version_op dd sz_Version_op |
||
2240 | |||
2241 | edit_box_draw dd sz_edit_box_draw |
||
2242 | edit_box_key dd sz_edit_box_key |
||
2243 | edit_box_mouse dd sz_edit_box_mouse |
||
2244 | edit_box_set_text dd sz_edit_box_set_text |
||
2245 | scrollbar_ver_draw dd sz_scrollbar_ver_draw |
||
2246 | scrollbar_hor_draw dd sz_scrollbar_hor_draw |
||
2247 | |||
2248 | tl_data_init dd sz_tl_data_init |
||
2249 | tl_data_clear dd sz_tl_data_clear |
||
2250 | tl_info_clear dd sz_tl_info_clear |
||
2251 | tl_key dd sz_tl_key |
||
2252 | tl_mouse dd sz_tl_mouse |
||
2253 | tl_draw dd sz_tl_draw |
||
2254 | tl_info_undo dd sz_tl_info_undo |
||
2255 | tl_info_redo dd sz_tl_info_redo |
||
2256 | tl_node_add dd sz_tl_node_add |
||
2257 | tl_node_set_data dd sz_tl_node_set_data |
||
2258 | tl_node_get_data dd sz_tl_node_get_data |
||
2259 | tl_node_delete dd sz_tl_node_delete |
||
2260 | tl_node_move_up dd sz_tl_node_move_up |
||
2261 | tl_node_move_down dd sz_tl_node_move_down |
||
2262 | tl_cur_beg dd sz_tl_cur_beg |
||
2263 | tl_cur_next dd sz_tl_cur_next |
||
2264 | tl_cur_perv dd sz_tl_cur_perv |
||
2265 | tl_node_close_open dd sz_tl_node_close_open |
||
2266 | tl_node_lev_inc dd sz_tl_node_lev_inc |
||
2267 | tl_node_lev_dec dd sz_tl_node_lev_dec |
||
2268 | tl_node_poi_get_info dd sz_tl_node_poi_get_info |
||
2269 | tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info |
||
2270 | tl_node_poi_get_data dd sz_tl_node_poi_get_data |
||
2271 | |||
2272 | dd 0,0 |
||
2273 | sz_init1 db 'lib_init',0 |
||
2274 | |||
2275 | sz_Init_checkbox db 'init_checkbox2',0 |
||
2276 | sz_Check_box_draw db 'check_box_draw2',0 |
||
2277 | sz_Check_box_mouse db 'check_box_mouse2',0 |
||
2278 | ;sz_Version_ch db 'version_ch2',0 |
||
2279 | |||
2280 | sz_Option_box_draw db 'option_box_draw',0 |
||
2281 | sz_Option_box_mouse db 'option_box_mouse',0 |
||
2282 | ;sz_Version_op db 'version_op',0 |
||
2283 | |||
2284 | sz_edit_box_draw db 'edit_box',0 |
||
2285 | sz_edit_box_key db 'edit_box_key',0 |
||
2286 | sz_edit_box_mouse db 'edit_box_mouse',0 |
||
2287 | sz_edit_box_set_text db 'edit_box_set_text',0 |
||
2288 | sz_scrollbar_ver_draw db 'scrollbar_v_draw',0 |
||
2289 | sz_scrollbar_hor_draw db 'scrollbar_h_draw',0 |
||
2290 | |||
2291 | sz_tl_data_init db 'tl_data_init',0 |
||
2292 | sz_tl_data_clear db 'tl_data_clear',0 |
||
2293 | sz_tl_info_clear db 'tl_info_clear',0 |
||
2294 | sz_tl_key db 'tl_key',0 |
||
2295 | sz_tl_mouse db 'tl_mouse',0 |
||
2296 | sz_tl_draw db 'tl_draw',0 |
||
2297 | sz_tl_info_undo db 'tl_info_undo',0 |
||
2298 | sz_tl_info_redo db 'tl_info_redo',0 |
||
2299 | sz_tl_node_add db 'tl_node_add',0 |
||
2300 | sz_tl_node_set_data db 'tl_node_set_data',0 |
||
2301 | sz_tl_node_get_data db 'tl_node_get_data',0 |
||
2302 | sz_tl_node_delete db 'tl_node_delete',0 |
||
2303 | sz_tl_node_move_up db 'tl_node_move_up',0 |
||
2304 | sz_tl_node_move_down db 'tl_node_move_down',0 |
||
2305 | sz_tl_cur_beg db 'tl_cur_beg',0 |
||
2306 | sz_tl_cur_next db 'tl_cur_next',0 |
||
2307 | sz_tl_cur_perv db 'tl_cur_perv',0 |
||
2308 | sz_tl_node_close_open db 'tl_node_close_open',0 |
||
2309 | sz_tl_node_lev_inc db 'tl_node_lev_inc',0 |
||
2310 | sz_tl_node_lev_dec db 'tl_node_lev_dec',0 |
||
2311 | sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 |
||
2312 | sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 |
||
2313 | sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 |
||
2314 | |||
2315 | align 4 |
||
2316 | mouse_dd dd 0 |
||
2317 | last_time dd 0 |
||
2318 | |||
2319 | align 16 |
||
2320 | sc system_colors |
||
2321 | |||
2322 | align 16 |
||
2323 | procinfo process_information |
||
2324 | |||
2325 | align 4 |
||
2326 | buf_0: dd 0 ;указатель на буфер изображения |
||
2327 | .l: dw 205 ;+4 left |
||
2328 | .t: dw 35 ;+6 top |
||
2329 | .w: dd 384 ;+8 w |
||
2330 | .h: dd 350 ;+12 h |
||
2331 | .color: dd 0xffffd0 ;+16 color |
||
2332 | db 24 ;+20 bit in pixel |
||
2333 | |||
2334 | align 4 |
||
2335 | buf_1: |
||
2336 | dd 0 ;указатель на буфер изображения |
||
2337 | dd 0 ;+4 left,top |
||
2338 | .w: dd 0 |
||
2339 | .h: dd 0,0,24 ;+12 color,bit in pixel |
||
2340 | |||
2341 | font_h dd 0 ;высота шрифта |
||
2342 | |||
2343 | align 4 |
||
2344 | buf_png: |
||
2345 | dd 0,0 |
||
2346 | .w: dd 0 |
||
2347 | .h: dd 0,0xffffff,24 |
||
2348 | |||
2349 | align 4 |
||
2350 | el_focus dd tree1 |
||
2351 | tree1 tree_list size_one_list,1000+2, tl_key_no_edit+tl_draw_par_line,\ |
||
2352 | 16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,340, 16,Figure.Caption,0,\ |
||
2353 | el_focus,w_scr_t1,0 |
||
2354 | |||
2355 | align 4 |
||
2356 | w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 |
||
2357 | |||
2358 | ;input: |
||
2359 | ; eax - число |
||
2360 | ; edi - буфер для строки |
||
2361 | ; len - длинна буфера |
||
2362 | ;output: |
||
2363 | align 4 |
||
2364 | proc convert_int_to_str uses eax ecx edx edi esi, len:dword |
||
2365 | mov esi,[len] |
||
2366 | add esi,edi |
||
2367 | dec esi |
||
2368 | call .str |
||
2369 | ret |
||
2370 | endp |
||
2371 | |||
2372 | align 4 |
||
2373 | .str: |
||
2374 | mov ecx,10 |
||
2375 | cmp eax,ecx |
||
2376 | jb @f |
||
2377 | xor edx,edx |
||
2378 | div ecx |
||
2379 | push edx |
||
2380 | ;dec edi ;смещение необходимое для записи с конца строки |
||
2381 | call .str |
||
2382 | pop eax |
||
2383 | @@: |
||
2384 | cmp edi,esi |
||
2385 | jge @f |
||
2386 | or al,0x30 |
||
2387 | stosb |
||
2388 | mov byte[edi],0 ;в конец строки ставим 0, что-бы не вылазил мусор |
||
2389 | @@: |
||
2390 | ret |
||
2391 | |||
2392 | align 4 |
||
2393 | proc mem_copy uses ecx esi edi, destination:dword, source:dword, len:dword |
||
2394 | cld |
||
2395 | mov esi, dword[source] |
||
2396 | mov edi, dword[destination] |
||
2397 | mov ecx, dword[len] |
||
2398 | rep movsb |
||
2399 | ret |
||
2400 | endp |
||
2401 | |||
2402 | align 16 |
||
2403 | i_end: |
||
2404 | rb 2048 |
||
2405 | thread_coords: |
||
2406 | rb 2048 |
||
2407 | thread_scale: |
||
2408 | rb 2048 |
||
2409 | thread_n_file: |
||
2410 | rb 2048 |
||
2411 | stacktop: |
||
2412 | sys_path rb 1024 |
||
2413 | file_name: |
||
2414 | rb 1024 ;4096 |
||
2415 | library_path rb 1024 |
||
2416 | plugin_path rb 4096 |
||
2417 | openfile_path rb 4096 |
||
2418 | filename_area rb 256 |
||
2419 | mem:'a' |
||
2420 |