Subversion Repositories Kolibri OS

Rev

Rev 7570 | Rev 7573 | 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. ;input:
  198. ; eax ¥á«¨ à ¢¥­: 0 - á®åà ­¥­¨¥ ¡¥§ ¤¨ «®£ , 1 - á®åà ­¥­¨¥ á ¤¨ «®£®¬
  199. ;description:
  200. ; äã­ªæ¨ï á®åà ­¥­¨ï ä ©« 
  201. align 4
  202. proc ted_but_save_file
  203.         or eax,eax
  204.         jnz .init_dlg
  205.                 ; á®å࠭塞 ¡¥§ ¢ë§®¢  ¤¨ «®£®¢®£® ®ª­ 
  206.                 cmp byte[openfile_path],0
  207.                 jne @f
  208.         .init_dlg:
  209.                 ; ¢ë§®¢ ¤¨ «®£®¢®£® ®ª­  ¤«ï á®åà ­¥­¨ï ä ©« 
  210.                 copy_path open_dialog_name,communication_area_default_path,file_name,0
  211.                 mov [OpenDialog_data.type],1
  212.                 stdcall [OpenDialog_Start],OpenDialog_data
  213.                 cmp [OpenDialog_data.status],1 ;if status==1 then save
  214.                 jne .end_save
  215.         @@:
  216.                 stdcall [ted_save_file],tedit0,run_file_70,openfile_path
  217.         .end_save:
  218.         ret
  219. endp
  220.  
  221. ;description:
  222. ; ª®¯¨à®¢ ­¨¥ ¯ ¬ïâ¨
  223. align 4
  224. proc mem_cpy uses ecx esi edi, destination:dword, source:dword, len:dword
  225.         cld
  226.         mov esi,[source]
  227.         mov edi,[destination]
  228.         mov ecx,[len]
  229.         rep movsb
  230.         ret
  231. endp
  232.  
  233. ;description:
  234. ; § ¯®«­¥­¨¥ ¯ ¬ï⨠¯à®¡¥« ¬¨
  235. align 4
  236. proc mem_spac uses eax ecx edi, mem:dword, len:dword
  237.         cld
  238.         mov al,' '
  239.         mov edi,[mem]
  240.         mov ecx,[len]
  241.         repne stosb
  242.         ret
  243. endp
  244.  
  245. ;input:
  246. ; eax = ª®¤ ®è¨¡ª¨
  247. ; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
  248. align 4
  249. ted_messages_after_open_file:
  250.         push ecx edi
  251.         cmp eax,0
  252.         je @f
  253.         cmp eax,6
  254.         je @f
  255.                 cmp ax,10
  256.                 jl .zifra_0_9
  257.                         mov al,'?'
  258.                         sub ax,48
  259.                 .zifra_0_9:
  260.                 add ax,48
  261.  
  262.                 mov byte[msgbox_4.err],al
  263.                 stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file!
  264.                 jmp .ret_f
  265.         @@:
  266.         cmp ebx,-1
  267.         je .ret_f
  268.                 ;if open file
  269.                 mov edi,tedit0
  270.                 mov ecx,ted_max_chars
  271.                 sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
  272.                 cmp ebx,ecx
  273.                 jl .ret_f
  274.                         stdcall [mb_create],msgbox_1,thread
  275.         .ret_f:
  276.         pop edi ecx
  277.         ret
  278.  
  279. align 4
  280. ted_save_err_msg:
  281.         mov byte[msgbox_6.err],al
  282.         stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
  283.         ret
  284.  
  285. ;description:
  286. ; äã­ªæ¨ï ­ ¦ â¨ï ­  ª­®¯ªã [à¨¬¥­¨âì] ¢ ¯ ­¥«¨ ᨭ⠪á¨á 
  287. align 4
  288. proc ted_but_open_syntax uses eax ebx ecx edi, edit:dword
  289.         mov edi,dword[edit]
  290.         cmp ted_panel_id,TED_PANEL_SYNTAX
  291.         jne @f
  292.                 stdcall dword[tl_node_get_data], tree1
  293.                 mov [fn_col_option],eax
  294.                 stdcall open_unpac_synt_file,eax
  295.                 cmp ebx,-1
  296.                 je @f
  297.  
  298.                 call [ted_text_colored]
  299.                 stdcall [ted_draw],edi
  300.         @@:
  301.         ret
  302. endp
  303.  
  304. ;®âªàë⨥ ¨ à á¯ ª®¢ª  ä ©«  ¯®¤á¢¥âª¨ ᨭ⠪á¨á 
  305. ;input:
  306. ; f_name - 㪠§ â¥«ì ­  ¨¬ï ®âªà뢠¥¬®£® ä ©«  ᨭ⠪á¨á  (¡¥§ ¯ã⨠¨ ¯ ¯ª¨ info)
  307. ;output:
  308. ; ebx - ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â ¨§ ä ©« 
  309. ; ecx - à §àãè ¥âáï
  310. align 4
  311. proc open_unpac_synt_file uses eax edi esi, f_name:dword
  312.         mov ebx,[f_name]
  313.         mov edi,last_open_synt_file
  314.         stdcall strcmp,ebx,edi ;áà ¢­¨¢ ¥¬ ¨¬ï ¯®¤ª«î祭­®£® ä ©«  á ¯®¤ª«î祭­ë¬ à ­¥¥ ä ©«®¬
  315.         test eax,eax
  316.         jz @f
  317.  
  318.         ;ª®¯¨à㥬 ¨¬ï ¯®¤ª«î祭­®£® ä ©«  (¤«ï ¨§¡¥¦ ­¨ï ¯®¢â®à­ëå ¯®¤ª«î祭¨©)
  319.         mov esi,ebx
  320.         mov ecx,32/4
  321.         cld
  322.         rep movsd
  323.  
  324.         copy_path ebx,fn_syntax_dir,syntax_path,0
  325.         copy_path syntax_path,sys_path,file_name,0
  326.         mov edi, tedit0
  327.         mov [run_file_70.Function], SSF_READ_FILE
  328.         mov [run_file_70.Position], 0
  329.         mov [run_file_70.Flags], 0
  330.         mov ecx, ted_syntax_file_size
  331.         mov dword[run_file_70.Count], ecx
  332.         m2m dword[run_file_70.Buffer], ted_syntax_file
  333.         mov byte[run_file_70+20], 0
  334.         mov [run_file_70.FileName], file_name
  335.         mcall SF_FILE, run_file_70
  336.         cmp ebx,-1
  337.         jne .end_0
  338.                 call ted_on_init_synt_err
  339.                 jmp @f
  340.         .end_0:
  341.                 mov eax,ted_syntax_file
  342.                 cmp dword[eax],'KPCK'
  343.                 jne .end_unpack
  344.                 cmp dword[eax+4],ecx
  345.                 jg @f ;¥á«¨ ¤«ï à á¯ ª®¢ ­®£® ä ©«  ­¥ 墠⠥⠢뤥«¥­­®© ¯ ¬ïâ¨
  346.                 cmp dword[unpac_mem],0
  347.                 jne .end_1
  348.                         ;¢ë¤¥«¥­¨¥ ¯ ¬ï⨠¤«ï à á¯ ª®¢ª¨ ä ©« 
  349.                         stdcall mem.Alloc,ecx
  350.                         mov [unpac_mem],eax
  351.                 .end_1:
  352.                 stdcall unpack,ted_syntax_file,[unpac_mem]
  353.                 mov edi,ted_syntax_file
  354.                 mov esi,[unpac_mem]
  355.                 mov ecx,[edi+4]
  356.                 cld
  357.                 rep movsb
  358.                 .end_unpack:
  359.                 stdcall [ted_init_syntax_file], tedit0
  360.         @@:
  361.         ret
  362. endp
  363.  
  364. ;description:
  365. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
  366. align 4
  367. proc ted_but_find uses edi
  368.         mov edi,tedit0
  369.  
  370.         cmp ted_panel_id,TED_PANEL_NULL
  371.         je @f
  372.                 mov ted_panel_id,TED_PANEL_NULL
  373.                 mov ted_wnd_l,0
  374.                 jmp .e_if
  375.         @@:
  376.                 mov ted_panel_id,TED_PANEL_FIND
  377.                 mov ted_wnd_l,TED_PANEL_WIDTH
  378.         .e_if:
  379.         call EvSize
  380.         stdcall [ted_draw],edi
  381.         ret
  382. endp
  383.  
  384. align 4
  385. tbl_1251_866:
  386. rb 128
  387. db   0,  0,  0,  0,  0,  0,  0,  0,  0,0,0,0,0,0,0,0 ;128
  388. db   0,  0,  0,  0,  0,  0,  0,  0,  0,0,0,0,0,0,0,0 ;144
  389. db   0,  0,  0,  0,  0,  0,  0,  0,240,0,0,0,0,0,0,0 ;160
  390. db   0,  0,  0,  0,  0,  0,  0,  0,241,0,0,0,0,0,0,0 ;176
  391. db 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143 ;192
  392. db 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159 ;208
  393. db 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175 ;224
  394. db 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239 ;240
  395.  
  396. align 4
  397. tbl_866_1251:
  398. rb 128
  399. db 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207 ;128
  400. db 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223 ;144
  401. db 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239 ;160
  402. db   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;176
  403. db   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;192
  404. db   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;208
  405. db 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 ;224
  406. db 168,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;240
  407.  
  408. align 4
  409. ted_on_find_err:
  410.         stdcall [mb_create],msgbox_7,thread ;message: Can not find text
  411.         ret
  412.  
  413. ;description:
  414. ; ª­®¯ª  [‡ ¬¥­¨âì] ­  ¯ ­¥«¨
  415. align 4
  416. but_replace:
  417.         ; ¯®ª  ­¥ ᤥ« ­®
  418.         ret
  419.  
  420. ;description:
  421. ; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
  422. align 4
  423. but_find_key_w:
  424.         cmp dword[wnd_k_words_run],0
  425.         jne @f
  426.                 pushad
  427.                 mcall SF_CREATE_THREAD,1,prop_start,thread_coords
  428.                 mov dword[wnd_k_words_run],eax
  429.                 popad
  430.         @@:
  431.         ret
  432.  
  433. ;description:
  434. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
  435. align 4
  436. proc but_sumb_invis uses edi, edit:dword
  437.         mov edi,dword[edit]
  438.  
  439.         xor ted_mode_invis,1
  440.         call draw_but_toolbar
  441.         stdcall [ted_draw],edi
  442.         ret
  443. endp
  444.  
  445. ;description:
  446. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ª«î祢ëå á«®¢
  447. align 4
  448. proc but_k_words_show uses edi, edit:dword
  449.         mov edi,dword[edit]
  450.  
  451.         xor ted_mode_color,1
  452.         cmp ted_mode_color,0
  453.         je @f
  454.                 call [ted_text_colored]
  455.         @@:
  456.         call draw_but_toolbar
  457.         stdcall [ted_draw],edi
  458.         ret
  459. endp
  460.  
  461. ;description:
  462. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
  463. align 4
  464. proc but_synt_show uses edi, edit:dword
  465.         mov edi,[edit]
  466.  
  467.         cmp ted_panel_id,TED_PANEL_NULL
  468.         je @f
  469.                 mov ted_panel_id,TED_PANEL_NULL
  470.                 mov ted_wnd_l,0
  471.                 jmp .e_if
  472.         @@:
  473.                 mov ted_panel_id,TED_PANEL_SYNTAX
  474.                 mov ted_wnd_l,TED_PANEL_WIDTH
  475.         .e_if:
  476.         call EvSize
  477.         stdcall [ted_draw],edi
  478.         ret
  479. endp
  480.