diff --git a/programs/other/cnc_editor/cnc_editor.asm b/programs/other/cnc_editor/cnc_editor.asm index d737e17a4f..a1c9183eeb 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 22.05.19',0 ;Ї®¤ЇЁбм ®Є­  +caption db 'CNC editor 23.05.19',0 ;Ї®¤ЇЁбм ®Є­  run_file_70 FileInfoBlock @@ -410,23 +410,25 @@ pushad mcall ,,,14 ;align sel points top add ebx,25 shl 16 mcall ,,,15 ;align sel points bottom - add ebx,25 shl 16 - mcall ,,,16 ;copy to clipboard - add ebx,25 shl 16 - mcall ,,,17 ;paste from clipboard - - add ebx,25 shl 16 - mcall ,,,18 ;sel points del + mcall ,,,16 ;optimize figure add ebx,30 shl 16 - mcall ,,,19 ;restore zoom - - add ebx,30 shl 16 - mcall ,,,20 ;.png + mcall ,,,17 ;copy to clipboard + add ebx,25 shl 16 + mcall ,,,18 ;paste from clipboard add ebx,25 shl 16 - mcall ,,,21 ;options scale + mcall ,,,19 ;sel points del + + add ebx,30 shl 16 + mcall ,,,20 ;restore zoom + + add ebx,30 shl 16 + mcall ,,,21 ;.png + + add ebx,25 shl 16 + mcall ,,,22 ;options scale ; *** аЁб®ў ­ЁҐ ЁЄ®­®Є ­  Є­®ЇЄ е *** mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(7 shl 16)+7 ;icon new @@ -469,7 +471,10 @@ pushad add edx,(25 shl 16) ;aling sel points bottom int 0x40 add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;copy to clipboard + add edx,(25 shl 16) ;optimize figure + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(30 shl 16) ;copy to clipboard int 0x40 add ebx,IMAGE_TOOLBAR_ICON_SIZE add edx,(25 shl 16) ;paste from clipboard @@ -627,36 +632,41 @@ button: @@: cmp ah,16 jne @f - call but_clipboard_copy_points + call but_points_optimize jmp still @@: cmp ah,17 jne @f - call but_clipboard_paste_points + call but_clipboard_copy_points jmp still @@: cmp ah,18 jne @f - call but_sel_points_del + call but_clipboard_paste_points jmp still @@: cmp ah,19 jne @f - call but_restore_zoom + call but_sel_points_del jmp still @@: cmp ah,20 jne @f - call but_save_png + call but_restore_zoom jmp still @@: cmp ah,21 + jne @f + call but_save_png + jmp still + @@: + cmp ah,22 jne @f call but_dlg_opt_scale jmp still @@: - ;cmp ah,22 + ;cmp ah,23 ;jne @f ;call but_... ;jmp still @@ -1817,6 +1827,21 @@ popad ret endp +;description: +; ®ЇвЁ¬Ё§ жЁп дЁЈгал +align 4 +proc but_points_optimize uses eax + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .no_point + cmp [eax+Figure.OType],'Fig' + jne .no_point + stdcall points_optimize,eax + mov dword[offs_last_timer],0 ;¤«п ®Ў­®ў«Ґ­Ёп Ї® в ©¬Ґаг + .no_point: + ret +endp + align 4 proc but_restore_zoom uses eax stdcall [tl_node_get_data],tree1 diff --git a/programs/other/cnc_editor/cnc_editor.inc b/programs/other/cnc_editor/cnc_editor.inc index 36bf67b23a..a3d7908575 100644 --- a/programs/other/cnc_editor/cnc_editor.inc +++ b/programs/other/cnc_editor/cnc_editor.inc @@ -118,6 +118,7 @@ PROP_BIT_SELECT equ 30 ; align 4 zoom_plus dq 1.25992105 +opt_koef dq 0.02 ;Є®Ґд. ¤«п ®ЇвЁ¬Ё§ жЁЁ (祬 Ў«Ё¦Ґ Є 0, ⥬ ЇаﬥҐ «Ё­Ёп) mouse_prop_x dd 0 ;Єгаб®а ¬лиЁ ®в­®бЁвҐ«м­® 業ва  ®Є­  buf_0 (¤«п Ё§¬Ґ­. ¬ бив Ў ) mouse_prop_y dd 0 mouse_down_x dd 0 ;Єгаб®а ¬лиЁ ®в­®бЁвҐ«м­® «Ґў®Ј® ўҐае­ҐЈ® гЈ«  ®Є­  buf_0 (¤«п б¤ўЁЈ  дЁЈгал) @@ -1525,6 +1526,72 @@ proc sel_points_invert_bit uses eax ebx ecx, pFig:dword, iBit:dword ret endp +;description: +; ®ЇвЁ¬Ё§ жЁп дЁЈгал, ўл¤Ґ«пҐв «Ёи­ЁҐ в®зЄЁ (1-п Ё Ї®б«Ґ¤­пп в®зЄЁ ­Ґ гзЁвлў овбп) +align 4 +proc points_optimize uses eax ebx ecx, pFig:dword + mov ebx,[pFig] + mov ecx,[ebx+Figure.PoiCount] + cmp ecx,3 + jl .no_point + sub ecx,2 ;®в­Ё¬ Ґ¬ в®зЄЁ Є®в®алҐ ­Ґ гзЁвлў овбп + stdcall sel_points_clear,ebx + mov ebx,[ebx+Figure.PoiData] + finit + .cycle0: + ;calc (x0-x1)/(x0-x2) + fld qword[ebx+Point.CoordX] + add ebx,sizeof.Point + fcom qword[ebx+Point.CoordX] + fstsw ax + sahf + jne @f + fcomp qword[ebx+sizeof.Point+Point.CoordX] + fstsw ax + sahf + jne .no_sel ;if( (x0==x1) && (x0!=x2) ) + jmp .sel ;if( x0==x1==x2 ) + @@: + fld st0 + fsub qword[ebx+Point.CoordX] + fxch st1 + fsub qword[ebx+sizeof.Point+Point.CoordX] + fdivp + + ;calc (y0-y1)/(y0-y2) + fld qword[ebx-sizeof.Point+Point.CoordY] + fcom qword[ebx+Point.CoordY] + fstsw ax + sahf + jne @f + fcomp qword[ebx+sizeof.Point+Point.CoordY] + fstsw ax + ffree st0 ;free (x0-x1)/(x0-x2) + fincstp + sahf + jne .no_sel ;if( (y0==y1) && (y0!=y2) ) + jmp .sel ;if( y0==y1==y2 ) + @@: + fld st0 + fsub qword[ebx+Point.CoordY] + fxch st1 + fsub qword[ebx+sizeof.Point+Point.CoordY] + fdivp + + fsubp + fabs + fcomp qword[opt_koef] ;if( abs((x0-x1)/(x0-x2)-(y0-y1)/(y0-y2)) > 0.02) + fstsw ax + sahf + jae .no_sel + .sel: + bts dword[ebx+Point.Prop],PROP_BIT_SELECT + .no_sel: + loop .cycle0 + .no_point: + ret +endp + ;input: ; pPoi - гЄ § вҐ«м ­  ¤ ­­лҐ в®зЄЁ align 4 @@ -1565,9 +1632,7 @@ proc mouse_left_d uses eax ebx cmp [eax+Figure.OType],'Fig' je @f cmp [eax+Figure.OType],'Obj' - je .end0 - jmp .end_f - .end0: + jne .end_f mov eax,ObjData @@: call buf_get_mouse_coord @@ -1588,9 +1653,7 @@ proc mouse_left_u uses eax ebx ecx cmp [eax+Figure.OType],'Fig' je @f cmp [eax+Figure.OType],'Obj' - je .end0 - jmp .end_f - .end0: + jne .end_f mov eax,ObjData @@: mov ecx,eax diff --git a/programs/other/cnc_editor/doc/but_17.png b/programs/other/cnc_editor/doc/but_17.png new file mode 100644 index 0000000000..2e69780d35 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_17.png differ diff --git a/programs/other/cnc_editor/doc/readme_ru.htm b/programs/other/cnc_editor/doc/readme_ru.htm index ecdee95464..b0a4cfa443 100644 --- a/programs/other/cnc_editor/doc/readme_ru.htm +++ b/programs/other/cnc_editor/doc/readme_ru.htm @@ -36,7 +36,7 @@ ol, ul, dl{ -

CNC_editor версия 24.09.18

+

CNC_editor версия 23.05.19

Оглавление