Subversion Repositories Kolibri OS

Rev

Rev 1592 | Rev 2125 | 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 22.08.11',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.         mov esi,[OpenDialog_data.openfile_path]
  117.         call strlen
  118.         mov [edit1.size],eax
  119.         mov [edit1.pos],eax
  120.         stdcall [edit_box_draw], edit1
  121.         stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
  122.         call ted_messages_after_open_file
  123.         .ret_f:
  124.         popad
  125.         ret
  126.  
  127. ;description:
  128. ; ª®¯¨à®¢ ­¨¥ ¯ ¬ïâ¨
  129. align 4
  130. proc mem_copy, source:dword, destination:dword, len:dword
  131.   push ecx esi edi
  132.     cld
  133.     mov esi, dword[source]
  134.     mov edi, dword[destination]
  135.     mov ecx, dword[len]
  136.     rep movsb
  137.   pop edi esi ecx
  138.   ret
  139. endp
  140.  
  141. ;description:
  142. ; § ¯®«­¥­¨¥ ¯ ¬ï⨠¯à®¡¥« ¬¨
  143. align 4
  144. proc mem_spac, mem:dword, len:dword
  145.   push eax ecx edi
  146.     cld
  147.     mov al,' '
  148.     mov edi, dword[mem]
  149.     mov ecx, dword[len]
  150.     repne stosb
  151.   pop edi ecx eax
  152.   ret
  153. endp
  154.  
  155. ;input:
  156. ; eax = ª®¤ ®è¨¡ª¨
  157. ; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
  158. ; edi = pointer to tedit struct
  159. align 4
  160. ted_messages_after_open_file:
  161.         push ecx
  162.         cmp eax,0
  163.         je @f
  164.         cmp eax,6
  165.         je @f
  166.                 cmp ax,10
  167.                 jl .zifra_0_9
  168.                         mov al,'?'
  169.                         sub ax,48
  170.                 .zifra_0_9:
  171.                 add ax,48
  172.  
  173.                 mov byte[msgbox_4.err],al
  174.                 stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file!
  175.                 jmp .ret_f
  176.         @@:
  177.         cmp ebx,-1
  178.         je .ret_f
  179.                 ;if open file
  180.                 mov ecx,ted_max_chars
  181.                 sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
  182.                 cmp ebx,ecx
  183.                 jl .ret_f
  184.                         stdcall [mb_create],msgbox_1,thread
  185.         .ret_f:
  186.         pop ecx
  187.         ret
  188.  
  189. align 4
  190. ted_save_err_msg:
  191.         mov byte[msgbox_6.err],al
  192.         stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
  193.         ret
  194.  
  195. ;description:
  196. ; äã­ªæ¨ï ­ ¦ â¨ï ­  ª­®¯ªã [à¨¬¥­¨âì] ¢ ¯ ­¥«¨ ᨭ⠪á¨á 
  197. align 4
  198. proc ted_but_open_syntax, edit:dword
  199.   push ebx edi
  200.   mov edi,dword[edit]
  201.  
  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.     stdcall [ted_init_syntax_file],edi,run_file_70,file_name
  210.     call [ted_text_colored]
  211.     stdcall [ted_draw],edi
  212.   @@:
  213.   pop edi ebx
  214.   ret
  215. endp
  216.  
  217. ;description:
  218. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
  219. align 4
  220. proc ted_but_find
  221.   push edi
  222.   mov edi,tedit0
  223.  
  224.   cmp ted_panel_id,TED_PANEL_NULL
  225.   je @f
  226.     mov ted_panel_id,TED_PANEL_NULL
  227.     mov ted_wnd_l,0
  228.     jmp .e_if
  229.   @@:
  230.     mov ted_panel_id,TED_PANEL_FIND
  231.     mov ted_wnd_l,TED_PANEL_WIDTH
  232.   .e_if:
  233.   stdcall EvSize,edi
  234.   stdcall [ted_draw],edi
  235.   pop edi
  236.   ret
  237. endp
  238.  
  239. align 4
  240. ted_on_find_err:
  241.         stdcall [mb_create],msgbox_7,thread ;message: Can not find text
  242.         ret
  243.  
  244. ;description:
  245. ; ª­®¯ª  [‡ ¬¥­¨âì] ­  ¯ ­¥«¨
  246. align 4
  247. but_replace:
  248.         ; ¯®ª  ­¥ ᤥ« ­®
  249.         ret
  250.  
  251. ;description:
  252. ; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
  253. align 4
  254. but_find_key_w:
  255.         ; ¯®ª  ­¥ ᤥ« ­®
  256.         ret
  257.  
  258. ;description:
  259. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
  260. align 4
  261. proc but_sumb_invis, edit:dword
  262.   push edi
  263.   mov edi,dword[edit]
  264.  
  265.   xor ted_mode_invis,1
  266.   call draw_but_toolbar
  267.   stdcall [ted_draw],edi
  268.   pop edi
  269.   ret
  270. endp
  271.  
  272. ;description:
  273. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ª«î祢ëå á«®¢
  274. align 4
  275. proc but_k_words_show, edit:dword
  276.   push edi
  277.   mov edi,dword[edit]
  278.  
  279.   xor ted_mode_color,1
  280.   cmp ted_mode_color,0
  281.   je @f
  282.     call [ted_text_colored]
  283.   @@:
  284.   call draw_but_toolbar
  285.   stdcall [ted_draw],edi
  286.   pop edi
  287.   ret
  288. endp
  289.  
  290. ;description:
  291. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
  292. align 4
  293. proc but_synt_show, edit:dword
  294.   push edi
  295.   mov edi,[edit]
  296.  
  297.   cmp ted_panel_id,TED_PANEL_NULL
  298.   je @f
  299.     mov ted_panel_id,TED_PANEL_NULL
  300.     mov ted_wnd_l,0
  301.     jmp .e_if
  302.   @@:
  303.     mov ted_panel_id,TED_PANEL_SYNTAX
  304.     mov ted_wnd_l,TED_PANEL_WIDTH
  305.   .e_if:
  306.   stdcall EvSize,edi
  307.   stdcall [ted_draw],edi
  308.   pop edi
  309.   ret
  310. endp
  311.