Subversion Repositories Kolibri OS

Rev

Rev 7441 | Rev 8442 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;CNC CONTROL
  2. ;Igor Afanasyev (aka IgorA) and Sergey Efremenkov (aka theonlymirage), 2018
  3.  
  4. ;02.10.18 - Only prototype UI
  5. ;08.10.18 - Add ComboBox (Button + KMenu), small text
  6.  
  7. format binary as ""
  8. use32
  9.         org 0
  10.         db 'MENUET01'
  11.         dd 1,start,i_end,mem,stacktop,file_name,sys_path
  12.  
  13. include '../../macros.inc'
  14. include '../../proc32.inc'
  15. include '../../KOSfuncs.inc'
  16. include '../../load_img.inc'
  17. include '../../develop/libraries/libs-dev/libimg/libimg.inc'
  18. include '../../develop/libraries/box_lib/trunk/box_lib.mac'
  19. include 'lang.inc'
  20. include 'cnc_control.inc'
  21. include '../../develop/info3ds/info_fun_float.inc'
  22.  
  23. KMENUITEM_NORMAL equ 0
  24. KMENUITEM_SUBMENU equ 1
  25. KMENUITEM_SEPARATOR equ 2
  26.  
  27. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  28. caption db 'CNC Control 22.05.19',0 ;¯®¤¯¨áì ®ª­ 
  29.  
  30. run_file_70 FileInfoBlock
  31.  
  32. offs_last_timer dd 0 ;¯®á«¥¤­¨© ᤢ¨£ ¯®ª § ­ë© ¢ ä㭪樨 â ©¬¥à 
  33.  
  34. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  35. image_data_toolbar dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  36. icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
  37. icon_toolbar dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï ¨ª®­®ª ®¡ê¥ªâ®¢
  38.  
  39. align 4
  40. start:
  41.         ;--- copy cmd line ---
  42.         mov esi,file_name
  43.         mov edi,openfile_path
  44. @@:
  45.         lodsd
  46.         or eax,eax
  47.         jz @f ;¢ë室, ¥á«¨ 0
  48.         stosd
  49.         jmp @b
  50. @@:
  51.         stosd
  52.  
  53.         load_libraries l_libs_start,l_libs_end
  54.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
  55.         mov     ebp,lib_0
  56.         cmp     dword [ebp+ll_struc_size-4],0
  57.         jz      @f
  58.                 mcall SF_TERMINATE_PROCESS
  59.         @@:
  60.         mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
  61.         mcall SF_SET_EVENTS_MASK,0xC0000027
  62.         stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
  63.  
  64.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
  65.  
  66.         ;èà¨äâ ¤¥« ¥¬ ¤® ᮧ¤ ­¨ï ¯ ­¥«¨ (¤«ï íª®­®¬¨¨ 㪠§ â¥«ï image_data_toolbar)
  67.         include_image_file '..\..\fs\kfar\trunk\font6x9.bmp', image_data_toolbar, buf_1.w,buf_1.h
  68.         stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
  69.         stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
  70.         stdcall [buf2d_conv_24_to_8], buf_1,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
  71.         stdcall [buf2d_convert_text_matrix], buf_1
  72.         mov eax,[buf_1.h]
  73.         shr eax,8
  74.         mov [font_h],eax
  75.  
  76.         include_image_file 'toolbar.png', image_data_toolbar
  77.  
  78.         ;*** ãáâ ­®¢ª  ¢à¥¬¥­¨ ¤«ï â ©¬¥à 
  79.         mcall SF_SYSTEM_GET,SSF_TIME_COUNT
  80.         mov [last_time],eax
  81.  
  82.         ;call but_new_file
  83.         option_boxes_set_sys_color sc,opt_grlist1
  84.  
  85.         ;progress bar
  86.         mov    [pb.left],           dword  50
  87.         mov    [pb.top],            dword  30
  88.         mov    [pb.width],          dword  350
  89.         mov    [pb.height],         dword  17
  90.         mov    [pb.max],            dword  100;599
  91.         mov    [pb.min],            dword  0 ;-397
  92.         mov    [pb.value],          dword  0 ;-397
  93.         mov    [pb.back_color],     dword 00C8D0D4h
  94.         mov    [pb.progress_color], dword 8072B7EBh
  95.         mov    [pb.frame_color],    dword 00406175h
  96.  
  97.         ;port menu
  98.         stdcall [kmenu_init], sc    ;kmenu initialisation
  99.         ;stdcall [ksubmenu_new]
  100.         ;mov [main_menu], eax
  101.  
  102.         stdcall [ksubmenu_new]
  103.         mov [port_menu], eax
  104.         stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_COMport, 110
  105.         stdcall [ksubmenu_add], [port_menu], eax
  106.         stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_USBport, 111
  107.         stdcall [ksubmenu_add], [port_menu], eax
  108.         ;stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0
  109.         ;stdcall [ksubmenu_add], [port_menu], eax
  110.         ;stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_OTHERport, 112
  111.         ;stdcall [ksubmenu_add], [port_menu], eax
  112.         stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_PortMenu, [port_menu]
  113.         ;stdcall [ksubmenu_add], [main_menu], eax
  114.  
  115.         ;open file from cmd line
  116.         cmp dword[openfile_path],0
  117.         je @f
  118.                 call but_open_file.no_dlg
  119.         @@:
  120.  
  121. align 4
  122. red_win:
  123.         call draw_window
  124.  
  125. align 4
  126. still:
  127.         mcall SF_SYSTEM_GET,SSF_TIME_COUNT
  128.         mov ebx,[last_time]
  129.         add ebx,10 ;§ ¤¥à¦ª 
  130.         cmp ebx,eax
  131.         jge @f
  132.                 mov ebx,eax
  133.         @@:
  134.         sub ebx,eax
  135.         mcall SF_WAIT_EVENT_TIMEOUT
  136.         cmp eax,0
  137.         jne @f
  138.                 call timer_funct
  139.                 jmp still
  140.         @@:
  141.  
  142.         cmp al,1
  143.         jz red_win
  144.         cmp al,2
  145.         jz key
  146.         cmp al,3
  147.         jz button
  148.         cmp al,6
  149.         jne @f
  150.                 mcall SF_THREAD_INFO,procinfo,-1
  151.                 cmp ax,word[procinfo.window_stack_position]
  152.                 jne @f ;®ª­® ­¥  ªâ¨¢­®
  153.                 call mouse
  154.         @@:
  155.         jmp still
  156.  
  157. align 4
  158. mouse:
  159.         stdcall [option_box_mouse], opt_grlist1
  160.         stdcall [edit_box_mouse], editFileName
  161.         stdcall [edit_box_mouse], editCommand
  162.         stdcall [kmainmenu_dispatch_cursorevent], [port_menu] ;[main_menu]
  163.  
  164.         push eax ebx ecx
  165.         mcall SF_MOUSE_GET,SSF_BUTTON_EXT
  166.         bt eax,8
  167.         jnc @f
  168.                 ;mouse l. but. press
  169.                 call mouse_left_d
  170.                 jmp .end_l
  171.         @@:
  172.         bt eax,16
  173.         jnc .end_l
  174.                 ;mouse l. but. up
  175.                 call mouse_left_u
  176.                 ;jmp .end_l
  177.         .end_l:
  178.  
  179.  
  180.         call buf_get_mouse_coord
  181.         cmp eax,-1
  182.         je .end0
  183.                 shl eax,1
  184.                 sub eax,[buf_0.w]
  185.                 sar eax,1
  186.                 mov [mouse_prop_x],eax
  187.                 mov ecx,ObjData
  188.                 shl ebx,1
  189.                 sub ebx,[buf_0.h]
  190.                 sar ebx,1
  191.                 mov [mouse_prop_y],ebx
  192.  
  193.                 mcall SF_MOUSE_GET,SSF_SCROLL_DATA
  194.                 test ax,ax
  195.                 jz .end0
  196.                 finit
  197.                 fld qword[zoom_plus]
  198.                 fld1
  199.                 fsubp
  200.                 fld st0 ;for Y coord
  201.  
  202.                 ;for X coord
  203.                 fild dword[mouse_prop_x]
  204.                 fmulp st1,st0
  205.  
  206.                 mov ebx,eax
  207.                 test ax,0x8000
  208.                 jnz .decr
  209.                         ;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
  210.                         fchs
  211.                         fild dword[ecx+Figure.MCentrX] ;add old value
  212.                         fmul qword[zoom_plus]
  213.                         faddp
  214.  
  215.                         fld qword[ecx+Figure.MScale]
  216.                         fmul qword[zoom_plus]
  217.                         ;if (Figure.MScale>16.0)
  218.                         ;...
  219.                         jmp @f
  220.                 .decr:
  221.                         ;㬥­ì襭¨¥ ¬ áèâ ¡ 
  222.                         fild dword[ecx+Figure.MCentrX] ;add old value
  223.                         fdiv qword[zoom_plus]
  224.                         faddp
  225.  
  226.                         fld qword[ecx+Figure.MScale]
  227.                         fdiv qword[zoom_plus]
  228.                         fld1
  229.                         fcomp
  230.                         fstsw ax
  231.                         sahf
  232.                         jbe @f
  233.                                 ;if (Figure.MScale<1.0)
  234.                                 ffree st0
  235.                                 fincstp
  236.                                 ffree st0
  237.                                 fincstp
  238.                                 fldz ;default Figure.MCentrX
  239.                                 fld1 ;default Figure.MScale
  240.                                 mov dword[ecx+Figure.MCentrY],0
  241.                 @@:
  242.                 fstp qword[ecx+Figure.MScale]
  243.                 fistp dword[ecx+Figure.MCentrX]
  244.  
  245.                 ;for Y coord
  246.                 fild dword[mouse_prop_y]
  247.                 fmulp st1,st0
  248.                 test bx,0x8000
  249.                 jnz .decr_y
  250.                         ;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
  251.                         fild dword[ecx+Figure.MCentrY] ;add old value
  252.                         fmul qword[zoom_plus]
  253.                         faddp
  254.                         jmp @f
  255.                 .decr_y:
  256.                         ;㬥­ì襭¨¥ ¬ áèâ ¡ 
  257.                         fchs
  258.                         fild dword[ecx+Figure.MCentrY] ;add old value
  259.                         fdiv qword[zoom_plus]
  260.                         faddp
  261.                 @@:
  262.                 fistp dword[ecx+Figure.MCentrY]
  263.  
  264.                 mov dword[offs_last_timer],0
  265.         .end0:
  266.  
  267.         pop ecx ebx eax
  268.         ret
  269.  
  270. ;output:
  271. ; eax - buffer coord X (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  272. ; ebx - buffer coord Y (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
  273. align 4
  274. proc buf_get_mouse_coord
  275.         mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
  276.         cmp ax,word[buf_0.t]
  277.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
  278.         mov ebx,eax
  279.         shr ebx,16
  280.         cmp bx,word[buf_0.l]
  281.         jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
  282.  
  283.         and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
  284.         sub ax,word[buf_0.t]
  285.         cmp eax,[buf_0.h]
  286.         jg .no_buf
  287.         sub bx,word[buf_0.l]
  288.         cmp ebx,[buf_0.w]
  289.         jg .no_buf
  290.         xchg eax,ebx
  291.         jmp .end_f
  292.         .no_buf:
  293.                 xor eax,eax
  294.                 not eax
  295.                 xor ebx,ebx
  296.                 not ebx
  297.         .end_f:
  298.         ret
  299. endp
  300.  
  301. align 4
  302. proc timer_funct uses eax ebx
  303.         mcall SF_SYSTEM_GET,SSF_TIME_COUNT
  304.         mov [last_time],eax
  305.  
  306.         cmp dword[offs_last_timer],ObjData
  307.         je @f
  308.                 mov dword[offs_last_timer],ObjData
  309.                 stdcall draw_obj2d,ObjData
  310.                 stdcall [buf2d_draw], buf_0
  311.         @@:
  312.         ret
  313. endp
  314.  
  315. WINDOW_WIDTH  = 775
  316. WINDOW_HEIGHT = 445
  317.  
  318. align 4
  319. draw_window:
  320. pushad
  321.         mcall SF_REDRAW,SSF_BEGIN_DRAW
  322.  
  323.         ; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
  324.         mov edx,[sc.work]
  325.         or  edx,0x33000000
  326.         mov edi,caption
  327.         mcall SF_CREATE_WINDOW,(20 shl 16)+WINDOW_WIDTH,(20 shl 16)+WINDOW_HEIGHT
  328.  
  329.         mov ecx,[ObjData.FigCount]
  330.         or ecx,ecx
  331.         jz .end0
  332.                 mov eax,[ObjData.FigData]
  333.                 xor edx,edx
  334.                 .cycle0:
  335.                         stdcall FigCalculateSizes,[eax+4*edx],0
  336.                         inc edx
  337.                         loop .cycle0
  338.                 stdcall ObjCalculateScale,ObjData
  339.                 mov dword[offs_last_timer],0
  340.                 call timer_funct
  341.         .end0:
  342.  
  343.         stdcall [edit_box_draw], editFileName
  344.         stdcall [edit_box_draw], editCommand
  345.  
  346.         stdcall [option_box_draw], opt_grlist1
  347.         push   pb
  348.         call   [progressbar_draw]
  349.  
  350.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
  351.         mcall SF_DEFINE_BUTTON,(731 shl 16)+20,(75 shl 16)+20,3, [sc.work_button]
  352.         mcall , (15 shl 16)+20,(27 shl 16)+20,4 ;restore
  353.         mcall ,(538 shl 16)+20,,5 ;connect
  354.         mcall ,(563 shl 16)+20,,6 ;close connect
  355.         mcall ,(437 shl 16)+86,(378 shl 16)+20,7 ;cancel
  356.         mcall ,(616 shl 16)+136,(378 shl 16)+20,8 ;run
  357.  
  358.         ; ***
  359.         mov ecx,[sc.work_text]
  360.         or ecx,0x80000000 ;0x81000000
  361.         textYcoord = 13;5
  362.         mcall SF_DRAW_TEXT,(15 shl 16)+textYcoord,,txt_preview
  363.         mcall ,(424 shl 16)+textYcoord,,txt_port
  364.         mov ecx,[sc.work_button_text]
  365.         or ecx,0x81000000
  366.         mcall ,(440 shl 16)+381,,txt_but_cancel
  367.         mcall ,(619 shl 16)+381,,txt_but_run
  368.  
  369.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  370.         mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(733 shl 16)+77 ;icon open
  371.  
  372.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  373.         mcall ,,,(17 shl 16)+29 ;restore scale
  374.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  375.         mcall ,,,(540 shl 16)+29 ;connect
  376.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  377.         mcall ,,,(565 shl 16)+29 ;close connect
  378.         ;;add ebx,IMAGE_TOOLBAR_ICON_SIZE
  379.         ;;mcall ,,,(439 shl 16)+380 ;cancel
  380.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  381.         mcall ,,,((638+97) shl 16)+380 ;run
  382.  
  383.         stdcall [buf2d_draw], buf_0
  384.  
  385.         ;delete port button, if it exist
  386.         mov edx, 0x80000008
  387.         mcall 8
  388.         ;draw button PORT
  389.         buttonPortX = 433
  390.         buttonPortY = 27 ;50
  391.         buttonPortTextXoffset = 5
  392.         mov ebx, buttonPortX*65536 + 95   ;X + Width
  393.         mov ecx, buttonPortY*65536 + 20   ;Y + Height
  394.         mov edx, 0x00000008       ;button id
  395.         mov esi, 0x00AABBCC       ;color button
  396.         mcall 8
  397.         ;draw text for button PORT
  398.         mov     ebx, (buttonPortX+buttonPortTextXoffset) * 65536 + (buttonPortY+6)    ;(x, y)
  399.         mov     ecx, 0xFFFFFF
  400.         mov     edx, sz_PortMenu
  401.         mov     esi, 11
  402.         mcall 4
  403.         ;stdcall [kmainmenu_draw], [main_menu]
  404.         ;mov word[coord.x], 0
  405.         ;mov word[coord.y], 0
  406.         ;stdcall [ksubmenu_draw], [port_menu], coord
  407.  
  408.         mcall SF_REDRAW,SSF_END_DRAW
  409. popad
  410.         ret
  411.  
  412. align 4
  413. key:
  414.         mcall SF_GET_KEY
  415.        
  416.         stdcall [edit_box_key], editFileName
  417.         stdcall [edit_box_key], editCommand
  418.        
  419.         mov ecx,eax
  420.         mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS
  421.         bt eax,2 ;left Ctrl
  422.         jc .key_Ctrl
  423.         bt eax,3 ;right Ctrl
  424.         jc .key_Ctrl
  425.         jmp .end0
  426.         .key_Ctrl:
  427.                 cmp ch,15 ;111 ;Ctrl+O
  428.                 jne @f
  429.                         call but_open_file
  430.                 @@:
  431.         .end0:
  432.         jmp still
  433.  
  434. align 4
  435. button:
  436.         mcall SF_GET_BUTTON
  437.  
  438.         cmp ah,3
  439.         jne @f
  440.                 call but_open_file
  441.                 jmp still
  442.         @@:
  443.         cmp ah,4
  444.         jne @f
  445.                 call but_restore_zoom
  446.                 jmp still
  447.         @@:
  448.         cmp ah, 8
  449.         jne @f
  450.                 push eax ebx ecx
  451.                 mcall 9, pi, -1 ;get window coord
  452.  
  453.                 mov eax, dword[pi+34]
  454.                 add eax, buttonPortX + 5
  455.                 mov word[coord.x], ax
  456.  
  457.                 mov eax, dword[pi+38]
  458.                 add eax, buttonPortY + 42
  459.                 mov word[coord.y], ax
  460.  
  461.                 stdcall [ksubmenu_draw], [port_menu], coord
  462.                 pop ecx ebx eax
  463.         @@:
  464.         ;cmp ah,5
  465.         ;jne @f
  466.                 ;call but_...
  467.                 ;jmp still
  468.         ;@@:
  469.         cmp ah,1
  470.         jne still
  471. .exit:
  472.         stdcall [buf2d_delete],buf_0
  473.         stdcall mem.Free,[image_data_toolbar]
  474.         stdcall mem.Free,[open_file_data]
  475.         mcall SF_TERMINATE_PROCESS
  476.  
  477.  
  478.  
  479. align 4
  480. open_file_data dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢
  481. open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©« 
  482.  
  483. align 4
  484. but_open_file:
  485.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  486.         pushad
  487.         mov [OpenDialog_data.type],0
  488.         stdcall [OpenDialog_Start],OpenDialog_data
  489.         cmp [OpenDialog_data.status],2
  490.         je .end_open_file
  491.         ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  492.         jmp .end0
  493. .no_dlg: ;¥á«¨ ¬¨­ã¥¬ ¤¨ «®£ ®âªàëâ¨ï ä ©« 
  494.                 pushad
  495.                 mov esi,openfile_path
  496.                 stdcall str_len,esi
  497.                 add esi,eax
  498.                 @@: ;横« ¤«ï ¯®¨áª  ­ ç «  ¨¬¥­¨ ä ©« 
  499.                         dec esi
  500.                         cmp byte[esi],'/'
  501.                         je @f
  502.                         cmp byte[esi],0x5c ;'\'
  503.                         je @f
  504.                         cmp esi,openfile_path
  505.                         jg @b
  506.                 @@:
  507.                 inc esi
  508.                 stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;ª®¯¨à㥬 ¨¬ï ä ©«  ¢ ¤¨ «®£ á®åà ­¥­¨ï
  509.         .end0:
  510.         push eax ebx ecx edx    ;copy file name path from OpenDialog
  511.         mov eax, openfile_path
  512.         mov ebx, fileNameBuffer ;.data
  513.         mov ecx, 0
  514.       @@:
  515.         mov dl, byte[eax]
  516.         cmp dl, 0 ;byte[eax], 0
  517.         je @f
  518.         mov byte[ebx], dl
  519.         inc eax
  520.         inc ebx
  521.         inc ecx
  522.         jmp @b
  523.       @@:
  524.         mov byte[ebx], 0
  525.         mov dword[fileNameBuffer.size], ecx
  526.         mov dword[editFileName.size], ecx
  527.         mov dword[editFileName.pos], ecx
  528.         pop edx ecx ebx eax
  529.  
  530.         mov [run_file_70.Function], SSF_GET_INFO
  531.         mov [run_file_70.Position], 0
  532.         mov [run_file_70.Flags], 0
  533.         mov dword[run_file_70.Count], 0
  534.         mov dword[run_file_70.Buffer], open_b
  535.         mov byte[run_file_70+20], 0
  536.         mov dword[run_file_70.FileName], openfile_path
  537.         mcall SF_FILE,run_file_70
  538.  
  539.         mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©«  ¢ ¡ ©â å
  540.         inc ecx ;for text files
  541.         stdcall mem.ReAlloc,[open_file_data],ecx
  542.         mov [open_file_data],eax
  543.         dec ecx ;for text files
  544.         mov byte[eax+ecx],0 ;for text files
  545.  
  546.         mov [run_file_70.Function], SSF_READ_FILE
  547.         mov [run_file_70.Position], 0
  548.         mov [run_file_70.Flags], 0
  549.         mov dword[run_file_70.Count], ecx
  550.         m2m dword[run_file_70.Buffer], dword[open_file_data]
  551.         mov byte[run_file_70+20], 0
  552.         mov dword[run_file_70.FileName], openfile_path
  553.         mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  554.         test eax,eax
  555.         jnz .end_open_file
  556.         cmp ebx,0xffffffff
  557.         je .end_open_file
  558.                 mov [open_file_size],ebx
  559.                 mcall SF_SET_CAPTION,1,openfile_path
  560.  
  561.                 stdcall FileInit,[open_file_data],[open_file_size]
  562.                 stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
  563.                 stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
  564.         .end_open_file:
  565.         popad
  566.         ret
  567.  
  568. ;output:
  569. ; ecx - memory size for save file
  570. align 4
  571. proc get_file_save_size uses eax ebx edx esi
  572.         mov ecx,100 ;title
  573.         mov ebx,ObjData
  574.         add ecx,50 ;object
  575.         mov edx,[ebx+Object.FigCount]
  576.         or edx,edx
  577.         jz .cycle1end
  578.         mov esi,[ebx+Object.FigData]
  579. align 4
  580.         .cycle1: ; 横« ¯® 䨣ãà ¬
  581.                 add ecx,80 ;figure
  582.                 mov eax,[esi]
  583.                 or eax,eax
  584.                 jz @f
  585.                         mov eax,[eax+Figure.PoiCount]
  586.                         imul eax,70
  587.                         add ecx,eax ;points
  588.                 @@:
  589.                 add esi,4
  590.                 dec edx
  591.                 jnz .cycle1
  592.         .cycle1end:
  593.         ret
  594. endp
  595.  
  596. align 4
  597. proc but_restore_zoom
  598.         finit
  599.         fld1
  600.         fstp qword[ObjData.MScale]
  601.         mov dword[ObjData.MCentrX],0
  602.         mov dword[ObjData.MCentrY],0
  603.         mov dword[offs_last_timer],0
  604.         ret
  605. endp
  606.  
  607. ;input:
  608. ; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
  609. ;output:
  610. ; eax - ç¨á«®
  611. align 4
  612. proc conv_str_to_int uses ebx ecx esi, buf:dword
  613.         xor eax,eax
  614.         xor ebx,ebx
  615.         mov esi,[buf]
  616.  
  617.         ;­  á«ãç © ¥á«¨ ¯¥à¥¤ ç¨á«®¬ ­ å®¤ïâáï ¯à®¡¥«ë
  618.         @@:
  619.         cmp byte[esi],' '
  620.         jne @f
  621.                 inc esi
  622.                 jmp @b
  623.         @@:
  624.  
  625.         ;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
  626.         xor ecx,ecx
  627.         inc ecx
  628.         cmp byte[esi],'-'
  629.         jne @f
  630.                 dec ecx
  631.                 inc esi
  632.         @@:
  633.  
  634.         cmp word[esi],'0x'
  635.         je .load_digit_16
  636.  
  637.         .load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
  638.                 mov bl,byte[esi]
  639.                 cmp bl,'0'
  640.                 jl @f
  641.                 cmp bl,'9'
  642.                 jg @f
  643.                         sub bl,'0'
  644.                         imul eax,10
  645.                         add eax,ebx
  646.                         inc esi
  647.                         jmp .load_digit_10
  648.         jmp @f
  649.  
  650.         .load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
  651.                 add esi,2
  652.         .cycle_16:
  653.                 mov bl,byte[esi]
  654.                 cmp bl,'0'
  655.                 jl @f
  656.                 cmp bl,'f'
  657.                 jg @f
  658.                 cmp bl,'9'
  659.                 jle .us1
  660.                         cmp bl,'A'
  661.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
  662.                 .us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
  663.                 cmp bl,'F'
  664.                 jle .us2
  665.                         cmp bl,'a'
  666.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
  667.                         sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
  668.                 .us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
  669.                         sub bl,'0'
  670.                         cmp bl,9
  671.                         jle .cor1
  672.                                 sub bl,7 ;convert 'A' to '10'
  673.                         .cor1:
  674.                         shl eax,4
  675.                         add eax,ebx
  676.                         inc esi
  677.                         jmp .cycle_16
  678.         @@:
  679.         cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
  680.         jne @f
  681.                 sub ecx,eax
  682.                 mov eax,ecx
  683.         @@:
  684.         ret
  685. endp
  686.  
  687.  
  688. ;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
  689. align 4
  690. OpenDialog_data:
  691. .type                   dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
  692. .procinfo               dd procinfo     ;+4
  693. .com_area_name          dd communication_area_name      ;+8
  694. .com_area               dd 0    ;+12
  695. .opendir_path           dd plugin_path  ;+16
  696. .dir_default_path       dd default_dir ;+20
  697. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  698. .draw_window            dd draw_window  ;+28
  699. .status                 dd 0    ;+32
  700. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  701. .filename_area          dd filename_area        ;+40
  702. .filter_area            dd Filter
  703. .x:
  704. .x_size                 dw 420 ;+48 ; Window X size
  705. .x_start                dw 10 ;+50 ; Window X position
  706. .y:
  707. .y_size                 dw 320 ;+52 ; Window y size
  708. .y_start                dw 10 ;+54 ; Window Y position
  709.  
  710. default_dir db '/rd/1',0
  711.  
  712. communication_area_name:
  713.         db 'FFFFFFFF_open_dialog',0
  714. open_dialog_name:
  715.         db 'opendial',0
  716. communication_area_default_path:
  717.         db '/rd/1/File managers/',0
  718.  
  719. Filter:
  720. dd Filter.end - Filter ;.1
  721. .1:
  722. db 'NC',0
  723. db 'PNG',0
  724. .end:
  725. db 0
  726.  
  727.  
  728. ;[
  729. ;for test
  730. main_menu dd 0
  731. port_menu dd 0
  732.  
  733. sz_PortMenu  db 'COM 12     ',0
  734. sz_COMport   db 'COM port 12',0
  735. sz_USBport   db 'USB port   ',0
  736. sz_OTHERport db 'Other port ',0
  737.  
  738. coord:
  739.   .x dw 100
  740.   .y dw 200
  741. ;]
  742.  
  743. align 4
  744. system_dir_0 db '/sys/lib/'
  745. lib_name_0 db 'proc_lib.obj',0
  746. system_dir_1 db '/sys/lib/'
  747. lib_name_1 db 'libimg.obj',0
  748. system_dir_2 db '/sys/lib/'
  749. lib_name_2 db 'buf2d.obj',0
  750. system_dir_3 db '/sys/lib/'
  751. lib_name_3 db 'box_lib.obj',0
  752. system_dir_4 db '/sys/lib/'
  753. lib_name_4 db 'kmenu.obj',0
  754.  
  755. head_f_i:
  756. if lang eq ru
  757.         head_f_l db '"‘¨á⥬­ ï ®è¨¡ª ',0
  758.         err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,'" -tE',0
  759.         err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,'" -tW',0
  760.         err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,'" -tE',0
  761.         err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,'" -tW',0
  762.         err_msg_found_lib_2 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,'" -tE',0
  763.         err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,'" -tW',0
  764.         err_msg_found_lib_3 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'box_lib.obj',39,'" -tE',0
  765.         err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'box_lib',39,'" -tW',0
  766.         err_msg_found_lib_4 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'kmenu.obj',39,'" -tE',0
  767.         err_msg_import_4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'kmenu',39,'" -tW',0
  768. else
  769.         head_f_l db '"System error',0
  770.         err_message_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,'" -tE',0
  771.         err_message_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,'" -tW',0
  772.         err_message_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,'" -tE',0
  773.         err_message_import_1 db 'Error on load import library ',39,'libimg.obj',39,'" -tW',0
  774.         err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'buf2d.obj',39,'" -tE',0
  775.         err_msg_import_2 db 'Error on load import library ',39,'buf2d',39,'" -tW',0
  776.         err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'box_lib.obj',39,'" -tE',0
  777.         err_msg_import_3 db 'Error on load import library ',39,'box_lib',39,'" -tW',0
  778.         err_msg_found_lib_4 db 'Sorry I cannot found library ',39,'kmenu.obj',39,'" -tE',0
  779.         err_msg_import_4 db 'Error on load import library ',39,'kmenu',39,'" -tW',0
  780. end if
  781.  
  782. align 4
  783. l_libs_start:
  784.         lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
  785.                 err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
  786.         lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
  787.                 err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
  788.         lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
  789.                 err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
  790.         lib_3 l_libs lib_name_3, sys_path, file_name,  system_dir_3,\
  791.                 err_msg_found_lib_3, head_f_l, import_box_lib,err_msg_import_3,head_f_i
  792.         lib_4 l_libs lib_name_4, sys_path, file_name, system_dir_4,\
  793.                 err_msg_found_lib_4, head_f_l, import_libkmenu,err_msg_import_4,head_f_i
  794. l_libs_end:
  795.  
  796. align 4
  797. import_libimg:
  798.         dd alib_init1
  799.         img_is_img  dd aimg_is_img
  800.         img_info    dd aimg_info
  801.         img_from_file dd aimg_from_file
  802.         img_to_file dd aimg_to_file
  803.         img_from_rgb dd aimg_from_rgb
  804.         img_to_rgb  dd aimg_to_rgb
  805.         img_to_rgb2 dd aimg_to_rgb2
  806.         img_decode  dd aimg_decode
  807.         img_encode  dd aimg_encode
  808.         img_create  dd aimg_create
  809.         img_destroy dd aimg_destroy
  810.         img_destroy_layer dd aimg_destroy_layer
  811.         img_count   dd aimg_count
  812.         img_lock_bits dd aimg_lock_bits
  813.         img_unlock_bits dd aimg_unlock_bits
  814.         img_flip    dd aimg_flip
  815.         img_flip_layer dd aimg_flip_layer
  816.         img_rotate  dd aimg_rotate
  817.         img_rotate_layer dd aimg_rotate_layer
  818.         img_draw    dd aimg_draw
  819.  
  820.         dd 0,0
  821.         alib_init1   db 'lib_init',0
  822.         aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
  823.         aimg_info    db 'img_info',0
  824.         aimg_from_file db 'img_from_file',0
  825.         aimg_to_file db 'img_to_file',0
  826.         aimg_from_rgb db 'img_from_rgb',0
  827.         aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
  828.         aimg_to_rgb2 db 'img_to_rgb2',0
  829.         aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
  830.         aimg_encode  db 'img_encode',0
  831.         aimg_create  db 'img_create',0
  832.         aimg_destroy db 'img_destroy',0
  833.         aimg_destroy_layer db 'img_destroy_layer',0
  834.         aimg_count   db 'img_count',0
  835.         aimg_lock_bits db 'img_lock_bits',0
  836.         aimg_unlock_bits db 'img_unlock_bits',0
  837.         aimg_flip    db 'img_flip',0
  838.         aimg_flip_layer db 'img_flip_layer',0
  839.         aimg_rotate  db 'img_rotate',0
  840.         aimg_rotate_layer db 'img_rotate_layer',0
  841.         aimg_draw    db 'img_draw',0
  842.  
  843. align 4
  844. proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
  845.         OpenDialog_Init dd aOpenDialog_Init
  846.         OpenDialog_Start dd aOpenDialog_Start
  847.         OpenDialog_Set_file_name dd aOpenDialog_Set_file_name
  848.         ;OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext
  849. dd 0,0
  850.         aOpenDialog_Init db 'OpenDialog_init',0
  851.         aOpenDialog_Start db 'OpenDialog_start',0
  852.         aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
  853.         ;aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
  854.  
  855. align 4
  856. import_buf2d:
  857.         init dd sz_init
  858.         buf2d_create dd sz_buf2d_create
  859.         buf2d_create_f_img dd sz_buf2d_create_f_img
  860.         buf2d_clear dd sz_buf2d_clear
  861.         buf2d_draw dd sz_buf2d_draw
  862.         buf2d_delete dd sz_buf2d_delete
  863.         buf2d_resize dd sz_buf2d_resize
  864.         buf2d_line dd sz_buf2d_line
  865.         buf2d_line_sm dd sz_buf2d_line_sm
  866.         buf2d_rect_by_size dd sz_buf2d_rect_by_size
  867.         buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
  868.         buf2d_circle dd sz_buf2d_circle
  869.         buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
  870.         buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
  871.         buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
  872.         buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
  873.         buf2d_bit_blt dd sz_buf2d_bit_blt
  874.         buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
  875.         buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
  876.         buf2d_curve_bezier dd sz_buf2d_curve_bezier
  877.         buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
  878.         buf2d_draw_text dd sz_buf2d_draw_text
  879.         buf2d_crop_color dd sz_buf2d_crop_color
  880.         buf2d_flip_h dd sz_buf2d_flip_h
  881.         buf2d_flip_v dd sz_buf2d_flip_v
  882.         buf2d_offset_h dd sz_buf2d_offset_h
  883.         buf2d_flood_fill dd sz_buf2d_flood_fill
  884.         buf2d_set_pixel dd sz_buf2d_set_pixel
  885.         dd 0,0
  886.         sz_init db 'lib_init',0
  887.         sz_buf2d_create db 'buf2d_create',0
  888.         sz_buf2d_create_f_img db 'buf2d_create_f_img',0
  889.         sz_buf2d_clear db 'buf2d_clear',0
  890.         sz_buf2d_draw db 'buf2d_draw',0
  891.         sz_buf2d_delete db 'buf2d_delete',0
  892.         sz_buf2d_resize db 'buf2d_resize',0
  893.         sz_buf2d_line db 'buf2d_line',0
  894.         sz_buf2d_line_sm db 'buf2d_line_sm',0
  895.         sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
  896.         sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
  897.         sz_buf2d_circle db 'buf2d_circle',0
  898.         sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
  899.         sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
  900.         sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
  901.         sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
  902.         sz_buf2d_bit_blt db 'buf2d_bit_blt',0
  903.         sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
  904.         sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
  905.         sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
  906.         sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
  907.         sz_buf2d_draw_text db 'buf2d_draw_text',0
  908.         sz_buf2d_crop_color db 'buf2d_crop_color',0
  909.         sz_buf2d_flip_h db 'buf2d_flip_h',0
  910.         sz_buf2d_flip_v db 'buf2d_flip_v',0
  911.         sz_buf2d_offset_h db 'buf2d_offset_h',0
  912.         sz_buf2d_flood_fill db 'buf2d_flood_fill',0
  913.         sz_buf2d_set_pixel db 'buf2d_set_pixel',0
  914.  
  915. align 4
  916. import_box_lib:
  917.         dd sz_init1
  918.  
  919.         init_checkbox   dd sz_Init_checkbox
  920.         check_box_draw  dd sz_Check_box_draw
  921.         check_box_mouse dd sz_Check_box_mouse
  922.         ;version_ch     dd sz_Version_ch
  923.  
  924.         option_box_draw  dd sz_Option_box_draw
  925.         option_box_mouse dd sz_Option_box_mouse
  926.         ;version_op      dd sz_Version_op
  927.  
  928.         edit_box_draw      dd sz_edit_box_draw
  929.         edit_box_key       dd sz_edit_box_key
  930.         edit_box_mouse     dd sz_edit_box_mouse
  931.         edit_box_set_text  dd sz_edit_box_set_text
  932.         scrollbar_ver_draw dd sz_scrollbar_ver_draw
  933.         scrollbar_hor_draw dd sz_scrollbar_hor_draw
  934.  
  935.         progressbar_draw     dd sz_progressbar_draw
  936.         progressbar_progress dd sz_progressbar_progress
  937.  
  938.         dd 0,0
  939.         sz_init1 db 'lib_init',0
  940.  
  941.         sz_Init_checkbox   db 'init_checkbox2',0
  942.         sz_Check_box_draw  db 'check_box_draw2',0
  943.         sz_Check_box_mouse db 'check_box_mouse2',0
  944.         ;sz_Version_ch     db 'version_ch2',0
  945.  
  946.         sz_Option_box_draw      db 'option_box_draw',0
  947.         sz_Option_box_mouse     db 'option_box_mouse',0
  948.         ;sz_Version_op      db 'version_op',0
  949.  
  950.         sz_edit_box_draw      db 'edit_box',0
  951.         sz_edit_box_key       db 'edit_box_key',0
  952.         sz_edit_box_mouse     db 'edit_box_mouse',0
  953.         sz_edit_box_set_text  db 'edit_box_set_text',0
  954.         sz_scrollbar_ver_draw db 'scrollbar_v_draw',0
  955.         sz_scrollbar_hor_draw db 'scrollbar_h_draw',0
  956.  
  957.         sz_progressbar_draw     db 'progressbar_draw', 0
  958.         sz_progressbar_progress db 'progressbar_progress', 0
  959.  
  960. align 4
  961. import_libkmenu:
  962.         kmenu_init      dd akmenu_init
  963.         kmainmenu_draw  dd akmainmenu_draw
  964.         kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent
  965.         ksubmenu_new    dd aksubmenu_new
  966.         ksubmenu_delete dd aksubmenu_delete
  967.         ksubmenu_draw   dd aksubmenu_draw
  968.         ksubmenu_add    dd aksubmenu_add
  969.         kmenuitem_new   dd akmenuitem_new
  970.         kmenuitem_delete dd akmenuitem_delete
  971.         kmenuitem_draw  dd akmenuitem_draw
  972. dd 0,0
  973.         akmenu_init     db 'kmenu_init',0
  974.         akmainmenu_draw db 'kmainmenu_draw',0
  975.         akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0
  976.         aksubmenu_new   db 'ksubmenu_new',0
  977.         aksubmenu_delete db 'ksubmenu_delete',0
  978.         aksubmenu_draw  db 'ksubmenu_draw',0
  979.         aksubmenu_add   db 'ksubmenu_add',0
  980.         akmenuitem_new  db 'kmenuitem_new',0
  981.         akmenuitem_delete db 'kmenuitem_delete',0
  982.         akmenuitem_draw  db 'kmenuitem_draw',0
  983.  
  984. button_press  dd 0     ;for kmenu
  985.  
  986. align 4
  987. mouse_dd dd 0
  988. last_time dd 0
  989.  
  990. align 16
  991. sc system_colors
  992.  
  993. align 16
  994. procinfo process_information
  995.  
  996. align 4
  997. buf_0: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  998. .l: dw 15 ;+4 left
  999. .t: dw 50 ;+6 top
  1000. .w: dd 384 ;+8 w
  1001. .h: dd 350 ;+12 h
  1002. .color: dd 0xffffd0 ;+16 color
  1003.         db 24 ;+20 bit in pixel
  1004.  
  1005. align 4
  1006. buf_1:
  1007.         dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  1008.         dd 0 ;+4 left,top
  1009. .w: dd 0
  1010. .h: dd 0,0,24 ;+12 color,bit in pixel
  1011.  
  1012. font_h dd 0 ;¢ëá®â  èà¨äâ 
  1013.  
  1014. ;input:
  1015. ; eax - ç¨á«®
  1016. ; edi - ¡ãä¥à ¤«ï áâப¨
  1017. ; len - ¤«¨­­  ¡ãä¥à 
  1018. ;output:
  1019. align 4
  1020. proc convert_int_to_str uses eax ecx edx edi esi, len:dword
  1021.         mov esi,[len]
  1022.         add esi,edi
  1023.         dec esi
  1024.         call .str
  1025.         ret
  1026. endp
  1027.  
  1028. align 4
  1029. .str:
  1030.         mov ecx,10
  1031.         cmp eax,ecx
  1032.         jb @f
  1033.                 xor edx,edx
  1034.                 div ecx
  1035.                 push edx
  1036.                 ;dec edi  ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  1037.                 call .str
  1038.                 pop eax
  1039.         @@:
  1040.         cmp edi,esi
  1041.         jge @f
  1042.                 or al,0x30
  1043.                 stosb
  1044.                 mov byte[edi],0 ;¢ ª®­¥æ áâப¨ áâ ¢¨¬ 0, çâ®-¡ë ­¥ ¢ë« §¨« ¬ãá®à
  1045.         @@:
  1046.         ret
  1047.  
  1048. align 4
  1049. proc mem_copy uses ecx esi edi, destination:dword, source:dword, len:dword
  1050.         cld
  1051.         mov esi, dword[source]
  1052.         mov edi, dword[destination]
  1053.         mov ecx, dword[len]
  1054.         rep movsb
  1055.         ret
  1056. endp
  1057.  
  1058. edMaxSize = 511
  1059. edMax = 0 ;max, size, pos
  1060.  
  1061. align 4
  1062. editFileName  edit_box 270,450,78, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, fileNameBuffer.data, mouse_dd, 0, edMax, edMax
  1063. editCommand   edit_box 150,450,121, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, commandBuffer.data, mouse_dd, 0, edMax, edMax
  1064.  
  1065. opt1 option_box opt_gr1, 433,64, 6,12,0xd0d0ff, 0xff, 0x80ff,txt_filename,txt_filename.end-txt_filename
  1066. opt2 option_box opt_gr1, 433,107,6,12,0xd0d0ff, 0xff, 0x80ff,txt_command,txt_command.end-txt_command
  1067. opt_gr1 dd opt1
  1068. align 4
  1069. opt_grlist1 dd opt1,opt2,0 ;end option group
  1070.  
  1071. pb:
  1072. .value          dd 0
  1073. .left           dd 0
  1074. .top            dd 0
  1075. .width          dd 0
  1076. .height         dd 0
  1077. .style          dd 0
  1078. .min            dd 0
  1079. .max            dd 0
  1080. .back_color     dd 0
  1081. .progress_color dd 0
  1082. .frame_color    dd 0
  1083.  
  1084. fileNameBuffer:
  1085. .data: rb 512
  1086. .size: rd 1
  1087. fileNameBufferEnd:
  1088.  
  1089. commandBuffer:
  1090. .data: rb 512
  1091. .size: rd 1
  1092. commandBufferEnd:
  1093.  
  1094. align 16
  1095. i_end:
  1096.         rb 2048
  1097. thread_coords:
  1098.         rb 2048
  1099. thread_scale:
  1100.         rb 2048
  1101. thread_n_file:
  1102.         rb 2048
  1103. stacktop:
  1104.         sys_path rb 1024
  1105.         file_name:
  1106.                 rb 1024
  1107.         library_path rb 1024
  1108.         plugin_path rb 4096
  1109.         openfile_path rb 4096
  1110.         filename_area rb 256
  1111.         pi rb 1024
  1112. mem:
  1113.  
  1114.