Subversion Repositories Kolibri OS

Rev

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