Subversion Repositories Kolibri OS

Rev

Rev 2707 | Rev 2817 | 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.  
  21. hed db 'TextEditor 1.06.12',0 ;¯®¤¯¨áì ®ª­ 
  22. sc system_colors
  23.  
  24. bmp_icon dd 0
  25. run_file_70 FileInfoBlock        
  26.  
  27.  
  28. ;input:
  29. ; al = ª®¤ ®è¨¡ª¨
  30. align 4
  31. ted_on_init_synt_err:
  32.         mov byte[msgbox_3.err],al
  33.         stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file!
  34.         ret
  35.  
  36.  
  37. align 4
  38. ted_but_new_file:
  39.   push eax ebx
  40.   stdcall [ted_can_save], tedit0
  41.   cmp al,1
  42.   jne @f
  43.     stdcall [mb_create],msgbox_2,thread ;message: save changes in file?
  44.     ;mov eax,5
  45.     ;mov ebx,50
  46.     ;int 0x40
  47.     stdcall [mb_setfunctions],msgbox_2_funct
  48.     jmp .ret_f
  49.   @@:
  50.   call On_NewFile
  51.   .ret_f:
  52.   pop ebx eax
  53.   ret
  54.  
  55. align 4
  56. On_NewFile:
  57.   stdcall [ted_clear], tedit0,1
  58.   call draw_but_toolbar
  59.   stdcall [ted_draw], tedit0
  60.   ret
  61.  
  62. align 4
  63. On_SaveAndNewFile:
  64.   push edi
  65.   mov edi, tedit0
  66.  
  67.   stdcall [ted_but_save_file],edi,run_file_70,[edit1.text]
  68.   cmp ted_err_save,0
  69.   jne @f
  70.     call On_NewFile
  71.   @@:
  72.   pop edi
  73.   ret
  74.  
  75. ;description:
  76. ; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  ¡¥§ ®ª­  á®®¡é¥­¨ï
  77. align 4
  78. but_no_msg_OpenFile:
  79.         push eax ebx
  80.         stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
  81.         call ted_messages_after_open_file
  82.         pop ebx eax
  83.         ret
  84.  
  85. ;description:
  86. ; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  á ¢®§¬®¦­ë¬ ®ª­®¬ á®®¡é¥­¨ï (® ¢®§¬®¦­®á⨠®â¬¥­¨âì ®âªàë⨥)
  87. align 4
  88. ted_but_open_file:
  89.         pushad
  90.  
  91.         stdcall [ted_can_save], tedit0
  92.         cmp al,1
  93.         jne @f
  94.                 stdcall [mb_create],msgbox_5,thread ;message: save changes in file?
  95.                 stdcall [mb_setfunctions],msgbox_5_funct
  96.                 jmp .ret_f
  97.         @@:
  98.  
  99.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  100.         mov [OpenDialog_data.type],0
  101.         stdcall [OpenDialog_Start],OpenDialog_data
  102.         cmp [OpenDialog_data.status],2
  103.         jne @f
  104.                 stdcall mem_spac, msgbox_9.fdp,100
  105.                 mov esi,file_name
  106.                 call strlen
  107.                 cmp eax,100
  108.                 jle .no_crop
  109.                         mov eax,100
  110.                 .no_crop:
  111.                 stdcall mem_copy, esi,msgbox_9.fdp,eax
  112.                 stdcall [mb_create],msgbox_9,thread ;message: error run 'open file dialog'
  113.                 jmp .ret_f
  114.         @@:
  115.   cmp [OpenDialog_data.status],1
  116.         jne .ret_f
  117.         mov esi,[OpenDialog_data.openfile_path]
  118.         call strlen
  119.         mov [edit1.size],eax
  120.         mov [edit1.pos],eax
  121.         stdcall [edit_box_draw], edit1
  122.         stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
  123.         call ted_messages_after_open_file
  124.         .ret_f:
  125.         popad
  126.         ret
  127.  
  128. ;description:
  129. ; ª®¯¨à®¢ ­¨¥ ¯ ¬ïâ¨
  130. align 4
  131. proc mem_copy, source:dword, destination:dword, len:dword
  132.   push ecx esi edi
  133.     cld
  134.     mov esi, dword[source]
  135.     mov edi, dword[destination]
  136.     mov ecx, dword[len]
  137.     rep movsb
  138.   pop edi esi ecx
  139.   ret
  140. endp
  141.  
  142. ;description:
  143. ; § ¯®«­¥­¨¥ ¯ ¬ï⨠¯à®¡¥« ¬¨
  144. align 4
  145. proc mem_spac, mem:dword, len:dword
  146.   push eax ecx edi
  147.     cld
  148.     mov al,' '
  149.     mov edi, dword[mem]
  150.     mov ecx, dword[len]
  151.     repne stosb
  152.   pop edi ecx eax
  153.   ret
  154. endp
  155.  
  156. ;input:
  157. ; eax = ª®¤ ®è¨¡ª¨
  158. ; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
  159. ; edi = pointer to tedit struct
  160. align 4
  161. ted_messages_after_open_file:
  162.         push ecx
  163.         cmp eax,0
  164.         je @f
  165.         cmp eax,6
  166.         je @f
  167.                 cmp ax,10
  168.                 jl .zifra_0_9
  169.                         mov al,'?'
  170.                         sub ax,48
  171.                 .zifra_0_9:
  172.                 add ax,48
  173.  
  174.                 mov byte[msgbox_4.err],al
  175.                 stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file!
  176.                 jmp .ret_f
  177.         @@:
  178.         cmp ebx,-1
  179.         je .ret_f
  180.                 ;if open file
  181.                 mov ecx,ted_max_chars
  182.                 sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
  183.                 cmp ebx,ecx
  184.                 jl .ret_f
  185.                         stdcall [mb_create],msgbox_1,thread
  186.         .ret_f:
  187.         pop ecx
  188.         ret
  189.  
  190. align 4
  191. ted_save_err_msg:
  192.         mov byte[msgbox_6.err],al
  193.         stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
  194.         ret
  195.  
  196. ;description:
  197. ; äã­ªæ¨ï ­ ¦ â¨ï ­  ª­®¯ªã [à¨¬¥­¨âì] ¢ ¯ ­¥«¨ ᨭ⠪á¨á 
  198. align 4
  199. proc ted_but_open_syntax uses eax ebx ecx edi, edit:dword
  200.         mov edi,dword[edit]
  201.         cmp ted_panel_id,TED_PANEL_SYNTAX
  202.         jne @f
  203.                 stdcall dword[tl_node_get_data], tree1
  204.                 pop dword[fn_col_option]
  205.                 mov ebx,dword[fn_col_option]
  206.                 copy_path ebx,fn_syntax_dir,file_name_rez,0x0
  207.                 copy_path file_name_rez,sys_path,file_name,0x0
  208.  
  209.                 call open_unpac_synt_file
  210.                 cmp ebx,-1
  211.                 je @f
  212.  
  213.                 call [ted_text_colored]
  214.                 stdcall [ted_draw],edi
  215.         @@:
  216.         ret
  217. endp
  218.  
  219. ;®âªàë⨥ ¨ à á¯ ª®¢ª  ä ©«  ¯®¤á¢¥âª¨ ᨭ⠪á¨á 
  220. ;output:
  221. ; ebx - ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â ¨§ ä ©« 
  222. align 4
  223. open_unpac_synt_file:
  224. push eax edi esi
  225.         mov edi, tedit0
  226.         mov [run_file_70.Function], 0
  227.         mov [run_file_70.Position], 0
  228.         mov [run_file_70.Flags], 0
  229.         mov ecx, ted_syntax_file_size
  230.         mov dword[run_file_70.Count], ecx
  231.         m2m dword[run_file_70.Buffer], ted_syntax_file
  232.         mov byte[run_file_70+20], 0
  233.         mov [run_file_70.FileName], file_name
  234.         mcall 70, run_file_70
  235.         cmp ebx,-1
  236.         jne .end_0
  237.                 call ted_on_init_synt_err
  238.                 jmp @f
  239.         .end_0:
  240.                 mov eax,ted_syntax_file
  241.                 cmp dword[eax],'KPCK'
  242.                 jne .end_unpack
  243.                 cmp dword[eax+4],ecx
  244.                 jg @f ;¥á«¨ ¤«ï à á¯ ª®¢ ­®£® ä ©«  ­¥ 墠⠥⠢뤥«¥­­®© ¯ ¬ïâ¨
  245.                 cmp dword[unpac_mem],0
  246.                 jne .end_1
  247.                         ;¢ë¤¥«¥­¨¥ ¯ ¬ï⨠¤«ï à á¯ ª®¢ª¨ ä ©« 
  248.                         stdcall mem.Alloc,ecx
  249.                         mov [unpac_mem],eax
  250.                 .end_1:
  251.                 stdcall unpack,ted_syntax_file,[unpac_mem]
  252.                 mov edi,ted_syntax_file
  253.                 mov esi,[unpac_mem]
  254.                 mov ecx,[edi+4]
  255.                 cld
  256.                 rep movsb
  257.                 .end_unpack:
  258.                 stdcall [ted_init_syntax_file], tedit0
  259.         @@:
  260. pop esi edi eax
  261.         ret
  262.  
  263. ;description:
  264. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
  265. align 4
  266. proc ted_but_find
  267.   push edi
  268.   mov edi,tedit0
  269.  
  270.   cmp ted_panel_id,TED_PANEL_NULL
  271.   je @f
  272.     mov ted_panel_id,TED_PANEL_NULL
  273.     mov ted_wnd_l,0
  274.     jmp .e_if
  275.   @@:
  276.     mov ted_panel_id,TED_PANEL_FIND
  277.     mov ted_wnd_l,TED_PANEL_WIDTH
  278.   .e_if:
  279.   call EvSize
  280.   stdcall [ted_draw],edi
  281.   pop edi
  282.   ret
  283. endp
  284.  
  285. align 4
  286. ted_on_find_err:
  287.         stdcall [mb_create],msgbox_7,thread ;message: Can not find text
  288.         ret
  289.  
  290. ;description:
  291. ; ª­®¯ª  [‡ ¬¥­¨âì] ­  ¯ ­¥«¨
  292. align 4
  293. but_replace:
  294.         ; ¯®ª  ­¥ ᤥ« ­®
  295.         ret
  296.  
  297. ;description:
  298. ; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
  299. align 4
  300. but_find_key_w:
  301.         ; ¯®ª  ­¥ ᤥ« ­®
  302.         ret
  303.  
  304. ;description:
  305. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
  306. align 4
  307. proc but_sumb_invis, edit:dword
  308.   push edi
  309.   mov edi,dword[edit]
  310.  
  311.   xor ted_mode_invis,1
  312.   call draw_but_toolbar
  313.   stdcall [ted_draw],edi
  314.   pop edi
  315.   ret
  316. endp
  317.  
  318. ;description:
  319. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ª«î祢ëå á«®¢
  320. align 4
  321. proc but_k_words_show, edit:dword
  322.   push edi
  323.   mov edi,dword[edit]
  324.  
  325.   xor ted_mode_color,1
  326.   cmp ted_mode_color,0
  327.   je @f
  328.     call [ted_text_colored]
  329.   @@:
  330.   call draw_but_toolbar
  331.   stdcall [ted_draw],edi
  332.   pop edi
  333.   ret
  334. endp
  335.  
  336. ;description:
  337. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
  338. align 4
  339. proc but_synt_show, edit:dword
  340.   push edi
  341.   mov edi,[edit]
  342.  
  343.   cmp ted_panel_id,TED_PANEL_NULL
  344.   je @f
  345.     mov ted_panel_id,TED_PANEL_NULL
  346.     mov ted_wnd_l,0
  347.     jmp .e_if
  348.   @@:
  349.     mov ted_panel_id,TED_PANEL_SYNTAX
  350.     mov ted_wnd_l,TED_PANEL_WIDTH
  351.   .e_if:
  352.   call EvSize
  353.   stdcall [ted_draw],edi
  354.   pop edi
  355.   ret
  356. endp
  357.