Subversion Repositories Kolibri OS

Rev

Rev 2125 | Rev 2707 | 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 19.04.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, edit:dword
  201.   push ebx edi
  202.   mov edi,dword[edit]
  203.  
  204.   cmp ted_panel_id,TED_PANEL_SYNTAX
  205.   jne @f
  206.     stdcall dword[tl_node_get_data], tree1
  207.     pop dword[fn_col_option]
  208.         mov ebx,dword[fn_col_option]
  209.         copy_path ebx,fn_syntax_dir,file_name_rez,0x0
  210.         copy_path file_name_rez,sys_path,file_name,0x0
  211.     stdcall [ted_init_syntax_file],edi,run_file_70,file_name
  212.     call [ted_text_colored]
  213.     stdcall [ted_draw],edi
  214.   @@:
  215.   pop edi ebx
  216.   ret
  217. endp
  218.  
  219. ;description:
  220. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
  221. align 4
  222. proc ted_but_find
  223.   push edi
  224.   mov edi,tedit0
  225.  
  226.   cmp ted_panel_id,TED_PANEL_NULL
  227.   je @f
  228.     mov ted_panel_id,TED_PANEL_NULL
  229.     mov ted_wnd_l,0
  230.     jmp .e_if
  231.   @@:
  232.     mov ted_panel_id,TED_PANEL_FIND
  233.     mov ted_wnd_l,TED_PANEL_WIDTH
  234.   .e_if:
  235.   call EvSize
  236.   stdcall [ted_draw],edi
  237.   pop edi
  238.   ret
  239. endp
  240.  
  241. align 4
  242. ted_on_find_err:
  243.         stdcall [mb_create],msgbox_7,thread ;message: Can not find text
  244.         ret
  245.  
  246. ;description:
  247. ; ª­®¯ª  [‡ ¬¥­¨âì] ­  ¯ ­¥«¨
  248. align 4
  249. but_replace:
  250.         ; ¯®ª  ­¥ ᤥ« ­®
  251.         ret
  252.  
  253. ;description:
  254. ; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
  255. align 4
  256. but_find_key_w:
  257.         ; ¯®ª  ­¥ ᤥ« ­®
  258.         ret
  259.  
  260. ;description:
  261. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
  262. align 4
  263. proc but_sumb_invis, edit:dword
  264.   push edi
  265.   mov edi,dword[edit]
  266.  
  267.   xor ted_mode_invis,1
  268.   call draw_but_toolbar
  269.   stdcall [ted_draw],edi
  270.   pop edi
  271.   ret
  272. endp
  273.  
  274. ;description:
  275. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ª«î祢ëå á«®¢
  276. align 4
  277. proc but_k_words_show, edit:dword
  278.   push edi
  279.   mov edi,dword[edit]
  280.  
  281.   xor ted_mode_color,1
  282.   cmp ted_mode_color,0
  283.   je @f
  284.     call [ted_text_colored]
  285.   @@:
  286.   call draw_but_toolbar
  287.   stdcall [ted_draw],edi
  288.   pop edi
  289.   ret
  290. endp
  291.  
  292. ;description:
  293. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
  294. align 4
  295. proc but_synt_show, edit:dword
  296.   push edi
  297.   mov edi,[edit]
  298.  
  299.   cmp ted_panel_id,TED_PANEL_NULL
  300.   je @f
  301.     mov ted_panel_id,TED_PANEL_NULL
  302.     mov ted_wnd_l,0
  303.     jmp .e_if
  304.   @@:
  305.     mov ted_panel_id,TED_PANEL_SYNTAX
  306.     mov ted_wnd_l,TED_PANEL_WIDTH
  307.   .e_if:
  308.   call EvSize
  309.   stdcall [ted_draw],edi
  310.   pop edi
  311.   ret
  312. endp
  313.