diff --git a/programs/other/cnc_control/cnc_control.asm b/programs/other/cnc_control/cnc_control.asm index 9ea777e2ed..ad300fa013 100644 --- a/programs/other/cnc_control/cnc_control.asm +++ b/programs/other/cnc_control/cnc_control.asm @@ -77,7 +77,7 @@ start: mov [pb.height], dword 17 mov [pb.max], dword 100;599 mov [pb.min], dword 0 ;-397 - mov [pb.value], dword 50;-397 + mov [pb.value], dword 0 ;-397 mov [pb.back_color], dword 00C8D0D4h mov [pb.progress_color], dword 8072B7EBh mov [pb.frame_color], dword 00406175h @@ -151,30 +151,13 @@ mouse: call mouse_left_d jmp .end_l @@: - ;bt eax,0 - ;jnc @f - ;mouse l. but. move - ;call mouse_left_m - ;jmp .end_l - ;@@: bt eax,16 jnc .end_l ;mouse l. but. up call mouse_left_u ;jmp .end_l .end_l: - ;bt eax,9 - ;jnc @f - ;mouse r. but. press - ;jmp .end_r - ;@@: - ;bt eax,1 - ;jnc @f - ;mouse r. but. move - ;call mouse_right_m - ;jmp .end_r - ;@@: - ;.end_r: + call buf_get_mouse_coord cmp eax,-1 @@ -298,8 +281,7 @@ proc buf_get_mouse_coord endp align 4 -proc timer_funct - pushad +proc timer_funct uses eax ebx mcall SF_SYSTEM_GET,SSF_TIME_COUNT mov [last_time],eax @@ -309,7 +291,6 @@ proc timer_funct stdcall draw_obj2d,ObjData stdcall [buf2d_draw], buf_0 @@: - popad ret endp @@ -559,11 +540,9 @@ but_open_file: jnz .end_open_file cmp ebx,0xffffffff je .end_open_file - mov [open_file_size],ebx mcall SF_SET_CAPTION,1,openfile_path - ;--- stdcall FileInit,[open_file_data],[open_file_size] stdcall [buf2d_clear], buf_0, [buf_0.color] ;чистим буфер stdcall [buf2d_draw], buf_0 ;обновляем буфер на экране @@ -610,8 +589,6 @@ proc but_restore_zoom ret endp - - ;input: ; buf - указатель на строку, число должно быть в 10 или 16 ричном виде ;output: @@ -1094,7 +1071,8 @@ thread_n_file: rb 2048 stacktop: sys_path rb 1024 - file_name: rb 1024 ;4096 + file_name: + rb 1024 library_path rb 1024 plugin_path rb 4096 openfile_path rb 4096 diff --git a/programs/other/cnc_control/cnc_control.inc b/programs/other/cnc_control/cnc_control.inc index 33a67cf803..2d41697d38 100644 --- a/programs/other/cnc_control/cnc_control.inc +++ b/programs/other/cnc_control/cnc_control.inc @@ -4,7 +4,7 @@ ;add_object_in_list, (врем. стр.), (Object.FigData) ; mov [Object.FigData], (tl_node_add(врем. стр.),tl_node_get_data) -;draw_fig2d_litl, ___, pobj, (Object.FigData), ___, ___, ___ +;draw_fig2d_litl, ___, pobj, (Object.FigData), fign, ___, ___, ___ struct Object OType dd ? @@ -107,8 +107,8 @@ graf_margin_left dd 3 ;margin in pixels graf_margin_right dd 3+6 ;margin in pixels graf_margin_top dd 3+9 ;margin in pixels graf_margin_bot dd 3+9 ;margin in pixels -png_data dd ? -png_size dd ? +data_printed dd ? ;число выполненных команд +data_all dd ? ;число всех команд ;global variables: ObjData Object @@ -220,6 +220,8 @@ proc ObjectInit uses eax ebx ecx edi, pobj:dword, etxt:dword push ecx mov edi,eax xor eax,eax + mov [data_all],eax ;хитрое начальное обнуление счетчика + mov [data_printed],eax rep stosd ;clear memory pop ecx @@ -227,12 +229,19 @@ proc ObjectInit uses eax ebx ecx edi, pobj:dword, etxt:dword align 4 .cycle0: stdcall FigureInit,edi + mov eax,[edi] + mov eax,[eax+Figure.PoiCount] + or eax,eax + jnz @f + inc eax ;минимум 1-на команда + @@: + add [data_all],eax cmp esi,[etxt] jge .cycle0end add edi,4 loop .cycle0 .cycle0end: - inc dword[ebx+Object.FigCount] ;??? + inc dword[ebx+Object.FigCount] or ecx,ecx jz @f ;уменьшаем объем памяти выделенный для команд @@ -242,6 +251,12 @@ align 4 stdcall mem.ReAlloc,[ebx+Object.FigData],eax mov [ebx+Object.FigData],eax @@: + ;установка счетчика и прогресбара на 25 % + mov eax,[data_all] + mov [pb.max],eax + shr eax,2 + mov [data_printed],eax + mov [pb.value],eax stdcall ObjCalculateScale,ebx @@ -896,6 +911,7 @@ endp align 4 proc draw_obj2d, pobj:dword locals + data_draw dd ? CentrX dd ? CentrY dd ? endl @@ -934,9 +950,17 @@ pushad add edx,[graf_margin_left] add edx,[ebx+Object.MCentrX] mov [CentrX],edx + mov dword[data_draw],0 align 4 .cycle0: - stdcall draw_fig2d_litl, buf_0,ebx,[edi],0,edx,eax + stdcall draw_fig2d_litl, buf_0,ebx,[edi],[data_draw],0,edx,eax + mov esi,[edi] + mov esi,[esi+Figure.PoiCount] + or esi,esi + jnz @f + inc esi + @@: + add [data_draw],esi add edi,4 loop .cycle0 stdcall [buf2d_flip_v], buf_0 @@ -981,12 +1005,17 @@ endp ;input: ; pbuf - pointer to buffer 2d +; pobj - указатель на объект +; pfig - указатель на фигуру +; fign - номер фигуры ;description: ; функция для рисования объекта по частям align 4 -proc draw_fig2d_litl, pbuf:dword, pobj:dword, pfig:dword, Scale:dword, CentrX:dword, CentrY:dword +proc draw_fig2d_litl, pbuf:dword, pobj:dword, pfig:dword, fign:dword,\ + Scale:dword, CentrX:dword, CentrY:dword locals - PervX dd 0 ;pervios point coord X + line_col dd ? ;figure color + PervX dd 0 ;pervios point coord X PervY dd 0 ;pervios point coord Y GrafX dd ? ;active point coord X GrafY dd ? ;active point coord Y @@ -1011,6 +1040,7 @@ pushad lea eax,[edx+Object.WScale] @@: fmul qword[eax] + mov esi,[fign] align 4 .cycle0: fld qword[edi+Point.CoordX] @@ -1025,17 +1055,24 @@ align 4 fistp dword[ebp-4] stdcall [buf2d_set_pixel], [pbuf], [GrafX],[GrafY], 0xff0000 cmp ecx,[ebx+Figure.PoiCount] - je @f - stdcall [buf2d_line_sm], [pbuf], [PervX],[PervY], [GrafX],[GrafY], 0x80 - ;sub esp,24 - ;call [buf2d_line] - stdcall [buf2d_line], [pbuf], [PervX],[PervY], [GrafX],[GrafY], 0x80 - @@: + je .end0 + ;определение цвета + cmp esi,[data_printed] + jl @f + mov [line_col],0x80 ;if not printed + jmp .end1 + @@: + mov [line_col],0xff0000 ;if was printed + .end1: + stdcall [buf2d_line_sm], [pbuf], [PervX],[PervY], [GrafX],[GrafY], [line_col] + stdcall [buf2d_line], [pbuf], [PervX],[PervY], [GrafX],[GrafY], [line_col] + .end0: mov eax,[GrafX] mov [PervX],eax mov eax,[GrafY] mov [PervY],eax add edi,sizeof.Point + inc esi ;;loop .cycle0 dec ecx jnz .cycle0 diff --git a/programs/other/cnc_editor/cnc_editor.asm b/programs/other/cnc_editor/cnc_editor.asm index 840adebac9..f9ad59671c 100644 --- a/programs/other/cnc_editor/cnc_editor.asm +++ b/programs/other/cnc_editor/cnc_editor.asm @@ -14,7 +14,7 @@ include 'cnc_editor.inc' include '../../develop/info3ds/info_fun_float.inc' @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load -caption db 'CNC editor 24.09.18',0 ;подпись окна +caption db 'CNC editor 08.10.18',0 ;подпись окна run_file_70 FileInfoBlock @@ -321,7 +321,7 @@ pushad ; *** рисование главного окна (выполняется 1 раз при запуске) *** mov edx,[sc.work] - or edx,(3 shl 24)+0x10000000+0x20000000 + or edx,0x33000000 mov edi,caption mcall SF_CREATE_WINDOW,(20 shl 16)+599,(20 shl 16)+415 @@ -363,73 +363,54 @@ pushad .end0: ; *** создание кнопок на панель *** - mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,, [sc.work_button] - - mov ebx,(30 shl 16)+20 - mov edx,4 ;0x4000000? - int 0x40 ;open + mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3, [sc.work_button] add ebx,25 shl 16 - mov edx,5 - int 0x40 ;save + mcall ,,,4 ;open + add ebx,25 shl 16 + mcall ,,,5 ;save add ebx,30 shl 16 - mov edx,6 - int 0x40 ;captions on off + mcall ,,,6 ;captions on off add ebx,25 shl 16 - mov edx,7 - int 0x40 ;figure move up + mcall ,,,7 ;figure move up add ebx,25 shl 16 - mov edx,8 - int 0x40 ;figure move down + mcall ,,,8 ;figure move down add ebx,25 shl 16 - mov edx,9 - int 0x40 ;sel points dlg + mcall ,,,9 ;sel points dlg add ebx,25 shl 16 - mov edx,10 - int 0x40 ;sel points move up + mcall ,,,10 ;sel points move up add ebx,25 shl 16 - mov edx,11 - int 0x40 ;sel points move down + mcall ,,,11 ;sel points move down add ebx,25 shl 16 - mov edx,12 - int 0x40 ;align sel points left + mcall ,,,12 ;align sel points left add ebx,25 shl 16 - mov edx,13 - int 0x40 ;align sel points right + mcall ,,,13 ;align sel points right add ebx,25 shl 16 - mov edx,14 - int 0x40 ;align sel points top + mcall ,,,14 ;align sel points top add ebx,25 shl 16 - mov edx,15 - int 0x40 ;align sel points bottom + mcall ,,,15 ;align sel points bottom add ebx,25 shl 16 - mov edx,16 - int 0x40 ;copy to clipboard + mcall ,,,16 ;copy to clipboard add ebx,25 shl 16 - mov edx,17 - int 0x40 ;paste from clipboard + mcall ,,,17 ;paste from clipboard add ebx,25 shl 16 - mov edx,18 - int 0x40 ;sel points del + mcall ,,,18 ;sel points del add ebx,30 shl 16 - mov edx,19 - int 0x40 ;restore zoom + mcall ,,,19 ;restore zoom add ebx,30 shl 16 - mov edx,20 - int 0x40 ;.png + mcall ,,,20 ;.png add ebx,25 shl 16 - mov edx,21 - int 0x40 ;options scale + mcall ,,,21 ;options scale ; *** рисование иконок на кнопках *** mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(7 shl 16)+7 ;icon new diff --git a/programs/other/cnc_editor/cnc_editor.inc b/programs/other/cnc_editor/cnc_editor.inc index a75988bd49..36bf67b23a 100644 --- a/programs/other/cnc_editor/cnc_editor.inc +++ b/programs/other/cnc_editor/cnc_editor.inc @@ -113,8 +113,6 @@ txt_rs db ')',0 txt_len db ' len=',0 txt_39 db 39,0 -use_mem_array_figure equ 0 ;1 - использовать динамический массив для структур с описаниями фигур - ;свойства для рисования точек PROP_BIT_SELECT equ 30 ;точка под выделением diff --git a/programs/other/cnc_editor/doc/cnc_01.png b/programs/other/cnc_editor/doc/cnc_01.png index efc88ee884..0a46d78ba3 100644 Binary files a/programs/other/cnc_editor/doc/cnc_01.png and b/programs/other/cnc_editor/doc/cnc_01.png differ diff --git a/programs/other/cnc_editor/doc/cnc_02.png b/programs/other/cnc_editor/doc/cnc_02.png index ed86c3183f..08fbc568c5 100644 Binary files a/programs/other/cnc_editor/doc/cnc_02.png and b/programs/other/cnc_editor/doc/cnc_02.png differ