Subversion Repositories Kolibri OS

Rev

Rev 4990 | Rev 7577 | 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 4096 ;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 '../../dll.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,dll.Load
  26.  
  27. ;Œ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨© á ¨á¯®«ì§®¢ ­¨¥¬ ¡¨¡«¨®â¥ª¨ libimg.obj
  28. ;¤«ï ¨á¯®«ì§®¢ ­¨ï ¬ ªà®á  ­ã¦­ë ¯¥à¥¬¥­­ë¥:
  29. ; - run_file_70 FileInfoBlock
  30. ; - image_data dd 0
  31. macro load_image_file path,buf,size
  32. {
  33.         ;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
  34.         if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
  35.                 jmp @f
  36.                         local .path_str
  37.                         .path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
  38.                         db 0
  39.                 @@:
  40.                 ;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
  41.                 copy_path .path_str,[32],file_name,0
  42.         else
  43.                 copy_path path,[32],file_name,0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
  44.         end if
  45.  
  46.         stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
  47.         mov [buf],eax
  48.  
  49.         mov [run_file_70.Function], 0
  50.         mov [run_file_70.Position], 0
  51.         mov [run_file_70.Flags], 0
  52.         mov [run_file_70.Count], dword size
  53.         mov [run_file_70.Buffer], eax
  54.         mov byte[run_file_70+20], 0
  55.         mov [run_file_70.FileName], file_name
  56.         mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  57.         cmp ebx,0xffffffff
  58.         je @f
  59.                 ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
  60.                 stdcall dword[img_decode], dword[buf],ebx,0
  61.                 mov dword[image_data],eax
  62.                 ;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
  63.                 stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
  64.                 ;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
  65.                 stdcall dword[img_destroy], dword[image_data]
  66.         @@:
  67. }
  68.  
  69. image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  70. icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
  71.  
  72. align 4
  73. start:
  74.         mcall 48,3,sc,sizeof.system_colors
  75.  
  76.         mcall 68,11
  77.         or eax,eax
  78.         jz button.exit
  79.  
  80.         mcall 66,1,1 ;scan code
  81.         mcall 40,0x27
  82.  
  83. ;-------------------------------------------------
  84.         mov ecx,maxSyntaxFileSize
  85.         stdcall mem.Alloc,ecx
  86.         mov [options_file],eax
  87.         mov [options_file_end],eax
  88.         add [options_file_end],ecx
  89.  
  90.  
  91. load_libraries l_libs_start,load_lib_end
  92.  
  93. ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
  94.         cmp dword [lib0+ll_struc_size-4],0
  95.         jz @f
  96.                 mcall -1 ;exit not correct
  97.         @@:
  98.  
  99. ;---------------------------------------------------------------------
  100.         stdcall dword[tl_data_init],dword tree1
  101.  
  102. ; ç¨â ¥¬ ä ©« á ªãàá®à ¬¨ ¨ «¨­¨ï¬¨
  103.         load_image_file 'tl_sys_16.png', icon_tl_sys,54+3*256*13
  104.         mov eax,dword[icon_tl_sys]
  105.         mov dword[tree1.data_img_sys],eax
  106. ;---------------------------------------------------------------------
  107. ; ç¨â ¥¬ bmp ä ©« á ¨ª®­ª ¬¨ 㧫®¢
  108.         load_image_file 'tl_nod_16.png', icon_tl_sys,54+3*256*2
  109.         mov eax,dword[icon_tl_sys]
  110.         mov dword[tree1.data_img],eax
  111. ;------------------------------------------------------------------------------
  112.   copy_path fn_syntax_dir,sys_path,file_name,0 ;¡¥à¥¬ ¯ãâì ª ¯ ¯ª¥ á ä ©« ¬¨ ᨭ⠪á¨á 
  113.   mov eax,70
  114.   mov ebx,tree_file_struct
  115.   int 0x40
  116.  
  117. cmp ebx,-1
  118. je .end_dir_init
  119.  
  120.   mov eax,dir_mem
  121.   add eax,32+4+1+3+4*6+8
  122. mov ecx,ebx
  123. @@:
  124.   cmp byte[eax],'.' ;䨫ìâà㥬 ä ©«ë á ¨¬¥­ ¬¨ '.' ¨ '..'
  125.   je .filter
  126.     stdcall dword[tl_node_add],tree1,0x10000,eax ;1*2^16 - £¤¥ 1 ­®¬¥à ¨ª®­ª¨ á ª­¨£®©
  127.     stdcall dword[tl_cur_next],tree1
  128.   .filter:
  129.   add eax,304
  130.   loop @b
  131.   stdcall dword[tl_cur_beg],tree1 ;áâ ¢¨¬ ªãàá®à ­  ­ ç «® ᯨ᪠
  132. .end_dir_init:
  133.  
  134. ;--- load color option file ---
  135. stdcall [ted_init], tedit0
  136. mov byte[file_name],0
  137.  
  138. align 4
  139. red_win:
  140.         call draw_window
  141.  
  142. align 4
  143. still:
  144.   mcall 10
  145.  
  146.   cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
  147.   jz red_win
  148.   cmp al,2
  149.   jz key
  150.   cmp al,3
  151.   jz button
  152.   cmp al,6
  153.   jz mouse
  154.  
  155.   jmp still
  156.  
  157.  
  158. align 4
  159. draw_window:
  160.         pushad
  161.         mcall 12,1
  162.  
  163.         mov edx,[sc.work]
  164.         or  edx,0x33000000
  165.         mov edi,hed
  166.         mcall 0,<10,555>,<10,333>
  167.  
  168.         mcall 9,procinfo,-1
  169.  
  170.         mov eax,8 ;ª­®¯ª 
  171.         mov ebx,5*65536+90
  172.         mov ecx,195*65536+20
  173.         mov edx,200
  174.         mov esi,[sc.work_button];0xd0
  175.         mcall
  176.  
  177.         ;mov eax,8
  178.         mov ebx,100*65536+85
  179.         mov ecx,195*65536+20
  180.         mov edx,201
  181.         mov esi,0xd00000
  182.         mcall
  183.  
  184.         mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
  185.         mov ebx,10*65536+200
  186.         mov ecx,[sc.work_button_text]
  187.         or  ecx,0x80000000
  188.         mov edx,txt122
  189.         mcall
  190.  
  191.         mov ebx,105*65536+200
  192.         mov ecx,0xffff00
  193.         or  ecx,0x80000000
  194.         mov edx,txt148
  195.         mcall
  196.  
  197.         mov ebx,195*65536+10
  198.         mov ecx,[sc.work_text]
  199.         or  ecx,0x80000000
  200.         mov edx,txt_inp_file
  201.         int 0x40
  202.  
  203.         add ebx,20
  204.         mov edx,txt_out_file
  205.         int 0x40
  206.  
  207.         push dword PathShow_data_1
  208.         call [PathShow_draw]
  209.        
  210.         stdcall [edit_box_draw],dword edit1
  211.         stdcall [tl_draw],dword tree1
  212.  
  213.         ;scroll 1
  214.         mov [ws_dir_lbox.all_redraw],1
  215.         stdcall [scrollbar_ver_draw],dword ws_dir_lbox
  216.         stdcall [ted_draw], tedit0
  217.  
  218.         mcall 12,2
  219.         popad
  220.         ret
  221.  
  222. align 4
  223. mouse:
  224.         stdcall [tl_mouse],tree1
  225.         stdcall [edit_box_mouse],edit1
  226.         stdcall [ted_mouse], tedit0
  227.         jmp still
  228.  
  229. ;output:
  230. ; ah = symbol
  231. align 4
  232. proc KeyConvertToASCII, table:dword
  233.         push ebx
  234.         mov ebx,dword[table] ;convert scan to ascii
  235.         ror ax,8
  236.         xor ah,ah
  237.         add bx,ax
  238.         mov ah,byte[ebx]
  239.         pop ebx
  240.         ret
  241. endp
  242.  
  243. align 4
  244. key:
  245.         mcall 66,3 ;66.3 ¯®«ãç¨âì á®áâ®ï­¨¥ ã¯à ¢«ïîé¨å ª« ¢¨è
  246.         xor esi,esi
  247.         mov ecx,1
  248.         test al,0x03 ;[Shift]
  249.         jz @f
  250.                 mov cl,2
  251.                 or esi,KM_SHIFT
  252.         @@:
  253.         test al,0x0c ;[Ctrl]
  254.         jz @f
  255.                 or esi,KM_CTRL
  256.         @@:
  257.         test al,0x30 ;[Alt]
  258.         jz @f
  259.                 mov cl,3
  260.                 or esi,KM_ALT
  261.         @@:
  262.         test al,0x80 ;[NumLock]
  263.         jz @f
  264.                 or esi,KM_NUMLOCK
  265.         @@:
  266.  
  267.         mcall 26,2,,conv_tabl ;26.2 ¯®«ãç¨âì à áª« ¤ªã ª« ¢¨ âãàë
  268.         mcall 2
  269.         stdcall [tl_key],tree1
  270.  
  271.         test word [edit1.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
  272.         je @f
  273.                 cmp ah,0x80 ;if key up
  274.                 ja still
  275.                 cmp ah,42 ;[Shift] (left)
  276.                 je still
  277.                 cmp ah,54 ;[Shift] (right)
  278.                 je still
  279.                 cmp ah,56 ;[Alt]
  280.                 je still
  281.                 cmp ah,29 ;[Ctrl]
  282.                 je still
  283.                 cmp ah,69 ;[Pause Break]
  284.                 je still
  285.  
  286.                 stdcall KeyConvertToASCII, dword conv_tabl
  287.                 stdcall [edit_box_key],edit1
  288.                 jmp still
  289.         @@:
  290.  
  291.         stdcall [ted_key], tedit0, conv_tabl,esi
  292.         jmp still
  293.  
  294. align 4
  295. button:
  296. ;  cmp [menu_active],1 ;¥á«¨ ­ ¦ «¨ ¬¥­î, â® á­ ç «  ॠªæ¨ï ­  ¬¥­î
  297. ;  jne @f ;mouse.menu_bar_1
  298. ;    mov [menu_active],0
  299. ;    jmp still
  300. ;  @@:
  301.  
  302.   mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
  303.  
  304.   cmp ah,200
  305.   jne @f
  306.     call but_OpenSyntax
  307.   @@:
  308.   cmp ah,201
  309.   jne @f
  310.     call but_SaveSyntax
  311.   @@:
  312.  
  313.   cmp ah,1
  314.   jne still
  315. .exit:
  316.   ;push eax
  317.  
  318.   stdcall mem.Free,[options_file]
  319.  
  320.   stdcall [tl_data_clear], tree1
  321.   stdcall [ted_delete], tedit0
  322.   mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
  323.  
  324. align 4
  325. but_OpenSyntax:
  326. push eax
  327.         stdcall [tl_node_get_data],tree1
  328.         mov [fn_col_option],eax
  329.         call InitColText
  330. pop eax
  331.         ret
  332.  
  333. align 4
  334. but_SaveSyntax:
  335.         stdcall [ted_save_file], tedit0,run_file_70,[edit1.text]
  336.         ret
  337.  
  338. align 4
  339. but_ctrl_o:
  340.         push eax
  341.         call get_wnd_in_focus
  342.         cmp eax,0
  343.         je @f
  344.                 stdcall [ted_open_file], eax,str_file_70,[edit1.text]
  345.         @@:
  346.         pop eax
  347.         ret
  348.  
  349. ;ᮧ¤ ­¨¥ ­®¢®£® ä ©« 
  350. align 4
  351. but_ctrl_n:
  352.         push eax
  353.         call get_wnd_in_focus
  354.         cmp eax,0
  355.         je @f
  356.                 stdcall [ted_clear], eax,1
  357.                 stdcall [ted_draw], eax
  358.         @@:
  359.         pop eax
  360.         ret
  361.  
  362. ;®¯à¥¤¥«ï¥¬ ª ª®¥ ¨§ ®ª®­ । ªâ®à  ¢ 䮪ãá¥
  363. align 4
  364. get_wnd_in_focus:
  365.         xor eax,eax
  366.         cmp dword[el_focus],tedit0
  367.         jne @f
  368.                 mov eax,tedit0
  369.         @@:
  370.         ;cmp dword[el_focus],tedit1
  371.         ;jne @f
  372.         ;       mov eax,tedit1
  373.         ;@@:
  374.         ret
  375.  
  376. hed db 'TextEditor syntax file converter 10.11.15',0 ;¯®¤¯¨áì ®ª­ 
  377. conv_tabl rb 128 ; â ¡«¨æ  ¤«ï ª®­¢¥àâ¨à®¢ ­¨ï scan-ª®¤  ¢ ascii-ª®¤
  378.  
  379. txt122 db '‡ £à. ä ©«',0
  380. txt148 db '‘®åà. ä ©«',0
  381. txt_inp_file db 'ˆáå. ä ©«:',0
  382. txt_out_file db '‚ëå. ä ©«:',0
  383.  
  384. txt_no_kpack db 'Žâªà뢠¥¬ë© ä ©« ᦠâ Kpack-®¬.',13,10,'„«ï à ¡®âë á ä ©«®¬ à á¯ ªã©â¥ ¥£® ¨á¯®«ì§ãï á¨á⥬­ãî ¯à®£à ¬¬ã Kpack.',13,10,' ¡®â  ᮠᦠâ묨 ä ©« ¬¨ ¯®ª  ­¥ ¯®¤¤¥à¦¨¢ ¥âáï.',0
  385.  
  386. head_f_i:
  387. head_f_l db 'System error',0
  388. err_message_found_lib_0 db 'Sorry I cannot found library ',39,'box_lib.obj',39,0
  389. err_message_import_0 db 'Error on load import library ',39,'box_lib.obj',39,0
  390. err_message_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,0
  391. err_message_import_1 db 'Error on load import library ',39,'libimg.obj',39,0
  392.  
  393. ;library structures
  394. l_libs_start:
  395.         lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0, err_message_found_lib_0, head_f_l, import_box_lib,err_message_import_0, head_f_i
  396.         lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1, err_message_found_lib_1, head_f_l, import_libimg,err_message_import_1, head_f_i
  397. load_lib_end:
  398.  
  399.  
  400. align 16
  401. i_end:
  402.         procinfo process_information
  403.                 rb 1024
  404.         thread:
  405.                 rb 1024
  406. stacktop:
  407.   sys_path:
  408.     rb 4096
  409.   file_name:
  410.     rb 4096
  411.   file_name_rez:
  412.     rb 4096
  413. mem:
  414.