Subversion Repositories Kolibri OS

Rev

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

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