Subversion Repositories Kolibri OS

Rev

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