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