Subversion Repositories Kolibri OS

Rev

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

  1. struct FileInfoBlock
  2.         Function dd ?
  3.         Position dd ?
  4.         Flags    dd ?
  5.         Count    dd ?
  6.         Buffer   dd ?
  7.                 db ?
  8.         FileName dd ?
  9. ends
  10.  
  11. struct symbol
  12.         c db ?    ; +0 ᨬ¢®«
  13.         col db ?  ; +1 梥â
  14.         perv dd ? ; +2
  15.         next dd ? ; +6 㪠§ â¥«¨
  16.         tc dd ?   ;+10 ¢à¥¬. ᮧ¤ ­¨ï
  17.         td dd ?   ;+14 ¢à¥¬. 㤠«¥­¨ï
  18. ends
  19.  
  20. bmp_icon dd 0
  21.  
  22.  
  23. ;input:
  24. ; al = ª®¤ ®è¨¡ª¨
  25. align 4
  26. ted_on_init_synt_err:
  27.         mov byte[msgbox_3.err],'0'
  28.         add byte[msgbox_3.err],al
  29.         stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file!
  30.         ret
  31.  
  32.  
  33. align 4
  34. ted_but_new_file:
  35.         push eax ebx
  36.         stdcall [ted_can_save], tedit0
  37.         cmp al,1
  38.         jne @f
  39.                 stdcall [mb_create],msgbox_2,thread ;message: save changes in file?
  40.                 stdcall [mb_setfunctions],msgbox_2N_funct
  41.                 jmp .ret_f
  42.         @@:
  43.         call On_NewFile
  44.         .ret_f:
  45.                 mov byte[openfile_path],0
  46.                 mcall 71,1,hed
  47.         pop ebx eax
  48.         ret
  49.  
  50. align 4
  51. On_NewFile:
  52.         stdcall [ted_clear], tedit0,1
  53.         call draw_but_toolbar
  54.         stdcall [ted_draw], tedit0
  55.         ret
  56.  
  57. align 4
  58. On_SaveAndNewFile:
  59.         push edi
  60.         mov edi, tedit0
  61.  
  62.         call ted_but_save_file
  63.         cmp ted_err_save,0
  64.         jne @f
  65.                 call On_NewFile
  66.         @@:
  67.         pop edi
  68.         ret
  69.  
  70. align 4
  71. On_SaveAndOpenFile:
  72.         push edi
  73.         mov edi, tedit0
  74.  
  75.         call ted_but_save_file
  76.         cmp ted_err_save,0
  77.         jne @f
  78.                 call ted_but_open_file.no_msg
  79.         @@:
  80.         pop edi
  81.         ret
  82.  
  83. align 4
  84. On_SaveAndExit:
  85.         push edi
  86.         mov edi, tedit0
  87.  
  88.         call ted_but_save_file
  89.         cmp ted_err_save,0
  90.         jne @f
  91.                 mov dword[exit_code],1
  92.         @@:
  93.         pop edi
  94.         ret
  95.  
  96. align 4
  97. On_Exit:
  98.         mov dword[exit_code],1
  99.         ret
  100.  
  101. ;description:
  102. ; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  ¡¥§ ®ª­  á®®¡é¥­¨ï
  103. align 4
  104. but_no_msg_OpenFile:
  105.         push eax ebx
  106.         stdcall [ted_open_file], tedit0,run_file_70,openfile_path
  107.         call ted_messages_after_open_file
  108.         pop ebx eax
  109.         ret
  110.  
  111. ;description:
  112. ; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  á ¢®§¬®¦­ë¬ ®ª­®¬ á®®¡é¥­¨ï (® ¢®§¬®¦­®á⨠®â¬¥­¨âì ®âªàë⨥)
  113. align 4
  114. ted_but_open_file:
  115.         pushad
  116.  
  117.         stdcall [ted_can_save], tedit0
  118.         cmp al,1
  119.         jne @f
  120.                 stdcall [mb_create],msgbox_2,thread ;message: save changes in file?
  121.                 stdcall [mb_setfunctions],msgbox_2O_funct
  122.                 jmp .ret_f
  123.         .no_msg: ;¬¥âª  ¤«ï ¢ë§®¢  ä㭪樨 ç¥à¥§ ª­®¯ªã ¢ á®®¡é¥­¨¨ msgbox_5
  124.                 pushad
  125.         @@:
  126.  
  127.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  128.         mov [OpenDialog_data.type],0
  129.         stdcall [OpenDialog_Start],OpenDialog_data
  130.         cmp [OpenDialog_data.status],2
  131.         jne @f
  132.                 stdcall mem_spac, msgbox_9.fdp,100
  133.                 mov esi,file_name
  134.                 call strlen
  135.                 cmp eax,100
  136.                 jle .no_crop
  137.                         mov eax,100
  138.                 .no_crop:
  139.                 stdcall mem_copy, esi,msgbox_9.fdp,eax
  140.                 stdcall [mb_create],msgbox_9,thread ;message: error run 'open file dialog'
  141.                 jmp .ret_f
  142.         @@:
  143.         cmp [OpenDialog_data.status],1
  144.         jne .ret_f
  145.  
  146.                 ;¨é¥¬ ¥áâì «¨ ä ©« ¯®¤á¢¥âª¨ ¤«ï ®âªà뢠¥¬®£® ⥪á⮢®£® ä ©« 
  147.                 mov esi,[OpenDialog_data.openfile_path]
  148.                 call strlen
  149.                 mov edx,openfile_path
  150.                 add edx,eax
  151.                 .f_beg:
  152.                 cmp byte[edx],'.'
  153.                 je .found
  154.                         dec edx
  155.                         cmp edx,openfile_path
  156.                         jg .f_beg
  157.                 .found:
  158.                 inc edx ;edx - 㪠§ â¥«ì ­  à áè¨à¥­¨¥ ®âªàë⮣® ä ©« 
  159.  
  160.                 mov ebx,synt_auto_open
  161.                 .cycle_0:
  162.                         add ebx,32
  163.                         stdcall strcmp,ebx,edx ;áà ¢­¨¢ ¥¬ à áè¨à¥­¨¥ ®âªàë⮣® ä ©«  á® §­ ç¥­¨ï¬¨ ®âªàëâ묨 á ini ä ©« 
  164.                         test eax,eax
  165.                         jz .ok
  166.                         add ebx,32
  167.                         cmp byte[ebx],0
  168.                         jne .cycle_0
  169.                 jmp .end_0
  170.                 .ok: ;®âªàë⨥ ä ©«  ¯®¤á¢¥âª¨ ¢ § ¢¨á¨¬®á⨠®â ­ ©¤¥­­®£® à áè¨à¥­¨ï
  171.                         sub ebx,32
  172.                         ;mov ecx,ebx
  173.                         ;mcall 71,1
  174.                         call open_unpac_synt_file
  175.                 .end_0:
  176.  
  177.                 stdcall [ted_open_file], tedit0,run_file_70,openfile_path
  178.                 call ted_messages_after_open_file
  179.  
  180.         .ret_f:
  181.         popad
  182.         ret
  183.  
  184. ;description:
  185. ; äã­ªæ¨ï á®åà ­¥­¨ï ä ©«  á ¢ë§®¢®¬ ®ª­  ¤¨ «®£ 
  186. align 4
  187. proc ted_but_save_file
  188.         ;*** ¢ë§®¢ ¤¨ «®£®¢®£® ®ª­  ¤«ï á®åà ­¥­¨ï ä ©« 
  189.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  190.         mov [OpenDialog_data.type],1
  191.         stdcall [OpenDialog_Start],OpenDialog_data
  192.         cmp [OpenDialog_data.status],1 ;if status==1 then save
  193.         jne .end_save_file
  194.                 stdcall [ted_save_file],tedit0,run_file_70,openfile_path
  195.         .end_save_file:
  196.         ret
  197. endp
  198.  
  199. ;description:
  200. ; ª®¯¨à®¢ ­¨¥ ¯ ¬ïâ¨
  201. align 4
  202. proc mem_copy uses ecx esi edi, source:dword, destination:dword, len:dword
  203.         cld
  204.         mov esi, dword[source]
  205.         mov edi, dword[destination]
  206.         mov ecx, dword[len]
  207.         rep movsb
  208.         ret
  209. endp
  210.  
  211. ;description:
  212. ; § ¯®«­¥­¨¥ ¯ ¬ï⨠¯à®¡¥« ¬¨
  213. align 4
  214. proc mem_spac uses eax ecx edi, mem:dword, len:dword
  215.         cld
  216.         mov al,' '
  217.         mov edi, dword[mem]
  218.         mov ecx, dword[len]
  219.         repne stosb
  220.         ret
  221. endp
  222.  
  223. ;input:
  224. ; eax = ª®¤ ®è¨¡ª¨
  225. ; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
  226. align 4
  227. ted_messages_after_open_file:
  228.         push ecx edi
  229.         cmp eax,0
  230.         je @f
  231.         cmp eax,6
  232.         je @f
  233.                 cmp ax,10
  234.                 jl .zifra_0_9
  235.                         mov al,'?'
  236.                         sub ax,48
  237.                 .zifra_0_9:
  238.                 add ax,48
  239.  
  240.                 mov byte[msgbox_4.err],al
  241.                 stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file!
  242.                 jmp .ret_f
  243.         @@:
  244.         cmp ebx,-1
  245.         je .ret_f
  246.                 ;if open file
  247.                 mov edi,tedit0
  248.                 mov ecx,ted_max_chars
  249.                 sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
  250.                 cmp ebx,ecx
  251.                 jl .ret_f
  252.                         stdcall [mb_create],msgbox_1,thread
  253.         .ret_f:
  254.         pop edi ecx
  255.         ret
  256.  
  257. align 4
  258. ted_save_err_msg:
  259.         mov byte[msgbox_6.err],al
  260.         stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
  261.         ret
  262.  
  263. ;description:
  264. ; äã­ªæ¨ï ­ ¦ â¨ï ­  ª­®¯ªã [à¨¬¥­¨âì] ¢ ¯ ­¥«¨ ᨭ⠪á¨á 
  265. align 4
  266. proc ted_but_open_syntax uses eax ebx ecx edi, edit:dword
  267.         mov edi,dword[edit]
  268.         cmp ted_panel_id,TED_PANEL_SYNTAX
  269.         jne @f
  270.                 stdcall dword[tl_node_get_data], tree1
  271.                 mov [fn_col_option],eax
  272.                 mov ebx,eax
  273.                 call open_unpac_synt_file
  274.                 cmp ebx,-1
  275.                 je @f
  276.  
  277.                 call [ted_text_colored]
  278.                 stdcall [ted_draw],edi
  279.         @@:
  280.         ret
  281. endp
  282.  
  283. ;®âªàë⨥ ¨ à á¯ ª®¢ª  ä ©«  ¯®¤á¢¥âª¨ ᨭ⠪á¨á 
  284. ;input:
  285. ; ebx - 㪠§ â¥«ì ­  ¨¬ï ®âªà뢠¥¬®£® ä ©«  ᨭ⠪á¨á  (¡¥§ ¯ã⨠¨ ¯ ¯ª¨ info)
  286. ;output:
  287. ; ebx - ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â ¨§ ä ©« 
  288. ; ecx - à §àãè ¥âáï
  289. align 4
  290. open_unpac_synt_file:
  291. push eax edi esi
  292.         mov edi,last_open_synt_file
  293.         stdcall strcmp,ebx,edi ;áà ¢­¨¢ ¥¬ ¨¬ï ¯®¤ª«î祭­®£® ä ©«  á ¯®¤ª«î祭­ë¬ à ­¥¥ ä ©«®¬
  294.         test eax,eax
  295.         jz @f
  296.  
  297.         ;ª®¯¨à㥬 ¨¬ï ¯®¤ª«î祭­®£® ä ©«  (¤«ï ¨§¡¥¦ ­¨ï ¯®¢â®à­ëå ¯®¤ª«î祭¨©)
  298.         mov esi,ebx
  299.         mov ecx,32
  300.         cld
  301.         rep movsb
  302.  
  303.         copy_path ebx,fn_syntax_dir,syntax_path,0
  304.         copy_path syntax_path,sys_path,file_name,0
  305.         mov edi, tedit0
  306.         mov [run_file_70.Function], 0
  307.         mov [run_file_70.Position], 0
  308.         mov [run_file_70.Flags], 0
  309.         mov ecx, ted_syntax_file_size
  310.         mov dword[run_file_70.Count], ecx
  311.         m2m dword[run_file_70.Buffer], ted_syntax_file
  312.         mov byte[run_file_70+20], 0
  313.         mov [run_file_70.FileName], file_name
  314.         mcall 70, run_file_70
  315.         cmp ebx,-1
  316.         jne .end_0
  317.                 call ted_on_init_synt_err
  318.                 jmp @f
  319.         .end_0:
  320.                 mov eax,ted_syntax_file
  321.                 cmp dword[eax],'KPCK'
  322.                 jne .end_unpack
  323.                 cmp dword[eax+4],ecx
  324.                 jg @f ;¥á«¨ ¤«ï à á¯ ª®¢ ­®£® ä ©«  ­¥ 墠⠥⠢뤥«¥­­®© ¯ ¬ïâ¨
  325.                 cmp dword[unpac_mem],0
  326.                 jne .end_1
  327.                         ;¢ë¤¥«¥­¨¥ ¯ ¬ï⨠¤«ï à á¯ ª®¢ª¨ ä ©« 
  328.                         stdcall mem.Alloc,ecx
  329.                         mov [unpac_mem],eax
  330.                 .end_1:
  331.                 stdcall unpack,ted_syntax_file,[unpac_mem]
  332.                 mov edi,ted_syntax_file
  333.                 mov esi,[unpac_mem]
  334.                 mov ecx,[edi+4]
  335.                 cld
  336.                 rep movsb
  337.                 .end_unpack:
  338.                 stdcall [ted_init_syntax_file], tedit0
  339.         @@:
  340. pop esi edi eax
  341.         ret
  342.  
  343. ;description:
  344. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
  345. align 4
  346. proc ted_but_find uses edi
  347.         mov edi,tedit0
  348.  
  349.         cmp ted_panel_id,TED_PANEL_NULL
  350.         je @f
  351.                 mov ted_panel_id,TED_PANEL_NULL
  352.                 mov ted_wnd_l,0
  353.                 jmp .e_if
  354.         @@:
  355.                 mov ted_panel_id,TED_PANEL_FIND
  356.                 mov ted_wnd_l,TED_PANEL_WIDTH
  357.         .e_if:
  358.         call EvSize
  359.         stdcall [ted_draw],edi
  360.         ret
  361. endp
  362.  
  363. align 4
  364. tbl_1251_866:
  365. rb 128
  366. db   0,  0,  0,  0,  0,  0,  0,  0,  0,0,0,0,0,0,0,0 ;128
  367. db   0,  0,  0,  0,  0,  0,  0,  0,  0,0,0,0,0,0,0,0 ;144
  368. db   0,  0,  0,  0,  0,  0,  0,  0,240,0,0,0,0,0,0,0 ;160
  369. db   0,  0,  0,  0,  0,  0,  0,  0,241,0,0,0,0,0,0,0 ;176
  370. db 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143 ;192
  371. db 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159 ;208
  372. db 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175 ;224
  373. db 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239 ;240
  374.  
  375. align 4
  376. tbl_866_1251:
  377. rb 128
  378. db 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207 ;128
  379. db 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223 ;144
  380. db 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239 ;160
  381. db   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;176
  382. db   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;192
  383. db   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;208
  384. db 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 ;224
  385. db 168,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;240
  386.  
  387. align 4
  388. ted_on_find_err:
  389.         stdcall [mb_create],msgbox_7,thread ;message: Can not find text
  390.         ret
  391.  
  392. ;description:
  393. ; ª­®¯ª  [‡ ¬¥­¨âì] ­  ¯ ­¥«¨
  394. align 4
  395. but_replace:
  396.         ; ¯®ª  ­¥ ᤥ« ­®
  397.         ret
  398.  
  399. ;description:
  400. ; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
  401. align 4
  402. but_find_key_w:
  403.         cmp byte[wnd_k_words_run],0
  404.         jne @f
  405.                 pushad
  406.                 mcall 51,1,prop_start,thread_coords
  407.                 popad
  408.         @@:
  409.         ret
  410.  
  411. ;description:
  412. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
  413. align 4
  414. proc but_sumb_invis, edit:dword
  415.   push edi
  416.   mov edi,dword[edit]
  417.  
  418.   xor ted_mode_invis,1
  419.   call draw_but_toolbar
  420.   stdcall [ted_draw],edi
  421.   pop edi
  422.   ret
  423. endp
  424.  
  425. ;description:
  426. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ª«î祢ëå á«®¢
  427. align 4
  428. proc but_k_words_show, edit:dword
  429.   push edi
  430.   mov edi,dword[edit]
  431.  
  432.   xor ted_mode_color,1
  433.   cmp ted_mode_color,0
  434.   je @f
  435.     call [ted_text_colored]
  436.   @@:
  437.   call draw_but_toolbar
  438.   stdcall [ted_draw],edi
  439.   pop edi
  440.   ret
  441. endp
  442.  
  443. ;description:
  444. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
  445. align 4
  446. proc but_synt_show, edit:dword
  447.   push edi
  448.   mov edi,[edit]
  449.  
  450.   cmp ted_panel_id,TED_PANEL_NULL
  451.   je @f
  452.     mov ted_panel_id,TED_PANEL_NULL
  453.     mov ted_wnd_l,0
  454.     jmp .e_if
  455.   @@:
  456.     mov ted_panel_id,TED_PANEL_SYNTAX
  457.     mov ted_wnd_l,TED_PANEL_WIDTH
  458.   .e_if:
  459.   call EvSize
  460.   stdcall [ted_draw],edi
  461.   pop edi
  462.   ret
  463. endp
  464.