Subversion Repositories Kolibri OS

Rev

Rev 7365 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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