Subversion Repositories Kolibri OS

Rev

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

  1. use32
  2.         org 0x0
  3.         db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
  4.         dd 0x1
  5.         dd start
  6.         dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
  7.         dd mem
  8.         dd stacktop
  9.         dd 0
  10.         dd sys_path
  11.  
  12. color_border equ 0xff0000
  13. color_s0 equ 0xff ;ᨣ­ « 0
  14. color_s1 equ 0xffffff ;ᨣ­ « 1
  15. color_s2 equ 0xff00 ;â®çª  ¡¥§ ¯¥à¥á¥ç¥­¨ï
  16. color_s3 equ 0xff0000 ;¢à¥¬¥­­®¥ §­ ç¥­¨¥ ¤«ï á®åà ­¥­¨ï
  17. color_caption equ 0x808080
  18.  
  19. ;­®¬ à  ¨ª®­®ª:
  20. el_icon_group equ 0 ;£à㯯®¢ ï
  21. el_icon_points equ 1 ;â®çª¨
  22. el_icon_sub_points equ 2 ;¨§®«ï樨
  23. el_icon_elems equ 3 ;í«¥¬¥­â 
  24. el_icon_captions equ 4 ;¯®¤¯¨á¨
  25.  
  26. size_el_opt equ 34 ;à §¬¥à áâàãªâãàë á ®¯æ¨ï¬¨ í«¥¬¥­â 
  27. el_offs_nam equ 0 ;ᬥ饭¨¥ ¤«ï ­ ç «  ¨¬¥­¨ í«¥¬¥­â 
  28. el_offs_col equ 16 ;梥â í«¥¬¥­â 
  29. el_offs_box_x equ 20 ;è¨à¨­  ª®à®¡ª¨ í«¥¬¥­â 
  30. el_offs_box_y equ 21 ;¢ëá®â  ª®à®¡ª¨ í«¥¬¥­â 
  31. el_offs_table equ 22 ;㪠§ â¥«ì ­  â ¡«¨æã à ¡®âë í«¥¬¥­â 
  32. el_offs_legs_inp equ 26 ;ᬥ饭¨¥ ­  ®¯¨á ­¨¥ ¢å®¤­ëå ­®£
  33. el_offs_legs_out equ 30 ;ᬥ饭¨¥ ­  ®¯¨á ­¨¥ ¢ë室­ëå ­®£
  34.  
  35. sp_offs_el_type equ 9 ;ᬥ饭¨¥ ¤«ï ⨯  í«¥¬¥­â  ¢ ᯨ᪥
  36.  
  37. points_max equ 1000
  38. capt_offs equ 10 ;ᬥ饭¨¥ ¤«ï ­ ç «  ¯®¤¯¨á¨ ¢ «¨á⥠tree1
  39.  
  40. include '../../../macros.inc'
  41. include '../../../proc32.inc'
  42. include '../../../develop/libraries/box_lib/load_lib.mac'
  43. include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
  44. include 'mem.inc'
  45. include 'dll.inc'
  46. include 'le_pole.inc'
  47. include 'le_signal.inc'
  48.  
  49. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  50. caption db '‹®£¨ç¥áª¨¥ í«¥¬¥­âë 20.03.12',0 ;¯®¤¯¨áì ®ª­ 
  51.  
  52. panel_0_coord_top equ 5 ;¢¥àå­ïï ª®®à¤¨­ â  0-£® à鸞 ¯ ­¥«¨ ¨­áâà㬥­â®¢
  53. panel_1_coord_top equ 35
  54. panel_2_coord_top equ 60
  55. panel_3_coord_top equ 85
  56.  
  57. align 4
  58. proc move_rotate_x_n90 uses ecx edi, d_x:dword, angle:dword
  59.         mov edi,[angle] ;㣮« ¯®¢®à®â  / 90 (®â 0-3)
  60.         and edi,3
  61.         shl edi,4 ;edi*=16
  62.         add edi,mcs
  63.  
  64.         mov ecx,[d_x]
  65.         imul ecx,dword[edi]
  66.         add eax,ecx
  67.  
  68.         mov ecx,[d_x]
  69.         imul ecx,dword[edi+8]
  70.         add ebx,ecx
  71.  
  72.         ret
  73. endp
  74.  
  75. struct FileInfoBlock
  76.         Function dd ?
  77.         Position dd ?
  78.         Flags    dd ?
  79.         Count    dd ?
  80.         Buffer   dd ?
  81.                 db ?
  82.         FileName dd ?
  83. ends
  84.  
  85. macro elOpt nam,col,box_x,box_y,table, il0, il1, il2, ol0, ol1, ol2
  86. {
  87.         @@: db nam
  88.         rb @b+16-$
  89.         dd col
  90.         db box_x
  91.         db box_y
  92.         dd table+0 ;+el_offs_table
  93. ;+26
  94.         db il0+0 ;0-ï ¢å®¤­ ï ­®£ 
  95.         db il1+0 ;1-ï ¢å®¤­ ï ­®£ 
  96.         db il2+0
  97.         db 0
  98. ;+30
  99.         db ol0+0
  100.         db ol1+0
  101.         db ol2+0
  102.         db 0
  103. }
  104.  
  105. align 4
  106. el_opt_beg:
  107. elOpt 'or[2]', 0xff00ff,5,5,tbl_or, 1,2,, 2
  108. elOpt 'or[3]', 0xff00ff,5,7,tbl_or, 1,2,2, 3
  109. elOpt 'and[2]',0xffff00,5,5,tbl_and.2, 1,2,, 2
  110. elOpt 'and[3]',0xffff00,5,7,tbl_and.3, 1,2,2, 3
  111. elOpt 'not',   0xffff,3,3,tbl_not, 1,,, 1
  112. elOpt 'xor',   0x8000ff,5,5,tbl_xor, 1,2,, 2
  113. elOpt 'sm[1]', 0x8080ff,7,7,tbl_sm, 1,2,2, 1,4
  114. .end:
  115. elOpt '???', 0x808080,3,3,tbl_and.3, 1,,, 1 ;­¥ ®¯®§­ ­­ë© í«¥¬¥­â
  116.  
  117. ;â ¡«¨æë ¯® ª®â®àë¬ § ¤ îâáï ¯à ¢¨«  à ¡®âë í«¥¬¥­â®¢
  118. align 4
  119. tbl_or db 0,1,1,1, 1,1,1,1 ;or2, or3
  120. tbl_and:
  121. .3: db 0,0,0,0
  122. .2: db 0,0,0,1
  123. tbl_xor db 0,1,1,0
  124. tbl_sm db 0,2,2,1, 2,1,1,3
  125. tbl_not db 1,0 ;not
  126.  
  127. time dd 0
  128. tim_ch db 0
  129. pen_mode dd 0 ;०¨¬ à¨á®¢ ­¨ï ¯à®¢®¤ 
  130. pen_coord_x dd 0 ;ª®®à¤¨­ â  x ­ ç «ì­®© â®çª¨ à¨á®¢ ­¨ï
  131. pen_coord_y dd 0
  132.  
  133. txt_set_0 db '0',0
  134. txt_set_1 db '1',0
  135. ;txt_mov_l db 27,0 ;<-
  136. ;txt_mov_r db 26,0 ;->
  137.  
  138. txt_size db 'size',0
  139. txt_elements db 'elements',0
  140. txt_points db 'points',0
  141. txt_sub_points db 'subpoints',0
  142. txt_captions db 'captions',0
  143.  
  144. ;¬ âà¨æ  ª®á¨­ãᮢ ¨ ᨭãᮢ, ¨á¯®«ì§ã¥¬ ï ¤«ï ¯®¢®à®â®¢ ᨣ­ «®¢ ¨ í«¥¬¥­â®¢
  145. align 4
  146. mcs dd 1, 0, 0, 1,\
  147.            0, 1,-1, 0,\
  148.           -1, 0, 0,-1,\
  149.            0,-1, 1, 0
  150.  
  151. run_file_70 FileInfoBlock
  152. image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  153.  
  154. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  155. IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*20
  156. image_data_toolbar dd 0
  157.  
  158. TREE_ICON_SYS16_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*11+54 ;à §¬¥à bmp ä ©«  á á¨á⥬­ë¬¨ ¨ª®­ª ¬¨
  159. icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
  160. TOOLBAR_ICON_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*5+54 ;à §¬¥à bmp ä ©«  á ¨ª®­ª ¬¨ ®¡ê¥ªâ®¢
  161. icon_toolbar dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï ¨ª®­®ª ®¡ê¥ªâ®¢
  162.  
  163. IMAGE_FONT_SIZE equ 128*144*3
  164. image_data_gray dd 0 ;¯ ¬ïâì á ¢à¥¬¥­­ë¬¨ á¥à묨 ¨§®¡à ¦¥­¨ï¬¨ ¢ ä®à¬ â¥ 24-bit, ¨§ ª®â®àëå ¡ã¤ãâ ᮧ¤ ¢ âìáï âà ä à¥âë
  165.  
  166. cursors_count equ 4
  167. IMAGE_CURSORS_SIZE equ 4096*cursors_count ;à §¬¥à ª à⨭ª¨ á ªãàá®à ¬¨
  168.  
  169. macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
  170.         ;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
  171.         if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
  172.                 jmp @f
  173.                         local .path_str
  174.                         .path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
  175.                         db 0
  176.                 @@:
  177.                 ;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
  178.                 copy_path .path_str,[32],file_name,0x0
  179.         else
  180.                 copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
  181.         end if
  182.  
  183.         stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
  184.         mov [buf],eax
  185.  
  186.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  187.         mov [run_file_70.Function], 0
  188.         mov [run_file_70.Position], 0
  189.         mov [run_file_70.Flags], 0
  190.         mov [run_file_70.Count], dword size
  191.         m2m [run_file_70.Buffer], [buf]
  192.         mov byte[run_file_70+20], 0
  193.         mov [run_file_70.FileName], file_name
  194.         mov ebx,run_file_70
  195.         int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  196.         cmp ebx,0xffffffff
  197.         je @f
  198.                 ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
  199.                 stdcall dword[img_decode], dword[buf],ebx,0
  200.                 mov dword[image_data],eax
  201.                 ;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
  202.                 stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
  203.                 ;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
  204.                 stdcall dword[img_destroy], dword[image_data]
  205.         @@:
  206. }
  207.  
  208.  
  209.  
  210. align 4
  211. start:
  212.         load_libraries l_libs_start,l_libs_end
  213.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
  214.         mov     ebp,lib_7
  215.         cmp     dword [ebp+ll_struc_size-4],0
  216.         jz      @f
  217.                 mcall -1 ;exit not correct
  218.         @@:
  219.         mcall 48,3,sc,sizeof.system_colors
  220.         mcall 40,0x27
  221.         stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
  222.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
  223.         load_image_file 'toolbar.png', image_data_toolbar,IMAGE_TOOLBAR_SIZE
  224.  
  225.         stdcall pole_init, pole
  226.         stdcall dword[tl_data_init], tree1
  227.  
  228.         ;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list
  229.         load_image_file 'tl_sys_16.png', icon_tl_sys,TREE_ICON_SYS16_BMP_SIZE
  230.         ;¥á«¨ ¨§®¡à ¦¥­¨¥ ­¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ
  231.         ;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à 
  232.         mov eax,dword[icon_tl_sys]
  233.         mov dword[tree1.data_img_sys],eax
  234.  
  235.         load_image_file 'objects.png', icon_toolbar,TOOLBAR_ICON_BMP_SIZE
  236.         mov eax,dword[icon_toolbar]
  237.         mov dword[tree1.data_img],eax
  238.  
  239.         ;*** § £à㧪  èà¨äâ 
  240.         load_image_file 'font6x9.bmp', image_data_gray,IMAGE_FONT_SIZE
  241.         stdcall [buf2d_create_f_img], buf_font,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
  242.         stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
  243.  
  244.         stdcall [buf2d_conv_24_to_8], buf_font,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
  245.         stdcall [buf2d_convert_text_matrix], buf_font
  246.  
  247.         ;*** § £à㧪  ªãàá®à®¢
  248.         load_image_file 'cursors_gr.png',image_data_gray,IMAGE_CURSORS_SIZE
  249.         stdcall [buf2d_create_f_img], buf_curs_8,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
  250.         stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
  251.  
  252.         load_image_file 'cursors.png',image_data_gray, IMAGE_CURSORS_SIZE
  253.         stdcall [buf2d_create_f_img], buf_curs,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
  254.         stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
  255.  
  256.         stdcall [buf2d_conv_24_to_8], buf_curs_8,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8¡¨â
  257.         stdcall [buf2d_conv_24_to_32],buf_curs,buf_curs_8 ;¤¥« ¥¬ ¡ãä¥à rgba 32¡¨â
  258.  
  259.         stdcall sign_init, 3000
  260.  
  261.         mcall 26,9
  262.         mov [last_time],eax
  263.  
  264. align 4
  265. red_win:
  266.         call draw_window
  267.  
  268. align 4
  269. still:
  270.         mcall 26,9
  271.         mov ebx,[last_time]
  272.         add ebx,10 ;§ ¤¥à¦ª 
  273.         cmp ebx,eax
  274.         jge @f
  275.                 mov ebx,eax
  276.         @@:
  277.         sub ebx,eax
  278.         ;cmp ebx,10 ;§ ¤¥à¦ª 
  279.         ;ja timer_funct
  280.         ;test ebx,ebx
  281.         ;jz timer_funct
  282.         mcall 23
  283.         cmp eax,0
  284.         je timer_funct
  285.  
  286.         cmp al,1
  287.         jz red_win
  288.         cmp al,EV_KEY
  289.         jz key
  290.         cmp al,3
  291.         jz button
  292.         cmp al,EV_MOUSE
  293.         jne @f
  294.                 call mouse
  295.         @@:
  296.         jmp still
  297.  
  298. align 4
  299. timer_funct:
  300.         pushad
  301.         mcall 26,9
  302.         mov [last_time],eax
  303.  
  304.         cmp byte[tim_ch],0
  305.         je @f
  306.                 inc dword[time]
  307.                 call sign_move
  308.                 mov eax,[time]
  309.                 and eax,11b ;ªà â­®áâì 4-¬
  310.                 jnz @f
  311.                         call sign_from_elems
  312.                         call sign_from_captions
  313.         @@:
  314.  
  315.         popad
  316.         jmp still
  317.  
  318. align 4
  319. mouse:
  320.         stdcall [tl_mouse], tree1
  321.  
  322.         push eax ebx ecx edx
  323.         mcall 37,2 ;­ ¦ âë¥ ª­®¯ª¨ ¬ëè¨
  324.         bt eax,0 ;«¥¢ ï ª­®¯ª  ­ ¦ â ?
  325.         jc @f
  326.                 xor eax,eax
  327.                 mov [pen_coord_x],eax
  328.                 mov [pen_coord_y],eax
  329.                 jmp .end_buf_wnd
  330.         @@:
  331.  
  332.         mcall 37,1 ;eax = (x shl 16) + y
  333.         cmp ax,word[buf_0.t]
  334.         jl .end_buf_wnd ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
  335.  
  336.         mov ebx,eax
  337.         shr ebx,16
  338.         cmp bx,word[buf_0.l]
  339.         jl .end_buf_wnd ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
  340.  
  341.                 and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
  342.                 sub ax,word[buf_0.t]
  343.                 sub bx,word[buf_0.l]
  344.                 ;*** ¤¥«¥­¨¥ ­  zoom
  345.                 movzx ecx,byte[zoom]
  346.                 xor edx,edx
  347.                 div ecx
  348.                 xchg eax,ebx ;ebx ¤¥«¨¬ ­  ecx
  349.                 xor edx,edx
  350.                 div ecx
  351.  
  352.                 sub eax,[Cor_x]
  353.                 sub ebx,[Cor_y]
  354.  
  355.                 ;*** ¯à®¢¥àª  ­  ¯®¯ ¤¥­¨¥ ¢ á奬ã
  356.                 bt eax,31
  357.                 jc .end_buf_wnd
  358.                 bt ebx,31
  359.                 jc .end_buf_wnd
  360.                 cmp eax,[shem_w]
  361.                 jge .end_buf_wnd
  362.                 cmp ebx,[shem_h]
  363.                 jge .end_buf_wnd
  364.  
  365.                 cmp byte[pen_mode],1
  366.                 jne .end_mode_1
  367.                         ;०¨¬ à¨á®¢ ­¨ï ¯à®¢®¤ 
  368.                         cmp dword[pen_coord_x],0
  369.                         jne @f
  370.                         cmp dword[pen_coord_y],0
  371.                         jne @f
  372.                                 mov [pen_coord_x],eax
  373.                                 mov [pen_coord_y],ebx
  374.                         @@:
  375.  
  376.                         cmp dword[pen_coord_x],eax
  377.                         je .beg_draw
  378.                         cmp dword[pen_coord_y],ebx
  379.                         je .beg_draw
  380.  
  381.                         mov ecx,eax
  382.                         sub ecx,[pen_coord_x]
  383.                         bt ecx,31
  384.                         jnc @f
  385.                                 neg ecx
  386.                                 inc ecx
  387.                         @@:
  388.                         mov edx,ebx
  389.                         sub edx,[pen_coord_y]
  390.                         bt edx,31
  391.                         jnc @f
  392.                                 neg edx
  393.                                 inc edx
  394.                         @@:
  395.                         cmp ecx,edx
  396.                         jl @f
  397.                                 mov ebx,[pen_coord_y] ;¯à¨¢ï§ª  ª ª®®à¤¨­ â¥ y
  398.                                 jmp .beg_draw
  399.                         @@:
  400.                         mov eax,[pen_coord_x] ;¯à¨¢ï§ª  ª ª®®à¤¨­ â¥ x
  401.  
  402.                         .beg_draw:
  403.                         stdcall pole_cell_creat, pole,eax,ebx,0
  404.                         ;­¨ç¥£® ­¥ ã¡à «®áì redraw_pole ­¥ ¯®¤å®¤¨â, â. ª. ç¨áâ¨âì ¯®«¥ ­¥ ­ã¦­®
  405.                         stdcall pole_paint, pole
  406.                         stdcall [buf2d_draw], buf_0
  407.                         ;stdcall but_test_pole, pole
  408.                         jmp .end_buf_wnd
  409.                 .end_mode_1:
  410.                 cmp byte[pen_mode],2
  411.                 jne @f
  412.                         ;०¨¬ à¨á®¢ ­¨ï ¨§®«ï樨 ¤«ï ¯à®¢®¤ 
  413.                         stdcall pole_cell_creat, pole,eax,ebx,2
  414.                         stdcall pole_paint, pole
  415.                         stdcall [buf2d_draw], buf_0
  416.                         ;stdcall but_test_pole, pole
  417.                         jmp .end_buf_wnd
  418.                 @@:
  419.                 cmp byte[pen_mode],3
  420.                 jne @f
  421.                         ;०¨¬ áâ¨à ­¨ï ¯à®¢®¤ 
  422.                         stdcall pole_cell_delete, pole,eax,ebx
  423.                         call redraw_pole
  424.                         ;stdcall but_test_pole, pole
  425.                         jmp .end_buf_wnd
  426.                 @@:
  427.                 cmp byte[pen_mode],4
  428.                 jne @f
  429.                         ;०¨¬ ᮧ¤ ­¨ï í«¥¬¥­â®¢
  430.                         stdcall shem_element_creat, eax,ebx
  431.                         stdcall pole_paint, pole
  432.                         stdcall [buf2d_draw], buf_0
  433.                         jmp .end_buf_wnd
  434.                 @@:
  435.  
  436.         .end_buf_wnd:
  437.         pop edx ecx ebx eax
  438.         ret
  439.  
  440. align 4
  441. draw_window:
  442. pushad
  443.         mcall 12,1
  444.  
  445.         ; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
  446.         xor eax,eax
  447.         mov ebx,(20 shl 16)+520
  448.         mov ecx,(20 shl 16)+415
  449.         mov edx,[sc.work]
  450.         or  edx,(3 shl 24)+0x10000000+0x20000000
  451.         mov edi,caption
  452.         int 0x40
  453.  
  454.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
  455.         mov eax,8
  456.         mov ebx,(5 shl 16)+20
  457.         mov ecx,(panel_0_coord_top shl 16)+20
  458.         mov edx,3
  459.         mov esi,[sc.work_button]
  460.         int 0x40
  461.  
  462.         mov ebx,(30 shl 16)+20
  463.         mov edx,4
  464.         int 0x40
  465.  
  466.         mov ebx,(55 shl 16)+20
  467.         mov edx,5
  468.         int 0x40
  469.  
  470.         mov ebx,(85 shl 16)+20
  471.         mov edx,6
  472.         int 0x40
  473.  
  474.         mov ebx,(110 shl 16)+20
  475.         mov edx,7
  476.         int 0x40
  477.  
  478.         mov ebx,(135 shl 16)+20
  479.         mov edx,8
  480.         int 0x40
  481.  
  482.         mov ebx,(160 shl 16)+20
  483.         mov edx,9
  484.         int 0x40
  485.  
  486.         mov ebx,(185 shl 16)+20
  487.         mov edx,10
  488.         int 0x40
  489.  
  490.         mov ebx,(210 shl 16)+20
  491.         mov edx,11
  492.         int 0x40
  493.  
  494.         mov ebx,(235 shl 16)+20
  495.         mov edx,12
  496.         int 0x40
  497.  
  498.         mov ebx,(265 shl 16)+20
  499.         mov edx,13
  500.         int 0x40
  501.  
  502.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  503.         mov eax,7
  504.         mov ebx,[image_data_toolbar]
  505.         mov ecx,(16 shl 16)+16
  506.         mov edx,(7 shl 16)+panel_0_coord_top+2 ;icon new
  507.         int 0x40
  508.  
  509.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  510.         add edx,(25 shl 16) ;icon open
  511.         int 0x40
  512.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  513.         add edx,(25 shl 16) ;icon save
  514.         int 0x40
  515.  
  516.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  517.         add edx,(30 shl 16) ;+
  518.         int 0x40
  519.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  520.         add edx,(25 shl 16) ;-
  521.         int 0x40
  522.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  523.         add edx,(25 shl 16) ;
  524.         int 0x40
  525.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  526.         add edx,(25 shl 16) ;m
  527.         int 0x40
  528.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  529.         add edx,(25 shl 16) ;m
  530.         int 0x40
  531.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  532.         add edx,(25 shl 16) ;m
  533.         int 0x40
  534.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  535.         add edx,(25 shl 16) ;m
  536.         int 0x40
  537.  
  538.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  539.         add edx,(30 shl 16) ;center
  540.         int 0x40
  541.  
  542.         ; *** à¨á®¢ ­¨¥ ¡ãä¥à  ***
  543.         stdcall [buf2d_draw], buf_0
  544.         mov dword[wScrObj.all_redraw],1
  545.         stdcall [tl_draw], tree1
  546.         stdcall pole_draw_pok, pole
  547.  
  548.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ãáâ ­®¢ª¨ ᨣ­ «®¢ set_0 ¨ set_1 ***
  549.         mov eax,8
  550.         mov ebx,(5 shl 16)+20
  551.         mov ecx,(panel_1_coord_top shl 16)+20
  552.         mov edx,20
  553.         mov esi,[sc.work_button]
  554.         int 0x40
  555.  
  556.         add ebx,25 shl 16
  557.         mov edx,21
  558.         int 0x40
  559.  
  560.         add ebx,30 shl 16
  561.         mov edx,22
  562.         int 0x40
  563.  
  564.         add ebx,25 shl 16
  565.         mov edx,23
  566.         int 0x40
  567.  
  568.         add ebx,25 shl 16
  569.         mov edx,24
  570.         int 0x40
  571.  
  572.         add ebx,25 shl 16
  573.         mov edx,25
  574.         int 0x40
  575.  
  576.         mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
  577.         mov ebx,(10 shl 16)+panel_1_coord_top+5
  578.         mov ecx,[sc.work_text]
  579.         or  ecx,0x80000000 ;or (1 shl 30)
  580.         mov edx,txt_set_0
  581.         ;mov edi,[sc.work]
  582.         int 0x40
  583.  
  584.         add ebx,25 shl 16
  585.         mov edx,txt_set_1
  586.         int 0x40
  587.  
  588.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  589.         mov eax,7
  590.         mov ebx,[image_data_toolbar]
  591.         mov ecx,(16 shl 16)+16
  592.         mov edx,(62 shl 16)+panel_1_coord_top+2
  593.  
  594.         add ebx,IMAGE_TOOLBAR_ICON_SIZE*16
  595.         int 0x40
  596.  
  597.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  598.         add edx,(25 shl 16)
  599.         int 0x40
  600.  
  601.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  602.         add edx,(25 shl 16)
  603.         int 0x40
  604.  
  605.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  606.         add edx,(25 shl 16)
  607.         int 0x40
  608.  
  609.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª à¨á®¢ ­¨ï ¯à®¢®¤  ***
  610.         mov eax,8
  611.         mov ebx,(5 shl 16)+20
  612.         mov ecx,(panel_2_coord_top shl 16)+20
  613.         mov edx,30
  614.         mov esi,[sc.work_button]
  615.         int 0x40
  616.  
  617.         add ebx,25 shl 16
  618.         mov edx,31
  619.         int 0x40
  620.  
  621.         add ebx,25 shl 16
  622.         mov edx,32
  623.         int 0x40
  624.  
  625.         add ebx,25 shl 16
  626.         mov edx,33
  627.         int 0x40
  628.  
  629.         add ebx,25 shl 16
  630.         mov edx,34
  631.         int 0x40
  632.  
  633.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  634.         mov eax,7
  635.         mov ebx,[image_data_toolbar]
  636.         mov ecx,(16 shl 16)+16
  637.         mov edx,(7 shl 16)+panel_2_coord_top+2 ;¨ª®­ª  áâ५ 
  638.  
  639.         add ebx,IMAGE_TOOLBAR_ICON_SIZE*11
  640.         int 0x40
  641.  
  642.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  643.         add edx,(25 shl 16) ;icon pen 1
  644.         int 0x40
  645.  
  646.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  647.         add edx,(25 shl 16) ;icon pen 2
  648.         int 0x40
  649.  
  650.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  651.         add edx,(25 shl 16) ;icon pen 3
  652.         int 0x40
  653.  
  654.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  655.         add edx,(25 shl 16) ;icon add elemet
  656.         int 0x40
  657.  
  658.         mcall 12,2
  659. popad
  660.         ret
  661.  
  662. align 4
  663. key:
  664.         mcall 2
  665.         stdcall [tl_key], dword tree1
  666.         jmp still
  667.  
  668.  
  669. align 4
  670. button:
  671.         mcall 17
  672.         cmp ah,3
  673.         jne @f
  674.                 call but_new_file
  675.         @@:
  676.         cmp ah,4
  677.         jne @f
  678.                 call but_open_file
  679.         @@:
  680.         cmp ah,5
  681.         jne @f
  682.                 call but_save_file
  683.         @@:
  684.         cmp ah,6
  685.         jne @f
  686.                 call but_run_stop
  687.         @@:
  688.         cmp ah,7
  689.         jne @f
  690.                 call but_zoom_p
  691.         @@:
  692.         cmp ah,8
  693.         jne @f
  694.                 call but_zoom_m
  695.         @@:
  696.         cmp ah,9
  697.         jne @f
  698.                 call but_pole_left
  699.         @@:
  700.         cmp ah,10
  701.         jne @f
  702.                 call but_pole_right
  703.         @@:
  704.         cmp ah,11
  705.         jne @f
  706.                 call but_pole_up
  707.         @@:
  708.         cmp ah,12
  709.         jne @f
  710.                 call but_pole_dn
  711.         @@:
  712.         cmp ah,13
  713.         jne @f
  714.                 call but_center
  715.         @@:
  716.         cmp ah,20
  717.         jne @f
  718.                 call but_set_0
  719.         @@:
  720.         cmp ah,21
  721.         jne @f
  722.                 call but_set_1
  723.         @@:
  724.         cmp ah,22
  725.         jne @f
  726.                 call but_mov_l
  727.         @@:
  728.         cmp ah,23
  729.         jne @f
  730.                 call but_mov_r
  731.         @@:
  732.         cmp ah,24
  733.         jne @f
  734.                 call but_mov_u
  735.         @@:
  736.         cmp ah,25
  737.         jne @f
  738.                 call but_mov_d
  739.         @@:
  740.         cmp ah,30
  741.         jne @f
  742.                 call but_set_none
  743.         @@:
  744.         cmp ah,31
  745.         jne @f
  746.                 stdcall set_pen_mode,1,0 ;ãáâ ­®¢ª  ०¨¬  à¨á®¢ ­¨ï ¯à®¢®¤ 
  747.         @@:
  748.         cmp ah,32
  749.         jne @f
  750.                 stdcall set_pen_mode,2,1
  751.         @@:
  752.         cmp ah,33
  753.         jne @f
  754.                 stdcall set_pen_mode,3,2 ;ãáâ ­®¢ª  ०¨¬  áâ¨à ­¨ï ¯à®¢®¤ 
  755.         @@:
  756.         cmp ah,34
  757.         jne @f
  758.                 stdcall set_pen_mode,4,3 ;ãáâ ­®¢ª  ०¨¬  ᮧ¤ ­¨ï í«¥¬¥­â®¢
  759.         @@:
  760.         cmp ah,1
  761.         jne still
  762. .exit:
  763.         stdcall [buf2d_delete],buf_0
  764.         stdcall [buf2d_delete],buf_font
  765.         stdcall [buf2d_delete],buf_curs
  766.         stdcall mem.Free,[image_data_toolbar]
  767.         stdcall pole_delete, pole
  768.         call sign_delete
  769.         stdcall [tl_data_clear], tree1
  770.         cmp [cursor_pointer],0
  771.         je @f
  772.                 mcall 37,6,[cursor_pointer]
  773.         @@:
  774.         mcall -1
  775.  
  776. ;ᮧ¤ ­¨¥ ­®¢®© á奬ë
  777. align 4
  778. proc but_new_file uses eax
  779.         call but_set_none
  780.         stdcall [tl_info_clear],tree1
  781.         stdcall [tl_draw],tree1
  782.         xor eax,eax
  783.         mov [shem_elems],eax
  784.         mov [shem_captions],eax
  785.         stdcall pole_clear, pole
  786.         call redraw_pole
  787.         ret
  788. endp
  789.  
  790. align 4
  791. f_size dd 0 ;à §¬¥à ®âªà뢠¥¬®£® ä ©« 
  792. shem_w dd 192 ;è¨à¨­  á奬ë
  793. shem_h dd 128 ;¢ëá®â  á奬ë
  794. shem_points dd 0 ;ª®««¨ç¥á⢮ 㧫®¢ ­  á奬¥
  795. shem_sub_points dd 0 ;ª®««¨ç¥á⢮ ¨§®«¨à®¢ ­­ëå 㧫®¢ ­  á奬¥
  796. shem_elems dd 0 ;ª®««¨ç¥á⢮ í«¥¬¥­â®¢ ­  á奬¥
  797. shem_captions dd 0
  798. shem_colors:
  799.         dd color_s0, color_s1, color_s2, color_s3
  800.  
  801. align 4
  802. open_file_lif:
  803.         rb 2*4096 ;®¡« áâì ¤«ï ®âªàëâ¨ï ä ©«®¢
  804. .end:
  805.  
  806. align 4
  807. but_open_file:
  808.         pushad
  809.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  810.         mov [OpenDialog_data.type],0
  811.         stdcall [OpenDialog_Start],OpenDialog_data
  812.         cmp [OpenDialog_data.status],2
  813.         je .end_open_file
  814.         ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  815.  
  816.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  817.         mov [run_file_70.Function], 0
  818.         mov [run_file_70.Position], 0
  819.         mov [run_file_70.Flags], 0
  820.         mov dword[run_file_70.Count], open_file_lif.end-open_file_lif
  821.         m2m [run_file_70.Buffer], open_file_lif
  822.         mov byte[run_file_70+20], 0
  823.         mov dword[run_file_70.FileName], openfile_path
  824.         mov ebx,run_file_70
  825.         int 0x40 ;§ £à㦠¥¬ ä ©«
  826.         cmp ebx,0xffffffff
  827.         je .end_open_file
  828.  
  829.                 mov dword[f_size],ebx
  830.                 add ebx,open_file_lif
  831.                 mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬
  832.                 mcall 71,1,openfile_path
  833.                 ;---
  834.  
  835.                 ;§ ¤ ¥¬ ¬¨­¨¬ «ì­ë¥ §­ ç¥­¨ï, ­  á«ãç © ¥á«¨ ¢ ä ©«¥ ¡ã¤ãâ ­¥ª®à¥ªâ­ë¥ à §¬¥àë
  836.                 mov dword[shem_w],5
  837.                 mov dword[shem_h],5
  838.  
  839.                 mov esi,txt_size
  840.                 call str_analiz_r
  841.                 cmp edi,0
  842.                 je @f
  843.                         stdcall str_len,esi
  844.                         add edi,eax
  845.                         stdcall conv_str_to_int,edi
  846.                         cmp eax,5
  847.                         jl @f ;®è¨¡ª  ¢ ä ©«¥ (­  .end_open_file ­¥ ¯¥à¥å®¤¨¬, ¯ëâ ¥¬áï ¯à®ç¨â âì ¤àã£ãî ¨­ä®à¬ æ¨î)
  848.                         mov dword[shem_w],eax
  849.  
  850.                         call str_next_val
  851.                         stdcall conv_str_to_int,edi
  852.                         cmp eax,5
  853.                         jl @f ;®è¨¡ª  ¢ ä ©«¥
  854.                         mov dword[shem_h],eax
  855.                 @@:
  856.  
  857.                 stdcall [tl_info_clear],tree1
  858.  
  859.                 ;*** ¤®¡ ¢«¥­¨¥ ¢ ᯨ᮪ «®£¨ç¥áª¨å í«¥¬¥­â®¢ ***
  860.                 stdcall [tl_node_add], txt_elements-capt_offs,(el_icon_group shl 16), tree1
  861.                 stdcall [tl_cur_next], tree1
  862.  
  863.                 mov esi,txt_elements
  864.                 call str_analiz_r
  865.                 cmp edi,0
  866.                 je .end_elems
  867.                         stdcall str_len,esi
  868.                         add edi,eax
  869.                         stdcall conv_str_to_int,edi
  870.                         cmp eax,0
  871.                         jle .end_elems ;¥á«¨ ç¨á«® í«¥¬¥­â®¢ = 0
  872.                         mov [shem_elems],eax
  873.                         mov ecx,eax
  874.                         .cycle_elem:
  875.                                 call str_next_val
  876.                                 stdcall conv_str_to_int,edi
  877.                                 mov dword[txt_buf],eax ;ª®®à¤¨­ â  x
  878.                                 call str_next_val
  879.                                 stdcall conv_str_to_int,edi
  880.                                 mov dword[txt_buf+4],eax ;ª®®à¤¨­ â  y
  881.                                 call str_next_val
  882.                                 stdcall conv_str_to_int,edi
  883.                                 mov byte[txt_buf+8],al ;­ ¯à ¢«¥­¨¥
  884.                                 call str_next_val
  885.                                 ;¯®  ¤à¥áã edi ­ §¢ ­¨¥ í«¥¬¥­â 
  886.                                 stdcall el_get_name, edi
  887.                                 mov byte[txt_buf+sp_offs_el_type],al ;⨯ í«¥¬¥­â 
  888.  
  889.                                 stdcall make_list_capts,txt_buf,edi
  890.  
  891.                                 stdcall [tl_node_add], txt_buf,(el_icon_elems shl 16)+1, tree1
  892.                                 stdcall [tl_cur_next], tree1
  893.                                 dec ecx
  894.                                 jnz .cycle_elem
  895.                 .end_elems:
  896.  
  897.                 ;*** ¤®¡ ¢«¥­¨¥ ¢ ᯨ᮪ ⥪á⮢ëå ¯®¤¯¨á¥© ***
  898.                 stdcall [tl_node_add], txt_captions-capt_offs,(el_icon_group shl 16), tree1
  899.                 stdcall [tl_cur_next], tree1
  900.  
  901.                 mov esi,txt_captions
  902.                 call str_analiz_r
  903.                 cmp edi,0
  904.                 je .end_captions
  905.                         stdcall str_len,esi
  906.                         add edi,eax
  907.                         stdcall conv_str_to_int,edi
  908.                         cmp eax,0
  909.                         jle .end_captions ;¥á«¨ ç¨á«® ¯®¤¯¨á¥© = 0
  910.                         mov [shem_captions],eax
  911.                         mov ecx,eax
  912.                         .cycle_captions:
  913.                                 call str_next_val
  914.                                 stdcall conv_str_to_int,edi
  915.                                 mov dword[txt_buf],eax ;ª®®à¤¨­ â  x
  916.                                 call str_next_val
  917.                                 stdcall conv_str_to_int,edi
  918.                                 mov dword[txt_buf+4],eax ;ª®®à¤¨­ â  y
  919.                                 call str_next_val
  920.                                 mov al,byte[edi]
  921.                                 mov byte[txt_buf+8],al ;¢¨¤ ¯®¤¯¨á¨ ('z' - ᨣ­ « á 0, 'o' - ᨣ­ « á 1, 'n' - ­¥â ᨣ­ « )
  922.                                 call str_next_val
  923.  
  924.                                 stdcall make_list_capts,txt_buf,edi
  925.  
  926.                                 stdcall [tl_node_add], txt_buf,(el_icon_captions shl 16)+1, tree1
  927.                                 stdcall [tl_cur_next], tree1
  928.                                 dec ecx
  929.                                 jnz .cycle_captions
  930.                 .end_captions:
  931.  
  932.                 mov byte[txt_buf+capt_offs],0 ;®¡­ã«¥­¨¥ ¯®¤¯¨á¥©
  933.  
  934.                 ;*** ¤®¡ ¢«¥­¨¥ ¢ ᯨ᮪ ª«î祢ëå â®ç¥ª ***
  935.                 stdcall [tl_node_add], txt_points-capt_offs,(el_icon_group shl 16), tree1
  936.                 stdcall [tl_cur_next], tree1
  937.  
  938.                 mov dword[shem_points],0
  939.                 mov esi,txt_points
  940.                 call str_analiz_r
  941.                 cmp edi,0
  942.                 je .end_points ;¥á«¨ ®¯¨á ­¨ï â®ç¥ª ­¥â ¢ ä ©«¥
  943.                         stdcall str_len,esi
  944.                         add edi,eax
  945.                         stdcall conv_str_to_int,edi
  946.                         cmp eax,0
  947.                         jle .end_points ;¥á«¨ ç¨á«® â®ç¥ª = 0
  948.                         mov [shem_points],eax
  949.                         mov ecx,eax
  950.                         .cycle_poi:
  951.                                 call str_next_val
  952.                                 stdcall conv_str_to_int,edi
  953.                                 mov dword[txt_buf],eax ;ª®®à¤¨­ â  x
  954.                                 call str_next_val
  955.                                 stdcall conv_str_to_int,edi
  956.                                 mov dword[txt_buf+4],eax ;ª®®à¤¨­ â  y
  957.                                 call str_next_val
  958.                                 stdcall conv_str_to_int,edi
  959.                                 mov byte[txt_buf+8],al ;­ ¯à ¢«¥­¨ï
  960.  
  961. ;                               stdcall make_list_capts,txt_buf,0
  962.  
  963.                                 stdcall [tl_node_add], txt_buf,(el_icon_points shl 16)+1, tree1
  964.                                 stdcall [tl_cur_next], tree1
  965.                                 dec ecx
  966.                                 jnz .cycle_poi
  967.                 .end_points:
  968.  
  969.                 stdcall [tl_cur_beg], tree1
  970.  
  971.         ;*** ¤®¡ ¢«¥­¨¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢ ***
  972.         stdcall pole_clear, pole
  973.         stdcall dword[tl_node_poi_get_info],0,tree1
  974.         pop esi
  975.         @@:
  976.                 cmp esi,0
  977.                 je @f
  978.                 cmp word[esi],el_icon_points ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨, ¨ ¯à®¯ã᪠­¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢
  979.                 jne .end_add_p0
  980.                         stdcall [tl_node_poi_get_data], esi, tree1
  981.                         pop eax
  982.                         stdcall pole_cell_creat, pole,dword[eax],dword[eax+4],0
  983.                 .end_add_p0:
  984.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  985.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  986.                 jmp @b
  987.         @@:
  988.         stdcall pole_sort, pole
  989.  
  990.         ;*** ¤®¡ ¢«¥­¨¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢ (­  ®á­®¢¥ «®£¨ç¥áª¨å í«¥¬¥­â®¢) ***
  991.         stdcall dword[tl_node_poi_get_info],0,tree1
  992.         pop esi
  993.         @@:
  994.                 cmp esi,0
  995.                 je @f
  996.                 cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  997.                 jne .end_add_p3
  998.                         stdcall [tl_node_poi_get_data], esi, tree1
  999.                         pop ecx
  1000.  
  1001.                         xor edx,edx ;edx - ­®¬¥à ¢å®¤­®© ­®£¨
  1002.                         .add_p1:
  1003.                                 stdcall el_get_leg_coords, ecx,edx
  1004.                                 test eax,eax
  1005.                                 jnz .add_beg1
  1006.                                 test ebx,ebx
  1007.                                 jnz .add_beg1
  1008.                                         jmp .end_add_p1 ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0), ¢ë室 ¨§ 横« 
  1009.                                 .add_beg1:
  1010.                                 stdcall pole_cell_creat, pole,eax,ebx,0
  1011.                                 inc edx
  1012.                                 jmp .add_p1
  1013.                         .end_add_p1:
  1014.  
  1015.                         mov edx,(1 shl 16) ;edx - ­®¬¥à ¢ë室­®© ­®£¨
  1016.                         .add_p2:
  1017.                                 stdcall el_get_leg_coords, ecx,edx
  1018.                                 test eax,eax
  1019.                                 jnz .add_beg2
  1020.                                 test ebx,ebx
  1021.                                 jnz .add_beg2
  1022.                                         jmp .end_add_p2 ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0), ¢ë室 ¨§ 横« 
  1023.                                 .add_beg2:
  1024.                                 stdcall pole_cell_creat, pole,eax,ebx,0
  1025.                                 inc edx
  1026.                                 jmp .add_p2
  1027.                         .end_add_p2:
  1028.  
  1029.                 .end_add_p3:
  1030.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1031.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1032.                 jmp @b
  1033.         @@:
  1034.         stdcall pole_sort, pole
  1035.  
  1036.         ;*** ¤®¡ ¢«¥­¨¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢ (­  ®á­®¢¥ ¯®¤¯¨á¥©) ***
  1037.         stdcall dword[tl_node_poi_get_info],0,tree1
  1038.         pop esi
  1039.         @@:
  1040.                 cmp esi,0
  1041.                 je @f
  1042.                 cmp word[esi],el_icon_captions ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  1043.                 jne .end_add_p6
  1044.                         stdcall [tl_node_poi_get_data], esi, tree1
  1045.                         pop ecx
  1046.                         cmp byte[ecx+8],'n'
  1047.                         je .end_add_p6
  1048.                                 stdcall pole_cell_creat, pole,[ecx],[ecx+4],0
  1049.                 .end_add_p6:
  1050.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1051.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1052.                 jmp @b
  1053.         @@:
  1054.         stdcall pole_sort, pole
  1055.  
  1056.         ;*** à¨á®¢ ­¨¥ ¯à®¢®¤®¢ (­  ®á­®¢¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢) ***
  1057.         stdcall dword[tl_node_poi_get_info],0,tree1
  1058.         pop esi
  1059.         xor ecx,ecx
  1060.         @@:
  1061.                 cmp esi,0
  1062.                 je @f
  1063.                 cmp word[esi],el_icon_points ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨, ¨ ¯à®¯ã᪠­¥ â®ç¥ç­ëå ®¡ê¥ªâ®¢
  1064.                 jne .end_add_p4
  1065.                         stdcall [tl_node_poi_get_data], esi, tree1
  1066.                         pop eax
  1067.                         movzx ebx,byte[eax+8]
  1068.                         stdcall shem_create_line, dword[eax],dword[eax+4],ebx
  1069.                         add ecx,edx
  1070.                 .end_add_p4:
  1071.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1072.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1073.                 cmp ecx,250 ;ecx - ç¨á«® ¤®¡ ¢«¥­­ëå â®ç¥ª
  1074.                 jl @b
  1075.                 xor ecx,ecx
  1076.                 stdcall pole_sort, pole ;á®àâ¨à㥬 ¤«ï ®¯â¨¬¨§ æ¨¨ ¡ëáâத¥©á⢨ï
  1077.                 jmp @b
  1078.         @@:
  1079.         stdcall pole_sort, pole
  1080.  
  1081.                 stdcall pole_reset_cells, pole ;ç¨á⪠ ¯à®¢®¤®¢
  1082.  
  1083.                 ;*** ¤®¡ ¢«¥­¨¥ ¨§®«ï樮­­ëå ®¡ê¥ªâ®¢ (¯àאַ ¨§ ä ©« , ¬¨­ãï § ¯¨áì ¢ ᯨ᮪) ***
  1084.                 mov dword[shem_sub_points],0
  1085.                 mov esi,txt_sub_points
  1086.                 call str_analiz_r
  1087.                 cmp edi,0
  1088.                 je .end_sub_points ;¥á«¨ ®¯¨á ­¨ï â®ç¥ª ­¥â ¢ ä ©«¥
  1089.                         stdcall str_len,esi
  1090.                         add edi,eax
  1091.                         stdcall conv_str_to_int,edi
  1092.                         cmp eax,0
  1093.                         jle .end_sub_points ;¥á«¨ ç¨á«® â®ç¥ª = 0
  1094.                         mov [shem_sub_points],eax
  1095.                         mov ecx,eax
  1096.                         .cycle_sub_poi:
  1097.                                 call str_next_val
  1098.                                 stdcall conv_str_to_int,edi
  1099.                                 mov ebx,eax ;ª®®à¤¨­ â  x
  1100.                                 call str_next_val
  1101.                                 stdcall conv_str_to_int,edi ;ª®®à¤¨­ â  y
  1102.                                 stdcall pole_cell_creat, pole,ebx,eax,2
  1103.  
  1104.                                 dec ecx
  1105.                                 jnz .cycle_sub_poi
  1106.                 .end_sub_points:
  1107.  
  1108.                 stdcall pole_sort, pole
  1109.  
  1110.                 ;*** 㤠«¥­¨¥ ª«î祢ëå â®ç¥ª ᮠᯨ᪠ ***
  1111.                 mov ecx,[shem_points]
  1112.                 inc ecx
  1113.                 cld
  1114.                 @@:
  1115.                         stdcall [tl_info_undo],tree1
  1116.                 loop @b
  1117.  
  1118.                 ;*** ä®à¬¨à®¢ ­¨¥ ¯®¤¯¨á¥© ® ¯ à ¬¥âà å á奬ë ***
  1119.                 mov dword[txt_info.size],0
  1120.                 mov eax,dword[shem_w]
  1121.                 mov edi,txt_info.size
  1122.                 call convert_int_to_str
  1123.                 stdcall str_cat, edi,txt_mull
  1124.                 mov eax,dword[shem_h]
  1125.                 mov edi,txt_buf
  1126.                 call convert_int_to_str
  1127.                 stdcall str_cat, txt_info.size,edi
  1128.                 stdcall str_cat, txt_info.size,txt_space ;§ ¢¥àè î騩 ¯à®¡¥«
  1129.  
  1130.                 ;---
  1131.                 call but_center ;業â஢ª  á奬ë á ãç¥â®¬ shem_w ¨ shem_h
  1132.                 call but_set_none
  1133.         .end_open_file:
  1134.         popad
  1135.         ret
  1136.  
  1137. align 4
  1138. proc but_save_file
  1139. locals
  1140.         napr dd ?
  1141. endl
  1142. pushad
  1143.         ;*** ¢ë§®¢ ¤¨ «®£®¢®£® ®ª­  ¤«ï á®åà ­¥­¨ï ä ©« 
  1144.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  1145.         mov [OpenDialog_data.type],1
  1146.         stdcall [OpenDialog_Start],OpenDialog_data
  1147.         cmp [OpenDialog_data.status],1 ;if status==1 then save
  1148.         jne .end_save_file
  1149.  
  1150.         ;*** ¯à®¢¥àª  ¥áâì «¨ ¯à®¢®¤  ­  á奬¥
  1151.         mov edi,pole
  1152.         mov esi,pole_index
  1153.         cmp dword[esi],0
  1154.         je .cycle1_beg ;.end_save_file ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室
  1155.  
  1156.         ;*** ãáâ ­ ¢«¨¢ ¥¬ ¬¥âª¨ ­  ª«îç¥¢ë¥ â®çª¨, ª®â®àë¥ ¡ã¤ãâ á®åà ­¥­ë ¢ ä ©«
  1157.         mov dword[shem_points],0 ;¤«ï ¯¥à¥®¯à¥¤¥«¥­¨ï â®ç¥ª
  1158.         mov dword[shem_sub_points],0
  1159.         mov ecx,dword[esi]
  1160.         .cycle0: ;横« ¯® ¢á¥¬ â®çª ¬
  1161.                 add esi,4
  1162.                 mov ebx,[esi]
  1163.                 imul ebx,sizeof.Cell
  1164.                 add ebx,pole_data
  1165.  
  1166.                 cmp byte[ebx+offs_cell_liv],2
  1167.                 jne @f
  1168.                         inc dword[shem_sub_points]
  1169.                         jmp .cycle0_next
  1170.                 @@:
  1171.  
  1172.                 mov dword[napr],0
  1173.  
  1174.                 mov edx,[ebx+offs_cell_y]
  1175.                 push edx
  1176.                 mov edx,[ebx+offs_cell_x]
  1177.                 inc edx
  1178.                 push edx
  1179.                 stdcall pole_cell_find, edi
  1180.                 cmp eax,0
  1181.                 je @f
  1182.                         or dword[napr],1
  1183.                 @@:
  1184.  
  1185.                 mov edx,[ebx+offs_cell_y]
  1186.                 inc edx
  1187.                 push edx
  1188.                 mov edx,[ebx+offs_cell_x]
  1189.                 push edx
  1190.                 stdcall pole_cell_find, edi
  1191.                 cmp eax,0
  1192.                 je @f
  1193.                         or dword[napr],2
  1194.                 @@:
  1195.  
  1196.                 mov edx,[ebx+offs_cell_y]
  1197.                 push edx
  1198.                 mov edx,[ebx+offs_cell_x]
  1199.                 dec edx
  1200.                 push edx
  1201.                 stdcall pole_cell_find, edi
  1202.                 cmp eax,0
  1203.                 je @f
  1204.                         or dword[napr],4
  1205.                 @@:
  1206.  
  1207.                 mov edx,[ebx+offs_cell_y]
  1208.                 dec edx
  1209.                 push edx
  1210.                 mov edx,[ebx+offs_cell_x]
  1211.                 push edx
  1212.                 stdcall pole_cell_find, edi
  1213.                 cmp eax,0
  1214.                 je @f
  1215.                         or dword[napr],8
  1216.                 @@:
  1217.  
  1218.                 cmp dword[napr],5
  1219.                 je @f
  1220.                 cmp dword[napr],10
  1221.                 je @f
  1222.                 cmp dword[napr],15
  1223.                 je @f
  1224.                         mov eax,dword[napr]
  1225.                         mov byte[ebx+offs_cell_liv],3 ;ãáâ ­®¢ª  ¬¥âª¨
  1226.                         mov byte[ebx+offs_cell_napr],al ;ãáâ ­®¢ª  ­ ¯à ¢«¥­¨©
  1227.                         inc dword[shem_points]
  1228.                 @@:
  1229.                 .cycle0_next:
  1230.                 dec ecx
  1231.                 jnz .cycle0
  1232.  
  1233.         ;*** á­ï⨥ ¬¥âª¨ á â®ç¥ª, ª®â®àë¥ ­ å®¤ïâáï ­  ¢å®¤­ëå ­®£ å «®£¨ç¥áª¨å í«¥¬¥­â®¢
  1234.         .cycle1_beg:
  1235.         mov dword[shem_elems],0 ;¤«ï ¯¥¯¥®¯à¥¤¥«¥­¨ï ç¨á«  í«¥¬¥­â®¢
  1236.         stdcall dword[tl_node_poi_get_info],0,tree1
  1237.         pop esi
  1238.         .cycle1:
  1239.                 cmp esi,0
  1240.                 je .cycle1_end
  1241.                 cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  1242.                 jne .end_add_p1
  1243.                         stdcall [tl_node_poi_get_data], esi, tree1
  1244.                         pop ecx
  1245.                         inc dword[shem_elems]
  1246.  
  1247.                         xor edx,edx ;edx - ­®¬¥à ¢å®¤­®© ­®£¨
  1248.                         @@:
  1249.                                 stdcall el_get_leg_coords, ecx,edx
  1250.                                 test eax,eax
  1251.                                 jz @f ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0)
  1252.                                 test ebx,ebx
  1253.                                 jz @f ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0)
  1254.                                 stdcall pole_cell_find, edi,eax,ebx
  1255.                                 test eax,eax
  1256.                                 jz .no_erase
  1257.                                         get_cell_offset ebx,eax
  1258.                                         mov byte[ebx+offs_cell_liv],0 ;á­ï⨥ ¬¥âª¨
  1259.                                         dec dword[shem_points]
  1260.                                 .no_erase:
  1261.                                 inc edx
  1262.                                 jmp @b
  1263.                         @@:
  1264.                         ;mov edx,(1 shl 16) ;edx - ­®¬¥à ¢ë室­®© ­®£¨
  1265.  
  1266.                 .end_add_p1:
  1267.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1268.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1269.                 jmp .cycle1
  1270.         .cycle1_end:
  1271.  
  1272.         ;*** ᮧ¤ ­¨¥ ¨­ä®à¬ æ¨¨ ¤«ï § ¯¨á¨ ¢ ä ©« ***
  1273.         mov edi,open_file_lif
  1274.         stdcall mem_copy,edi,txt_size,5
  1275.         stdcall str_cat,edi,txt_space
  1276.         mov eax,dword[shem_w]
  1277.         add edi,5
  1278.         stdcall convert_int_to_str
  1279.         stdcall str_cat,edi,txt_space
  1280.         stdcall str_len,edi
  1281.         add edi,eax
  1282.         mov eax,[shem_h]
  1283.         stdcall convert_int_to_str
  1284.         stdcall str_cat,edi,txt_nl
  1285.  
  1286.         ;*** á®åà ­¥­¨¥ «®£¨ç¥áª¨å í«¥¬¥­â®¢ ***
  1287.         stdcall str_cat,edi,txt_elements
  1288.         stdcall str_cat,edi,txt_space
  1289.         stdcall str_len,edi
  1290.         add edi,eax
  1291.         mov eax,[shem_elems]
  1292.         stdcall convert_int_to_str
  1293.         stdcall str_cat,edi,txt_nl
  1294.  
  1295.         cmp eax,1
  1296.         jl .cycle2_end
  1297.         stdcall dword[tl_node_poi_get_info],0,tree1
  1298.         pop esi
  1299.         .cycle2:
  1300.                 cmp esi,0
  1301.                 je .cycle2_end
  1302.                 cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  1303.                 jne .end_add_p2
  1304.                         stdcall [tl_node_poi_get_data], esi, tree1
  1305.                         pop ecx
  1306.  
  1307.                         stdcall str_len,edi
  1308.                         add edi,eax
  1309.                         mov eax,[ecx] ;coord x
  1310.                         stdcall convert_int_to_str
  1311.                         stdcall str_cat,edi,txt_space
  1312.        
  1313.                         stdcall str_len,edi
  1314.                         add edi,eax
  1315.                         mov eax,[ecx+4] ;coord y
  1316.                         stdcall convert_int_to_str
  1317.                         stdcall str_cat,edi,txt_space
  1318.  
  1319.                         stdcall str_len,edi
  1320.                         add edi,eax
  1321.                         movzx eax,byte[ecx+8] ;angle
  1322.                         stdcall convert_int_to_str
  1323.                         stdcall str_cat,edi,txt_space
  1324.  
  1325.                         ;¨¬ï í«¥¬¥­â 
  1326.                         movzx eax,byte[ecx+sp_offs_el_type]
  1327.                         imul eax,size_el_opt
  1328.                         add eax,el_opt_beg+el_offs_nam
  1329.                         stdcall str_cat,edi,eax
  1330.  
  1331.                         stdcall str_cat,edi,txt_nl
  1332.  
  1333.                 .end_add_p2:
  1334.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1335.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1336.                 jmp .cycle2
  1337.         .cycle2_end:
  1338.  
  1339.         ;*** á®åà ­¥­¨¥ ¯®¤¯¨á¥© ***
  1340.         stdcall str_cat,edi,txt_captions
  1341.         stdcall str_cat,edi,txt_space
  1342.         stdcall str_len,edi
  1343.         add edi,eax
  1344.         mov eax,[shem_captions]
  1345.         stdcall convert_int_to_str
  1346.         stdcall str_cat,edi,txt_nl
  1347.  
  1348.         cmp eax,1
  1349.         jl .cycle3_end
  1350.         stdcall dword[tl_node_poi_get_info],0,tree1
  1351.         pop esi
  1352.         .cycle3:
  1353.                 cmp esi,0
  1354.                 je .cycle3_end
  1355.                 cmp word[esi],el_icon_captions ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  1356.                 jne .end_add_p3
  1357.                         stdcall [tl_node_poi_get_data], esi, tree1
  1358.                         pop ecx
  1359.  
  1360.                         stdcall str_len,edi
  1361.                         add edi,eax
  1362.                         mov eax,[ecx] ;coord x
  1363.                         stdcall convert_int_to_str
  1364.                         stdcall str_cat,edi,txt_space
  1365.        
  1366.                         stdcall str_len,edi
  1367.                         add edi,eax
  1368.                         mov eax,[ecx+4] ;coord y
  1369.                         stdcall convert_int_to_str
  1370.                         stdcall str_cat,edi,txt_space
  1371.  
  1372.                         stdcall str_len,edi
  1373.                         add edi,eax
  1374.                         movzx eax,byte[ecx+8] ;n,z,o
  1375.                         mov ah,' ' ;¯à®¡¥« ¯®á«¥ ¡ãª¢ë, çâ® ¡ë ­¥ ¤®¡ ¢«ïâì txt_space
  1376.                         mov dword[edi],eax ;al
  1377.  
  1378.                         ;¨¬ï í«¥¬¥­â 
  1379.                         mov ebx,edi
  1380.                         mov edi,ecx
  1381.                         add edi,capt_offs
  1382.                         call str_next_val
  1383.                         call str_next_val
  1384.                         ;call str_next_val
  1385.                         xchg ebx,edi
  1386.                         stdcall str_cat,edi,ebx
  1387.  
  1388.                         stdcall str_cat,edi,txt_nl
  1389.  
  1390.                 .end_add_p3:
  1391.                 stdcall dword[tl_node_poi_get_next_info],esi,tree1
  1392.                 pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  1393.                 jmp .cycle3
  1394.         .cycle3_end:
  1395.  
  1396.         ;*** á®åà ­¥­¨¥ ª«î祢ëå â®ç¥ª ***
  1397.         stdcall str_cat,edi,txt_points
  1398.         stdcall str_cat,edi,txt_space
  1399.         stdcall str_len,edi
  1400.         add edi,eax
  1401.         mov eax,[shem_points]
  1402.         stdcall convert_int_to_str
  1403.         stdcall str_cat,edi,txt_nl
  1404.  
  1405.         mov eax,edi
  1406.         mov edi,pole
  1407.         mov esi,pole_index
  1408.         cmp dword[esi],0
  1409.         je .no_points ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¯à®¯ãáª
  1410.         mov ebx,pole_data
  1411.         mov dword[napr],ebx
  1412.         mov edi,eax
  1413.  
  1414.         mov ecx,dword[esi]
  1415.         .cycle4: ;横« ¯® ¢á¥¬ â®çª ¬
  1416.                 add esi,4
  1417.                 mov ebx,[esi]
  1418.                 imul ebx,sizeof.Cell
  1419.                 add ebx,dword[napr] ;pole_data
  1420.  
  1421.                 movzx edx,word[ebx+offs_cell_liv] ;also use offs_cell_napr
  1422.                 cmp dl,3
  1423.                 jne @f
  1424.                         stdcall str_len,edi
  1425.                         add edi,eax
  1426.                         mov eax,dword[ebx+offs_cell_x]
  1427.                         stdcall convert_int_to_str
  1428.                         stdcall str_cat,edi,txt_space
  1429.  
  1430.                         stdcall str_len,edi
  1431.                         add edi,eax
  1432.                         mov eax,dword[ebx+offs_cell_y]
  1433.                         stdcall convert_int_to_str
  1434.                         stdcall str_cat,edi,txt_space
  1435.  
  1436.                         stdcall str_len,edi
  1437.                         add edi,eax
  1438.                         movzx eax,dh
  1439.                         stdcall convert_int_to_str
  1440.                         stdcall str_cat,edi,txt_space
  1441.                         ;stdcall str_cat,edi,txt_nl
  1442.                 @@:
  1443.                 dec ecx
  1444.                 jnz .cycle4
  1445.                 stdcall str_cat,edi,txt_nl
  1446.  
  1447.         ;*** á®åà ­¥­¨¥ ¨§®«ï樮­­ëå â®ç¥ª ***
  1448.         stdcall str_cat,edi,txt_sub_points
  1449.         stdcall str_cat,edi,txt_space
  1450.         stdcall str_len,edi
  1451.         add edi,eax
  1452.         mov eax,[shem_sub_points]
  1453.         stdcall convert_int_to_str
  1454.         stdcall str_cat,edi,txt_nl
  1455.  
  1456.         mov eax,edi
  1457.         mov edi,pole
  1458.         mov esi,pole_index
  1459.         ;cmp dword[esi],0
  1460.         ;je .no_points ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¯à®¯ãáª
  1461.         ;mov ebx,pole_data
  1462.         ;mov dword[napr],ebx
  1463.         mov edi,eax
  1464.  
  1465.         mov ecx,dword[esi]
  1466.         .cycle5: ;横« ¯® ¢á¥¬ â®çª ¬
  1467.                 add esi,4
  1468.                 mov ebx,[esi]
  1469.                 imul ebx,sizeof.Cell
  1470.                 add ebx,dword[napr] ;pole_data
  1471.  
  1472.                 movzx edx,byte[ebx+offs_cell_liv]
  1473.                 cmp dl,2
  1474.                 jne @f
  1475.                         stdcall str_len,edi
  1476.                         add edi,eax
  1477.                         mov eax,dword[ebx+offs_cell_x]
  1478.                         stdcall convert_int_to_str
  1479.                         stdcall str_cat,edi,txt_space
  1480.  
  1481.                         stdcall str_len,edi
  1482.                         add edi,eax
  1483.                         mov eax,dword[ebx+offs_cell_y]
  1484.                         stdcall convert_int_to_str
  1485.                         stdcall str_cat,edi,txt_space
  1486.  
  1487.                         ;stdcall str_cat,edi,txt_nl
  1488.                 @@:
  1489.                 dec ecx
  1490.                 jnz .cycle5
  1491.                 stdcall str_cat,edi,txt_nl
  1492.  
  1493.         .no_points:
  1494.  
  1495.         ;*** ®¯à¥¤¥«¥­¨¥ ¯ à ¬¥â஢ ä ©« 
  1496.         mov edi,open_file_lif
  1497.         stdcall str_len,edi
  1498.         mov ecx,eax
  1499.  
  1500.         ;*** § ¯¨áì ä ©« 
  1501.         mov eax,70
  1502.         mov [run_file_70.Function], 2
  1503.         mov [run_file_70.Position], 0
  1504.         mov [run_file_70.Flags], 0
  1505.         mov dword[run_file_70.Count], ecx
  1506.         mov [run_file_70.Buffer], edi
  1507.         mov byte[run_file_70+20], 0
  1508.         mov dword[run_file_70.FileName], openfile_path
  1509.         mov ebx,run_file_70
  1510.         int 0x40 ;á®å࠭塞 ä ©«
  1511.  
  1512.         call redraw_pole
  1513.         .end_save_file:
  1514. popad
  1515.         ret
  1516. endp
  1517.  
  1518. ;ä®à¬¨à®¢ ­¨¥ ¯®¤¯¨á¨ ¤«ï ᯨ᪠
  1519. align 4
  1520. proc make_list_capts uses eax ebx ecx edi, buf:dword, txt:dword
  1521.         mov ebx,dword[buf]
  1522.  
  1523.         mov edi,ebx
  1524.         add edi,capt_offs
  1525.         mov dword[edi],'    ' ;¯à®¡¥«ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¬ «¥­ìª¨å ç¨á¥«
  1526.  
  1527.         mov eax,dword[ebx] ;+0 - offset coord x
  1528.         cmp eax,100
  1529.         jge @f
  1530.                 inc edi
  1531.         @@:
  1532.         cmp eax,10
  1533.         jge @f
  1534.                 inc edi
  1535.         @@:
  1536.         call convert_int_to_str ;ª®®à¤¨­ â  x (¤«ï ¯®¤¯¨á¨)
  1537.         stdcall str_cat,edi,txt_space
  1538.         stdcall str_len,edi
  1539.         add edi,eax
  1540.         mov eax,dword[ebx+4] ;+4 - offset coord y
  1541.         call convert_int_to_str ;ª®®à¤¨­ â  y (¤«ï ¯®¤¯¨á¨)
  1542.         stdcall str_cat,edi,txt_space
  1543.  
  1544.         mov edi,dword[txt]
  1545.         cmp edi,0
  1546.         je .end_f
  1547.                 stdcall str_len,edi ;eax = strlen([edi])
  1548.                 mov ecx,edi
  1549.                 call str_next_spaces
  1550.                 sub edi,ecx ;®¯à¥¤¥«ï¥¬ ¤«¨­­ã ¯®¤¯¨á¨
  1551.  
  1552.                 cmp edi,eax
  1553.                 jle @f
  1554.                         mov edi,eax ;¥á«¨ áâப  § ª®­ç¨« áì ­¥ ¯à®¡¥«®¬
  1555.                 @@:
  1556.                 ;cmp edi,1
  1557.                 ;jge @f
  1558.                 ;       mov edi,1 ;¬¨­¨¬ã¬ 1 ᨬ¢®«
  1559.                 ;@@:
  1560.  
  1561.                 add ebx,capt_offs      
  1562.                 stdcall str_n_cat, ebx,ecx,edi
  1563.         .end_f:
  1564.         ret
  1565. endp
  1566.  
  1567. ;¤®¡ ¢«¥­¨¥ ­®¢®£® í«¥¬¥­â  ã¯à ¢«¥­¨ï ­  á奬ã
  1568. ;¯à¨ ¤®¡ ¢«¥­¨¨ ¨á¯®«ì§ãîâáï áâ ­¤ àâ­ë¥ ­ áâனª¨
  1569. align 4
  1570. proc shem_element_creat uses eax ebx, coord_x:dword, coord_y:dword
  1571.         mov eax,dword[coord_x]
  1572.         mov dword[txt_buf],eax ;ª®®à¤¨­ â  x
  1573.         mov eax,dword[coord_y]
  1574.         mov dword[txt_buf+4],eax ;ª®®à¤¨­ â  y
  1575.  
  1576.         xor eax,eax
  1577.         mov byte[txt_buf+8],al ;­ ¯à ¢«¥­¨¥
  1578.         ;¯®  ¤à¥áã edi ­ §¢ ­¨¥ í«¥¬¥­â 
  1579.         ;stdcall el_get_name, edi
  1580.         mov byte[txt_buf+sp_offs_el_type],al ;⨯ í«¥¬¥­â 
  1581.  
  1582.         movzx ebx,al
  1583.         imul ebx,size_el_opt
  1584.         add ebx,el_opt_beg+el_offs_nam
  1585.         stdcall make_list_capts,txt_buf,ebx
  1586.         stdcall [tl_node_add], txt_buf,(el_icon_elems shl 16)+1, tree1
  1587.         stdcall [tl_cur_next], tree1
  1588.         stdcall [tl_draw], tree1
  1589.         ret
  1590. endp
  1591.  
  1592. ;output:
  1593. ; eax - ⨯ í«¥¬¥­â 
  1594. align 4
  1595. proc el_get_name uses ecx edi esi, str:dword
  1596.         mov edi,[str]
  1597.         mov esi,el_opt_beg+el_offs_nam
  1598.         xor ecx,ecx
  1599.         @@:
  1600.                 stdcall str_instr, edi,esi
  1601.                 cmp eax,0
  1602.                 je @f
  1603.                 add esi,size_el_opt
  1604.                 cmp esi,el_opt_beg.end
  1605.                 jge @f
  1606.                 inc ecx
  1607.                 jmp @b
  1608.         @@:
  1609.         mov eax,ecx
  1610.         ret
  1611. endp
  1612.  
  1613. ;input:
  1614. ; el_data - 㪠§ â¥«ì ­  ¤ ­­ë¥ í«¥¬¥­â 
  1615. ; l_opt - ­®¬¥à ­®£¨, ¤«ï ª®â®à®© ¨éãâáï ª®®à¤¨­ âë, ¢å®¤­ ï/¢ë室­ ï ­®£ 
  1616. ;output:
  1617. ; eax - coord x (if not found eax=0)
  1618. ; ebx - coord y (if not found ebx=0)
  1619. align 4
  1620. proc el_get_leg_coords uses ecx edx edi esi, el_data:dword, l_opt:dword
  1621.         mov edi,[el_data] ;¤ ­­ë¥ í«¥¬¥­â 
  1622.         movzx esi,byte[edi+sp_offs_el_type] ;⨯ í«¥¬¥­â 
  1623.         imul esi,size_el_opt
  1624.         add esi,el_opt_beg
  1625.         ;esi+el_offs_legs_inp - 㪠§ â¥«ì ­  ¯ à ¬¥âàë 0-© ¢å®¤­®© ­®£¨
  1626.  
  1627.         mov eax,[edi+0]
  1628.         mov ebx,[edi+4]
  1629.         mov edx,[l_opt]
  1630.         movzx edi,byte[edi+8] ;㣮« ¯®¢®à®â  / 90 (®â 0-3)
  1631.  
  1632.         btr edx,16 ;¢å®¤­ ï/¢ë室­ ï ­®£ 
  1633.         jc .output_leg
  1634.  
  1635.         ;¥á«¨ ­®£  ¢å®¤­ ï
  1636.         inc edx ;­®¬¥à æ¨ï ­®£ ­ ç¨­ ¥âáï á ­ã«ï, ¯®â®¬ã ¤®¡ ¢«ï¥¬ 1
  1637.         stdcall move_rotate_x_n90, -2,edi
  1638.         add esi,el_offs_legs_inp
  1639.         @@:
  1640.                 movzx ecx,byte[esi]
  1641.                 cmp ecx,0
  1642.                 je .not_found ;­®£¨ ª®­ç¨«¨áì à ­ìè¥, 祬 ®¦¨¤ «®áì
  1643.                 stdcall move_rotate_n90, 0,ecx,edi
  1644.                 inc esi
  1645.                 dec edx
  1646.                 jnz @b
  1647.                 jmp .end_f
  1648.  
  1649.         ;¥á«¨ ­®£  ¢ë室­ ï
  1650.         .output_leg:
  1651.         inc edx ;­®¬¥à æ¨ï ­®£ ­ ç¨­ ¥âáï á ­ã«ï, ¯®â®¬ã ¤®¡ ¢«ï¥¬ 1
  1652.         movzx ecx,byte[esi+el_offs_box_x]
  1653.         add ecx,2
  1654.         stdcall move_rotate_x_n90, ecx,edi
  1655.         add esi,el_offs_legs_out
  1656.         @@:
  1657.                 movzx ecx,byte[esi]
  1658.                 cmp ecx,0
  1659.                 je .not_found ;­®£¨ ª®­ç¨«¨áì à ­ìè¥, 祬 ®¦¨¤ «®áì
  1660.                 stdcall move_rotate_n90, 0,ecx,edi
  1661.                 inc esi
  1662.                 dec edx
  1663.                 jnz @b
  1664.                 jmp .end_f
  1665.  
  1666.         .not_found:
  1667.                 xor eax,eax
  1668.                 xor ebx,ebx
  1669.         .end_f:
  1670.         ret
  1671. endp
  1672.  
  1673. align 4
  1674. proc move_rotate_n90 uses ecx edi, d_x:dword, d_y:dword, angle:dword
  1675.         mov edi,[angle] ;㣮« ¯®¢®à®â  / 90 (®â 0-3)
  1676.         and edi,3
  1677.         shl edi,4 ;edi*=16
  1678.         add edi,mcs
  1679.  
  1680.         mov ecx,[d_x]
  1681.         imul ecx,dword[edi]
  1682.         add eax,ecx
  1683.         mov ecx,[d_y]
  1684.         imul ecx,dword[edi+4]
  1685.         add eax,ecx
  1686.  
  1687.         mov ecx,[d_x]
  1688.         imul ecx,dword[edi+8]
  1689.         add ebx,ecx
  1690.         mov ecx,[d_y]
  1691.         imul ecx,dword[edi+12]
  1692.         add ebx,ecx
  1693.         ret
  1694. endp
  1695.  
  1696. align 4
  1697. proc mem_copy, destination:dword, source:dword, len:dword
  1698.   push ecx esi edi
  1699.     cld
  1700.     mov esi, dword[source]
  1701.     mov edi, dword[destination]
  1702.     mov ecx, dword[len]
  1703.     rep movsb
  1704.   pop edi esi ecx
  1705.   ret
  1706. endp
  1707.  
  1708. ;description:
  1709. ; ”ã­ªæ¨ï ¯à®¯ã᪠¥â ®¤­® á«®¢® (¨«¨ ç¨á«®) á ãç¥â®¬ à §¤¥«¨â¥«ì­ëå ᨬ¢®«®¢:
  1710. ; ¯à®¡¥« , â ¡ã«ï樨, ­®¢®© áâப¨. ã¦­  ¤«ï ¯®á«¥¤®¢ â¥«ì­®£® áç¨â뢠­¨ ç¨á¥« ¨§ áâப¨
  1711. ;input:
  1712. ; edi - 㪠§ â¥«ì ­  ¯à®¡¥« ¨«¨ á«®¢®
  1713. ;output:
  1714. ; edi - 㪠§ â¥«ì ­  á«¥¤ãî饥 á«®¢®
  1715. align 4
  1716. str_next_val:
  1717.         call str_skip_spaces
  1718.         @@:
  1719.                 cmp byte[edi],0
  1720.                 je @f
  1721.  
  1722.                 cmp byte[edi],' '
  1723.                 je @f
  1724.                 cmp byte[edi],9
  1725.                 je @f
  1726.                 cmp byte[edi],10
  1727.                 je @f
  1728.                 cmp byte[edi],13
  1729.                 je @f
  1730.  
  1731.                 inc edi
  1732.                 jmp @b
  1733.         @@:
  1734.         call str_skip_spaces
  1735.         ret
  1736.  
  1737. align 4
  1738. str_skip_spaces:
  1739.         dec edi
  1740.         @@:
  1741.                 inc edi
  1742.                 cmp byte[edi],' '
  1743.                 je @b
  1744.                 cmp byte[edi],9
  1745.                 je @b
  1746.                 cmp byte[edi],10
  1747.                 je @b
  1748.                 cmp byte[edi],13
  1749.                 je @b
  1750.         ret
  1751.  
  1752. align 4
  1753. str_next_spaces:
  1754.         dec edi
  1755.         @@:
  1756.                 inc edi
  1757.                 cmp byte[edi],0
  1758.                 je @f
  1759.                 cmp byte[edi],' '
  1760.                 je @f
  1761.                 cmp byte[edi],9
  1762.                 je @f
  1763.                 cmp byte[edi],10
  1764.                 je @f
  1765.                 cmp byte[edi],13
  1766.                 je @f
  1767.                 jmp @b
  1768.         @@:    
  1769.         ret
  1770.  
  1771. ;input:
  1772. ; esi - 㪠§ â¥«ì ­  ¨áª®¬®¥ á«®¢®
  1773. ;output:
  1774. ; edi - 㪠§ â¥«ì ­  ¯®§¨æ¨î ¢ ª®â®à®© á«®¢® ­ ©¤¥­®, ¥á«¨ á«®¢® ­¥ ­ ©¤¥­® â® edi=0
  1775. ;¯®àâïâáï ॣ¨áâàë:
  1776. ; eax ecx
  1777. align 4
  1778. str_analiz_r:
  1779.         mov edi,open_file_lif
  1780.         mov ecx,dword[f_size]
  1781.         @@:
  1782.                 mov al,byte[esi] ;ãáâ ­ ¢«¨¢ ¥¬ ¯¥à¢ë© ᨬ¢®« ¤«ï ¯®¨áª 
  1783.                 cld
  1784.                 repnz scasb
  1785.                 cmp ecx,0
  1786.                 je @f ;¥á«¨ § ª®­ç¨«áï ¢¥áì ⥪áâ, â® ¢ë室 ¨§ ä㭪樨
  1787.                 ;¯¥à¢ë© ᨬ¢®« ¯®  ¤à¥áã edi-1 ¤®«¦¥­ ¡ëâì ¨§ áâப¨ esi
  1788.                 dec edi
  1789.                 stdcall str_instr, edi,esi ;¯à®¢¥à塞 á«®¢® ­  ᮢ¯ ¤¥­¨¥
  1790.                 inc edi
  1791.                 cmp al,0
  1792.                 jne @b ;¥á«¨ á«®¢® ­¥ ᮢ¯ «®, ¨é¥¬ ¢ áâப¥ á«¥¤ãî騩 ¯¥à¢ë© ᨬ¢®« ¤«ï áà ¢­¥­¨ï
  1793.                 ;á ¯®¯ ¤ ¥¬ ¥á«¨ ­ è«¨ á«®¢® esi ¯®  ¤à¥áã edi
  1794.                 jmp .exit_f
  1795.         @@:
  1796.                 ;á ¯®¯ ¤ ¥¬ ¥á«¨ ­¥ ­ è«¨ á«®¢® esi ¯®  ¤à¥áã edi
  1797.                 xor edi,edi
  1798.         .exit_f:
  1799.         ret
  1800.  
  1801. ;description:
  1802. ; ¯à®¢¥àï¥â ᮤ¥à¦¨âáï «¨ áâப  str1 ¢ áâப¥ str0
  1803. ; ¯à®¢¥àª  ¤¥« ¥âáï ⮫쪮 ­ ç¨­ ï á ¯¥à¢ëå ᨬ¢®«®¢, 㪠§ ­­ëå ¢ str0 ¨ str1
  1804. ; ¯à¨¬¥à 1: ¥á«¨ str0='aaabbbccc', str1='bbb' ᮢ¯ ¤¥­¨ï ­¥ ¡ã¤¥â
  1805. ; ¯à¨¬¥à 2: ¥á«¨ str0='aaabbbccc', str1='aaa' ᮢ¯ ¤¥­¨¥ ¡ã¤¥â
  1806. ;output:
  1807. ; al = 0 ¥á«¨ áâப  str1 ᮤ¥à¦¨âáï ¢ str0
  1808. ; al != 0 ¥á«¨ áâப  str1 ­¥ ᮤ¥à¦¨âáï ¢ str0
  1809. align 4
  1810. proc str_instr uses edi esi, str0:dword, str1:dword
  1811.         ;xor eax,eax
  1812.         mov edi,[str0]
  1813.         mov esi,[str1]
  1814.         cld
  1815.         @@:
  1816.                 mov al,[esi]
  1817.                 cmp al,0
  1818.                 je .e1
  1819.                 inc esi
  1820.                 scasb ;áà ¢­¨¢ ¥¬ ᨬ¢®«ë
  1821.         jz @b ;¥á«¨ ᮢ¯ «¨, â® ¯¥à¥å®¤¨¬ ª áà ¢­¥­¨î á«¥¤ãîé¨å
  1822.         ;á ¯®¯ ¤ ¥¬ ¥á«¨ áâப¨ ­¥ ᮢ¯ «¨
  1823.         sub al,[edi-1]
  1824.         .e1: ;á ¯®¯ ¤ ¥¬ ¥á«¨ áâப  str1 (esi) § ª®­ç¨« áì
  1825.         ret
  1826. endp
  1827.  
  1828. align 4
  1829. proc but_run_stop
  1830.         xor byte[tim_ch],1
  1831.         cmp byte[tim_ch],0
  1832.         jne @f
  1833.                 ;®áâ ­®¢ª  á奬ë
  1834.                 stdcall pole_reset_cells, pole ;ç¨á⪠ ¯à®¢®¤®¢
  1835.                 call redraw_pole
  1836.                 jmp .end_f
  1837.         @@:
  1838.                 ;¯®¤£®â®¢ª  áå¥¬ë ª § ¯ãáªã
  1839.                 call sign_clear
  1840.         .end_f:
  1841.         ret
  1842. endp
  1843.  
  1844. align 4
  1845. proc but_set_0 uses eax
  1846.         stdcall [tl_node_get_data], tree1
  1847.         pop eax
  1848.         test eax,eax
  1849.         jz .end_f
  1850. ;el_icon_captions
  1851. ;       cmp byte[eax+8],'n'
  1852. ;       je .end_f
  1853.         cmp byte[eax+8],'o' ;¢à¥¬¥­­®¥ ®âá¥ç¥­¨¥, ¯®ª  ­¥â ¯à®¢¥àª¨ ⨯  ⥪ã饩 ¨ª®­ª¨
  1854.         jne .end_f
  1855.                 mov byte[eax+8],'z'
  1856.         .end_f:
  1857.         ret
  1858. endp
  1859.  
  1860. align 4
  1861. proc but_set_1 uses eax
  1862.         stdcall [tl_node_get_data], tree1
  1863.         pop eax
  1864.         test eax,eax
  1865.         jz .end_f
  1866. ;el_icon_captions
  1867. ;       cmp byte[eax+8],'n'
  1868. ;       je .end_f
  1869.         cmp byte[eax+8],'z' ;¢à¥¬¥­­®¥ ®âá¥ç¥­¨¥, ¯®ª  ­¥â ¯à®¢¥àª¨ ⨯  ⥪ã饩 ¨ª®­ª¨
  1870.         jne .end_f
  1871.                 mov byte[eax+8],'o'
  1872.         .end_f:
  1873.         ret
  1874. endp
  1875.  
  1876. ;ᤢ¨£ ®¡ê¥ªâ  ¢«¥¢®
  1877. align 4
  1878. proc but_mov_l uses eax edi
  1879.         cmp byte[tim_ch],0
  1880.         jne .end_f
  1881.         stdcall [tl_node_get_data], tree1
  1882.         pop eax
  1883.         test eax,eax
  1884.         jz .end_f
  1885.                 cmp dword[eax],1
  1886.                 jle .end_f
  1887.                 dec dword[eax]
  1888.                 mov edi,eax
  1889.                 stdcall mem_copy,txt_buf,eax,capt_offs
  1890.                 add edi,capt_offs
  1891.                 call str_next_val
  1892.                 call str_next_val
  1893.                 stdcall make_list_capts,txt_buf,edi
  1894.                 stdcall mem_copy,eax,txt_buf,32 ;capt_offs
  1895.                 call redraw_pole
  1896.                 stdcall [tl_draw],tree1
  1897.         .end_f:
  1898.         ret
  1899. endp
  1900.  
  1901. ;ᤢ¨£ ®¡ê¥ªâ  ¢¯à ¢®
  1902. align 4
  1903. proc but_mov_r uses eax edi
  1904.         cmp byte[tim_ch],0
  1905.         jne .end_f
  1906.         stdcall [tl_node_get_data], tree1
  1907.         pop eax
  1908.         test eax,eax
  1909.         jz .end_f
  1910.                 inc dword[eax]
  1911.                 mov edi,eax
  1912.                 stdcall mem_copy,txt_buf,eax,capt_offs
  1913.                 add edi,capt_offs
  1914.                 call str_next_val
  1915.                 call str_next_val
  1916.                 stdcall make_list_capts,txt_buf,edi
  1917.                 stdcall mem_copy,eax,txt_buf,32 ;capt_offs
  1918.                 call redraw_pole
  1919.                 stdcall [tl_draw],tree1
  1920.         .end_f:
  1921.         ret
  1922. endp
  1923.  
  1924. align 4
  1925. proc but_mov_u uses eax edi
  1926.         cmp byte[tim_ch],0
  1927.         jne .end_f
  1928.         stdcall [tl_node_get_data], tree1
  1929.         pop eax
  1930.         test eax,eax
  1931.         jz .end_f
  1932.                 cmp dword[eax+4],1
  1933.                 jle .end_f
  1934.                 dec dword[eax+4]
  1935.                 mov edi,eax
  1936.                 stdcall mem_copy,txt_buf,eax,capt_offs
  1937.                 add edi,capt_offs
  1938.                 call str_next_val
  1939.                 call str_next_val
  1940.                 stdcall make_list_capts,txt_buf,edi
  1941.                 stdcall mem_copy,eax,txt_buf,32 ;capt_offs
  1942.                 call redraw_pole
  1943.                 stdcall [tl_draw],tree1
  1944.         .end_f:
  1945.         ret
  1946. endp
  1947.  
  1948. align 4
  1949. proc but_mov_d uses eax edi
  1950.         cmp byte[tim_ch],0
  1951.         jne .end_f
  1952.         stdcall [tl_node_get_data], tree1
  1953.         pop eax
  1954.         test eax,eax
  1955.         jz .end_f
  1956.                 inc dword[eax+4]
  1957.                 mov edi,eax
  1958.                 stdcall mem_copy,txt_buf,eax,capt_offs
  1959.                 add edi,capt_offs
  1960.                 call str_next_val
  1961.                 call str_next_val
  1962.                 stdcall make_list_capts,txt_buf,edi
  1963.                 stdcall mem_copy,eax,txt_buf,32 ;capt_offs
  1964.                 call redraw_pole
  1965.                 stdcall [tl_draw],tree1
  1966.         .end_f:
  1967.         ret
  1968. endp
  1969.  
  1970. ;ãáâ ­®¢ª  ®¡ëç­®£® ०¨¬ , ¡¥§ à¨á®¢ ­¨ï
  1971. align 4
  1972. proc but_set_none
  1973.         mov byte[pen_mode],0
  1974.         cmp [cursor_pointer],0
  1975.         je @f
  1976.                 push eax ebx ecx
  1977.                 mcall 37,6,[cursor_pointer]
  1978.                 pop ecx ebx eax
  1979.         @@:
  1980.         ret
  1981. endp
  1982.  
  1983. align 4
  1984. proc set_pen_mode uses eax ebx ecx edx, mode:dword, icon:dword
  1985.         mov eax,[mode]
  1986.         cmp byte[pen_mode],al
  1987.         je @f
  1988.                 mov byte[pen_mode],al
  1989.                 ;mov edx,((cx shl 8) + cy) shl 16
  1990.                 mov edx,2 ;LOAD_INDIRECT
  1991.                 mov ecx,[icon]
  1992.                 shl ecx,12 ;㬭®¦ ¥¬ ­  4 ª¡
  1993.                 add ecx,[buf_curs.data]
  1994.                 mcall 37,4
  1995.  
  1996.                 cmp eax,0
  1997.                 je @f
  1998.                         mov [cursor_pointer],eax
  1999.                         mcall 37,5,[cursor_pointer]
  2000.         @@:
  2001.         ret
  2002. endp
  2003.  
  2004. ;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
  2005. align 4
  2006. OpenDialog_data:
  2007. .type                   dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
  2008. .procinfo               dd procinfo     ;+4
  2009. .com_area_name          dd communication_area_name      ;+8
  2010. .com_area               dd 0    ;+12
  2011. .opendir_path           dd plugin_path  ;+16
  2012. .dir_default_path       dd default_dir ;+20
  2013. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  2014. .draw_window            dd draw_window  ;+28
  2015. .status                 dd 0    ;+32
  2016. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  2017. .filename_area          dd filename_area        ;+40
  2018. .filter_area            dd Filter
  2019. .x:
  2020. .x_size                 dw 420 ;+48 ; Window X size
  2021. .x_start                dw 10 ;+50 ; Window X position
  2022. .y:
  2023. .y_size                 dw 320 ;+52 ; Window y size
  2024. .y_start                dw 10 ;+54 ; Window Y position
  2025.  
  2026. default_dir db '/rd/1',0
  2027.  
  2028. communication_area_name:
  2029.         db 'FFFFFFFF_open_dialog',0
  2030. open_dialog_name:
  2031.         db 'opendial',0
  2032. communication_area_default_path:
  2033.         db '/rd/1/File managers/',0
  2034.  
  2035. Filter:
  2036. dd Filter.end - Filter ;.1
  2037. .1:
  2038. db 'TXT',0
  2039. db 'ASM',0
  2040. .end:
  2041. db 0
  2042.  
  2043. include 'le_libs.inc'
  2044.  
  2045. mouse_dd dd 0x0
  2046. sc system_colors
  2047. last_time dd 0
  2048.  
  2049.  
  2050.  
  2051. align 16
  2052. procinfo process_information
  2053.  
  2054. align 4
  2055. buf_0: dd 0 ;
  2056. .l: dw 170 ;+4 left
  2057. .t: dw panel_1_coord_top ;+6 top
  2058. .w: dd 335 ;+8 w
  2059. .h: dd 340 ;+12 h
  2060. .color: dd 0 ;+16 color
  2061.         db 24 ;+20 bit in pixel
  2062.  
  2063. align 4
  2064. buf_font: ;¡ãä¥à á® èà¨ä⮬
  2065.         dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  2066.         dw 25 ;+4 left
  2067.         dw 25 ;+6 top
  2068.         dd 96 ;+8 w
  2069.         dd 144 ;+12 h
  2070.         dd 0 ;+16 color
  2071.         db 24 ;+20 bit in pixel
  2072.  
  2073. align 4
  2074. buf_curs: ;¡ãä¥à á ªãàá®à ¬¨
  2075. .data: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  2076.         dw 0 ;+4 left
  2077.         dw 0 ;+6 top
  2078.         dd 32 ;+8 w
  2079.         dd 32*cursors_count ;+12 h
  2080.         dd 0 ;+16 color
  2081.         db 24 ;+20 bit in pixel
  2082.  
  2083. align 4
  2084. buf_curs_8: ;¡ãä¥à á ªãàá®à ¬¨
  2085. .data: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  2086.         dw 0 ;+4 left
  2087.         dw 0 ;+6 top
  2088.         dd 32 ;+8 w
  2089.         dd 32*cursors_count ;+12 h
  2090.         dd 0 ;+16 color
  2091.         db 24 ;+20 bit in pixel
  2092.  
  2093. cursor_pointer dd 0 ;㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï ªãàá®à 
  2094.  
  2095. el_focus dd 0
  2096. tree1 tree_list 32,points_max+2, tl_key_no_edit, 16,16,\
  2097.     0x8080ff,0x0000ff,0xffffff, 5,panel_3_coord_top,145,250, 0,capt_offs,0,\
  2098.     el_focus, wScrObj,0
  2099. align 4
  2100. wScrObj:
  2101. .x:
  2102. .size_x     dw 16 ;+0
  2103. .start_x    dw 0 ;+2
  2104. .y:
  2105. .size_y     dw 150 ;+4
  2106. .start_y    dw 0 ;+6
  2107. .btn_high   dd 15 ;+8
  2108. .type       dd 1  ;+12
  2109. .max_area   dd 100  ;+16
  2110. .cur_area   dd 30  ;+20
  2111. .position   dd 0  ;+24
  2112. .bckg_col   dd 0xeeeeee ;+28
  2113. .frnt_col   dd 0xbbddff ;+32
  2114. .line_col   dd 0  ;+36
  2115. .redraw     dd 0  ;+40
  2116. .delta      dw 0  ;+44
  2117. .delta2     dw 0  ;+46
  2118. .run_x:
  2119. .r_size_x   dw 0  ;+48
  2120. .r_start_x  dw 0  ;+50
  2121. .run_y:
  2122. .r_size_y   dw 0 ;+52
  2123. .r_start_y  dw 0 ;+54
  2124. .m_pos      dd 0 ;+56
  2125. .m_pos_2    dd 0 ;+60
  2126. .m_keys     dd 0 ;+64
  2127. .run_size   dd 0 ;+68
  2128. .position2  dd 0 ;+72
  2129. .work_size  dd 0 ;+76
  2130. .all_redraw dd 0 ;+80
  2131. .ar_offset  dd 1 ;+84
  2132.  
  2133. align 4
  2134. proc str_n_cat uses eax ecx edi esi, str1:dword, str2:dword, n:dword
  2135.         mov esi,dword[str2]
  2136.         mov ecx,dword[n]
  2137.         mov edi,dword[str1]
  2138.         stdcall str_len,edi
  2139.         add edi,eax
  2140.         cld
  2141.         repne movsb
  2142.         mov byte[edi],0
  2143.         ret
  2144. endp
  2145.  
  2146. align 4
  2147. proc str_cat uses eax ecx edi esi, str1:dword, str2:dword
  2148.         mov esi,dword[str2]
  2149.         stdcall str_len,esi
  2150.         mov ecx,eax
  2151.         inc ecx
  2152.         mov edi,dword[str1]
  2153.         stdcall str_len,edi
  2154.         add edi,eax
  2155.         cld
  2156.         repne movsb
  2157.         ret
  2158. endp
  2159.  
  2160. ;output:
  2161. ; eax = strlen
  2162. align 4
  2163. proc str_len, str1:dword
  2164.         mov eax,[str1]
  2165.         @@:
  2166.                 cmp byte[eax],0
  2167.                 je @f
  2168.                 inc eax
  2169.                 jmp @b
  2170.         @@:
  2171.         sub eax,[str1]
  2172.         ret
  2173. endp
  2174.  
  2175. ;input:
  2176. ; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
  2177. ;output:
  2178. ; eax - ç¨á«®
  2179. align 4
  2180. proc conv_str_to_int, buf:dword
  2181.         xor eax,eax
  2182.         push ebx ecx esi
  2183.         xor ebx,ebx
  2184.         mov esi,[buf]
  2185.  
  2186.         ;­  á«ãç © ¥á«¨ ¯¥à¥¤ ç¨á«®¬ ­ å®¤ïâáï ¯à®¡¥«ë
  2187.         @@:
  2188.         cmp byte[esi],' '
  2189.         jne @f
  2190.                 inc esi
  2191.                 jmp @b
  2192.         @@:
  2193.  
  2194.         ;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
  2195.         xor ecx,ecx
  2196.         inc ecx
  2197.         cmp byte[esi],'-'
  2198.         jne @f
  2199.                 dec ecx
  2200.                 inc esi
  2201.         @@:
  2202.  
  2203.         cmp word[esi],'0x'
  2204.         je .load_digit_16
  2205.  
  2206.         .load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
  2207.                 mov bl,byte[esi]
  2208.                 cmp bl,'0'
  2209.                 jl @f
  2210.                 cmp bl,'9'
  2211.                 jg @f
  2212.                         sub bl,'0'
  2213.                         imul eax,10
  2214.                         add eax,ebx
  2215.                         inc esi
  2216.                         jmp .load_digit_10
  2217.         jmp @f
  2218.  
  2219.         .load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
  2220.                 add esi,2
  2221.         .cycle_16:
  2222.                 mov bl,byte[esi]
  2223.                 cmp bl,'0'
  2224.                 jl @f
  2225.                 cmp bl,'f'
  2226.                 jg @f
  2227.                 cmp bl,'9'
  2228.                 jle .us1
  2229.                         cmp bl,'A'
  2230.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
  2231.                 .us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
  2232.                 cmp bl,'F'
  2233.                 jle .us2
  2234.                         cmp bl,'a'
  2235.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
  2236.                         sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
  2237.                 .us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
  2238.                         sub bl,'0'
  2239.                         cmp bl,9
  2240.                         jle .cor1
  2241.                                 sub bl,7 ;convert 'A' to '10'
  2242.                         .cor1:
  2243.                         shl eax,4
  2244.                         add eax,ebx
  2245.                         inc esi
  2246.                         jmp .cycle_16
  2247.         @@:
  2248.         cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
  2249.         jne @f
  2250.                 sub ecx,eax
  2251.                 mov eax,ecx
  2252.         @@:
  2253.         pop esi ecx ebx
  2254.         ret
  2255. endp
  2256.  
  2257. ;íâ®â ª®¤ ­¥ ¬®©, ®­ ¯à¥®¡à §ã¥â ç¨á«® ¢ áâபã
  2258. ;input:
  2259. ; eax = value
  2260. ; edi = string buffer
  2261. ;output:
  2262. align 4
  2263. convert_int_to_str:
  2264.         pushad
  2265.                 mov dword[edi+1],0;0x20202020
  2266.                 call .str
  2267.         popad
  2268.         ret
  2269.  
  2270. align 4
  2271. .str:
  2272.         mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
  2273.     ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
  2274.         cmp eax,ecx  ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
  2275.         jb @f
  2276.                 xor edx,edx  ;®ç¨áâ¨âì edx
  2277.                 div ecx      ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
  2278.                 push edx     ;¯®«®¦¨âì ¢ á⥪
  2279.                 ;dec edi             ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  2280.                 call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
  2281.                 pop eax
  2282.         @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
  2283.         or al,0x30  ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥  ç¥¬ ¤¢¥ ¢ëè¥
  2284.         stosb       ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
  2285.         ret           ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
  2286.  
  2287. i_end:
  2288.         rb 1024
  2289. stacktop:
  2290.         sys_path rb 1024
  2291.         file_name:
  2292.                 rb 1024 ;4096
  2293.         library_path rb 1024
  2294.         plugin_path rb 4096
  2295.         openfile_path rb 4096
  2296.         filename_area rb 256
  2297. mem:
  2298.