Subversion Repositories Kolibri OS

Rev

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