Subversion Repositories Kolibri OS

Rev

Rev 2102 | Rev 2159 | 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 0x01
  5.   dd start
  6.   dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
  7.   dd mem
  8.   dd stacktop
  9.   dd file_name
  10.   dd sys_path
  11.  
  12. MAX_COLOR_WORD_LEN equ 40
  13. BUF_SIZE equ 1000 ;buffer for copy|paste
  14. maxSyntaxFileSize equ 310000
  15. CAPT_PATH_WIDTH equ 50 ;è¨à¨­  ¯®¤¯¨á¨ ¯¥à¥¤ ⥪áâ®¢ë¬ ¯®«¥¬
  16.  
  17. include '../../macros.inc'
  18. include '../../proc32.inc'
  19. include '../../develop/libraries/box_lib/load_lib.mac'
  20. include '../../develop/libraries/box_lib/trunk/box_lib.mac'
  21. include '../t_edit/mem.inc'
  22. include 'te_data.inc'
  23. include 'te_work.inc' ;text work functions
  24.  
  25. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,0
  26.  
  27. align 4
  28. start:
  29.   mov eax,48
  30.   mov ebx,3
  31.   mov ecx,sc
  32.   mov edx,sizeof.system_colors
  33.   mcall
  34.  
  35.   mcall 68,11
  36.   or eax,eax
  37.   jz button.exit
  38.  
  39.   mcall 40,0x27
  40.  
  41. ;-------------------------------------------------
  42.   mov ecx,maxSyntaxFileSize
  43.   stdcall mem.Alloc,ecx
  44.   mov [options_file],eax
  45.   mov [options_file_end],eax
  46.   add [options_file_end],ecx
  47.  
  48.  
  49. load_libraries l_libs_start,load_lib_end
  50.  
  51. ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
  52.         mov     ebp,lib0
  53.         cmp     dword [ebp+ll_struc_size-4],0
  54.         jz      @f
  55.         mcall   -1      ;exit not correct
  56. @@:
  57.  
  58. ;---------------------------------------------------------------------
  59.   stdcall dword[tl_data_init],dword tree1
  60.   copy_path fn_icon_tl_sys,sys_path,file_name,0
  61.  
  62.   mov ecx,3*256*13
  63.   stdcall mem.Alloc,ecx
  64.   mov dword[tree1.data_img_sys],eax
  65.  
  66.   mov [run_file_70.Function], 0
  67.   mov [run_file_70.Position], 54
  68.   mov [run_file_70.Flags], 0
  69.   mov [run_file_70.Count], ecx
  70.   mov [run_file_70.Buffer], eax
  71.   mov byte[run_file_70+20], 0
  72.   mov [run_file_70.FileName], file_name
  73.  
  74.   mov eax,70 ;load icon file
  75.   mov ebx,run_file_70
  76.   int 0x40
  77.   cmp ebx,0
  78.   jg @f
  79.     mov dword[tree1.data_img_sys],0
  80.   @@:
  81. ;---------------------------------------------------------------------
  82. ; ç¨â ¥¬ bmp ä ©« á ¨ª®­ª ¬¨ 㧫®¢
  83.   copy_path fn_icon_tl_nod,sys_path,file_name,0
  84.  
  85.   mov ecx,3*256*2
  86.   stdcall mem.Alloc,ecx
  87.   mov dword[tree1.data_img],eax
  88.  
  89. ;  mov [run_file_70.Function], 0
  90. ;  mov [run_file_70.Position], 54
  91. ;  mov [run_file_70.Flags], 0
  92.   mov [run_file_70.Count], ecx
  93.   mov [run_file_70.Buffer], eax
  94. ;  mov byte[run_file_70+20], 0
  95. ;  mov [run_file_70.FileName], file_name
  96.  
  97.   mov eax,70 ;load icon file
  98.   mov ebx,run_file_70
  99.   int 0x40
  100.   cmp ebx,0
  101.   jg @f
  102.     mov dword[tree1.data_img],0
  103.   @@:
  104. ;------------------------------------------------------------------------------
  105.   copy_path fn_syntax_dir,sys_path,file_name,0 ;¡¥à¥¬ ¯ãâì ª ¯ ¯ª¥ á ä ©« ¬¨ ᨭ⠪á¨á 
  106.   mov eax,70
  107.   mov ebx,tree_file_struct
  108.   int 0x40
  109.  
  110. cmp ebx,-1
  111. je .end_dir_init
  112.  
  113.   mov eax,dir_mem
  114.   add eax,32+4+1+3+4*6+8
  115. mov ecx,ebx
  116. @@:
  117.   cmp byte[eax],'.' ;䨫ìâà㥬 ä ©«ë á ¨¬¥­ ¬¨ '.' ¨ '..'
  118.   je .filter
  119.     push dword tree1
  120.     push dword 0x10000 ;1*2^16 - £¤¥ 1 ­®¬¥à ¨ª®­ª¨ á ª­¨£®©
  121.     push dword eax
  122.     call dword[tl_node_add]
  123.  
  124.     stdcall dword[tl_cur_next],tree1
  125.   .filter:
  126.   add eax,304
  127.   loop @b
  128.   stdcall dword[tl_cur_beg],tree1 ;áâ ¢¨¬ ªãàá®à ­  ­ ç «® ᯨ᪠
  129. .end_dir_init:
  130.  
  131. ;--- load color option file ---
  132. stdcall [ted_init], tedit0
  133. mov byte[file_name],0
  134.  
  135. align 4
  136. red_win:
  137.         call draw_window
  138.  
  139. align 4
  140. still:
  141.   mcall 10
  142.  
  143.   cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
  144.   jz red_win
  145.   cmp al,2
  146.   jz key
  147.   cmp al,3
  148.   jz button
  149.   cmp al,6
  150.   jz mouse
  151.  
  152.   jmp still
  153.  
  154.  
  155. align 4
  156. draw_window:
  157.         pushad
  158.         mcall 12,1
  159.  
  160.         mov edx,[sc.work]
  161.         or  edx,0x33000000
  162.         mov edi,hed
  163.         mcall 0,<10,555>,<10,333>
  164.  
  165.         mcall 9,procinfo,-1
  166.  
  167.         mov eax,8 ;ª­®¯ª 
  168.         mov ebx,5*65536+90
  169.         mov ecx,195*65536+20
  170.         mov edx,200
  171.         mov esi,[sc.work_button];0xd0
  172.         mcall
  173.  
  174.         ;mov eax,8
  175.         mov ebx,100*65536+85
  176.         mov ecx,195*65536+20
  177.         mov edx,201
  178.         mov esi,0xd00000
  179.         mcall
  180.  
  181.         mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
  182.         mov ebx,10*65536+200
  183.         mov ecx,[sc.work_button_text]
  184.         or  ecx,0x80000000
  185.         mov edx,txt122
  186.         mcall
  187.  
  188.         mov ebx,105*65536+200
  189.         mov ecx,0xffff00
  190.         or  ecx,0x80000000
  191.         mov edx,txt148
  192.         mcall
  193.  
  194.         mov ebx,195*65536+10
  195.         mov ecx,[sc.work_text]
  196.         or  ecx,0x80000000
  197.         mov edx,txt_inp_file
  198.         int 0x40
  199.  
  200.         add ebx,20
  201.         mov edx,txt_out_file
  202.         int 0x40
  203.  
  204.         push dword PathShow_data_1
  205.         call [PathShow_draw]
  206.        
  207.         stdcall [edit_box_draw],dword edit1
  208.         stdcall [tl_draw],dword tree1
  209.  
  210.         ;scroll 1
  211.         mov [ws_dir_lbox.all_redraw],1
  212.         stdcall [scrollbar_ver_draw],dword ws_dir_lbox
  213.         stdcall [ted_draw], tedit0
  214.  
  215.         mcall 12,2
  216.         popad
  217.         ret
  218.  
  219. align 4
  220. mouse:
  221.         stdcall [tl_mouse],tree1
  222.         stdcall [edit_box_mouse],edit1
  223.         stdcall [ted_mouse], tedit0
  224.         jmp still
  225.  
  226.  
  227. align 4
  228. key:
  229.         mcall 2
  230.         stdcall [tl_key],tree1
  231.         stdcall [edit_box_key],edit1
  232. ;;;stdcall [ted_key], tedit0, conv_tabl,esi
  233.         jmp still
  234.  
  235. align 4
  236. button:
  237. ;  cmp [menu_active],1 ;¥á«¨ ­ ¦ «¨ ¬¥­î, â® á­ ç «  ॠªæ¨ï ­  ¬¥­î
  238. ;  jne @f ;mouse.menu_bar_1
  239. ;    mov [menu_active],0
  240. ;    jmp still
  241. ;  @@:
  242.  
  243.   mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
  244.  
  245.   cmp ah,200
  246.   jne @f
  247.     call but_OpenSyntax
  248.   @@:
  249.   cmp ah,201
  250.   jne @f
  251.     call but_SaveSyntax
  252.   @@:
  253.  
  254.   cmp ah,1
  255.   jne still
  256. .exit:
  257.   ;push eax
  258.  
  259.   stdcall mem.Free,[options_file]
  260.  
  261.   stdcall [tl_data_clear], tree1
  262.   stdcall [ted_delete], tedit0
  263.   mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
  264.  
  265. align 4
  266. but_OpenSyntax:
  267.   stdcall [tl_node_get_data],tree1
  268.   pop dword [fn_col_option]
  269.   call InitColText
  270.   ret
  271.  
  272. align 4
  273. but_SaveSyntax:
  274.         stdcall [ted_but_save_file], tedit0,run_file_70,[edit1.text]
  275.         ret
  276.  
  277. align 4
  278. but_ctrl_o:
  279.         push eax
  280.         call get_wnd_in_focus
  281.         cmp eax,0
  282.         je @f
  283.                 stdcall [ted_open_file], eax,str_file_70,[edit1.text]
  284.         @@:
  285.         pop eax
  286.         ret
  287.  
  288. ;ᮧ¤ ­¨¥ ­®¢®£® ä ©« 
  289. align 4
  290. but_ctrl_n:
  291.         push eax
  292.         call get_wnd_in_focus
  293.         cmp eax,0
  294.         je @f
  295.                 stdcall [ted_clear], eax,1
  296.                 stdcall [ted_draw], eax
  297.         @@:
  298.         pop eax
  299.         ret
  300.  
  301. ;®¯à¥¤¥«ï¥¬ ª ª®¥ ¨§ ®ª®­ । ªâ®à  ¢ 䮪ãá¥
  302. align 4
  303. get_wnd_in_focus:
  304.         xor eax,eax
  305.         cmp dword[el_focus],tedit0
  306.         jne @f
  307.                 mov eax,tedit0
  308.         @@:
  309.         ;cmp dword[el_focus],tedit1
  310.         ;jne @f
  311.         ;       mov eax,tedit1
  312.         ;@@:
  313.         ret
  314.  
  315. hed db 'TextEditor syntax file converter 26.08.11',0 ;¯®¤¯¨áì ®ª­ 
  316.  
  317. txt122 db '‡ £à. ä ©«',0
  318. txt148 db '‘®åà. ä ©«',0
  319. txt_inp_file db 'ˆáå. ä ©«:',0
  320. txt_out_file db '‚ëå. ä ©«:',0
  321.  
  322. err_message_found_lib0   db 'Sorry I cannot found library box_lib.obj',0
  323. head_f_i0:
  324. head_f_l0         db 'System error',0
  325. err_message_import0      db 'Error on load import library box_lib.obj',0
  326. err_message_found_lib1  db 'Sorry I cannot found library msgbox.obj',0
  327.  
  328. ;library structures
  329. l_libs_start:
  330.   lib0 l_libs boxlib_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l0, boxlib_import,err_message_import0, head_f_i0
  331. load_lib_end:
  332.  
  333.  
  334. i_end:
  335.         rb 1024
  336.         align 16
  337.         procinfo process_information
  338.         thread:
  339.                 rb 1024
  340. stacktop:
  341.   sys_path:
  342.     rb 4096
  343.   file_name:
  344.     rb 4096
  345.   file_name_rez:
  346.     rb 4096
  347. mem:
  348.