Subversion Repositories Kolibri OS

Rev

Rev 2086 | Rev 2125 | 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.         mov ebx,(215+CAPT_PATH_WIDTH) shl 16 + 10
  205.         mov edx,file_name
  206.         int 0x40
  207.  
  208.         stdcall [edit_box_draw],dword edit1
  209.         stdcall [tl_draw],dword tree1
  210.  
  211.         ;scroll 1
  212.         mov [ws_dir_lbox.all_redraw],1
  213.         stdcall [scrollbar_ver_draw],dword ws_dir_lbox
  214.         stdcall [ted_draw], tedit0
  215.  
  216.         mcall 12,2
  217.         popad
  218.         ret
  219.  
  220. align 4
  221. mouse:
  222.         stdcall [tl_mouse],tree1
  223.         stdcall [edit_box_mouse],edit1
  224.         stdcall [ted_mouse], tedit0
  225.         jmp still
  226.  
  227.  
  228. align 4
  229. key:
  230.         mcall 2
  231.         stdcall [tl_key],tree1
  232.         stdcall [edit_box_key],edit1
  233. ;;;stdcall [ted_key], tedit0, conv_tabl,esi
  234.         jmp still
  235.  
  236. align 4
  237. button:
  238. ;  cmp [menu_active],1 ;¥á«¨ ­ ¦ «¨ ¬¥­î, â® á­ ç «  ॠªæ¨ï ­  ¬¥­î
  239. ;  jne @f ;mouse.menu_bar_1
  240. ;    mov [menu_active],0
  241. ;    jmp still
  242. ;  @@:
  243.  
  244.   mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
  245.  
  246.   cmp ah,200
  247.   jne @f
  248.     call but_OpenSyntax
  249.   @@:
  250.   cmp ah,201
  251.   jne @f
  252.     call but_SaveSyntax
  253.   @@:
  254.  
  255.   cmp ah,1
  256.   jne still
  257. .exit:
  258.   ;push eax
  259.  
  260.   stdcall mem.Free,[options_file]
  261.  
  262.   stdcall [tl_data_clear], tree1
  263.   stdcall [ted_delete], tedit0
  264.   mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
  265.  
  266. align 4
  267. but_OpenSyntax:
  268.   stdcall [tl_node_get_data],tree1
  269.   pop dword [fn_col_option]
  270.   call InitColText
  271.   ret
  272.  
  273. align 4
  274. but_SaveSyntax:
  275.         stdcall [ted_but_save_file], tedit0,run_file_70,[edit1.text]
  276.         ret
  277.  
  278. align 4
  279. but_ctrl_o:
  280.         push eax
  281.         call get_wnd_in_focus
  282.         cmp eax,0
  283.         je @f
  284.                 stdcall [ted_open_file], eax,str_file_70,[edit1.text]
  285.         @@:
  286.         pop eax
  287.         ret
  288.  
  289. ;ᮧ¤ ­¨¥ ­®¢®£® ä ©« 
  290. align 4
  291. but_ctrl_n:
  292.         push eax
  293.         call get_wnd_in_focus
  294.         cmp eax,0
  295.         je @f
  296.                 stdcall [ted_clear], eax,1
  297.                 stdcall [ted_draw], eax
  298.         @@:
  299.         pop eax
  300.         ret
  301.  
  302. ;®¯à¥¤¥«ï¥¬ ª ª®¥ ¨§ ®ª®­ । ªâ®à  ¢ 䮪ãá¥
  303. align 4
  304. get_wnd_in_focus:
  305.         xor eax,eax
  306.         cmp dword[el_focus],tedit0
  307.         jne @f
  308.                 mov eax,tedit0
  309.         @@:
  310.         ;cmp dword[el_focus],tedit1
  311.         ;jne @f
  312.         ;       mov eax,tedit1
  313.         ;@@:
  314.         ret
  315.  
  316. hed db 'TextEditor syntax file converter 22.08.11',0 ;¯®¤¯¨áì ®ª­ 
  317.  
  318. txt122 db '‡ £à. ä ©«',0
  319. txt148 db '‘®åà. ä ©«',0
  320. txt_inp_file db 'ˆáå. ä ©«:',0
  321. txt_out_file db '‚ëå. ä ©«:',0
  322.  
  323. edit1 edit_box 305+16-CAPT_PATH_WIDTH, 215+CAPT_PATH_WIDTH, 25, 0xffffff, 0xff, 0xff0000, 0, 0x80, MAX_COLOR_WORD_LEN, ed_buffer.127, mouse_dd, 0
  324.  
  325. ed_buffer: ;⥪áâ ¤«ï edit
  326.   .127: rb MAX_COLOR_WORD_LEN+2
  327.  
  328. err_message_found_lib0   db 'Sorry I cannot found library box_lib.obj',0
  329. head_f_i0:
  330. head_f_l0         db 'System error',0
  331. err_message_import0      db 'Error on load import library box_lib.obj',0
  332. err_message_found_lib1  db 'Sorry I cannot found library msgbox.obj',0
  333.  
  334. ;library structures
  335. l_libs_start:
  336.   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
  337. load_lib_end:
  338.  
  339.  
  340. i_end:
  341.         rb 1024
  342.         align 16
  343.         procinfo process_information
  344.         thread:
  345.                 rb 1024
  346. stacktop:
  347.   sys_path:
  348.     rb 4096
  349.   file_name:
  350.     rb 4096
  351.   file_name_rez:
  352.     rb 4096
  353.   file_info:
  354.     rb 40
  355. mem:
  356.