diff --git a/programs/other/cnc_editor/build_en.bat b/programs/other/cnc_editor/build_en.bat new file mode 100644 index 0000000000..0fdd2a0c7b --- /dev/null +++ b/programs/other/cnc_editor/build_en.bat @@ -0,0 +1,9 @@ +if not exist bin mkdir bin +@copy *.nc bin\*.nc + +@erase lang.inc +@echo lang fix en >lang.inc + +@fasm.exe -m 32768 cnc_editor.asm bin\cnc_editor.kex +@kpack bin\cnc_editor.kex +pause \ No newline at end of file diff --git a/programs/other/cnc_editor/build_ru.bat b/programs/other/cnc_editor/build_ru.bat new file mode 100644 index 0000000000..f63c4cd7b6 --- /dev/null +++ b/programs/other/cnc_editor/build_ru.bat @@ -0,0 +1,9 @@ +if not exist bin mkdir bin +@copy *.nc bin\*.nc + +@erase lang.inc +@echo lang fix ru >lang.inc + +@fasm.exe -m 32768 cnc_editor.asm bin\cnc_editor.kex +@kpack bin\cnc_editor.kex +pause \ No newline at end of file diff --git a/programs/other/cnc_editor/cnc_editor.asm b/programs/other/cnc_editor/cnc_editor.asm new file mode 100644 index 0000000000..d6244d0567 --- /dev/null +++ b/programs/other/cnc_editor/cnc_editor.asm @@ -0,0 +1,2061 @@ +use32 + org 0 + db 'MENUET01' + dd 1,start,i_end,mem,stacktop,0,sys_path + +include 'd:/kolibri/svn/programs/macros.inc' +include 'd:/kolibri/svn/programs/proc32.inc' +include 'd:/kolibri/svn/programs/KOSfuncs.inc' +include 'd:/kolibri/svn/programs/load_img.inc' +include 'd:/kolibri/svn/programs/develop/libraries/libs-dev/libimg/libimg.inc' +include 'd:/kolibri/svn/programs/develop/libraries/box_lib/trunk/box_lib.mac' +include 'lang.inc' +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 14.09.18',0 ;подпись окна + +run_file_70 FileInfoBlock + +offs_last_timer dd 0 ;последний сдвиг показаный в функции таймера + +IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 +image_data_toolbar dd 0 ;указатель на временную память. для нужен преобразования изображения +icon_tl_sys dd 0 ;указатель на память для хранения системных иконок +icon_toolbar dd 0 ;указатель на память для хранения иконок объектов + +include 'wnd_point_coords.inc' +include 'wnd_scale.inc' +include 'wnd_new_file.inc' + +align 4 +start: + load_libraries l_libs_start,l_libs_end + ;проверка на сколько удачно загузилась библиотека + mov ebp,lib_0 + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS + @@: + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0xC0000027 + stdcall [OpenDialog_Init],OpenDialog_data ;подготовка диалога + + stdcall [buf2d_create], buf_0 ;создание буфера + + ;шрифт делаем до создания панели (для экономии указателя image_data_toolbar) + include_image_file '..\..\fs\kfar\trunk\font6x9.bmp', image_data_toolbar, buf_1.w,buf_1.h + stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;создаем буфер + stdcall mem.Free,[image_data_toolbar] ;освобождаем память + stdcall [buf2d_conv_24_to_8], buf_1,1 ;делаем буфер прозрачности 8 бит + stdcall [buf2d_convert_text_matrix], buf_1 + mov eax,[buf_1.h] + shr eax,8 + mov [font_h],eax + + include_image_file 'toolbar.png', image_data_toolbar + + mov dword[w_scr_t1.type],1 + stdcall dword[tl_data_init], tree1 + ;системные иконки 16*16 для tree_list + include_image_file 'tl_sys_16.png', icon_tl_sys + mov eax,dword[icon_tl_sys] + mov dword[tree1.data_img_sys],eax + + include_image_file 'objects.png', icon_toolbar + mov eax,dword[icon_toolbar] + mov dword[tree1.data_img],eax + + ;*** установка времени для таймера + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + ;call but_new_file + +align 4 +red_win: + call draw_window + +align 4 +still: + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov ebx,[last_time] + add ebx,10 ;задержка + cmp ebx,eax + jge @f + mov ebx,eax + @@: + sub ebx,eax + mcall SF_WAIT_EVENT_TIMEOUT + cmp eax,0 + jne @f + call timer_funct + jmp still + @@: + + cmp al,1 + jz red_win + cmp al,2 + jz key + cmp al,3 + jz button + cmp al,6 + jne @f + mcall SF_THREAD_INFO,procinfo,-1 + cmp ax,word[procinfo.window_stack_position] + jne @f ;окно не активно + call mouse + @@: + jmp still + +align 4 +mouse: + push eax ebx ecx + mcall SF_MOUSE_GET,SSF_BUTTON_EXT + bt eax,8 + jnc @f + ;mouse l. but. press + 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 + call mouse_right_d + ;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 + je .end0 + shl eax,1 + sub eax,[buf_0.w] + sar eax,1 + mov [mouse_prop_x],eax + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end0 + cmp [eax+Figure.OType],'Fig' + je @f + cmp [eax+Figure.OType],'Obj' + je .end1 + jmp .end0 + .end1: + mov eax,ObjData + @@: + mov ecx,eax + shl ebx,1 + sub ebx,[buf_0.h] + sar ebx,1 + mov [mouse_prop_y],ebx + + mcall SF_MOUSE_GET,SSF_SCROLL_DATA + test ax,ax + jz .end0 + finit + fld qword[zoom_plus] + fld1 + fsubp + fld st0 ;for Y coord + + ;for X coord + fild dword[mouse_prop_x] + fmulp st1,st0 + + mov ebx,eax + test ax,0x8000 + jnz .decr + ;увеличение масштаба + fchs + fild dword[ecx+Figure.MCentrX] ;add old value + fmul qword[zoom_plus] + faddp + + fld qword[ecx+Figure.MScale] + fmul qword[zoom_plus] + ;if (Figure.MScale>16.0) + ;... + jmp @f + .decr: + ;уменьшение масштаба + fild dword[ecx+Figure.MCentrX] ;add old value + fdiv qword[zoom_plus] + faddp + + fld qword[ecx+Figure.MScale] + fdiv qword[zoom_plus] + fld1 + fcomp + fstsw ax + sahf + jbe @f + ;if (Figure.MScale<1.0) + ffree st0 + fincstp + ffree st0 + fincstp + fldz ;default Figure.MCentrX + fld1 ;default Figure.MScale + mov dword[ecx+Figure.MCentrY],0 + @@: + fstp qword[ecx+Figure.MScale] + fistp dword[ecx+Figure.MCentrX] + + ;for Y coord + fild dword[mouse_prop_y] + fmulp st1,st0 + test bx,0x8000 + jnz .decr_y + ;увеличение масштаба + fild dword[ecx+Figure.MCentrY] ;add old value + fmul qword[zoom_plus] + faddp + jmp @f + .decr_y: + ;уменьшение масштаба + fchs + fild dword[ecx+Figure.MCentrY] ;add old value + fdiv qword[zoom_plus] + faddp + @@: + fistp dword[ecx+Figure.MCentrY] + + mov dword[offs_last_timer],0 + .end0: + + stdcall [tl_mouse], tree1 + pop ecx ebx eax + ret + +;output: +; eax - buffer coord X (если курсор за буфером -1) +; ebx - buffer coord Y (если курсор за буфером -1) +align 4 +proc buf_get_mouse_coord + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + cmp ax,word[buf_0.t] + jl .no_buf ;не попали в окно буфера по оси y + mov ebx,eax + shr ebx,16 + cmp bx,word[buf_0.l] + jl .no_buf ;не попали в окно буфера по оси x + + and eax,0xffff ;оставляем координату y + sub ax,word[buf_0.t] + cmp eax,[buf_0.h] + jg .no_buf + sub bx,word[buf_0.l] + cmp ebx,[buf_0.w] + jg .no_buf + xchg eax,ebx + jmp .end_f + .no_buf: + xor eax,eax + not eax + xor ebx,ebx + not ebx + .end_f: + ret +endp + +align 4 +proc timer_funct + pushad + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + ;просматриваем выделенный блок данных + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_f + cmp dword[offs_last_timer],eax + je .end_f + ;если выделенный блок данных не совпадает с последним запомненным + mov dword[offs_last_timer],eax + + stdcall get_object_data,eax + or ecx,ecx + jz .end_oblo + stdcall draw_obj2d,ecx + stdcall [buf2d_draw], buf_0 + jmp .end_f + .end_oblo: + + cmp [eax+Figure.OType],'Fig' + jne .end_fblo + stdcall draw_fig2d,eax + stdcall [buf2d_draw], buf_0 + jmp .end_f + .end_fblo: + + .end_f: + + popad + ret +endp + +align 4 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + ; *** рисование главного окна (выполняется 1 раз при запуске) *** + mov edx,[sc.work] + or edx,(3 shl 24)+0x10000000+0x20000000 + mov edi,caption + mcall SF_CREATE_WINDOW,(20 shl 16)+599,(20 shl 16)+415 + + mcall SF_THREAD_INFO,procinfo,-1 + mov eax,dword[procinfo.box.height] + cmp eax,120 + jge @f + mov eax,120 ;min size + @@: + sub eax,65 + mov dword[tree1.box_height],eax + mov word[w_scr_t1.y_size],ax ;новые размеры скроллинга + mov ebx,dword[procinfo.box.width] + cmp ebx,270 + jge @f + mov ebx,270 + @@: + sub ebx,215 + cmp eax,dword[buf_0.h] ;смотрим размер буфера + jne @f + cmp ebx,dword[buf_0.w] + jne @f + jmp .end0 + @@: + stdcall [buf2d_resize],buf_0,ebx,eax,1 + mov eax,ObjData + mov ecx,[eax+Object.FigCount] + or ecx,ecx + jz .end0 + mov eax,[eax+Object.FigData] + xor edx,edx + .cycle0: + stdcall FigCalculateSizes,[eax+4*edx],0 + inc edx + loop .cycle0 + stdcall ObjCalculateScale,ObjData + mov dword[offs_last_timer],0 + call timer_funct + .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 + + add ebx,25 shl 16 + mov edx,5 + int 0x40 ;save + + add ebx,30 shl 16 + mov edx,6 + int 0x40 ;captions on off + + add ebx,25 shl 16 + mov edx,7 + int 0x40 ;figure move up + + add ebx,25 shl 16 + mov edx,8 + int 0x40 ;figure move down + + add ebx,25 shl 16 + mov edx,9 + int 0x40 ;sel points dlg + + add ebx,25 shl 16 + mov edx,10 + int 0x40 ;sel points move up + + add ebx,25 shl 16 + mov edx,11 + int 0x40 ;sel points move down + + add ebx,25 shl 16 + mov edx,12 + int 0x40 ;copy to clipboard + + add ebx,25 shl 16 + mov edx,13 + int 0x40 ;paste from clipboard + + add ebx,25 shl 16 + mov edx,14 + int 0x40 ;sel points del + + add ebx,30 shl 16 + mov edx,15 + int 0x40 ;restore zoom + + add ebx,30 shl 16 + mov edx,16 + int 0x40 ;.png + + add ebx,25 shl 16 + mov edx,17 + int 0x40 ;options scale + + ; *** рисование иконок на кнопках *** + mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(7 shl 16)+7 ;icon new + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon open + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon save + int 0x40 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(30 shl 16) ;captions on off + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;figure move up + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;figure move down + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;sel points dlg + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;sel points move up + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;sel points move down + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;copy to clipboard + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;paste from clipboard + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;sel points del + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(30 shl 16) ;restore zoom + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(30 shl 16) ;.png + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;options scale + int 0x40 + + mov dword[w_scr_t1.all_redraw],1 + stdcall [tl_draw], tree1 + stdcall [buf2d_draw], buf_0 + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +key: + mcall SF_GET_KEY + cmp dword[el_focus], tree1 + jne @f + stdcall [tl_key], tree1 + jmp .end0 + @@: + + cmp ah,178 ;Up + jne @f + call but_selection_move_up + jmp .end0 + @@: + cmp ah,177 ;Down + jne @f + call but_selection_move_down + jmp .end0 + @@: + cmp ah,176 ;Left + jne @f + call but_selection_move_up + jmp .end0 + @@: + cmp ah,179 ;Right + jne @f + call but_selection_move_down + jmp .end0 + @@: + cmp ah,182 ;Delete + jne @f + call but_sel_points_del + jmp .end0 + @@: + + mov ecx,eax + mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS + bt eax,2 ;left Ctrl + jc .key_Ctrl + bt eax,3 ;right Ctrl + jc .key_Ctrl + jmp .end0 + .key_Ctrl: + cmp ch,15 ;111 ;Ctrl+O + jne @f + call but_open_file + @@: + cmp ch,19 ;115 ;Ctrl+S + jne @f + call but_save_file + @@: + cmp ch,14 ;110 ;Ctrl+N + jne @f + call but_new_file + @@: + cmp ch,1 ;97 ;Ctrl+A + jne @f + call but_sel_points_all + @@: + .end0: + jmp still + + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + call but_new_file + jmp still + @@: + cmp ah,4 + jne @f + call but_open_file + jmp still + @@: + cmp ah,5 + jne @f + call but_save_file + jmp still + @@: + cmp ah,6 + jne @f + call but_captions_on_off + jmp still + @@: + cmp ah,7 + jne @f + call but_sel_figure_move_up + jmp still + @@: + cmp ah,8 + jne @f + call but_sel_figure_move_down + jmp still + @@: + cmp ah,9 + jne @f + call but_dlg_point_coords + jmp still + @@: + cmp ah,10 + jne @f + call but_sel_points_move_up + jmp still + @@: + cmp ah,11 + jne @f + call but_sel_points_move_down + jmp still + @@: + cmp ah,12 + jne @f + call but_clipboard_copy_points + jmp still + @@: + cmp ah,13 + jne @f + call but_clipboard_paste_points + jmp still + @@: + cmp ah,14 + jne @f + call but_sel_points_del + jmp still + @@: + cmp ah,15 + jne @f + call but_restore_zoom + jmp still + @@: + cmp ah,16 + jne @f + call but_save_png + jmp still + @@: + cmp ah,17 + jne @f + call but_dlg_opt_scale + jmp still + @@: + + ;cmp ah,18 + ;jne @f + ;call but_... + ;jmp still + ;@@: + cmp ah,1 + jne still +.exit: + stdcall [buf2d_delete],buf_0 + stdcall mem.Free,[image_data_toolbar] + stdcall mem.Free,[open_file_data] + mcall SF_TERMINATE_PROCESS + + +align 4 +but_new_file: + cmp byte[wnd_n_file],0 + jne .end_f +pushad + mcall SF_CREATE_THREAD,1,start_n_file,thread_n_file +popad + .end_f: + ret + +align 4 +open_file_data dd 0 ;указатель на память для открытия файлов +open_file_size dd 0 ;размер открытого файла + +align 4 +but_open_file: + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_open_file + ;код при удачном открытии диалога + + mov [run_file_70.Function], SSF_GET_INFO + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], 0 + mov dword[run_file_70.Buffer], open_b + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + + ;mov eax,dword[open_b+32] + ;mov edi,txt_buf + ;stdcall convert_int_to_str,20 + ;notify_window_run txt_buf + + mov ecx,dword[open_b+32] ;+32 qword: размер файла в байтах + inc ecx ;for text files + stdcall mem.ReAlloc,[open_file_data],ecx + mov [open_file_data],eax + dec ecx ;for text files + mov byte[eax+ecx],0 ;for text files + + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], ecx + m2m dword[run_file_70.Buffer], dword[open_file_data] + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 ;загружаем файл изображения + test eax,eax + 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 ;обновляем буфер на экране + .end_open_file: + popad + ret + +align 4 +proc but_save_file +locals + pCou dd ? + pData dd ? +endl + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],1 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_save_file + ;код при удачном открытии диалога + + ;*** определение примерного размера файла + call get_file_save_size + stdcall mem.ReAlloc,[open_file_data],ecx + mov [open_file_data],eax + mov [open_file_size],ecx + + ;clear memory + mov edi,eax + xor eax,eax + shr ecx,2 + rep stosd + + ;*** пишем информацию в память + mov edi,[open_file_data] + mov ebx,ObjData + mov edx,[ebx+Object.FigCount] + or edx,edx + jz .cycle1end + mov esi,[ebx+Object.FigData] +align 4 + .cycle1: ;цикл по фигурам + ;param 1 + mov eax,[esi] + or eax,eax + jz .err_save + mov eax,[eax+Figure.PoiCount] + mov [pCou],eax + or eax,eax + jnz @f + mov eax,[esi] + lea eax,[eax+Figure.Caption] + stdcall str_cat,edi,eax + stdcall str_len,edi + add edi,eax + stdcall str_cat,edi,txt_nl + @@: + cmp dword[pCou],0 + je .cycle2end + mov eax,[esi] + mov eax,[eax+Figure.PoiData] + mov [pData],eax + mov word[NumberSymbolsAD],8 +align 4 + .cycle2: ;цикл по точкам + stdcall str_cat,edi,txt_s_poi + ;param 1 + push edi esi + mov esi,[pData] + lea esi,[esi+Point.CoordX] + mov edi,Data_Double + movsd + movsd + pop esi edi + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,edi,Data_String + stdcall str_cat,edi,txt_s_poi_Y + ;param 2 + push edi esi + mov esi,[pData] + lea esi,[esi+Point.CoordY] + mov edi,Data_Double + movsd + movsd + pop esi edi + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,edi,Data_String + ; + stdcall str_cat,edi,txt_nl + add dword[pData],sizeof.Point + dec dword[pCou] + jnz .cycle2 + .cycle2end: + add esi,4 + dec edx + jnz .cycle1 + .cycle1end: + + jmp @f + .err_save: + notify_window_run txt_err_save_txt_file_1 + @@: + + ;*** определение параметров файла + mov edi,[open_file_data] + stdcall str_len,edi + ;;cmp eax,[open_file_size] + mov [run_file_70.Count],eax ;размер файла + + ;*** сохраняем файл + mov [run_file_70.Function], SSF_CREATE_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov ebx, dword[open_file_data] + mov [run_file_70.Buffer], ebx + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + or eax,eax + jz .end_save_file + or ebx,ebx + jnz .end_save_file + ;сообщение о неудачном сохранении + notify_window_run txt_err_save_txt_file_0 + .end_save_file: + popad + ret +endp + +;output: +; ecx - memory size for save file +align 4 +proc get_file_save_size uses eax ebx edx esi + mov ecx,100 ;title + mov ebx,ObjData + add ecx,50 ;object + mov edx,[ebx+Object.FigCount] + or edx,edx + jz .cycle1end + mov esi,[ebx+Object.FigData] +align 4 + .cycle1: ; цикл по фигурам + add ecx,80 ;figure + mov eax,[esi] + or eax,eax + jz @f + mov eax,[eax+Figure.PoiCount] + imul eax,70 + add ecx,eax ;points + @@: + add esi,4 + dec edx + jnz .cycle1 + .cycle1end: + ret +endp + +align 4 +but_captions_on_off: + xor dword[opt_draw],1 + mov dword[offs_last_timer],0 ;для обновления по таймеру + ret + +align 4 +but_sel_figure_move_up: + pushad + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_fblo + cmp [eax+Figure.OType],'Fig' + jne .end_fblo + stdcall found_parent_obj,eax + or eax,eax + jz .end_f ;if not found + or ecx,ecx + jz .fig_is_0 ;если фигура в начале списка + mov ebx,[eax+Object.FigData] + mov edx,[ebx+4*ecx] ;передвигаемая фигура + mov edi,[ebx+4*ecx-4] + ;меняем фигуры местами + mov [ebx+4*ecx],edi + mov [ebx+4*ecx-4],edx + ;меняем фигуры в списке + stdcall [tl_node_move_up],tree1 + jmp .end_f + .fig_is_0: + notify_window_run txt_err_figure_is_0 + jmp .end_f + .end_fblo: + notify_window_run txt_err_no_figure_select + .end_f: + popad + ret + +align 4 +but_save_png: + pushad + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_save_file + + stdcall get_object_data,eax + or ecx,ecx + jz .end_oblo + stdcall draw_obj2d_png,ecx + jmp .beg0 + .end_oblo: + +; cmp [eax+Figure.OType],'Fig' +; jne .end_fblo +; stdcall draw_fig2d_png,eax +; jmp .beg0 +; .end_fblo: + + jmp .end_save_file + .beg0: + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],1 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_save_file + ;код при удачном открытии диалога + mov dword[png_data],0 + + ;create image struct + stdcall [img_create], [buf_png.w], [buf_png.h], Image.bpp24 + mov ebx,eax + test eax,eax + jz @f + ;copy foto to image buffer + mov edi,[eax+Image.Data] + mov esi,[buf_png] + mov ecx,[buf_png.w] + mov edx,[buf_png.h] + imul ecx,edx + imul ecx,3 + shr ecx,2 ;OpenGL buffer align to 4 + rep movsd + + ;encode image + stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0 + test eax,eax + jz @f + mov [png_data],eax + mov [png_size],ecx + @@: + stdcall [img_destroy],ebx + + ; заполняем структуру для сохранения файла + mov ebx,run_file_70 + mov dword[ebx],SSF_CREATE_FILE + mov eax,[png_size] + mov [ebx+12],eax ;file size + mov eax,[png_data] + mov [ebx+16],eax + mov dword[ebx+FileInfoBlock.FileName], openfile_path + + mcall SF_FILE,run_file_70 + test eax,eax + jnz .save_error + ;notify_window_run openfile_path + jmp @f + .save_error: + ;сообщение о неудачном сохранении + notify_window_run txt_err_save_img_file + @@: + mcall SF_SYS_MISC, SSF_MEM_FREE, [png_data] + .end_save_file: + popad + ret + +;description: +; выделенные точки сдвигаются вверх +align 4 +proc but_sel_points_move_up +locals + pObj dd ? + pFig dd ? + idFig dd ? +endl + pushad + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .no_point + cmp [eax+Figure.OType],'Fig' + jne .no_point + + mov [pFig],eax + stdcall sel_points_get_count,eax + or eax,eax + jz .no_point + + stdcall found_parent_obj,[pFig] + or eax,eax + jz .end_f ;if not found + mov [pObj],eax + mov [idFig],ecx + + ;проверяем выделенные точки + mov eax,[pFig] + mov ecx,[eax+Figure.PoiCount] + or ecx,ecx + jz .no_point + mov ebx,[eax+Figure.PoiData] + xor eax,eax + .cycle0: + bt dword[ebx+Point.Prop],PROP_BIT_SELECT + jnc @f + or eax,eax + jz .point_is_0 + stdcall point_move_up, [pObj],[pFig],[idFig],ebx;,eax + @@: + inc eax + add ebx,sizeof.Point + loop .cycle0 + + ;для обновления по таймеру + mov dword[offs_last_timer],0 + jmp .end_f + .point_is_0: + notify_window_run txt_err_poi_is_0 + jmp .end_f + .no_point: + notify_window_run txt_err_no_point_sel + .end_f: + popad + ret +endp + +;description: +; выделенные точки сдвигаются вниз +align 4 +proc but_sel_points_move_down +locals + pObj dd ? + pFig dd ? + idFig dd ? +endl + pushad + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .no_point + cmp [eax+Figure.OType],'Fig' + jne .no_point + + mov [pFig],eax + stdcall sel_points_get_count,eax + or eax,eax + jz .no_point + + stdcall found_parent_obj,[pFig] + or eax,eax + jz .end_f ;if not found + mov [pObj],eax + mov [idFig],ecx + + ;проверяем выделенные точки + mov eax,[pFig] + mov ecx,[eax+Figure.PoiCount] + or ecx,ecx + jz .no_point + mov ebx,ecx + dec ebx + imul ebx,sizeof.Point + add ebx,[eax+Figure.PoiData] + .cycle0: + bt dword[ebx+Point.Prop],PROP_BIT_SELECT + jnc @f + cmp ecx,[eax+Figure.PoiCount] + je .point_is_last + mov edi,ebx + add edi,sizeof.Point + stdcall point_move_up, [pObj],[pFig],[idFig],edi;,ecx + @@: + sub ebx,sizeof.Point + loop .cycle0 + + ;для обновления по таймеру + mov dword[offs_last_timer],0 + jmp .end_f + .point_is_last: + notify_window_run txt_err_poi_is_last + jmp .end_f + .no_point: + notify_window_run txt_err_no_point_sel + .end_f: + popad + ret +endp + +;description: +; выделение выбранной точки сдвигается вверх +align 4 +proc but_selection_move_up +locals + pFig dd ? +endl + pushad + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_fblo + cmp [eax+Figure.OType],'Fig' + jne .end_fblo + + mov [pFig],eax + stdcall sel_points_get_count,eax + cmp eax,1 + jne .no_point + + ;проверяем выделенные точки + mov eax,[pFig] + mov ecx,[eax+Figure.PoiCount] + or ecx,ecx + jz .no_point + dec ecx + jecxz .end_f + mov ebx,[eax+Figure.PoiData] + .cycle0: + add ebx,sizeof.Point + bt dword[ebx+Point.Prop],PROP_BIT_SELECT + jnc @f + btr dword[ebx+Point.Prop],PROP_BIT_SELECT + bts dword[ebx+Point.Prop-sizeof.Point],PROP_BIT_SELECT + xor ecx,ecx + inc ecx ;ecx = 1 - for exit from cycle + @@: + loop .cycle0 + + ;для обновления по таймеру + mov dword[offs_last_timer],0 + jmp .end_f + .no_point: + notify_window_run txt_err_no_point_sel_1 + jmp .end_f + .end_fblo: + ;notify_window_run txt_err_no_figure_select + .end_f: + popad + ret +endp + +;description: +; выделение выбранной точки сдвигается вниз +align 4 +proc but_selection_move_down +locals + pFig dd ? +endl + pushad + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_fblo + cmp [eax+Figure.OType],'Fig' + jne .end_fblo + + mov [pFig],eax + stdcall sel_points_get_count,eax + cmp eax,1 + jne .no_point + + ;проверяем выделенные точки + mov eax,[pFig] + mov ecx,[eax+Figure.PoiCount] + or ecx,ecx + jz .no_point + dec ecx + jecxz .end_f + mov ebx,[eax+Figure.PoiData] + .cycle0: + bt dword[ebx+Point.Prop],PROP_BIT_SELECT + jnc @f + btr dword[ebx+Point.Prop],PROP_BIT_SELECT + bts dword[ebx+Point.Prop+sizeof.Point],PROP_BIT_SELECT + xor ecx,ecx + inc ecx ;ecx = 1 - for exit from cycle + @@: + add ebx,sizeof.Point + loop .cycle0 + + ;для обновления по таймеру + mov dword[offs_last_timer],0 + jmp .end_f + .no_point: + notify_window_run txt_err_no_point_sel_1 + jmp .end_f + .end_fblo: + ;notify_window_run txt_err_no_figure_select + .end_f: + popad + ret +endp + +;output: +; eax - couunt new points +align 4 +proc but_clipboard_copy_points uses ebx ecx edx edi esi +locals + pData dd 0 + pBuf dd 0 +endl + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .no_point + cmp [eax+Figure.OType],'Fig' + jne .no_point + + mov ecx,[eax+Figure.PoiData] + mov [pData],ecx + mov ecx,[eax+Figure.PoiCount] + stdcall sel_points_get_count,eax + or eax,eax + jz .no_point + push eax + imul eax,32 ;for string 'X___.________ Y___.________^^' + stdcall mem.Alloc,eax + mov [pBuf],eax + + mov edx,eax + mov dword[edx+4],0 ;text data + mov dword[edx+8],1 ;code 866 + add edx,12 ;system buffer header size + mov dword[edx],0 + mov word[NumberSymbolsAD],8 +align 4 + .cycle2: ;цикл по точкам + mov esi,[pData] + bt dword[esi+Point.Prop],PROP_BIT_SELECT + jnc .end0 + stdcall str_cat,edx,txt_s_poi + ;param 1 + add esi,Point.CoordX + mov edi,Data_Double + movsd + movsd + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,edx,Data_String + stdcall str_cat,edx,txt_s_poi_Y + ;param 2 + ;;mov esi,[pData] + ;;lea esi,[esi+Point.CoordY] + mov edi,Data_Double + movsd + movsd + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,edx,Data_String + ; + stdcall str_cat,edx,txt_nl + .end0: + add dword[pData],sizeof.Point + loop .cycle2 + .cycle2end: + + mov edx,[pBuf] + add edx,12 + stdcall str_len,edx + sub edx,12 + mov [edx],eax + add eax,12 + mov ecx,eax + mcall SF_CLIPBOARD,SSF_WRITE_CB ;,ecx,edx + stdcall mem.Free,[pBuf] + pop eax + + .no_point: + ret +endp + +;output: +; eax - couunt new points +align 4 +proc but_clipboard_paste_points uses ebx ecx edx esi edi +locals + pFig dd ? + nCount dd ? +endl + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end0 + cmp [eax+Figure.OType],'Fig' + jne .end0 + + mov [pFig],eax + + mcall SF_CLIPBOARD,SSF_GET_SLOT_COUNT + cmp eax,1 + jl .end0 + + mov esi,eax + .cycle0: ;обратный цикл по слотам + dec esi ;номер текущего, проверяемого слота + mcall SF_CLIPBOARD,SSF_READ_CB,esi + cmp eax,1 + je .end0 + cmp eax,-1 + je .end0 + mov ecx,dword[eax] + cmp ecx,5 ;min text size + jl .end0 + cmp dword[eax+4],0 ;text + je @f + cmp esi,1 + jge .cycle0 ;если в буфере не текст, а слотов в буфере несколько, пробуем перейти к верхнему слоту + jmp .end0 + @@: + + mov esi,eax + add esi,12 ;смещение начала текста в буфере + stdcall get_max_points + or eax,eax + jz .end_f + mov [nCount],eax + mov ebx,[pFig] + mov edi,[ebx+Figure.PoiCount] + add [ebx+Figure.PoiCount],eax + add eax,edi + imul eax,sizeof.Point + stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax + mov [ebx+Figure.PoiData],eax + + mov ecx,edi + mov edx,eax +align 4 + .cycle1: ;цикл для снятия выделения со старых точек + btr dword[edx+Point.Prop],PROP_BIT_SELECT + add edx,sizeof.Point + loop .cycle1 + + mov ecx,[nCount] + imul edi,sizeof.Point + add edi,eax + finit +align 4 + .cycle2: ;цикл для добавления новых точек + stdcall PointInit,edi + or eax,eax + jz .cycle2end + bts dword[edi+Point.Prop],PROP_BIT_SELECT + add edi,sizeof.Point + loop .cycle2 + .cycle2end: + or ecx,ecx + jz .end1 + ;уменьшаем объем памяти выделенный для точек + sub [ebx+Figure.PoiCount],ecx + mov eax,[ebx+Figure.PoiCount] + imul eax,sizeof.Point + stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax + mov [ebx+Figure.PoiData],eax + .end1: + stdcall found_parent_obj,ebx ;get figure number in ecx + stdcall figure_update_coords,ObjData,ecx + + mov eax,[nCount] + mov dword[offs_last_timer],0 + jmp .end_f + .end0: + xor eax,eax + .end_f: + ret +endp + +align 4 +proc but_sel_points_del +locals + pFig dd ? + nDel dd ? ;need delete +endl + pushad + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .no_point + cmp [eax+Figure.OType],'Fig' + jne .no_point + + mov [pFig],eax + stdcall sel_points_get_count,eax + or eax,eax + jz .no_point + mov [nDel],eax + + ;проверяем выделенные точки + mov ebx,[pFig] + mov ecx,[ebx+Figure.PoiCount] + or ecx,ecx + jz .no_point + + cmp ecx,eax + jle .no_all + + stdcall found_parent_obj,[pFig] + or eax,eax + jz .end_f ;if not found + mov edi,[ebx+Figure.PoiData] + mov edx,[ebx+Figure.PoiCount] + imul edx,sizeof.Point + add edx,edi + + .cycle0: ;1-я выделенная точка + cmp edi,edx + jge .end0 + bt dword[edi+Point.Prop],PROP_BIT_SELECT + jc .cycle0end + add edi,sizeof.Point + jmp .cycle0 + .cycle0end: + + mov esi,edi ;следущая 1-я не выделенная точка + add esi,sizeof.Point + .cycle1: + cmp esi,edx + jge .end0 + bt dword[esi+Point.Prop],PROP_BIT_SELECT + jnc .cycle1end + add esi,sizeof.Point + jmp .cycle1 + .cycle1end: + + mov ecx,sizeof.Point + rep movsb ;замена выделенной точки + bts dword[esi+Point.Prop-sizeof.Point],PROP_BIT_SELECT ;ставим выделение на точку, что-бы потом ее удалить + + jmp .cycle0 + .end0: + + ;обновление памяти + mov eax,[ebx+Figure.PoiCount] + sub eax,[nDel] + mov [ebx+Figure.PoiCount],eax + imul eax,sizeof.Point + stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax + mov [ebx+Figure.PoiData],eax + + ;перерасчет размеров фигуры + stdcall found_parent_obj,ebx ;get figure number in ecx + stdcall figure_update_coords,ObjData,ecx + + ;для обновления по таймеру + mov dword[offs_last_timer],0 + jmp .end_f + + .no_all: + notify_window_run txt_err_no_point_del + jmp .end_f + .no_point: + notify_window_run txt_err_no_point_sel + .end_f: + popad + ret +endp + +align 4 +proc but_sel_points_all uses eax ecx + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .no_point + cmp [eax+Figure.OType],'Fig' + jne .no_point + + ;проверяем выделенные точки + mov ecx,[eax+Figure.PoiCount] + or ecx,ecx + jz .no_point + mov eax,[eax+Figure.PoiData] + .cycle0: ;1-я выделенная точка + bts dword[eax+Point.Prop],PROP_BIT_SELECT + add eax,sizeof.Point + loop .cycle0 + ;для обновления по таймеру + mov dword[offs_last_timer],0 + .no_point: + ret +endp + +align 4 +proc but_restore_zoom uses eax + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_f + cmp [eax+Figure.OType],'Fig' + je @f + cmp [eax+Figure.OType],'Obj' + je .end0 + jmp .end_f + .end0: + mov eax,ObjData + @@: + finit + fld1 + fstp qword[eax+Figure.MScale] + mov dword[eax+Figure.MCentrX],0 + mov dword[eax+Figure.MCentrY],0 + mov dword[offs_last_timer],0 + .end_f: + ret +endp + +align 4 +but_sel_figure_move_down: + pushad + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_fblo + cmp [eax+Figure.OType],'Fig' + jne .end_fblo + stdcall found_parent_obj,eax + or eax,eax + jz .end_f ;if not found + inc ecx + cmp ecx,[eax+Object.FigCount] + jge .fig_is_last ;если фигура в конце списка + mov ebx,[eax+Object.FigData] + mov edx,[ebx+4*ecx] ;передвигаемая фигура + mov edi,[ebx+4*ecx-4] + ;меняем фигуры местами + mov [ebx+4*ecx],edi + mov [ebx+4*ecx-4],edx + ;меняем фигуры в списке + stdcall [tl_node_move_down],tree1 + jmp .end_f + .fig_is_last: + notify_window_run txt_err_figure_is_last + jmp .end_f + .end_fblo: + notify_window_run txt_err_no_figure_select + .end_f: + popad + ret + +;description: +; запуск окна создания/редактирования точки +align 4 +but_dlg_point_coords: + cmp byte[wnd_run_prop],0 + jne .end_f +pushad + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_fblo + cmp [eax+Figure.OType],'Fig' + jne .end_fblo + mov [wnd_pFig],eax ;фигура + stdcall sel_points_get_count,eax + cmp eax,1 + jne .no_select_1 + stdcall found_parent_obj,[wnd_pFig] + or eax,eax + jz .end0 ;if not found + + mov [wnd_pObj],eax ;obj + mov [wnd_FigN],ecx ;fig number + stdcall sel_points_get_first,[wnd_pFig] + mov [wnd_pPoi],eax + mov edx,[wnd_pFig] + sub eax,[edx+Figure.PoiData] + xor edx,edx + mov ecx,sizeof.Point + div ecx + jmp .end1 + .no_select_1: + or eax,eax + jnz .end_fblo + stdcall found_parent_obj,[wnd_pFig] + or eax,eax + jz .end0 ;if not found + + mov [wnd_pObj],eax ;obj + mov [wnd_FigN],ecx ;fig number + xor eax,eax + mov [wnd_pPoi],eax + mov edx,[wnd_pFig] + mov eax,[edx+Figure.PoiCount] + .end1: + mov [wnd_PoiN],eax + mcall SF_CREATE_THREAD,1,start_prop,thread_coords + jmp .end0 + .end_fblo: + notify_window_run txt_err_no_1_point_sel + ;jmp @f + ;.end_fblo: + ;notify_window_run txt_err_... + .end0: +popad + .end_f: + ret + +align 4 +but_dlg_opt_scale: + cmp byte[wnd_run_scale],0 + jne .end_f +pushad + mcall SF_CREATE_THREAD,1,start_scale,thread_scale +popad + .end_f: + ret + + + +;input: +; buf - указатель на строку, число должно быть в 10 или 16 ричном виде +;output: +; eax - число +align 4 +proc conv_str_to_int uses ebx ecx esi, buf:dword + xor eax,eax + xor ebx,ebx + mov esi,[buf] + + ;на случай если перед числом находятся пробелы + @@: + cmp byte[esi],' ' + jne @f + inc esi + jmp @b + @@: + + ;определение отрицательных чисел + xor ecx,ecx + inc ecx + cmp byte[esi],'-' + jne @f + dec ecx + inc esi + @@: + + cmp word[esi],'0x' + je .load_digit_16 + + .load_digit_10: ;считывание 10-тичных цифр + mov bl,byte[esi] + cmp bl,'0' + jl @f + cmp bl,'9' + jg @f + sub bl,'0' + imul eax,10 + add eax,ebx + inc esi + jmp .load_digit_10 + jmp @f + + .load_digit_16: ;считывание 16-ричных цифр + add esi,2 + .cycle_16: + mov bl,byte[esi] + cmp bl,'0' + jl @f + cmp bl,'f' + jg @f + cmp bl,'9' + jle .us1 + cmp bl,'A' + jl @f ;отсеиваем символы >'9' и <'A' + .us1: ;составное условие + cmp bl,'F' + jle .us2 + cmp bl,'a' + jl @f ;отсеиваем символы >'F' и <'a' + sub bl,32 ;переводим символы в верхний регистр, для упрощения их последущей обработки + .us2: ;составное условие + sub bl,'0' + cmp bl,9 + jle .cor1 + sub bl,7 ;convert 'A' to '10' + .cor1: + shl eax,4 + add eax,ebx + inc esi + jmp .cycle_16 + @@: + cmp ecx,0 ;если число отрицательное + jne @f + sub ecx,eax + mov eax,ecx + @@: + ret +endp + + +;данные для диалога открытия файлов +align 4 +OpenDialog_data: +.type dd 0 ;0 - открыть, 1 - сохранить, 2 - выбрать дтректорию +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 путь к диалогу открытия файлов +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 путь к открываемому файлу +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/rd/1',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/rd/1/File managers/',0 + +Filter: +dd Filter.end - Filter ;.1 +.1: +db 'NC',0 +db 'PNG',0 +.end: +db 0 + + + +head_f_i: +head_f_l db 'Системная ошибка',0 + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +err_message_found_lib_0 db 'Не найдена библиотека ',39,'proc_lib.obj',39,0 +err_message_import_0 db 'Ошибка при импорте библиотеки ',39,'proc_lib.obj',39,0 + +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +err_message_found_lib_1 db 'Не найдена библиотека ',39,'libimg.obj',39,0 +err_message_import_1 db 'Ошибка при импорте библиотеки ',39,'libimg.obj',39,0 + +system_dir_2 db '/sys/lib/' +lib_name_2 db 'buf2d.obj',0 +err_msg_found_lib_2 db 'Не найдена библиотека ',39,'buf2d.obj',39,0 +err_msg_import_2 db 'Ошибка при импорте библиотеки ',39,'buf2d',39,0 + +system_dir_3 db '/sys/lib/' +lib_name_3 db 'box_lib.obj',0 +err_msg_found_lib_3 db 'Не найдена библиотека ',39,'box_lib.obj',39,0 +err_msg_import_3 db 'Ошибка при импорте библиотеки ',39,'box_lib',39,0 + +l_libs_start: + lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ + err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i + lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ + err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i + lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\ + err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i + lib_3 l_libs lib_name_3, sys_path, file_name, system_dir_3,\ + err_msg_found_lib_3, head_f_l, import_box_lib,err_msg_import_3,head_f_i +l_libs_end: + +align 4 +import_libimg: + dd alib_init1 + img_is_img dd aimg_is_img + img_info dd aimg_info + img_from_file dd aimg_from_file + img_to_file dd aimg_to_file + img_from_rgb dd aimg_from_rgb + img_to_rgb dd aimg_to_rgb + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode + img_encode dd aimg_encode + img_create dd aimg_create + img_destroy dd aimg_destroy + img_destroy_layer dd aimg_destroy_layer + img_count dd aimg_count + img_lock_bits dd aimg_lock_bits + img_unlock_bits dd aimg_unlock_bits + img_flip dd aimg_flip + img_flip_layer dd aimg_flip_layer + img_rotate dd aimg_rotate + img_rotate_layer dd aimg_rotate_layer + img_draw dd aimg_draw + + dd 0,0 + alib_init1 db 'lib_init',0 + aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение + aimg_info db 'img_info',0 + aimg_from_file db 'img_from_file',0 + aimg_to_file db 'img_to_file',0 + aimg_from_rgb db 'img_from_rgb',0 + aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных + aimg_encode db 'img_encode',0 + aimg_create db 'img_create',0 + aimg_destroy db 'img_destroy',0 + aimg_destroy_layer db 'img_destroy_layer',0 + aimg_count db 'img_count',0 + aimg_lock_bits db 'img_lock_bits',0 + aimg_unlock_bits db 'img_unlock_bits',0 + aimg_flip db 'img_flip',0 + aimg_flip_layer db 'img_flip_layer',0 + aimg_rotate db 'img_rotate',0 + aimg_rotate_layer db 'img_rotate_layer',0 + aimg_draw db 'img_draw',0 + +align 4 +proclib_import: ;описание экспортируемых функций + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + +align 4 +import_buf2d: + init dd sz_init + buf2d_create dd sz_buf2d_create + buf2d_create_f_img dd sz_buf2d_create_f_img + buf2d_clear dd sz_buf2d_clear + buf2d_draw dd sz_buf2d_draw + buf2d_delete dd sz_buf2d_delete + buf2d_resize dd sz_buf2d_resize + buf2d_line dd sz_buf2d_line + buf2d_line_sm dd sz_buf2d_line_sm + buf2d_rect_by_size dd sz_buf2d_rect_by_size + buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size + buf2d_circle dd sz_buf2d_circle + buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 + buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 + buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 + buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 + buf2d_bit_blt dd sz_buf2d_bit_blt + buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp + buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha + buf2d_curve_bezier dd sz_buf2d_curve_bezier + buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix + buf2d_draw_text dd sz_buf2d_draw_text + buf2d_crop_color dd sz_buf2d_crop_color + buf2d_flip_h dd sz_buf2d_flip_h + buf2d_flip_v dd sz_buf2d_flip_v + buf2d_offset_h dd sz_buf2d_offset_h + buf2d_flood_fill dd sz_buf2d_flood_fill + buf2d_set_pixel dd sz_buf2d_set_pixel + dd 0,0 + sz_init db 'lib_init',0 + sz_buf2d_create db 'buf2d_create',0 + sz_buf2d_create_f_img db 'buf2d_create_f_img',0 + sz_buf2d_clear db 'buf2d_clear',0 + sz_buf2d_draw db 'buf2d_draw',0 + sz_buf2d_delete db 'buf2d_delete',0 + sz_buf2d_resize db 'buf2d_resize',0 + sz_buf2d_line db 'buf2d_line',0 + sz_buf2d_line_sm db 'buf2d_line_sm',0 + sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 + sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 + sz_buf2d_circle db 'buf2d_circle',0 + sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 + sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 + sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 + sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 + sz_buf2d_bit_blt db 'buf2d_bit_blt',0 + sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 + sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 + sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 + sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 + sz_buf2d_draw_text db 'buf2d_draw_text',0 + sz_buf2d_crop_color db 'buf2d_crop_color',0 + sz_buf2d_flip_h db 'buf2d_flip_h',0 + sz_buf2d_flip_v db 'buf2d_flip_v',0 + sz_buf2d_offset_h db 'buf2d_offset_h',0 + sz_buf2d_flood_fill db 'buf2d_flood_fill',0 + sz_buf2d_set_pixel db 'buf2d_set_pixel',0 + +align 4 +import_box_lib: + dd sz_init1 + + init_checkbox dd sz_Init_checkbox + check_box_draw dd sz_Check_box_draw + check_box_mouse dd sz_Check_box_mouse + ;version_ch dd sz_Version_ch + + option_box_draw dd sz_Option_box_draw + option_box_mouse dd sz_Option_box_mouse + ;version_op dd sz_Version_op + + edit_box_draw dd sz_edit_box_draw + edit_box_key dd sz_edit_box_key + edit_box_mouse dd sz_edit_box_mouse + edit_box_set_text dd sz_edit_box_set_text + scrollbar_ver_draw dd sz_scrollbar_ver_draw + scrollbar_hor_draw dd sz_scrollbar_hor_draw + + tl_data_init dd sz_tl_data_init + tl_data_clear dd sz_tl_data_clear + tl_info_clear dd sz_tl_info_clear + tl_key dd sz_tl_key + tl_mouse dd sz_tl_mouse + tl_draw dd sz_tl_draw + tl_info_undo dd sz_tl_info_undo + tl_info_redo dd sz_tl_info_redo + tl_node_add dd sz_tl_node_add + tl_node_set_data dd sz_tl_node_set_data + tl_node_get_data dd sz_tl_node_get_data + tl_node_delete dd sz_tl_node_delete + tl_node_move_up dd sz_tl_node_move_up + tl_node_move_down dd sz_tl_node_move_down + tl_cur_beg dd sz_tl_cur_beg + tl_cur_next dd sz_tl_cur_next + tl_cur_perv dd sz_tl_cur_perv + tl_node_close_open dd sz_tl_node_close_open + tl_node_lev_inc dd sz_tl_node_lev_inc + tl_node_lev_dec dd sz_tl_node_lev_dec + tl_node_poi_get_info dd sz_tl_node_poi_get_info + tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info + tl_node_poi_get_data dd sz_tl_node_poi_get_data + + dd 0,0 + sz_init1 db 'lib_init',0 + + sz_Init_checkbox db 'init_checkbox2',0 + sz_Check_box_draw db 'check_box_draw2',0 + sz_Check_box_mouse db 'check_box_mouse2',0 + ;sz_Version_ch db 'version_ch2',0 + + sz_Option_box_draw db 'option_box_draw',0 + sz_Option_box_mouse db 'option_box_mouse',0 + ;sz_Version_op db 'version_op',0 + + sz_edit_box_draw db 'edit_box',0 + sz_edit_box_key db 'edit_box_key',0 + sz_edit_box_mouse db 'edit_box_mouse',0 + sz_edit_box_set_text db 'edit_box_set_text',0 + sz_scrollbar_ver_draw db 'scrollbar_v_draw',0 + sz_scrollbar_hor_draw db 'scrollbar_h_draw',0 + + sz_tl_data_init db 'tl_data_init',0 + sz_tl_data_clear db 'tl_data_clear',0 + sz_tl_info_clear db 'tl_info_clear',0 + sz_tl_key db 'tl_key',0 + sz_tl_mouse db 'tl_mouse',0 + sz_tl_draw db 'tl_draw',0 + sz_tl_info_undo db 'tl_info_undo',0 + sz_tl_info_redo db 'tl_info_redo',0 + sz_tl_node_add db 'tl_node_add',0 + sz_tl_node_set_data db 'tl_node_set_data',0 + sz_tl_node_get_data db 'tl_node_get_data',0 + sz_tl_node_delete db 'tl_node_delete',0 + sz_tl_node_move_up db 'tl_node_move_up',0 + sz_tl_node_move_down db 'tl_node_move_down',0 + sz_tl_cur_beg db 'tl_cur_beg',0 + sz_tl_cur_next db 'tl_cur_next',0 + sz_tl_cur_perv db 'tl_cur_perv',0 + sz_tl_node_close_open db 'tl_node_close_open',0 + sz_tl_node_lev_inc db 'tl_node_lev_inc',0 + sz_tl_node_lev_dec db 'tl_node_lev_dec',0 + sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 + sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 + sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 + +align 4 +mouse_dd dd 0 +last_time dd 0 + +align 16 +sc system_colors + +align 16 +procinfo process_information + +align 4 +buf_0: dd 0 ;указатель на буфер изображения +.l: dw 205 ;+4 left +.t: dw 35 ;+6 top +.w: dd 384 ;+8 w +.h: dd 350 ;+12 h +.color: dd 0xffffd0 ;+16 color + db 24 ;+20 bit in pixel + +align 4 +buf_1: + dd 0 ;указатель на буфер изображения + dd 0 ;+4 left,top +.w: dd 0 +.h: dd 0,0,24 ;+12 color,bit in pixel + +font_h dd 0 ;высота шрифта + +align 4 +buf_png: + dd 0,0 +.w: dd 0 +.h: dd 0,0xffffff,24 + +align 4 +el_focus dd tree1 +tree1 tree_list size_one_list,1000+2, tl_key_no_edit+tl_draw_par_line,\ + 16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,340, 16,Figure.Caption,0,\ + el_focus,w_scr_t1,0 + +align 4 +w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 + +;input: +; eax - число +; edi - буфер для строки +; len - длинна буфера +;output: +align 4 +proc convert_int_to_str uses eax ecx edx edi esi, len:dword + mov esi,[len] + add esi,edi + dec esi + call .str + ret +endp + +align 4 +.str: + mov ecx,10 + cmp eax,ecx + jb @f + xor edx,edx + div ecx + push edx + ;dec edi ;смещение необходимое для записи с конца строки + call .str + pop eax + @@: + cmp edi,esi + jge @f + or al,0x30 + stosb + mov byte[edi],0 ;в конец строки ставим 0, что-бы не вылазил мусор + @@: + ret + +align 4 +proc mem_copy uses ecx esi edi, destination:dword, source:dword, len:dword + cld + mov esi, dword[source] + mov edi, dword[destination] + mov ecx, dword[len] + rep movsb + ret +endp + +align 16 +i_end: + rb 2048 +thread_coords: + rb 2048 +thread_scale: + rb 2048 +thread_n_file: + rb 2048 +stacktop: + sys_path rb 1024 + file_name: + rb 1024 ;4096 + library_path rb 1024 + plugin_path rb 4096 + openfile_path rb 4096 + filename_area rb 256 +mem: + diff --git a/programs/other/cnc_editor/cnc_editor.inc b/programs/other/cnc_editor/cnc_editor.inc new file mode 100644 index 0000000000..2b34648ed9 --- /dev/null +++ b/programs/other/cnc_editor/cnc_editor.inc @@ -0,0 +1,1728 @@ + +;FigureInit, (врем. стр.), (Object.FigData) + +;add_object_in_list, ___, ___, (врем. стр.), (Object.FigData) +; mov [Object.FigData], (tl_node_add(врем. стр.),tl_node_get_data) + +;draw_fig2d_litl, ___, pobj, (Object.FigData), ___, ___, ___ + +struct Object + OType dd ? + FigCount dd ? + FigData dd ? ;array pointers to Figures + MinX dq ? + MinY dq ? + SizeX dq ? + SizeY dq ? + WScale dq ? ;prewiew window scale + MScale dq ? ;mouse scale (show partition figure) + MCentrX dd ? ;mouse centr X + MCentrY dd ? ;mouse centr Y + Caption rb 32 +ends + +struct Figure + OType dd ? + PoiCount dd ? + PoiData dd ? + MinX dq ? + MinY dq ? + SizeX dq ? + SizeY dq ? + WScale dq ? ;prewiew window scale (show all figure) + MScale dq ? ;mouse scale (show partition figure) + MCentrX dd ? ;mouse centr X + MCentrY dd ? ;mouse centr Y + Caption rb 32 +ends + +struct Point + Prop dd ? ;prorerties + CoordX dq ? ;coord X + CoordY dq ? ;coord Y +ends + +txt_err_1 db 'Ошибка при считывании объекта',0 +txt_err_2 db 'Ошибка при считывании фигуры',0 +txt_err_3 db 'Не найдена точка в фигуре',0 +txt_err_no_figure_select db 'Не выбрана команда для перемещения',0 +txt_err_figure_is_0 db 'Команда не может быть сдвинута вверх,',13,10,'она в начале списка.',0 +txt_err_figure_is_last db 'Команда не может быть сдвинута вниз,',13,10,'она в конце списка.',0 +txt_err_no_point_del db 'Не можна удалить все точки из фигуры.',0 +txt_err_poi_is_0 db 'Не можна переместить точку вверх,',13,10,'она в начале списка.',0 +txt_err_poi_is_last db 'Не можна переместить точку вниз,',13,10,'она в конце списка.',0 +txt_err_no_1_point_sel db 'Выберите не больше одной точки.',0 + +txt_min_x db 'min x: ',0 +txt_min_y db 'min y: ',0 + +if lang eq ru +; +; rus +; +txt_err_no_point_sel db 'Не выбраны точки.',0 +txt_err_no_point_sel_1 db 'Выберите одну точку.',0 +txt_but_cancel db 'Отмена',0 +txt_but_apply db 'Применить',0 +txt_but_create db 'Создать',0 +txt_size_x db 'размер x: ',0 +txt_size_y db 'размер y: ',0 +txt_poi_sel: db 'Выбрано точек: ' +.end db 0 +txt_err_save_txt_file_0: + db 'Не могу сохранить *.nc файл.',0 +txt_err_save_txt_file_1: + db 'Не удалось сохранить весь *.nc файл.',0 +txt_err_save_img_file: + db 'Не могу сохранить *.png файл.',0 +txt_obj: db 'Объект: ',39 +.end db 0 +else +; +; eng +; +txt_err_no_point_sel db 'No select points.',0 +txt_err_no_point_sel_1 db 'Select one point.',0 +txt_but_cancel db 'Cancel',0 +txt_but_apply db 'Apply',0 +txt_but_create db 'Create',0 +txt_size_x db 'size x: ',0 +txt_size_y db 'size y: ',0 +txt_poi_sel: db 'Select points: ' +.end db 0 +txt_err_save_txt_file_0: +txt_err_save_txt_file_1: + db 'Can',39,'t save *.nc file.',0 +txt_err_save_img_file: + db 'Can',39,'t save *.png file.',0 +txt_obj: db 'Object: ',39 +.end db 0 +end if + +align 4 +txt_s_39 db 39,' ',0 +txt_s_poi db 'X',0 +txt_s_poi_Y db ' Y',0 +txt_s_poi_Z db ' Z',0 +txt_coma db ',' +txt_space db ' ',0 ;не отрывать от запятой +txt_nl db 13,10,0 +txt_n db 13,0 +txt_ls db ' (',0 +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 ;точка под выделением + +align 4 +zoom_plus dq 1.25992105 +mouse_prop_x dd 0 ;курсор мыши относительно центра окна buf_0 (для измен. масштаба) +mouse_prop_y dd 0 +mouse_down_x dd 0 ;курсор мыши относительно левого верхнего угла окна buf_0 (для сдвига фигуры) +mouse_down_y dd 0 +opt_draw dd 1 +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 ? + +;global variables: +ObjData Object +FigData Figure ;временная структура для заполнения tree1 +PoiData Point + +size_one_list equ sizeof.Figure ;max (sizeof.Figure, sizeof.Object) + +if sizeof.Object > sizeof.Figure + ... need fix size_one_list +end if + +if (Object.FigCount <> Figure.PoiCount) | (Object.FigData <> Figure.PoiData) | (Object.MScale <> Figure.MScale) | (Object.MCentrX <> Figure.MCentrX) | (Object.MCentrY <> Figure.MCentrY) + ... need fix offsets +end if + +align 4 +Scale1mm dq 11.81102362204724 ;pixels in 1 mm -> 300 dpi + ;5.905511811023622 ;pixels in 1 mm -> 150 dpi + +txt_buf rb 80 ;??? +txt_sp db ' ',0 + +;input: +; esi - text pointer +align 4 +proc txt_next_line uses eax ecx edi, mlen:dword + mov al,13 + mov ecx,[mlen] + mov edi,esi + repne scasb + cmp byte[edi],10 + jne @f + inc edi + @@: + mov esi,edi + ret +endp + +;input: +; edi - destination buffer +; esi - source text string: '...\nl +; mlen - maximum len destination buffer +align 4 +proc txt_load_line uses eax ebx ecx esi, mlen:dword + mov byte[edi],0 + mov al,13 + cmp byte[esi],al + je .end_f + mov ecx,[mlen] + mov ebx,edi + mov edi,esi + repne scasb ;found end of string + mov ecx,edi + sub ecx,esi + dec ecx ;ecx = string len + mov edi,ebx + rep movsb ;copy caption string + cmp byte[esi],13 + je @f + .cycle0: + inc esi + cmp byte[esi],13 + jne .cycle0 + @@: + mov byte[edi],0 + inc esi + .end_f: + ret +endp + +;input: +; itxt - input description text +; msize - max size +align 4 +proc FileInit uses eax ebx ecx edi esi, itxt:dword, msize:dword + stdcall [tl_node_poi_get_info], tree1,0 + or eax,eax + jz @f + mov ebx,eax + stdcall [tl_node_poi_get_data], tree1,ebx + stdcall clear_object_in_list, eax + @@: + stdcall [tl_info_clear], tree1 ;очистка списка объектов + mov dword[offs_last_timer],0 + + mov esi,[itxt] + mov ebx,esi + add ebx,[msize] + stdcall ObjectInit,ObjData,ebx + stdcall [tl_cur_beg], tree1 + ret +endp + +;input: +; esi - input description text +; pobj - pointer to object struct +; etxt - pointer to end of input text +align 4 +proc ObjectInit uses eax ebx ecx edi, pobj:dword, etxt:dword + mov ebx,[pobj] + mov [ebx+Object.OType],'Obj' + mov edi,ebx + add edi,Object.Caption + mov dword[edi],'CNC' + + stdcall get_max_lines + test eax,eax + jz .err_init + mov [ebx+Object.FigCount],eax + mov ecx,eax + + shl eax,2 + stdcall mem.Alloc,eax + mov [ebx+Object.FigData],eax + push ecx + mov edi,eax + xor eax,eax + rep stosd ;clear memory + pop ecx + + stdcall add_object_in_list,0,0,ebx,0 + ;eax -> pointer to object node + mov edi,[ebx+Object.FigData] +align 4 + .cycle0: + stdcall FigureInit,FigData,edi + cmp esi,[etxt] + jge .cycle0end + add edi,4 + loop .cycle0 + .cycle0end: + inc dword[ebx+Object.FigCount] ;??? + or ecx,ecx + jz @f + ;уменьшаем объем памяти выделенный для команд + sub [ebx+Object.FigCount],ecx + mov eax,[ebx+Object.FigCount] + shl eax,2 + stdcall mem.ReAlloc,[ebx+Object.FigData],eax + mov [ebx+Object.FigData],eax + @@: + + stdcall ObjCalculateScale,ebx + + jmp .end_f + .err_init: + notify_window_run txt_err_1 + .end_f: + ret +endp + +align 4 +proc ObjCalculateScale uses eax ebx ecx edi, pobj:dword + mov ebx,[pobj] + + ;*** Calculate scale for object *** + finit + + ;found min coord X + mov ecx,[ebx+Object.FigCount] + jecxz .cycle2end + mov edi,[ebx+Object.FigData] + push edi esi ;copy first min X + @@: + mov eax,[edi] + dec ecx + jecxz .cycle2end + add edi,4 + or eax,eax + jz @b + cmp [eax+Figure.PoiCount],0 + je @b + lea esi,[eax+Figure.MinX] + lea edi,[ebx+Object.MinX] + movsd + movsd + pop esi edi +align 4 + .cycle2: + mov eax,[edi] + or eax,eax + jz @f + cmp [eax+Figure.PoiCount],0 + je @f + fld qword[eax+Figure.MinX] + fcomp qword[ebx+Object.MinX] + fstsw ax + sahf + ja @f + push edi esi + mov eax,[edi] + lea esi,[eax+Figure.MinX] + lea edi,[ebx+Object.MinX] + movsd + movsd + pop esi edi + @@: + add edi,4 + loop .cycle2 + .cycle2end: + + ;found min coord Y + mov ecx,[ebx+Object.FigCount] + jecxz .cycle3end + mov edi,[ebx+Object.FigData] + push edi esi ;copy first min Y + @@: + mov eax,[edi] + dec ecx + jecxz .cycle3end + add edi,4 + or eax,eax + jz @b + cmp [eax+Figure.PoiCount],0 + je @b + lea esi,[eax+Figure.MinY] + lea edi,[ebx+Object.MinY] + movsd + movsd + pop esi edi +align 4 + .cycle3: + mov eax,[edi] + or eax,eax + jz @f + cmp [eax+Figure.PoiCount],0 + je @f + fld qword[eax+Figure.MinY] + fcomp qword[ebx+Object.MinY] + fstsw ax + sahf + ja @f + push edi esi + mov eax,[edi] + lea esi,[eax+Figure.MinY] + lea edi,[ebx+Object.MinY] + movsd + movsd + pop esi edi + @@: + add edi,4 + loop .cycle3 + .cycle3end: + + ;found max coord X + mov ecx,[ebx+Object.FigCount] + jecxz .cycle4end + mov edi,[ebx+Object.FigData] + ;copy first min X + mov eax,[edi] + fld qword[eax+Figure.MinX] + fadd qword[eax+Figure.SizeX] + fstp qword[ebx+Object.SizeX] + dec ecx + jecxz .cycle4end +align 4 + .cycle4: + add edi,4 + mov eax,[edi] + or eax,eax + jz @f + cmp [eax+Figure.PoiCount],0 + je @f + fld qword[eax+Figure.MinX] + fadd qword[eax+Figure.SizeX] + fcomp qword[ebx+Object.SizeX] + fstsw ax + sahf + jbe @f + mov eax,[edi] + fld qword[eax+Figure.MinX] + fadd qword[eax+Figure.SizeX] + fstp qword[ebx+Object.SizeX] + @@: + loop .cycle4 + .cycle4end: + + ;found max coord Y + mov ecx,[ebx+Object.FigCount] + jecxz .cycle5end + mov edi,[ebx+Object.FigData] + ;copy first min Y + mov eax,[edi] + fld qword[eax+Figure.MinY] + fadd qword[eax+Figure.SizeY] + fstp qword[ebx+Object.SizeY] + dec ecx + jecxz .cycle5end +align 4 + .cycle5: + add edi,4 + mov eax,[edi] + or eax,eax + jz @f + cmp [eax+Figure.PoiCount],0 + je @f + fld qword[eax+Figure.MinY] + fadd qword[eax+Figure.SizeY] + fcomp qword[ebx+Object.SizeY] + fstsw ax + sahf + jbe @f + mov eax,[edi] + fld qword[eax+Figure.MinY] + fadd qword[eax+Figure.SizeY] + fstp qword[ebx+Object.SizeY] + @@: + loop .cycle5 + .cycle5end: + + ;found size X + fld qword[ebx+Object.SizeX] + fsub qword[ebx+Object.MinX] + fstp qword[ebx+Object.SizeX] + ;found size Y + fld qword[ebx+Object.SizeY] + fsub qword[ebx+Object.MinY] + fstp qword[ebx+Object.SizeY] + + ;*** Calculate scale *** + fld1 + fstp qword[ebx+Object.WScale] ;set default scale + + fld qword[ebx+Object.SizeX] + ftst + fstsw ax + sahf + jne .els_0 ;if (SizeX == 0.0) + ffree st0 + fincstp + jmp .els_1 + .els_0: ;else if (SizeX != 0.0) + fild dword[buf_0.w] + fisub dword[graf_margin_left] + fisub dword[graf_margin_right] + fxch st1 + fdivp + fstp qword[ebx+Object.WScale] + .els_1: + + fld qword[ebx+Object.SizeY] + ftst + fstsw ax + sahf + jne .els_2 ;if (SizeY == 0.0) + ffree st0 + fincstp + jmp .els_3 + .els_2: ;else if (SizeY != 0.0) + fild dword[buf_0.h] + fisub dword[graf_margin_top] + fisub dword[graf_margin_bot] + fxch st1 + fdivp + fcom qword[ebx+Object.WScale] + fstsw ax + sahf + jbe @f + ffree st0 + fincstp + jmp .els_3 + @@: + fstp qword[ebx+Object.WScale] + .els_3: + + fld1 + fstp qword[ebx+Figure.MScale] + mov dword[ebx+Figure.MCentrX],0 + mov dword[ebx+Figure.MCentrY],0 + ret +endp + +;input: +; esi - input description text +; pmem - pointer to memory for struct +; pfig - pointer to figure struct +;output: +; esi - output description text +align 4 +proc FigureInit uses eax ebx ecx edx edi, pmem:dword, pfig:dword + mov ebx,[pmem] + mov [ebx+Figure.OType],'Fig' + mov edi,ebx + add edi,Figure.Caption + stdcall txt_load_line,32 + + xor eax,eax + mov [ebx+Figure.PoiCount],eax + mov [ebx+Figure.PoiData],eax + cmp byte[esi],'X' + jne .end0 + stdcall get_max_points + mov [ebx+Figure.PoiCount],eax + or eax,eax + jz .end0 + mov ecx,eax + imul eax,sizeof.Point + stdcall mem.Alloc,eax + mov [ebx+Figure.PoiData],eax + or eax,eax + jz .err_init + mov edi,eax +align 4 + .cycle0: + stdcall PointInit,edi + or eax,eax + jz .cycle0end + add edi,sizeof.Point + loop .cycle0 + .cycle0end: + or ecx,ecx + jz .end1 + ;уменьшаем объем памяти выделенный для точек + sub [ebx+Figure.PoiCount],ecx + mov eax,[ebx+Figure.PoiCount] + imul eax,sizeof.Point + stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax + mov [ebx+Figure.PoiData],eax + jmp .end1 + .err_init: + notify_window_run txt_err_2 + .end0: + ;command + stdcall txt_next_line, 80 + cmp byte[esi],13 + jne @f + ;if null line + inc esi + cmp byte[esi],10 + jne .end2 + inc esi + .end2: + mov dword[edi],(10 shl 8)+13 ;new line + @@: + stdcall add_object_in_list,1,1,ebx,[pfig] + jmp .end_f + .end1: + ;coords + stdcall add_object_in_list,2,1,ebx,[pfig] + or eax,eax + jz .end_f + stdcall FigCalculateSizes,eax,1 + .end_f: + ret +endp + +;input: +; esi - pointer to file +;output: +; eax - max lines in file +align 4 +proc get_max_lines uses esi + xor eax,eax + .cycle0: + cmp byte[esi],13 + jne @f + inc eax + @@: + inc esi + cmp byte[esi],0 + jne .cycle0 + ret +endp + +;input: +; esi - pointer to file +;output: +; eax - max point coords in file +align 4 +proc get_max_points uses esi + xor eax,eax + .cycle0: + cmp word[esi],' Y' + jne @f + inc eax + @@: + inc esi + cmp byte[esi+1],0 + jne .cycle0 + ret +endp + +;input: +; opt_calc - если 0 - пересчитать масштаб фигуры, +; 1 - пересчитать размеры и масштаб фигуры +align 4 +proc FigCalculateSizes uses eax ebx ecx edi esi, pfig:dword, opt_calc:dword + mov ebx,[pfig] + or ebx,ebx + jz .end_f + + finit + bt dword[opt_calc],0 + jnc .calc_scale + + ;*** Calculate sizes *** + mov esi,[ebx+Figure.PoiData] + or esi,esi + jz .end_f + + lea esi,[esi+Point.CoordX] + lea edi,[ebx+Figure.MinX] + movsd + movsd ;Figure.MinX = Point[0].CoordX + sub esi,8 + lea edi,[ebx+Figure.SizeX] + movsd + movsd ;Figure.SizeX = Point[0].CoordX + mov esi,[ebx+Figure.PoiData] + lea esi,[esi+Point.CoordY] + lea edi,[ebx+Figure.MinY] + movsd + movsd ;Figure.MinY = Point[0].CoordY + sub esi,8 + lea edi,[ebx+Figure.SizeY] + movsd + movsd ;Figure.SizeY = Point[0].CoordY + + ;found min coord X + mov ecx,[ebx+Figure.PoiCount] + jecxz .cycle2end + mov edi,[ebx+Figure.PoiData] +align 4 + .cycle2: + fld qword[edi+Point.CoordX] + fcomp qword[ebx+Figure.MinX] + fstsw ax + sahf + ja @f + push edi esi + lea esi,[edi+Point.CoordX] + lea edi,[ebx+Figure.MinX] + movsd + movsd + pop esi edi + @@: + add edi,sizeof.Point + loop .cycle2 + .cycle2end: + + ;found min coord Y + mov ecx,[ebx+Figure.PoiCount] + jecxz .cycle3end + mov edi,[ebx+Figure.PoiData] +align 4 + .cycle3: + fld qword[edi+Point.CoordY] + fcomp qword[ebx+Figure.MinY] + fstsw ax + sahf + ja @f + push edi esi + lea esi,[edi+Point.CoordY] + lea edi,[ebx+Figure.MinY] + movsd + movsd + pop esi edi + @@: + add edi,sizeof.Point + loop .cycle3 + .cycle3end: + + ;found max coord X + mov ecx,[ebx+Figure.PoiCount] + jecxz .cycle4end + mov edi,[ebx+Figure.PoiData] +align 4 + .cycle4: + fld qword[edi+Point.CoordX] + fcomp qword[ebx+Figure.SizeX] + fstsw ax + sahf + jbe @f + push edi esi + lea esi,[edi+Point.CoordX] + lea edi,[ebx+Figure.SizeX] + movsd + movsd + pop esi edi + @@: + add edi,sizeof.Point + loop .cycle4 + .cycle4end: + + ;found max coord Y + mov ecx,[ebx+Figure.PoiCount] + jecxz .cycle5end + mov edi,[ebx+Figure.PoiData] +align 4 + .cycle5: + fld qword[edi+Point.CoordY] + fcomp qword[ebx+Figure.SizeY] + fstsw ax + sahf + jbe @f + push edi esi + lea esi,[edi+Point.CoordY] + lea edi,[ebx+Figure.SizeY] + movsd + movsd + pop esi edi + @@: + add edi,sizeof.Point + loop .cycle5 + .cycle5end: + + ;found size X + fld qword[ebx+Figure.SizeX] + fsub qword[ebx+Figure.MinX] + fstp qword[ebx+Figure.SizeX] + ;found size Y + fld qword[ebx+Figure.SizeY] + fsub qword[ebx+Figure.MinY] + fstp qword[ebx+Figure.SizeY] + + ;*** Calculate scale *** +align 4 + .calc_scale: + mov dword[ebx+Figure.MCentrX],0 + mov dword[ebx+Figure.MCentrY],0 + fld1 + fst qword[ebx+Figure.MScale] ;??? + fstp qword[ebx+Figure.WScale] ;set default scale + + fld qword[ebx+Figure.SizeX] + ftst + fstsw ax + sahf + jne .els_0 ;if (SizeX == 0.0) + ffree st0 + fincstp + jmp .els_1 + .els_0: ;else if (SizeX != 0.0) + fild dword[buf_0.w] + fisub dword[graf_margin_left] + fisub dword[graf_margin_right] + fxch st1 + fdivp + fstp qword[ebx+Figure.WScale] + .els_1: + + fld qword[ebx+Figure.SizeY] + ftst + fstsw ax + sahf + jne .els_2 ;if (SizeY == 0.0) + ffree st0 + fincstp + jmp .els_3 + .els_2: ;else if (SizeY != 0.0) + fild dword[buf_0.h] + fisub dword[graf_margin_top] + fisub dword[graf_margin_bot] + fxch st1 + fdivp + fcom qword[ebx+Figure.WScale] + fstsw ax + sahf + jbe @f + ffree st0 + fincstp + jmp .els_3 + @@: + fstp qword[ebx+Figure.WScale] + .els_3: + + .end_f: + ret +endp + +;input: +; esi - input description text +; ppoi - pointer to point struct +;output: +; eax - 0 (if error init) or 1 +; esi - output description text +align 4 +proc PointInit uses ebx ecx edi, ppoi:dword + mov ecx,64 ;защита от зацикливания + @@: + lodsb + cmp al,' ' + jne @f + loop @b + @@: + dec esi + cmp byte[esi],'X' + jne .err_init + inc esi + stdcall conv_str_to_int, esi + mov ebx,[ppoi] + + ;Data_String <- esi + push esi + mov ecx,32 + mov edi,esi + @@: + lodsb + or al,al + jz @f + cmp al,' ' + je @f + cmp al,13 + je @f + loop @b + @@: + mov esi,edi + sub ecx,32 + neg ecx + mov edi,Data_String + rep movsb + mov byte[edi],0 + pop esi + stdcall String_to_DoubleFloat + ;Data_Double -> Point.CoordX + push esi + mov esi,Data_Double + lea edi,[ebx+Point.CoordX] + movsd + movsd + pop esi + + push edi + mov al,'Y' + mov ecx,80 + mov edi,esi + repne scasb + mov esi,edi + pop edi + ;Data_String <- esi + push esi + mov ecx,32 + mov edi,esi + @@: + lodsb + or al,al + jz @f + cmp al,' ' + je @f + cmp al,13 + je @f + loop @b + @@: + mov esi,edi + sub ecx,32 + neg ecx + mov edi,Data_String + rep movsb + mov byte[edi],0 + pop esi + stdcall String_to_DoubleFloat + ;Data_Double -> Point.CoordY + push esi + mov esi,Data_Double + lea edi,[ebx+Point.CoordY] + movsd + movsd + pop esi + + stdcall txt_next_line, 80 + jmp @f + .err_init: + xor eax,eax + jmp .end_f + @@: + xor eax,eax + inc eax + .end_f: + ret +endp + +;input: +; icon - номер иконки +; level - уровень вложенности узла +; buffer - добавляемые данные +; pfig - указатель на добавленную фигуру (для контроля со стороны родительского объекта) +;output: +; eax - object data pointer +align 4 +proc add_object_in_list uses ebx, icon:dword,level:dword,buffer:dword, pfig:dword + mov ax,word[icon] + shl eax,16 + mov ax,word[level] + + stdcall [tl_node_add], tree1, eax, [buffer] + stdcall [tl_node_get_data],tree1 + mov ebx,[pfig] + or ebx,ebx + jz @f + mov [ebx],eax + @@: + stdcall [tl_cur_next], tree1 + ret +endp + +align 4 +proc clear_object_in_list uses eax, buffer:dword + mov eax,[buffer] + cmp dword[eax+Object.FigCount],0 ;or Figure.PoiCount + je .end_f + stdcall mem.Free,[eax+Object.FigData] ;or Figure.PoiData + .end_f: + ret +endp + +;description: +; функция для рисования выбранного объекта +align 4 +proc draw_obj2d, pobj:dword +locals + CentrX dd ? + CentrY dd ? +endl +pushad + mov ebx,[pobj] + stdcall [buf2d_clear], buf_0, [buf_0.color] + mov ecx,[ebx+Object.FigCount] + or ecx,ecx + jz .end_f + ;;jecxz .end_f + mov edi,[ebx+Object.FigData] + finit + fld qword[ebx+Object.SizeY] + fmul qword[ebx+Object.WScale] + fmul qword[ebx+Object.MScale] + fchs + fistp dword[CentrY] + mov eax,[CentrY] + sub eax,[graf_margin_top] + sub eax,[graf_margin_bot] + add eax,[buf_0.h] + sar eax,1 + add eax,[graf_margin_bot] ;_bot а не _top - в связи с тем что коорд. Y перевернута + add eax,[ebx+Object.MCentrY] + mov [CentrY],eax + fld qword[ebx+Object.SizeX] + fmul qword[ebx+Object.WScale] + fmul qword[ebx+Object.MScale] + fchs + fistp dword[CentrX] + mov edx,[CentrX] + sub edx,[graf_margin_left] + sub edx,[graf_margin_right] + add edx,[buf_0.w] + sar edx,1 + add edx,[graf_margin_left] + add edx,[ebx+Object.MCentrX] + mov [CentrX],edx +align 4 + .cycle0: + stdcall draw_fig2d_litl, buf_0,ebx,[edi],0,edx,eax + add edi,4 + loop .cycle0 + stdcall [buf2d_flip_v], buf_0 + + bt dword[opt_draw],0 + jnc .end_f + ; draw min & sizes + mov word[NumberSymbolsAD],8 + stdcall mem_copy, txt_buf,txt_size_x,20 + fld qword[ebx+Object.SizeX] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall str_cat,txt_buf,txt_n + stdcall str_cat,txt_buf,txt_size_y + fld qword[ebx+Object.SizeY] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,23,0 + + fld qword[ebx+Object.MinX] + fstp qword[Data_Double] + stdcall mem_copy, txt_buf,txt_min_x,20 + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall str_cat,txt_buf,txt_n + stdcall str_cat,txt_buf,txt_min_y + fld qword[ebx+Object.MinY] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0 + .end_f: +popad + ret +endp + +align 4 +proc draw_obj2d_png uses eax ebx ecx edi esi, pobj:dword + mov ebx,[pobj] + mov ecx,[ebx+Object.FigCount] + cmp dword[ebx+Object.FigCount],0 + or ecx,ecx + jz .end_f + ;;jecxz .end_f + mov edi,[ebx+Object.FigData] + stdcall [buf2d_delete], buf_png + finit + fld qword[ebx+Object.SizeY] + fmul qword[Scale1mm] + fiadd dword[graf_margin_top] + fiadd dword[graf_margin_bot] + fistp dword[buf_png.h] + fld qword[ebx+Object.SizeX] + fmul qword[Scale1mm] + fiadd dword[graf_margin_left] + fiadd dword[graf_margin_right] + fistp dword[buf_png.w] + stdcall [buf2d_create], buf_png +align 4 + .cycle0: + stdcall draw_fig2d_litl, buf_png,ebx,[edi],Scale1mm,[graf_margin_left],[graf_margin_bot] ;_bot а не _top - в связи с тем что коорд. Y перевернута + add edi,4 + loop .cycle0 + stdcall [buf2d_flip_v], buf_png + .end_f: + ret +endp + +;input: +; pbuf - pointer to buffer 2d +;description: +; функция для рисования объекта по частям +align 4 +proc draw_fig2d_litl, pbuf:dword, pobj:dword, pfig:dword, Scale:dword, CentrX:dword, CentrY:dword +locals + 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 +endl +pushad + mov ebx,[pfig] + test ebx,ebx + jz .end_f + mov ecx,[ebx+Figure.PoiCount] + ;;jecxz .end_f + test ecx,ecx + jz .end_f + mov edi,[ebx+Figure.PoiData] + mov edx,[pobj] + + fld1 + mov eax,[Scale] + or eax,eax + jnz @f + lea eax,[edx+Object.MScale] + fmul qword[eax] + lea eax,[edx+Object.WScale] + @@: + fmul qword[eax] +align 4 + .cycle0: + fld qword[edi+Point.CoordX] + fsub qword[edx+Object.MinX] + fmul st0,st1 + fiadd dword[CentrX] + fistp dword[ebp-8] + fld qword[edi+Point.CoordY] + fsub qword[edx+Object.MinY] + fmul st0,st1 + fiadd dword[CentrY] + 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 + @@: + mov eax,[GrafX] + mov [PervX],eax + mov eax,[GrafY] + mov [PervY],eax + add edi,sizeof.Point + ;;loop .cycle0 + dec ecx + jnz .cycle0 + ffree st0 + fincstp + + .end_f: +popad + ret +endp + +;description: +; функция для рисования выбранной фигуры +align 4 +proc draw_fig2d, pfig:dword +locals + n dd 0 + col_lin dd 0 ;цвет линий фигуры + CentrX dd ? + CentrY dd ? + 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 + old_tl dd 0 ;old text coord X0 + old_tt dd 0 ;old text coord Y0 + old_tw dd 0 ;old text coord X1 + old_th dd 0 ;old text coord Y1 + new_tl dd 0 ;new text coord X0 + ;new_tt dd 0 ;new text coord Y0 + new_tw dd 0 ;new text coord X1 + ;new_th dd 0 ;new text coord Y1 +endl +pushad + stdcall [buf2d_clear], buf_0, [buf_0.color] + mov ebx,[pfig] + test ebx,ebx + jz .end_f + mov ecx,[ebx+Figure.PoiCount] + ;;jecxz .end_f + test ecx,ecx + jz .end_f + mov edi,[ebx+Figure.PoiData] + finit + fld qword[ebx+Figure.SizeY] + fmul qword[ebx+Figure.WScale] + fmul qword[ebx+Figure.MScale] + fchs + fistp dword[CentrY] + mov eax,[CentrY] + sub eax,[graf_margin_top] + sub eax,[graf_margin_bot] + add eax,[buf_0.h] + sar eax,1 + add eax,[graf_margin_bot] + add eax,[ebx+Figure.MCentrY] + mov [CentrY],eax + ;CentrY = (-(Figure.SizeY * Figure.WScale) - graf_margin_top - graf_margin_bot + buf_0.h) / 2 + graf_margin_bot + fld qword[ebx+Figure.SizeX] + fmul qword[ebx+Figure.WScale] + fmul qword[ebx+Figure.MScale] + fchs + fistp dword[CentrX] + mov eax,[CentrX] + sub eax,[graf_margin_left] + sub eax,[graf_margin_right] + add eax,[buf_0.w] + sar eax,1 + add eax,[graf_margin_left] + add eax,[ebx+Figure.MCentrX] + mov [CentrX],eax + ;CentrX = (-(Figure.SizeX * Figure.WScale) - graf_margin_left - graf_margin_right + buf_0.w) / 2 + graf_margin_left + +align 4 + .cycle0: + fld qword[edi+Point.CoordX] + fsub qword[ebx+Figure.MinX] + fmul qword[ebx+Figure.WScale] + fmul qword[ebx+Figure.MScale] + fiadd dword[CentrX] + fistp dword[GrafX] + ;GrafX = (Point.CoordX - Figure.MinX) * Figure.WScale + CentrX + fld qword[edi+Point.CoordY] + fsub qword[ebx+Figure.MinY] + fmul qword[ebx+Figure.WScale] + fmul qword[ebx+Figure.MScale] + fiadd dword[CentrY] + fisub dword[buf_0.h] ;invert coord Y + fchs + fistp dword[GrafY] + ;GrafY = -((Point.CoordY - Figure.MinY) * Figure.WScale + CentrY - buf_0.h) + + stdcall [buf2d_set_pixel], buf_0, [GrafX],[GrafY], 0xff0000 + mov dword[col_lin],0x80 + bt dword[edi+Point.Prop],PROP_BIT_SELECT + jnc @f + stdcall [buf2d_circle], buf_0, [GrafX],[GrafY], 3, 0xff0000 + @@: + cmp ecx,[ebx+Figure.PoiCount] + je @f + stdcall [buf2d_line_sm], buf_0, [PervX],[PervY], [GrafX],[GrafY], [col_lin] + stdcall [buf2d_line], buf_0, [PervX],[PervY], [GrafX],[GrafY], [col_lin] + @@: + mov eax,[GrafX] + mov [PervX],eax + mov edx,[GrafY] + mov [PervY],edx + add edi,sizeof.Point + + bt dword[opt_draw],0 + jnc .end0 + ; draw number points + ;mov eax,[GrafX] + ;mov edx,[GrafY] + add eax,2 + add edx,2 + push eax edi + mov eax,[n] + mov edi,txt_buf + stdcall convert_int_to_str,20 + pop edi eax + + inc dword[n] + ;calculate new text coords + mov [new_tl],eax + mov esi,eax + stdcall str_len,txt_buf + imul eax,[buf_1.w] + add eax,esi + mov [new_tw],eax + ;rect compare coords + cmp [old_tl],eax + jg .no_comp + cmp [old_tw],esi + jl .no_comp + ;calculate new text coord Y1 + mov esi,edx + add esi,[font_h] + cmp [old_tt],esi + jg .no_comp + cmp [old_th],edx + ;jl .no_comp + ;jmp .end0 + jge .end0 + .no_comp: + mov eax,[new_tl] + mov [old_tl],eax + mov eax,[new_tw] + mov [old_tw],eax + mov [old_tt],edx + add edx,[font_h] + mov [old_th],edx + stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,[old_tl],[old_tt],0x000000 + .end0: + dec ecx + jnz .cycle0 + + stdcall sel_points_get_count,[pfig] + or eax,eax + jz .no_point + stdcall mem_copy, txt_buf,txt_poi_sel,txt_poi_sel.end-txt_poi_sel + mov edi,txt_buf+txt_poi_sel.end-txt_poi_sel + stdcall convert_int_to_str, 20 + mov word[NumberSymbolsAD],8 + cmp eax,1 + jne @f + ;если выбрана одна точка, то по ней вывод более детальной информации + stdcall sel_points_get_first,[pfig] + stdcall str_cat,txt_buf,txt_ls + fld qword[eax+Point.CoordX] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall str_cat,txt_buf,txt_coma + fld qword[eax+Point.CoordY] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall str_cat,txt_buf,txt_rs + jmp .end1 + @@: + cmp eax,2 + jne .end1 + ;если выбрано 2 точки + stdcall sel_points_get_first,[pfig] + fld qword[eax+Point.CoordX] + fld qword[eax+Point.CoordY] + stdcall sel_points_get_last,[pfig] + fsub qword[eax+Point.CoordY] + fmul st0,st0 + fxch st1 + fsub qword[eax+Point.CoordX] + fmul st0,st0 + faddp st1,st0 + fsqrt + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,txt_len + stdcall str_cat,txt_buf,Data_String + .end1: + stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0 + jmp .end_f ;не выводим информацию о размерах + .no_point: + + bt dword[opt_draw],0 + jnc .end_f + ; draw min & sizes + mov word[NumberSymbolsAD],8 + stdcall mem_copy, txt_buf,txt_size_x,20 + fld qword[ebx+Figure.SizeX] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall str_cat,txt_buf,txt_n + stdcall str_cat,txt_buf,txt_size_y + fld qword[ebx+Figure.SizeY] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,23,0 + + fld qword[ebx+Figure.MinX] + fstp qword[Data_Double] + stdcall mem_copy, txt_buf,txt_min_x,20 + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall str_cat,txt_buf,txt_n + stdcall str_cat,txt_buf,txt_min_y + fld qword[ebx+Figure.MinY] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat,txt_buf,Data_String + stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0 + .end_f: +popad + ret +endp + +;input: +; pnode - указатель на данные узла +align 4 +proc get_object_data, pnode:dword + mov ecx,[pnode] + cmp [ecx+Object.OType],'Obj' + jne .end0 + mov ecx,ObjData + jmp .end_f + .end0: + xor ecx,ecx + .end_f: + ret +endp + +;input: +; pfig - pointer to figure +;output: +; eax - указатель на родительский объект или 0 если не найдено +; ecx - номер фигуры внутри объекта +align 4 +proc found_parent_obj uses ebx edx edi, pfig:dword + mov eax,ObjData + mov edx,[eax+Object.FigCount] + or edx,edx + jz .cycle1end + mov edi,[eax+Object.FigData] + xor ecx,ecx + .cycle1: ;цикл по фигурам + mov ebx,[edi] + cmp ebx,[pfig] + je .end_f ;если найдено + add edi,4 + inc ecx + dec edx + jnz .cycle1 + .cycle1end: + xor eax,eax + .end_f: + ret +endp + +;description: +; считает колличество выделенных точек +align 4 +proc sel_points_get_count uses ebx ecx, pFig:dword + xor eax,eax + mov ebx,[pFig] + mov ecx,[ebx+Figure.PoiCount] + or ecx,ecx + jz .no_point + mov ebx,[ebx+Figure.PoiData] + .cycle0: + bt dword[ebx+Point.Prop],PROP_BIT_SELECT + jnc @f + inc eax + @@: + add ebx,sizeof.Point + loop .cycle0 + .no_point: + ret +endp + +;description: +; берет указатель на первую выделенную точку +;output: +; eax - указатель на точку или 0 если не выделенно +align 4 +proc sel_points_get_first uses ecx, pFig:dword + mov eax,[pFig] + mov ecx,[eax+Figure.PoiCount] + or ecx,ecx + jz .no_point + mov eax,[eax+Figure.PoiData] + .cycle0: + bt dword[eax+Point.Prop],PROP_BIT_SELECT + jc .end_f + add eax,sizeof.Point + loop .cycle0 + .no_point: + xor eax,eax + .end_f: + ret +endp + +;input: +; pObj - указатель на объект +; FigN - номер комманды +;description: +; пересчет фигур после обновления координат точки +align 4 +proc figure_update_coords uses eax ecx edx, pObj:dword, FigN:dword + mov eax,[pObj] + mov ecx,[eax+Object.FigCount] + mov eax,[eax+Object.FigData] + mov edx,[FigN] + cmp ecx,edx + jle @f + stdcall FigCalculateSizes,[eax+4*edx],1 + stdcall ObjCalculateScale,[pObj] + @@: + ret +endp + +;description: +; берет указатель на последнюю выделенную точку +align 4 +proc sel_points_get_last uses ebx ecx, pFig:dword + mov ebx,[pFig] + mov ecx,[ebx+Figure.PoiCount] + or ecx,ecx + jz .no_point + mov eax,ecx + dec eax + imul eax,sizeof.Point + add eax,[ebx+Figure.PoiData] + .cycle0: + bt dword[eax+Point.Prop],PROP_BIT_SELECT + jc .end_f + sub eax,sizeof.Point + loop .cycle0 + .no_point: + xor eax,eax + .end_f: + ret +endp + +;description: +; снимает выделение с точек +align 4 +proc sel_points_clear uses ebx ecx, pFig:dword + mov ebx,[pFig] + mov ecx,[ebx+Figure.PoiCount] + or ecx,ecx + jz .no_point + mov ebx,[ebx+Figure.PoiData] + .cycle0: + btr dword[ebx+Point.Prop],PROP_BIT_SELECT + add ebx,sizeof.Point + loop .cycle0 + .no_point: + ret +endp + +;description: +; инвертирует указанный бит в свойствах выделенных точек +align 4 +proc sel_points_invert_bit uses eax ebx ecx, pFig:dword, iBit:dword + mov ecx,[iBit] + xor eax,eax + inc eax + shl eax,cl + mov ebx,[pFig] + mov ecx,[ebx+Figure.PoiCount] + or ecx,ecx + jz .no_point + mov ebx,[ebx+Figure.PoiData] + .cycle0: + bt dword[ebx+Point.Prop],PROP_BIT_SELECT + jnc @f + xor dword[ebx+Point.Prop],eax + @@: + add ebx,sizeof.Point + loop .cycle0 + .no_point: + ret +endp + +;input: +; pPoi - указатель на данные точки +align 4 +proc point_move_up, pObj:dword,pFig:dword,idFig:dword,pPoi:dword +pushad + ;изменение ссылок на точки + mov eax,[pObj] + mov ecx,[idFig] + mov edx,[eax+Object.FigCount] + or edx,edx + jz .end_f + mov edi,[eax+Object.FigData] + + ;меняем точки местами + mov ecx,sizeof.Point + mov esi,[pPoi] + sub esi,ecx + mov edi,PoiData + rep movsb ;p(-1) > p_s + mov ecx,sizeof.Point + mov edi,[pPoi] + sub edi,ecx + rep movsb ;p(0) > p(-1) + mov esi,PoiData + mov ecx,sizeof.Point + rep movsb ;p_s > p(0) + .end_f: +popad + ret +endp + +align 4 +proc mouse_left_d uses eax ebx + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_f + + cmp [eax+Figure.OType],'Fig' + je @f + cmp [eax+Figure.OType],'Obj' + je .end0 + jmp .end_f + .end0: + mov eax,ObjData + @@: + call buf_get_mouse_coord + cmp eax,-1 + je .end_f + mov [mouse_down_x],eax + mov [mouse_down_y],ebx + .end_f: + ret +endp + +align 4 +proc mouse_left_u uses eax ebx ecx + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_f + + cmp [eax+Figure.OType],'Fig' + je @f + cmp [eax+Figure.OType],'Obj' + je .end0 + jmp .end_f + .end0: + mov eax,ObjData + @@: + mov ecx,eax + + call buf_get_mouse_coord + cmp eax,-1 + je .end_f + sub eax,[mouse_down_x] + sub ebx,[mouse_down_y] + add [ecx+Figure.MCentrX],eax + sub [ecx+Figure.MCentrY],ebx + mov dword[offs_last_timer],0 + .end_f: + ret +endp + +;output: +; eax, ebx - портятся +align 4 +proc mouse_right_d uses ecx edx edi +locals + BufX dd ? + BufY dd ? + CentrX dd ? + CentrY dd ? + GrafX dd ? ;active point coord X + GrafY dd ? ;active point coord Y +endl + call buf_get_mouse_coord + cmp eax,-1 + je .end_f + mov [BufX],eax + mov [BufY],ebx + + ;просматриваем выделенный блок данных + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_f + + cmp [eax+Figure.OType],'Fig' + jne .end_fblo + + mov ecx,eax + mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;проверка Shift + bt eax,0 + jc @f + bt eax,1 + jc @f + ;если не нажат Shift + stdcall sel_points_clear,ecx + @@: + mov ebx,ecx + mov ecx,[ebx+Figure.PoiCount] + ;;jecxz .end_f + test ecx,ecx + jz .end_f + + mov edi,[ebx+Figure.PoiData] + finit + fld qword[ebx+Figure.SizeY] + fmul qword[ebx+Figure.WScale] + fmul qword[ebx+Figure.MScale] + fchs + fistp dword[CentrY] + mov eax,[CentrY] + sub eax,[graf_margin_top] + sub eax,[graf_margin_bot] + add eax,[buf_0.h] + sar eax,1 + add eax,[graf_margin_bot] + add eax,[ebx+Figure.MCentrY] + mov [CentrY],eax + fld qword[ebx+Figure.SizeX] + fmul qword[ebx+Figure.WScale] + fmul qword[ebx+Figure.MScale] + fchs + fistp dword[CentrX] + mov eax,[CentrX] + sub eax,[graf_margin_left] + sub eax,[graf_margin_right] + add eax,[buf_0.w] + sar eax,1 + add eax,[graf_margin_left] + add eax,[ebx+Figure.MCentrX] + mov [CentrX],eax + +align 4 + .cycle0: + fld qword[edi+Point.CoordX] + fsub qword[ebx+Figure.MinX] + fmul qword[ebx+Figure.WScale] + fmul qword[ebx+Figure.MScale] + fiadd dword[CentrX] + fistp dword[GrafX] + fld qword[edi+Point.CoordY] + fsub qword[ebx+Figure.MinY] + fmul qword[ebx+Figure.WScale] + fmul qword[ebx+Figure.MScale] + fiadd dword[CentrY] + fisub dword[buf_0.h] ;invert coord Y + fchs + fistp dword[GrafY] + + mov eax,[GrafX] + sub eax,[BufX] + bt eax,31 + jnc @f + neg eax + @@: + mov edx,[GrafY] + sub edx,[BufY] + bt edx,31 + jnc @f + neg edx + @@: + add eax,edx + cmp eax,7 ;приблизительное расстояние до точки + jg @f + ;выделяем или снимаем выделение с точек + xor dword[edi+Point.Prop],(1 shl PROP_BIT_SELECT) + @@: + + add edi,sizeof.Point + dec ecx + jnz .cycle0 + + mov dword[offs_last_timer],0 + ;jmp .end_f + .end_fblo: + + .end_f: + ret +endp diff --git a/programs/other/cnc_editor/doc/but_01.png b/programs/other/cnc_editor/doc/but_01.png new file mode 100644 index 0000000000..5ca1e2d261 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_01.png differ diff --git a/programs/other/cnc_editor/doc/but_02.png b/programs/other/cnc_editor/doc/but_02.png new file mode 100644 index 0000000000..94187ab83a Binary files /dev/null and b/programs/other/cnc_editor/doc/but_02.png differ diff --git a/programs/other/cnc_editor/doc/but_03.png b/programs/other/cnc_editor/doc/but_03.png new file mode 100644 index 0000000000..07ec7a2a9d Binary files /dev/null and b/programs/other/cnc_editor/doc/but_03.png differ diff --git a/programs/other/cnc_editor/doc/but_04.png b/programs/other/cnc_editor/doc/but_04.png new file mode 100644 index 0000000000..2edb10bc53 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_04.png differ diff --git a/programs/other/cnc_editor/doc/but_05.png b/programs/other/cnc_editor/doc/but_05.png new file mode 100644 index 0000000000..10b9616b66 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_05.png differ diff --git a/programs/other/cnc_editor/doc/but_06.png b/programs/other/cnc_editor/doc/but_06.png new file mode 100644 index 0000000000..87cf287a4f Binary files /dev/null and b/programs/other/cnc_editor/doc/but_06.png differ diff --git a/programs/other/cnc_editor/doc/but_07.png b/programs/other/cnc_editor/doc/but_07.png new file mode 100644 index 0000000000..d1b7ba2de8 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_07.png differ diff --git a/programs/other/cnc_editor/doc/but_08.png b/programs/other/cnc_editor/doc/but_08.png new file mode 100644 index 0000000000..84ddaf96a3 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_08.png differ diff --git a/programs/other/cnc_editor/doc/but_09.png b/programs/other/cnc_editor/doc/but_09.png new file mode 100644 index 0000000000..3eeb930b25 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_09.png differ diff --git a/programs/other/cnc_editor/doc/but_10.png b/programs/other/cnc_editor/doc/but_10.png new file mode 100644 index 0000000000..adee03e946 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_10.png differ diff --git a/programs/other/cnc_editor/doc/but_11.png b/programs/other/cnc_editor/doc/but_11.png new file mode 100644 index 0000000000..6cda650fac Binary files /dev/null and b/programs/other/cnc_editor/doc/but_11.png differ diff --git a/programs/other/cnc_editor/doc/but_12.png b/programs/other/cnc_editor/doc/but_12.png new file mode 100644 index 0000000000..855ffccfe6 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_12.png differ diff --git a/programs/other/cnc_editor/doc/but_13.png b/programs/other/cnc_editor/doc/but_13.png new file mode 100644 index 0000000000..7805cb4d4a Binary files /dev/null and b/programs/other/cnc_editor/doc/but_13.png differ diff --git a/programs/other/cnc_editor/doc/but_14.png b/programs/other/cnc_editor/doc/but_14.png new file mode 100644 index 0000000000..a38ac67432 Binary files /dev/null and b/programs/other/cnc_editor/doc/but_14.png differ diff --git a/programs/other/cnc_editor/doc/but_15.png b/programs/other/cnc_editor/doc/but_15.png new file mode 100644 index 0000000000..b5154cbd9f Binary files /dev/null and b/programs/other/cnc_editor/doc/but_15.png differ diff --git a/programs/other/cnc_editor/doc/cnc_01.png b/programs/other/cnc_editor/doc/cnc_01.png new file mode 100644 index 0000000000..efc88ee884 Binary files /dev/null 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 new file mode 100644 index 0000000000..ed86c3183f Binary files /dev/null and b/programs/other/cnc_editor/doc/cnc_02.png differ diff --git a/programs/other/cnc_editor/doc/cnc_03.png b/programs/other/cnc_editor/doc/cnc_03.png new file mode 100644 index 0000000000..29aac13df2 Binary files /dev/null and b/programs/other/cnc_editor/doc/cnc_03.png differ diff --git a/programs/other/cnc_editor/doc/cnc_04.png b/programs/other/cnc_editor/doc/cnc_04.png new file mode 100644 index 0000000000..c081ce6954 Binary files /dev/null and b/programs/other/cnc_editor/doc/cnc_04.png differ diff --git a/programs/other/cnc_editor/doc/cnc_05.png b/programs/other/cnc_editor/doc/cnc_05.png new file mode 100644 index 0000000000..af6eed4ee1 Binary files /dev/null and b/programs/other/cnc_editor/doc/cnc_05.png differ diff --git a/programs/other/cnc_editor/doc/cnc_06.png b/programs/other/cnc_editor/doc/cnc_06.png new file mode 100644 index 0000000000..abd3cd51f0 Binary files /dev/null and b/programs/other/cnc_editor/doc/cnc_06.png differ diff --git a/programs/other/cnc_editor/doc/readme_ru.htm b/programs/other/cnc_editor/doc/readme_ru.htm new file mode 100644 index 0000000000..add0d6181e --- /dev/null +++ b/programs/other/cnc_editor/doc/readme_ru.htm @@ -0,0 +1,114 @@ + + +CNC_editor + + + + +

CNC_editor тхЁёш  14.09.18

+ +

╬уыртыхэшх

+ + +

╬ яЁюуЁрььх

+

CNC_editor - яЁюуЁрььр яЁюёьюЄЁр ш ЁхфръЄшЁютрэш  Їрщыют ЇюЁьрЄр *.nc. ╘рщы√ *.nc ёюфхЁцрЄ т ёхсх ъюф (gcode) фы  ёЄрэъют ё ╫╧╙ (ўшёыютюх яЁюуЁрььэюх єяЁртыхэшх шыш эр рэуышщёъюь CNC). ╩ Єръшь ёЄрэърь юЄэюё Єё : ырчхЁэ√х уЁртхЁ√, ЇЁхчхЁютры№э√х ёЄрэъш, ётхЁышы№э√х ёЄрэъш, яыюЄЄхЁ√. ═р яюїюцхь яЁшэЎшях ЁрсюЄр■Є 3D яЁшэЄхЁ√ Єюы№ъю шёяюы№чє■Є фЁєующ ЇюЁьрЄ фрээ√ї *.stl.

+ +

+

╨шё. 1. ┬эх°эшщ тшф яЁюуЁрьь√ ё юЄъЁ√Є√ь Їрщыюь *.nc

+ +

┬ючьюцэюёЄш яЁюуЁрьь√:

+

╬ЄъЁ√Єшх Їрщыют ш яЁюёьюЄЁ ЄЁрхъЄюЁшш фтшцхэш  ёЄрэър. ╠юцэю шчьхэ Є№ ъююЁфшэрЄ√, фюсрты Є№ Єюўъш т ЄЁрхъЄюЁш■, єфры Є№ Єюўъш, ьхэ Є№ яюЁ фюъ Єюўхъ фтшцхэш . ═х тёх фрээ√х ЁхфръЄшЁє■Єё  яЁюуЁрььющ, эряЁшьхЁ: єёЄрэютър ёъюЁюёЄш фтшцхэш , яюфэ Єшх/юяєёърэшх °яшэфхы  т яЁюуЁрььх шчьхэшЄ№ эхы№ч . ╤юїЁрэхэшх ЄЁрхъЄюЁшш фтшцхэш  т Їрщы *.png. ╩юф gcode шьххЄ ЁрчэютшфэюёЄш т чртшёшьюёЄш юЄ ёяхЎшЇшъш ёЄрэър, яюЄюьє эх тёх Їрщы√ *.nc ьюуєЄ ъюЁЁхъЄэю юЄюсЁрцрЄ№ё  фрээющ яЁюуЁрььющ.

+ +

+

╨шё. 2. ╧ЁюёьюЄЁ Єюўхъ фтшцхэш  ёЄрэър

+ +

╧рэхы№ шэёЄЁєьхэЄют

+

эют√щ Їрщы. ╧Ёш ёючфрэшш эютюую Їрщыр ьюцэю т√сЁрЄ№ ЇшуєЁє юъЁєцэюёЄ№ шыш яЁ ьюєуюы№эшъ. ╩юЄюЁ√х яюЄюь ьюцэю ЁхфръЄшЁютрЄ№.

+

+

╨шё. 3. ╬ъэю ёючфрэш  эютюую Їрщыр

+ +

╧рЁрьхЄЁ√ фы  ёючфрэш  юъЁєцэюёЄш:

+ +

╧рЁрьхЄЁ√ фы  ёючфрэш  яЁ ьюєуюы№эшър:

+ +

юЄъЁ√Є№ Їрщы

+

ёюїЁрэшЄ№ Їрщы

+

ёяЁ ЄрЄ№/яюърчрЄ№ эюьхЁрЎш■ Єюўхъ

+

, яхЁхьх∙хэшх т√сЁрэющ ъюьрэф√ т ёяшёъх

+

т√чтрЄ№ фшрыюу ёючфрэш /ЁхфръЄшЁютрэш  Єюўъш. ┼ёыш эш юфэр Єюўър эх т√сЁрэр, Єю т√ч√трхЄё  фшрыюу ёючфрэш  Єюўъш. ┼ёыш т√фхыхэр юфэр Єюўър Єю т√ч√трхЄё  фшрыюу ЁхфръЄшЁютрэш  ъююЁфшэрЄ Єюўъш.

+

+

╨шё. 4. ╬ъэю ёючфрэш  Єюўъш

+

+

╨шё. 5. ╬ъэю ЁхфръЄшЁютрэш  Єюўъш

+ +

, яхЁхьх∙хэшх т√фхыхээ√ї Єюўхъ ттхЁї шыш тэшч т яЁхфхырї т√сЁрээющ ЄЁр¤ъЄюЁшш

+

ъюяшЁютрэшх ъююЁфшэрЄ т√фхыхээ√ї Єюўхъ т сєЇхЁр юсьхэр

+

тёЄртър Єюўхъ шч сєЇхЁр юсьхэр. ╘юЁьрЄ ЄхъёЄр фы  тёЄртъш т сєЇхЁх юсьхэр: 'X_ Y_\n...\0'.

+

єфрыхэшх т√фхыхээ√ї Єюўхъ

+

ёсЁюё ьрё°Єрср ш ЎхэЄЁютър Єхъє∙хщ ЇшуєЁ√ яю ЎхэЄЁє юъэр яЁюёьюЄЁр

+

ёюїЁрэхэшх ЄЁрхъЄюЁшш т Їрщы *.png

+

эрёЄЁющъш ЁрчЁх°хэш  фы  ёюїЁрэхэш  Їрщыр *.png, єърч√трхЄё  ўшёыю яшъёхыхщ эр 1 ьь. ╧ю єьюыўрэш■ єърчрэю ўшёыю 11.81102362204724 (фы  яхЁхтюфр т dpi: 11.81102362204724 * 25.4 = 300).

+

+

╨шё. 6. ╬ъэю эрёЄЁюхъ ЁрчЁх°хэш 

+ +

╩ыртшрЄєЁр

+

Delete - єфры хЄ т√фхыхээ√х Єюўъш.

+

┼ёыш эх єфрхЄё  ь√°хщ т√фхышЄ№ юфэє ъръє■-ышсю Єюўъє (эряЁшьхЁ ъюуфр хх ъююЁфшэрЄ√ ёютярфр■Є ё фЁєушьш Єюўърьш, Єюуфр т√фхы ■Єё  ёЁрчє тёх ёютярфр■∙шх Єюўъш р эхюсїюфшью тч Є№ Єюы№ъю юфэє), ьюцэю тюёяюы№чютрЄ№ё  ъєЁёюЁрьш:

+

, - яхЁьх∙рхЄ т√фхыхэшх Єюўъш ттхЁї, т√фхы хЄё  яЁхф√фє∙р  Єюўър.

+

, - яхЁьх∙рхЄ т√фхыхэшх Єюўъш тэшч, т√фхы хЄё  ёыхфє∙р  Єюўър.

+

Ctrl+N - ёючфрэшх эютюую Їрщыр.

+

Ctrl+O - юЄъЁ√Єшх Їрщыр.

+

Ctrl+S - ёюїЁрэхэшх Їрщыр.

+

Ctrl+A - т√фхыхэшх тёхї Єюўхъ Єхъє∙хщ ЇшуєЁ√.

+ +

└тЄюЁ

+

IgorA

+ + + \ No newline at end of file diff --git a/programs/other/cnc_editor/kolibri.NC b/programs/other/cnc_editor/kolibri.NC new file mode 100644 index 0000000000..0404a40ab2 --- /dev/null +++ b/programs/other/cnc_editor/kolibri.NC @@ -0,0 +1,789 @@ +;PCB graving +G0 M3 X0 Y0 Z5 + +G0 X40.28 Y38.95 Z5 +G1 F100 Z0 +X40.28 Y38.95 +X39.46 Y38.44 +X37.03 Y36.89 +X35.56 Y35.99 +X34.9 Y35.63 +X34.41 Y35.35 +X33.74 Y34.97 +X32.97 Y34.52 +X32.69 Y34.35 +X32.38 Y34.35 +X32.1 Y34.43 +X31.82 Y34.51 +X31.18 Y34.6 +X30.54 Y34.7 +X30.03 Y34.78 +X29.52 Y34.85 +X29.1 Y34.88 +X28.68 Y34.9 +X28.6 Y34.96 +X28.37 Y34.96 +X28.22 Y34.9 +X28.27 Y34.81 +X28.62 Y34.65 +X28.96 Y34.49 +X29.16 Y34.42 +X29.72 Y34.17 +X30.08 Y34.01 +X30.7 Y33.81 +X31.32 Y33.61 +X30.98 Y33.43 +X30.34 Y33.21 +X30 Y33.08 +X29.78 Y33.04 +X29.77 Y32.87 +X29.76 Y32.7 +X29.89 Y32.58 +X30.02 Y32.46 +X30.12 Y32.46 +X30.67 Y32.3 +X30.03 Y31.51 +X29.8 Y31.16 +X29.41 Y30.53 +X29.19 Y30.13 +X29.19 Y30.08 +X29.22 Y30.06 +X29.24 Y30.06 +X29.69 Y30.24 +X29.36 Y29.88 +X29.03 Y29.52 +X28.49 Y28.91 +X27.95 Y28.29 +X27.54 Y27.8 +X27.46 Y27.71 +X27.08 Y27.34 +X26.7 Y26.96 +X26.61 Y26.89 +X26.04 Y26.5 +X25.56 Y26.31 +X25.07 Y26.13 +X24.8 Y26.06 +X24.54 Y25.76 +X24.43 Y25.76 +X24.32 Y25.76 +X24.06 Y25.63 +X23.8 Y25.5 +X23.69 Y25.42 +X23.59 Y25.33 +X23.43 Y25.1 +X23.27 Y24.87 +X23.08 Y24.69 +X22.89 Y24.51 +X22.74 Y24.21 +X22.58 Y23.9 +X22.51 Y23.7 +X22.43 Y23.49 +X22.37 Y23.23 +X22.31 Y22.98 +X22.22 Y22.96 +X22.13 Y23.01 +X21.93 Y23.2 +X21.72 Y23.37 +X21.28 Y23.85 +X20.83 Y24.29 +X20.45 Y24.58 +X20.13 Y24.78 +X19.81 Y24.93 +X19.65 Y24.97 +X19.49 Y25 +X19.36 Y24.95 +X19.24 Y24.9 +X19.15 Y24.82 +X19.07 Y24.73 +X19.07 Y24.55 +X19.07 Y24.36 +X19.32 Y23.59 +X19.43 Y23.26 +X19.53 Y22.93 +X19.59 Y22.64 +X19.83 Y22.38 +X19.99 Y21.8 +X20.12 Y21.45 +X20.24 Y21.18 +X20.24 Y21.09 +X20.6 Y20.69 +X21.04 Y19.79 +X21.19 Y19.54 +X21.33 Y19.49 +X21.47 Y19.36 +X21.8 Y18.84 +X21.89 Y18.74 +X21.98 Y18.56 +X22.3 Y18.17 +X22.34 Y18.07 +X22.38 Y17.97 +X22.28 Y17.79 +X22.05 Y17.71 +X21.85 Y17.73 +X21.26 Y18.02 +X20.68 Y18.31 +X20.45 Y18.4 +X20.22 Y18.5 +X19.4 Y18.9 +X18.91 Y19.07 +X18.43 Y19.24 +X18.29 Y19.33 +X18.16 Y19.42 +X18.13 Y19.42 +X18.1 Y19.42 +X17.85 Y19.57 +X17.61 Y19.72 +X16.99 Y19.92 +X16.38 Y20.13 +X16 Y20.19 +X15.62 Y20.25 +X15.26 Y20.33 +X14.9 Y20.41 +X14.57 Y20.45 +X14.24 Y20.48 +X13.83 Y20.6 +X13.42 Y20.71 +X12.65 Y20.91 +X11.88 Y21.12 +X11.63 Y21.16 +X11.37 Y21.21 +X11.04 Y21.28 +X10.71 Y21.36 +X10.3 Y21.44 +X9.89 Y21.52 +X9.1 Y21.65 +X8.3 Y21.77 +X7.79 Y21.83 +X7.28 Y21.88 +X6.43 Y21.88 +X5.57 Y21.88 +X4.68 Y21.77 +X3.86 Y21.58 +X2.94 Y21.25 +X2.71 Y21.1 +X2.48 Y20.94 +X2.41 Y20.87 +X2.34 Y20.8 +X2.36 Y20.69 +X2.38 Y20.58 +X2.58 Y20.44 +X2.79 Y20.3 +X3.09 Y20.22 +X3.4 Y20.14 +X3.68 Y20.14 +X3.96 Y20.14 +X4.2 Y19.89 +X4.44 Y19.65 +X4.77 Y19.44 +X5.11 Y19.23 +X5.12 Y19.29 +X5.14 Y19.34 +X5.36 Y19.05 +X5.57 Y18.77 +X5.76 Y18.62 +X5.96 Y18.48 +X5.98 Y18.45 +X6.01 Y18.43 +X6.11 Y18.36 +X6.21 Y18.3 +X6.39 Y18.22 +X6.57 Y18.14 +X6.64 Y18.08 +X6.71 Y18.02 +X6.84 Y18.01 +X6.98 Y18 +X7.07 Y18 +X7.16 Y17.99 +X7.35 Y17.79 +X7.54 Y17.58 +X7.6 Y17.58 +X7.66 Y17.58 +X7.68 Y17.51 +X7.71 Y17.44 +X7.86 Y17.36 +X8 Y17.29 +X8.25 Y17.15 +X8.51 Y17.02 +X8.57 Y17.04 +X8.63 Y17.07 +X8.66 Y16.99 +X8.69 Y16.92 +X8.8 Y16.93 +X8.92 Y16.95 +X8.92 Y16.82 +X8.92 Y16.7 +X9.15 Y16.53 +X9.38 Y16.36 +X9.58 Y16.25 +X9.79 Y16.14 +X9.89 Y16.05 +X9.99 Y15.96 +X10.24 Y15.9 +X10.49 Y15.83 +X10.64 Y15.84 +X10.79 Y15.84 +X10.84 Y15.74 +X10.89 Y15.64 +X10.95 Y15.64 +X11.02 Y15.64 +X11.4 Y15.39 +X11.77 Y15.13 +X12.04 Y15.05 +X12.31 Y14.97 +X12.5 Y15.01 +X12.68 Y15.04 +X12.67 Y15 +X12.67 Y14.95 +X12.67 Y14.9 +X12.68 Y14.84 +X13.21 Y14.57 +X13.74 Y14.3 +X14.02 Y14.29 +X14.3 Y14.28 +X14.37 Y14.23 +X14.44 Y14.17 +X14.59 Y14.1 +X14.75 Y14.02 +X15.07 Y13.91 +X15.4 Y13.79 +X15.68 Y13.79 +X15.95 Y13.8 +X15.98 Y13.73 +X16.01 Y13.65 +X16.29 Y13.55 +X16.57 Y13.44 +X16.66 Y13.44 +X16.74 Y13.44 +X16.8 Y13.29 +X16.86 Y13.14 +X17.02 Y13.1 +X17.18 Y13.07 +X17.18 Y13.03 +X17.18 Y12.99 +X17.4 Y12.93 +X17.63 Y12.87 +X17.72 Y12.77 +X17.8 Y12.68 +X17.86 Y12.68 +X17.92 Y12.68 +X18.07 Y12.52 +X18.22 Y12.37 +X18.43 Y12.27 +X18.64 Y12.17 +X18.97 Y12.17 +X19.25 Y12.36 +X19.32 Y12.46 +X19.43 Y12.55 +X19.54 Y12.65 +X19.62 Y12.8 +X19.7 Y12.96 +X19.7 Y12.86 +X19.54 Y12.36 +X19.37 Y11.86 +X19.3 Y11.44 +X19.23 Y11.02 +X19.25 Y9.53 +X19.27 Y8.05 +X19.33 Y7.69 +X19.38 Y7.34 +X19.48 Y6.93 +X19.57 Y6.52 +X19.63 Y6.21 +X19.68 Y5.9 +X19.74 Y5.7 +X19.79 Y5.5 +X19.84 Y5.11 +X19.89 Y4.73 +X19.97 Y4.5 +X20.04 Y4.27 +X20.09 Y2.58 +X20.13 Y0.88 +X20.21 Y0.74 +X20.28 Y0.59 +X20.39 Y0.49 +X20.5 Y0.39 +X20.5 Y0.5 +X20.5 Y0.6 +X20.69 Y0.64 +X20.88 Y0.67 +X20.97 Y0.76 +X21.07 Y0.84 +X21.27 Y0.83 +X21.47 Y0.82 +X21.8 Y0.94 +X22.12 Y1.06 +X22.31 Y1.21 +X22.49 Y1.35 +X22.49 Y1.4 +X22.49 Y1.44 +X22.59 Y1.58 +X22.69 Y1.71 +X22.75 Y1.94 +X22.81 Y2.17 +X22.81 Y2.29 +X22.8 Y2.41 +X22.78 Y2.54 +X23.56 Y3.07 +X23.67 Y3.27 +X23.77 Y3.82 +X23.87 Y4.37 +X23.91 Y5.38 +X23.94 Y6.39 +X24.07 Y6.99 +X24.27 Y7 +X24.4 Y6.85 +X24.47 Y6.85 +X24.75 Y6.98 +X25.02 Y7.03 +X25.04 Y7.05 +X25.26 Y7.35 +X25.71 Y8 +X26.06 Y8.49 +X26.04 Y8.87 +X25.87 Y9.12 +X25.87 Y9.28 +X26.14 Y9.69 +X26.41 Y10.1 +X26.81 Y10.71 +X27.1 Y11.22 +X27.75 Y12.55 +X28.17 Y13.72 +X28.21 Y14.08 +X28.33 Y15.16 +X28.3 Y16 +X28.25 Y16.92 +X28.16 Y17.66 +X28 Y18.5 +X27.85 Y19.35 +X27.99 Y20.78 +X27.98 Y21.52 +X27.97 Y22.26 +X27.86 Y23.13 +X27.76 Y24 +X27.71 Y24.61 +X27.63 Y25.73 +X27.62 Y26.44 +X27.91 Y27.07 +X28.33 Y27.68 +X29.15 Y28.78 +X29.44 Y29.15 +X30.03 Y29.78 +X30.59 Y30.35 +X31.15 Y30.92 +X31.27 Y30.83 +X31.84 Y30.76 +X32.21 Y31.09 +X32.58 Y31.41 +X32.7 Y31.51 +X32.81 Y31.59 +X32.89 Y31.41 +X32.9 Y30.9 +X32.9 Y30.39 +X32.95 Y29.52 +X33 Y28.65 +X33.04 Y28.59 +X33.08 Y28.52 +X33.15 Y28.6 +X33.23 Y28.67 +X33.23 Y28.88 +X33.23 Y29.09 +X33.3 Y29.46 +X33.38 Y29.83 +X33.43 Y30.26 +X33.48 Y30.69 +X33.48 Y30.83 +X33.66 Y30.73 +X34.1 Y30.65 +X34.53 Y30.58 +X34.86 Y30.52 +X35.19 Y30.47 +X35.76 Y30.41 +X36.32 Y30.35 +X36.36 Y30.31 +X36.4 Y30.28 +X36.05 Y29.96 +X35.71 Y29.64 +X35.48 Y29.55 +X35.37 Y29.31 +X35.26 Y29.07 +X35.4 Y28.95 +X35.53 Y28.83 +X35.67 Y28.82 +X35.81 Y28.82 +X36 Y28.84 +X35.93 Y28.62 +X35.64 Y28.19 +X35.41 Y27.68 +X35.19 Y27.09 +X34.98 Y26.5 +X34.94 Y26.42 +X34.9 Y26.33 +X35.04 Y26.35 +X35.18 Y26.36 +X35.23 Y26.45 +X35.28 Y26.53 +X35.59 Y26.74 +X35.91 Y26.96 +X36.63 Y27.59 +X36.85 Y27.8 +X37.07 Y28.02 +X37.21 Y28.17 +X37.26 Y27.99 +X37.47 Y27.58 +X37.75 Y27.42 +X37.88 Y27.42 +X38.01 Y27.43 +X38.13 Y27.5 +X38.24 Y27.85 +X38.35 Y28.19 +X38.53 Y28.6 +X38.6 Y28.89 +X39.1 Y27.86 +X38.99 Y27.65 +X38.87 Y27.44 +X38.53 Y26.79 +X38.19 Y26.15 +X37.65 Y25.05 +X37.11 Y23.95 +X36.84 Y23.41 +X35.69 Y22.3 +X34.97 Y21.83 +X34.75 Y21.62 +X34.53 Y21.42 +X34.45 Y21.31 +X34.45 Y21.21 +X34.52 Y21.18 +X34.59 Y21.16 +X34.81 Y21.29 +X35.04 Y21.42 +X35.12 Y21.42 +X35.19 Y21.42 +X35.26 Y21.37 +X35.33 Y21.33 +X35.15 Y21.07 +X34.97 Y20.81 +X34.85 Y20.56 +X34.68 Y20.27 +X34.57 Y20.11 +X34.45 Y19.95 +X34.45 Y19.86 +X34.51 Y19.78 +X34.56 Y19.78 +X34.7 Y19.87 +X34.84 Y19.96 +X35.19 Y20.26 +X35.54 Y20.57 +X36.26 Y21.22 +X36.66 Y21.54 +X36.7 Y21.51 +X36.7 Y21.2 +X36.7 Y20.89 +X36.83 Y20.78 +X36.96 Y20.66 +X36.87 Y20.5 +X36.78 Y20.34 +X36.92 Y20.25 +X37.05 Y20.3 +X37.09 Y20.11 +X37.14 Y19.77 +X37.27 Y19.67 +X37.41 Y19.57 +X37.51 Y19.62 +X37.61 Y19.67 +X37.78 Y20.37 +X37.92 Y20.79 +X38.11 Y21.01 +X38.14 Y21.01 +X38.18 Y20.91 +X38.36 Y20.54 +X38.64 Y19.9 +X38.76 Y19.63 +X38.95 Y19.19 +X39.06 Y18.92 +X39.18 Y18.66 +X39.26 Y18.67 +X39.33 Y18.69 +X39.31 Y18.94 +X39.3 Y19.12 +X39.3 Y19.3 +X39.3 Y19.63 +X39.31 Y19.96 +X39.26 Y20.32 +X39.2 Y20.73 +X39.51 Y20.38 +X39.83 Y20.04 +X39.95 Y20.04 +X40.08 Y20.04 +X40.08 Y20.09 +X40.08 Y20.14 +X39.97 Y20.32 +X39.87 Y20.5 +X39.87 Y20.64 +X39.64 Y20.98 +X39.4 Y21.32 +X39.3 Y21.66 +X39.15 Y22.06 +X39.05 Y22.56 +X39 Y23.02 +X39.16 Y24.05 +X39.47 Y25.64 +X39.63 Y26.5 +X39.67 Y26.73 +X39.72 Y26.76 +X39.77 Y26.79 +X39.8 Y26.66 +X39.92 Y26.53 +X40.01 Y26.53 +X40.01 Y26.71 +X39.97 Y26.89 +X39.94 Y26.96 +X39.88 Y27.11 +X39.84 Y27.25 +X40.02 Y27.62 +X40.18 Y28.02 +X40.47 Y28.69 +X40.76 Y29.37 +X40.91 Y29.67 +X41.27 Y30.39 +X41.57 Y30.97 +X41.86 Y31.55 +X41.89 Y31.43 +X41.91 Y31.31 +X41.96 Y30.97 +X42.02 Y30.64 +X42.27 Y30.13 +X42.4 Y29.98 +X42.52 Y29.83 +X42.62 Y29.88 +X42.71 Y29.94 +X42.81 Y30.14 +X42.91 Y30.34 +X42.92 Y28.45 +X42.93 Y26.56 +X42.81 Y25.1 +X42.68 Y23.65 +X42.58 Y23.28 +X42.58 Y22.69 +X42.74 Y21.92 +X42.98 Y21.09 +X43.2 Y20.63 +X43.42 Y20.26 +X43.67 Y19.95 +X43.92 Y19.64 +X44.03 Y19.61 +X44.13 Y19.58 +X44.17 Y19.6 +X44.2 Y19.63 +X44.29 Y19.92 +X44.38 Y20.22 +X44.57 Y20.68 +X44.67 Y21.14 +X44.7 Y21.57 +X44.74 Y22.01 +X44.83 Y22.57 +X44.86 Y22.91 +X44.81 Y23.44 +X44.7 Y23.9 +X44.67 Y24.15 +X44.63 Y24.26 +X44.58 Y24.36 +X44.53 Y24.61 +X44.42 Y25.12 +X44.29 Y25.71 +X44.17 Y26.3 +X44.07 Y26.86 +X43.99 Y27.45 +X43.92 Y28.04 +X43.88 Y28.68 +X43.85 Y29.32 +X44.09 Y29 +X44.17 Y28.93 +X44.37 Y28.76 +X44.49 Y28.68 +X44.61 Y28.68 +X44.72 Y28.68 +X44.75 Y28.72 +X44.77 Y28.75 +X44.8 Y29.06 +X44.84 Y29.36 +X44.86 Y29.4 +X44.88 Y30.01 +X44.89 Y30.59 +X44.85 Y30.95 +X44.78 Y31.31 +X44.59 Y31.68 +X44.4 Y32.06 +X44.05 Y32.89 +X43.95 Y33.56 +X43.87 Y34.53 +X43.84 Y35.19 +X43.98 Y35.81 +X44.23 Y36 +X44.43 Y36.22 +X44.61 Y36.57 +X44.78 Y36.92 +X44.78 Y37.24 +X44.96 Y37.43 +X45.16 Y37.62 +X45.63 Y37.98 +X46.08 Y38.34 +X46.88 Y38.7 +X47.3 Y38.7 +X47.72 Y38.7 +X47.89 Y38.65 +X48.06 Y38.6 +X48.2 Y38.45 +X48.35 Y38.3 +X48.32 Y38.17 +X48.29 Y38.03 +X48.42 Y38.03 +X48.54 Y38.03 +X48.73 Y38.09 +X48.92 Y38.14 +X48.92 Y38.22 +X48.92 Y38.3 +X49.18 Y38.26 +X49.43 Y38.23 +X49.7 Y38.16 +X49.96 Y38.09 +X50.04 Y38 +X50.12 Y37.92 +X50.06 Y37.89 +X50 Y37.87 +X49.8 Y37.7 +X49.55 Y37.52 +X49.48 Y37.44 +X49.48 Y37.37 +X49.56 Y37.37 +X49.83 Y37.49 +X50.02 Y37.61 +X50.18 Y37.66 +X50.35 Y37.72 +X50.37 Y37.73 +X50.38 Y37.79 +X50.53 Y37.84 +X50.68 Y37.88 +X50.91 Y37.85 +X51.14 Y37.82 +X51.7 Y37.7 +X52.26 Y37.57 +X52.3 Y37.57 +X52.34 Y37.57 +X52.34 Y38.33 +X51.96 Y38.4 +X51.04 Y38.7 +X50.71 Y39.02 +X50.57 Y38.84 +X49.91 Y38.88 +X49.35 Y39.26 +X45.25 Y39.26 +X44.85 Y39.18 +X44.45 Y39.1 +X44.24 Y39.1 +X44.03 Y39.1 +X43.91 Y39.02 +X43.76 Y38.9 +X43.48 Y38.76 +X43.23 Y38.64 +X43.08 Y38.53 +X42.94 Y38.41 +X42.67 Y38.15 +X42.41 Y37.88 +X42.3 Y37.88 +X42.3 Y37.88 +X42.02 Y37.72 +X41.74 Y37.59 +X41.64 Y37.59 +X41.52 Y37.62 +X41.34 Y37.75 +X41.15 Y37.87 +X41.12 Y37.82 +X41.25 Y37.62 +X41.42 Y37.47 +X41.59 Y37.42 +X41.86 Y37.42 +X41.94 Y37.44 +X41.87 Y37.35 +X41.71 Y37.12 +X41.46 Y36.61 +X41.2 Y36 +X41.03 Y35.19 +X40.85 Y34.48 +X40.69 Y34.12 +X40.19 Y33.63 +X39.69 Y33.14 +X38.77 Y32.38 +X38.71 Y32.33 +X38.64 Y32.28 +X38.47 Y32.13 +X38.17 Y31.92 +X38.03 Y31.81 +X37.82 Y31.64 +X37.61 Y31.48 +X37.07 Y31.43 +X36.52 Y31.39 +X35.63 Y31.31 +X34.73 Y31.2 +X34.5 Y31.17 +X33.9 Y31.1 +X33.52 Y31.06 +X33.55 Y31.44 +X33.64 Y32.01 +X33.7 Y32.51 +X33.71 Y32.82 +X34.08 Y33.19 +X34.44 Y33.56 +X34.94 Y34.01 +X35.42 Y34.45 +X35.9 Y34.89 +X36.23 Y35.19 +X36.83 Y35.72 +X37.34 Y36.08 +X37.85 Y36.45 +X38.34 Y36.78 +X38.83 Y37.11 +X39.61 Y37.62 +X40.12 Y37.93 +X41.02 Y38.47 +X41.38 Y38.66 +X42.4 Y39.26 +X40.76 Y39.26 +X40.28 Y38.95 +G0 Z5 + +G0 X44.02 Y38.18 Z5 +G1 F100 Z0 +X44.02 Y38.18 +X43.93 Y38.01 +X43.7 Y37.43 +X43.45 Y37.2 +X43.45 Y37.55 +X43.65 Y37.95 +X43.65 Y38.12 +X43.82 Y38.26 +X44.04 Y38.38 +X44.11 Y38.36 +X44.02 Y38.18 +G0 Z5 + +G0 X40.52 Y32.28 Z5 +G1 F100 Z0 +X40.52 Y32.28 +X40.54 Y32.12 +X40.7 Y31.9 +X40.93 Y31.9 +X41.22 Y32.12 +X41.19 Y32.07 +X41.17 Y32.03 +X39.57 Y28.78 +X39.52 Y28.78 +X39.41 Y29.21 +X39.37 Y29.62 +X39.32 Y29.88 +X39.15 Y30.37 +X40.43 Y32.36 +X40.49 Y32.36 +X40.52 Y32.28 +G0 Z5 + +G0 M5 X0 Y0 Z5 diff --git a/programs/other/cnc_editor/objects.png b/programs/other/cnc_editor/objects.png new file mode 100644 index 0000000000..58f7a53358 Binary files /dev/null and b/programs/other/cnc_editor/objects.png differ diff --git a/programs/other/cnc_editor/tl_sys_16.png b/programs/other/cnc_editor/tl_sys_16.png new file mode 100644 index 0000000000..65fac3ba12 Binary files /dev/null and b/programs/other/cnc_editor/tl_sys_16.png differ diff --git a/programs/other/cnc_editor/toolbar.png b/programs/other/cnc_editor/toolbar.png new file mode 100644 index 0000000000..a7979ca2cd Binary files /dev/null and b/programs/other/cnc_editor/toolbar.png differ diff --git a/programs/other/cnc_editor/wnd_new_file.inc b/programs/other/cnc_editor/wnd_new_file.inc new file mode 100644 index 0000000000..7d04ad253c --- /dev/null +++ b/programs/other/cnc_editor/wnd_new_file.inc @@ -0,0 +1,587 @@ +; +; в этом файле собраны функции нужные для создания и +; работы окна создания нового файла +; + +wnd_n_file_width equ 300 ;ширина окна создания нового файла +wnd_n_file_height equ 200 ;высота окна создания нового файла + +align 4 +wnd_n_file db 0 ;переменная следящая за тем что-бы не запускать больше 1-го окна создания нового файла + +align 4 +NOptCoordX0 dq 35.0 +NOptCoordY0 dq 25.0 +NOptCoordX1 dq 20.0 ;for circle Radius +NOptCoordY1 dq 16.0 ;S +NOptCoordZ0 dq 1.0 +NOptCoordZ1 dq 5.0 + +;даное окно (процесс) вызываеться функцией but_wnd_coords +align 4 +start_n_file: +pushad + mcall SF_SET_EVENTS_MASK,0x27 ;маска ожидаемых событий + inc byte[wnd_n_file] + + edit_boxes_set_sys_color edit4,editboxes_end_nf,sc ;установка системных цветов + option_boxes_set_sys_color sc,opt_grlist1 + + call get_n_file_opt +popad + call red_win_n_file + +;не отрывать эту функцию от предыдущей +align 4 +still_n_file: + pushad + + mcall SF_WAIT_EVENT_TIMEOUT,10 + or eax,eax + jnz @f + call timer_funct_n_file + jmp .end + @@: + + cmp al,1 ;изм. положение окна + jne @f + call red_win_n_file + jmp .end + @@: + cmp al,2 + jne @f + call key_n_file + jmp .end + @@: + cmp al,3 + jz button_n_file + cmp al,6 + jne @f + call mouse_n_file + @@: +.end: + popad + jmp still_n_file + +align 4 +red_win_n_file: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT + mov edi,capt_n_file ;children window caption + mov bx,word[procinfo.box.left] + add bx,word[buf_0.l] + add bx,5 ;ширина боковой рамки + shl ebx,16 + mov bx,wnd_n_file_width + mov cx,word[procinfo.box.top] + add cx,ax ;add skin height + add cx,word[buf_0.t] + shl ecx,16 + mov cx,wnd_n_file_height + mov edx,[sc.work] + or edx,0x33000000 + xor eax,eax + int 0x40 + + mov esi,[sc.work_button] + ;ebx = (l<:)+w, ecx = (t<:)+h + mcall SF_DEFINE_BUTTON, (5 shl 16)+59, (145 shl 16)+20, 3 + mcall , (75 shl 16)+59, (145 shl 16)+20, 4 + + mov ecx,[sc.work_text] + bts ecx,31 ;рисуемая строка заканчивается нулём + mcall SF_DRAW_TEXT, (5 shl 16)+5,, capt_sel_fig + + mcall , (5 shl 16)+32,, capt_coord_x0 + mcall , (5 shl 16)+50,, capt_coord_y0 + cmp [opt_gr1],opt1 + jne @f + ;circle + mcall , (5 shl 16)+68,, capt_coord_r + mcall , (5 shl 16)+86,, capt_coord_s + jmp .end0 + @@: + ;rect + mcall , (5 shl 16)+68,, capt_coord_x1 + mcall , (5 shl 16)+86,, capt_coord_y1 + .end0: + mcall , (5 shl 16)+104,,capt_coord_z0 + mcall , (5 shl 16)+122,,capt_coord_z1 + + mov ecx,[sc.work_button_text] + bts ecx,31 + mcall , (9 shl 16)+151,, txt_but_cancel + mcall ,(79 shl 16)+151,, txt_but_create + + stdcall [option_box_draw], opt_grlist1 + + stdcall [edit_box_draw], edit4 + stdcall [edit_box_draw], edit5 + stdcall [edit_box_draw], edit6 + stdcall [edit_box_draw], edit7 + stdcall [edit_box_draw], edit8 + stdcall [edit_box_draw], edit9 + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +proc key_n_file uses eax ebx + mcall SF_GET_KEY + + test word [edit4.flags],10b ;ed_focus + je @f + stdcall [edit_box_key], edit4 + jmp .end + @@: + test word [edit5.flags],10b + je @f + stdcall [edit_box_key], edit5 + jmp .end + @@: + test word [edit6.flags],10b + je @f + stdcall [edit_box_key], edit6 + jmp .end + @@: + test word [edit7.flags],10b + je @f + stdcall [edit_box_key], edit7 + jmp .end + @@: + test word [edit8.flags],10b + je @f + stdcall [edit_box_key], edit8 + jmp .end + @@: + test word [edit9.flags],10b + je @f + stdcall [edit_box_key], edit9 + ;jmp .end + @@: + .end: + ret +endp + +align 4 +mouse_n_file: + stdcall [option_box_mouse], opt_grlist1 + + stdcall [edit_box_mouse], edit4 + stdcall [edit_box_mouse], edit5 + stdcall [edit_box_mouse], edit6 + stdcall [edit_box_mouse], edit7 + stdcall [edit_box_mouse], edit8 + stdcall [edit_box_mouse], edit9 + ret + +align 4 +button_n_file: + mcall SF_GET_BUTTON + + cmp ah,3 + je .exit + cmp ah,4 + jne .end_save + push eax ecx edi esi + finit + + mov esi,string4 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;считываем как double + fstp qword[NOptCoordX0] ;сохраняем как double + + mov esi,string5 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordY0] + + mov esi,string6 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordX1] + + mov esi,string7 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordY1] + + mov esi,string8 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordZ0] + + mov esi,string9 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordZ1] + + mov word[NumberSymbolsAD],3 + ;fld qword[NOptCoordZ1] + ;fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + mov dword[txt_01.z],0 + mov dword[txt_05.z],0 + mov dword[txt_06.z],0 + stdcall str_cat, txt_01.z, Data_String + stdcall str_cat, txt_01.z, txt_nl + stdcall str_cat, txt_01.z, txt_nl + stdcall str_cat, txt_05.z, Data_String + stdcall str_cat, txt_05.z, txt_nl + stdcall str_cat, txt_05.z, txt_nl + stdcall str_cat, txt_06.z, Data_String + + fld qword[NOptCoordZ0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + mov dword[txt_03.z],0 + stdcall str_cat, txt_03.z, Data_String + + fld qword[NOptCoordX0] + cmp [opt_gr1],opt1 + jne @f + ;circle + fadd qword[NOptCoordX1] + @@: + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + mov dword[txt_04.x],0 + stdcall str_cat, txt_04.x, Data_String + stdcall str_cat, txt_04.x, txt_s_poi_Y + fld qword[NOptCoordY0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat, txt_04.x, Data_String + mov dword[txt_02.x],0 + stdcall str_cat, txt_02.x, txt_04.x + stdcall str_cat, txt_02.x, txt_s_poi_Z + fld qword[NOptCoordZ1] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat, txt_02.x, Data_String + + ;clear old file + stdcall [tl_node_poi_get_info], tree1,0 + or eax,eax + jz @f + mov ebx,eax + stdcall [tl_node_poi_get_data], tree1,ebx + stdcall clear_object_in_list, eax + @@: + stdcall [tl_info_clear], tree1 ;очистка списка объектов + mov dword[offs_last_timer],0 + + stdcall ObjectCreate,ObjData + stdcall [tl_cur_beg], tree1 + + mov dword[offs_last_timer],0 ;для обновления блока в таймере + pop esi edi ecx eax + jmp .exit + .end_save: + + cmp ah,1 + jne still_n_file.end +.exit: + mov byte[wnd_n_file],0 ;обнуляем счетчик окон + mcall SF_TERMINATE_PROCESS ;выход из программы + +align 4 +proc ObjectCreate, pobj:dword +pushad + mov ebx,[pobj] + mov [ebx+Object.OType],'Obj' + mov edi,ebx + add edi,Object.Caption + mov dword[edi],'CNC' + + mov eax,7 ;max lines + mov [ebx+Object.FigCount],eax + mov ecx,eax + + shl eax,2 + stdcall mem.Alloc,eax + mov [ebx+Object.FigData],eax + push ecx + mov edi,eax + xor eax,eax + rep stosd ;clear memory + pop ecx + + stdcall add_object_in_list,0,0,ebx,0 + ;eax -> pointer to object node + mov edi,[ebx+Object.FigData] + + mov esi,txt_00 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_01 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_02 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_03 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_04 ;X__ Y__ + stdcall FigureInit,FigData,edi + ; *** create new points *** + mov edx,[edi] + cmp [opt_gr1],opt1 + jne .rect + ;circle + fld qword[NOptCoordY1] + fistp dword[edx+Figure.PoiCount] + inc dword[edx+Figure.PoiCount] + mov eax,[edx+Figure.PoiCount] + imul eax,sizeof.Point + stdcall mem.ReAlloc,[edx+Figure.PoiData],eax + mov [edx+Figure.PoiData],eax + + ;init points + fldpi + fadd st0,st0 + fdiv qword[NOptCoordY1] + fldz + ;st0 - angle (=0) + ;st1 - delta angle (=pi/slices) + + mov ecx,[edx+Figure.PoiCount] + cmp ecx,3 + jge @f + mov ecx,3 + @@: + mov edx,[edx+Figure.PoiData] + add edx,Point.CoordX + .cycle0: + add edx,sizeof.Point + fadd st0,st1 ;angle += delta angle + + fld st0 + fcos + fmul qword[NOptCoordX1] ;st0 = cos(angle) * radius + fadd qword[NOptCoordX0] + fstp qword[edx] + fld st0 + fsin + fmul qword[NOptCoordX1] ;st0 = sin(angle) * radius + fadd qword[NOptCoordY0] + fstp qword[edx+8] + loop .cycle0 + ffree st0 + fincstp + ffree st0 + fincstp + jmp .end0 + .rect: + ;rect + mov eax,5 + mov dword[edx+Figure.PoiCount],eax + imul eax,sizeof.Point + stdcall mem.ReAlloc,[edx+Figure.PoiData],eax + mov [edx+Figure.PoiData],eax + ;init points + push edi + mov ecx,[edx+Figure.PoiData] + ;p1 + add ecx,sizeof.Point + lea edi,[ecx+Point.CoordX] + mov esi,NOptCoordX1 + movsd + movsd + mov esi,NOptCoordY0 + movsd + movsd + ;p2 + add ecx,sizeof.Point + lea edi,[ecx+Point.CoordX] + mov esi,NOptCoordX1 + movsd + movsd + mov esi,NOptCoordY1 + movsd + movsd + ;p3 + add ecx,sizeof.Point + lea edi,[ecx+Point.CoordX] + mov esi,NOptCoordX0 + movsd + movsd + mov esi,NOptCoordY1 + movsd + movsd + ;p4 + add ecx,sizeof.Point + lea edi,[ecx+Point.CoordX] + mov esi,NOptCoordX0 + movsd + movsd + mov esi,NOptCoordY0 + movsd + movsd + pop edi + .end0: + stdcall found_parent_obj,[edi] ;get figure number in ecx + stdcall figure_update_coords,ObjData,ecx + + add edi,4 + mov esi,txt_05 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_06 + stdcall FigureInit,FigData,edi + + stdcall ObjCalculateScale,ebx +popad + ret +endp + +align 4 +proc get_n_file_opt uses eax + ;загрузка координат в editbox-ы + mov word[NumberSymbolsAD],3 + finit + fld qword[NOptCoordX0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit4, Data_String + fld qword[NOptCoordY0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit5, Data_String + fld qword[NOptCoordX1] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit6, Data_String + fld qword[NOptCoordY1] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit7, Data_String + fld qword[NOptCoordZ0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit8, Data_String + fld qword[NOptCoordZ1] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit9, Data_String + ; + ;stdcall [edit_box_draw], edit4 + ;stdcall [edit_box_draw], edit5 + ret +endp + +align 4 +proc timer_funct_n_file uses eax + ;просматриваем выделенную координату + mov eax,[opt_gr1] + cmp eax,[last_opt] + je @f + mov eax,[opt_gr1] + mov [last_opt],eax + call red_win_n_file + @@: + ret +endp + +capt_coord_x0 db 'X0:',0 +capt_coord_y0 db 'Y0:',0 +capt_coord_z0 db 'Z0:',0 +capt_coord_x1 db 'X1:',0 +capt_coord_y1 db 'Y1:',0 +capt_coord_z1 db 'Z1:',0 +capt_coord_r db 'R:',0 +capt_coord_s db 'S:',0 + +edit4 edit_box 80, 24, 28, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string4, mouse_dd, 0 +edit5 edit_box 80, 24, 46, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string5, mouse_dd, 0 +edit6 edit_box 80, 24, 64, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string6, mouse_dd, 0 +edit7 edit_box 80, 24, 82, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string7, mouse_dd, 0 +edit8 edit_box 80, 24, 100, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string8, mouse_dd, 0 +edit9 edit_box 80, 24, 118, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string9, mouse_dd, 0 +editboxes_end_nf: + +string4 rb 34 +string5 rb 34 +string6 rb 34 +string7 rb 34 +string8 rb 34 +string9 rb 34 + +align 4 +last_opt dd opt1 ;for timer +opt_gr1 dd opt1 + +opt1 option_box opt_gr1, 115,28,6,12,0xd0d0ff, 0xff, 0x80ff,txt_circle,txt_circle.end-txt_circle +opt2 option_box opt_gr1, 115,46,6,12,0xd0d0ff, 0xff, 0x80ff,txt_rect,txt_rect.end-txt_rect + +align 4 +opt_grlist1 dd opt1,opt2,0 ;end option group + +txt_00 db ';PCB graving',0 +txt_01: db 'G0 M3 X0 Y0 Z' +.z: rb 12 +txt_02: db 'G0 X' +.x: rb 50 ;X__ Y__ Z__ +txt_03: db 'G1 F100 Z' +.z: rb 12 +txt_04: db 'X' +.x: rb 30 ;X__ Y__ +txt_05: db 'G0 Z' +.z: rb 12 +txt_06: db 'G0 M5 X0 Y0 Z' +.z: rb 12 + +if lang eq ru +capt_n_file db 'Создать новый файл',0 +capt_sel_fig db 'Выберите фигуру:',0 +txt_circle: db 'Окружность' +.end: db 0 +txt_rect: db 'Прямоугольник' +.end: db 0 +else +capt_n_file db 'Create new file',0 +capt_sel_fig db 'Select figure:',0 +txt_circle: db 'Circle' +.end: db 0 +txt_rect: db 'Rectangle' +.end: db 0 +end if \ No newline at end of file diff --git a/programs/other/cnc_editor/wnd_point_coords.inc b/programs/other/cnc_editor/wnd_point_coords.inc new file mode 100644 index 0000000000..de8d410862 --- /dev/null +++ b/programs/other/cnc_editor/wnd_point_coords.inc @@ -0,0 +1,302 @@ +; +; в этом файле собраны функции нужные для создания и +; работы окна с координатами вершин +; + +wnd_prop_width equ 320 ;ширина окна со свойствами объекта +wnd_prop_height equ 150 ;высота окна со свойствами объекта + +align 4 +wnd_run_prop db 0 ;переменная следящая за тем что-бы не запускать больше 1-го окна со свойствами одновременно +txt_p db '.',0 + +align 4 +wnd_pObj dd 0 ;obj +wnd_pFig dd 0 ;фигура +wnd_FigN dd 0 ;fig number +wnd_pPoi dd 0 ;select point +wnd_PoiN dd 0 ;select point number + + +;даное окно (процесс) вызываеться функцией but_wnd_coords +align 4 +start_prop: +pushad + mcall SF_SET_EVENTS_MASK,0x27 ;маска ожидаемых событий + inc byte[wnd_run_prop] + + ;имя объекта + stdcall mem_copy,capt_p,txt_obj,1+txt_obj.end-txt_obj + mov edi,capt_p+txt_obj.end-txt_obj + mov eax,[wnd_pObj] + or eax,eax + jz @f + add eax,Object.Caption + stdcall str_cat,edi,eax + @@: + stdcall str_cat,edi,txt_39 + ;имя фигуры + mov edi,capt_fig.name + mov byte[edi],0 ;clear pervios name + mov eax,[wnd_pFig] + or eax,eax + jz @f + add eax,Figure.Caption + stdcall str_cat,edi,eax + @@: + stdcall str_cat,edi,txt_39 + ;номер точки + mov edi,capt_poi.numb + mov byte[edi],0 + mov eax,[wnd_PoiN] + stdcall convert_int_to_str, 20 + + edit_boxes_set_sys_color edit1,editboxes_end,sc ;установка системных цветов + init_checkboxes2 check_boxes,check_boxes_end + check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc + call get_point_coords +popad + call red_win_prop + +;не отрывать эту функцию от предыдущей +align 4 +still_prop: + pushad + + mcall SF_WAIT_EVENT_TIMEOUT,10 + or eax,eax + jnz @f + call timer_funct_prop + jmp .end + @@: + + cmp al,1 ;изм. положение окна + jne @f + call red_win_prop + jmp .end + @@: + cmp al,2 + jne @f + call key_prop + jmp .end + @@: + cmp al,3 + jz button_prop + cmp al,6 + jne @f + call mouse_prop + @@: +.end: + popad + jmp still_prop + +align 4 +red_win_prop: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT + mov edi,capt_p ;children window caption + mov bx,word[procinfo.box.left] + add bx,word[buf_0.l] + add bx,5 ;ширина боковой рамки + shl ebx,16 + mov bx,wnd_prop_width + mov cx,word[procinfo.box.top] + add cx,ax ;add skin height + add cx,word[buf_0.t] + shl ecx,16 + mov cx,wnd_prop_height + mov edx,[sc.work] + or edx,0x33000000 + xor eax,eax + int 0x40 + + mov esi,[sc.work_button] + ;ebx = (l<:)+w, ecx = (t<:)+h + mcall SF_DEFINE_BUTTON, (5 shl 16)+59, (95 shl 16)+20, 3 + mcall , (75 shl 16)+59, (95 shl 16)+20, 4 + + mov ecx,[sc.work_text] + bts ecx,31 ;рисуемая строка заканчивается нулём + mcall SF_DRAW_TEXT, (5 shl 16)+5,, capt_fig + mcall , (5 shl 16)+15,, capt_poi + + mcall , (5 shl 16)+32,, capt_coord_x + mcall , (5 shl 16)+50,, capt_coord_y + + mov ecx,[sc.work_button_text] + bts ecx,31 + mcall , (9 shl 16)+101,, txt_but_cancel + mov edx,txt_but_apply + cmp dword[wnd_pPoi],0 + jne @f + mov edx,txt_but_create + @@: + mcall ,(79 shl 16)+101 + + stdcall [edit_box_draw], edit1 + stdcall [edit_box_draw], edit2 + checkboxes_draw2 check_boxes,check_boxes_end + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +proc key_prop uses eax ebx + mcall SF_GET_KEY + + test word [edit1.flags],10b ;ed_focus + je @f + stdcall [edit_box_key], edit1 + jmp .end + @@: + test word [edit2.flags],10b + je @f + stdcall [edit_box_key], edit2 + ;jmp .end + @@: + + .end: + ret +endp + +align 4 +mouse_prop: + stdcall [edit_box_mouse], edit1 + stdcall [edit_box_mouse], edit2 + checkboxes_mouse2 check_boxes,check_boxes_end + ret + +align 4 +button_prop: + mcall SF_GET_BUTTON + + cmp ah,3 + je .exit + cmp ah,4 + jne .end_save + push eax ebx ecx edi esi + mov ebx,[wnd_pPoi] + or ebx,ebx + jnz .select_1 + ; *** create new point *** + mov ebx,[wnd_pFig] + mov eax,[ebx+Figure.PoiCount] + inc eax + imul eax,sizeof.Point + stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax + mov [ebx+Figure.PoiData],eax + inc dword[ebx+Figure.PoiCount] + mov ebx,[ebx+Figure.PoiCount] + dec ebx + imul ebx,sizeof.Point + add ebx,eax + .select_1: + finit + + mov esi,string1 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;считываем как double + fstp qword[ebx+Point.CoordX] ;сохраняем как double + + mov esi,string2 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[ebx+Point.CoordY] + + stdcall figure_update_coords,[wnd_pObj],[wnd_FigN] + ;выставляем свойства + and dword[ebx+Point.Prop], not 7 ;7 = 2^PROP_BIT_START +2^PROP_BIT_LINE +2^PROP_BIT_LINE_CLOSE) + mov dword[offs_last_timer],0 ;для обновления блока в таймере + pop esi edi ecx ebx eax + jmp .exit + .end_save: + + cmp ah,1 + jne still_prop.end +.exit: + mov byte[wnd_run_prop],0 ;обнуляем счетчик окон + mcall SF_TERMINATE_PROCESS ;выход из программы + +align 4 +proc get_point_coords uses eax ebx + ;загрузка координат в editbox-ы + mov ebx,[wnd_pPoi] + btr dword[ch1.flags],1 + btr dword[ch2.flags],1 + btr dword[ch3.flags],1 + or ebx,ebx + jz .end0 + mov word[NumberSymbolsAD],8 + finit + fld qword[ebx+Point.CoordX] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit1, Data_String + fld qword[ebx+Point.CoordY] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit2, Data_String + ; + jmp .end1 + .end0: + stdcall [edit_box_set_text], edit1, txt_p + stdcall [edit_box_set_text], edit2, txt_p + .end1: + ;stdcall [edit_box_draw], edit1 + ;stdcall [edit_box_draw], edit2 + ret +endp + +align 4 +proc timer_funct_prop + ;просматриваем выделенную координату + ret +endp + +align 4 +capt_p rb 64 +if lang eq ru +capt_fig: db 'Команда: ',39 +.name: rb 55 +capt_poi: db 'Точка: ' +.numb: rb 25 +else +capt_fig: db 'Command: ',39 +.name: rb 55 +capt_poi: db 'Point: ' +.numb: rb 25 +end if + +capt_coord_x db 'X:',0 +capt_coord_y db 'Y:',0 + +edit1 edit_box 80, 18, 28, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string1, mouse_dd, 0 +edit2 edit_box 80, 18, 46, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string2, mouse_dd, 0 +editboxes_end: + +string1 rb 34 +string2 rb 34 + +check_boxes: +ch1 check_box2 (115 shl 16+15),(28 shl 16 +11),5,0xffffff,0,0x80000000,ch_text.1,ch_flag_en+ch_flag_middle +ch2 check_box2 (115 shl 16+15),(43 shl 16 +11),5,0xffffff,0,0x80000000,ch_text.2,ch_flag_en+ch_flag_middle +ch3 check_box2 (115 shl 16+15),(58 shl 16 +11),5,0xffffff,0,0x80000000,ch_text.3,ch_flag_en+ch_flag_middle +check_boxes_end: + +ch_text: +.1 db 'X',0 +.2 db 'Y',0 +.3 db 'Z',0 diff --git a/programs/other/cnc_editor/wnd_scale.inc b/programs/other/cnc_editor/wnd_scale.inc new file mode 100644 index 0000000000..88ccdc6ae0 --- /dev/null +++ b/programs/other/cnc_editor/wnd_scale.inc @@ -0,0 +1,181 @@ +; +; в этом файле собраны функции нужные для создания и +; работы окна с настройками +; + +wnd_scale_width equ 320 ;ширина окна с настройками +wnd_scale_height equ 150 ;высота окна с настройками + +align 4 +wnd_run_scale db 0 ;переменная следящая за тем что-бы не запускать больше 1-го окна со свойствами одновременно + +;даное окно (процесс) вызываеться функцией but_wnd_coords +align 4 +start_scale: +pushad + mcall SF_SET_EVENTS_MASK,0x27 ;маска ожидаемых событий + inc byte[wnd_run_scale] + + edit_boxes_set_sys_color edit3,editboxes_end_sc,sc ;установка системных цветов + call get_scale +popad + call red_win_scale + +;не отрывать эту функцию от предыдущей +align 4 +still_scale: + pushad + + mcall SF_WAIT_EVENT_TIMEOUT,10 + or eax,eax + jnz @f + call timer_funct_scale + jmp .end + @@: + + cmp al,1 ;изм. положение окна + jne @f + call red_win_scale + jmp .end + @@: + cmp al,2 + jne @f + call key_scale + jmp .end + @@: + cmp al,3 + jz button_scale + cmp al,6 + jne @f + call mouse_scale + @@: +.end: + popad + jmp still_scale + +align 4 +red_win_scale: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT + mov edi,capt_opt ;children window caption + mov bx,word[procinfo.box.left] + add bx,word[buf_0.l] + add bx,5 ;ширина боковой рамки + shl ebx,16 + mov bx,wnd_scale_width + mov cx,word[procinfo.box.top] + add cx,ax ;add skin height + add cx,word[buf_0.t] + shl ecx,16 + mov cx,wnd_scale_height + mov edx,[sc.work] + or edx,0x33000000 + xor eax,eax + int 0x40 + + mov esi,[sc.work_button] + ;ebx = (l<:)+w, ecx = (t<:)+h + mcall SF_DEFINE_BUTTON, (5 shl 16)+59, (95 shl 16)+20, 3 + mcall , (75 shl 16)+59, (95 shl 16)+20, 4 + + mov ecx,[sc.work_text] + bts ecx,31 ;рисуемая строка заканчивается нулём + mcall SF_DRAW_TEXT, (5 shl 16)+15,, capt_sc + + mov ecx,[sc.work_button_text] + bts ecx,31 + mcall , (9 shl 16)+101,, txt_but_cancel + mov edx,txt_but_apply + mcall ,(79 shl 16)+101 + + stdcall [edit_box_draw], edit3 + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +proc key_scale uses eax ebx + mcall SF_GET_KEY + + test word [edit3.flags],10b ;ed_focus + je @f + stdcall [edit_box_key], edit3 + ;jmp .end + @@: + + .end: + ret +endp + +align 4 +mouse_scale: + stdcall [edit_box_mouse], edit3 + ret + +align 4 +button_scale: + mcall SF_GET_BUTTON + + cmp ah,3 + je .exit + cmp ah,4 + jne .end_save + push eax ecx edi esi + finit + + mov esi,string3 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;считываем как double + fstp qword[Scale1mm] ;сохраняем как double + + pop esi edi ecx eax + jmp .exit + .end_save: + + cmp ah,1 + jne still_scale.end +.exit: + mov byte[wnd_run_scale],0 ;обнуляем счетчик окон + mcall SF_TERMINATE_PROCESS ;выход из программы + +align 4 +get_scale: + ;загрузка координат в editbox-ы + push eax + mov word[NumberSymbolsAD],8 + finit + fld qword[Scale1mm] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit3, Data_String + ;stdcall [edit_box_draw], edit3 + pop eax + ret + +align 4 +proc timer_funct_scale + ;просматриваем выделенную координату + ret +endp + +align 4 +if lang eq ru +capt_opt db 'Настройки',0 +capt_sc db 'Масштаб:',0 +else +capt_opt db 'Options',0 +capt_sc db 'Scale:',0 +end if + +edit3 edit_box 80, 54, 11, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string3, mouse_dd, 0 +editboxes_end_sc: + +string3 rb 34