Subversion Repositories Kolibri OS

Rev

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