Subversion Repositories Kolibri OS

Rev

Rev 1489 | 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 TexColViv
  12.   Text rb MAX_COLOR_WORD_LEN ; á«®¢® ¤«ï ¯®¤á¢¥âª¨
  13.   f1 dd 0 ; á¯à ¢ª  ¯® á«®¢ã
  14.   wwo db ? ; whole words only
  15.   endc db ? ; ᨬ¢®« ª®­æ  ¢ë¤¥«¥­¨ï (wwo&4)
  16.   color db ? ; ­®¬¥à 梥â 
  17. ends
  18.  
  19. struct symbol
  20.   c db ?    ;  +0 ᨬ¢®«
  21.   col db ?  ;  +1 梥â
  22.   perv dd ? ;  +2
  23.   next dd ? ;  +6 㪠§ â¥«¨
  24.   tc dd ?   ; +10 ¢à¥¬. ᮧ¤ ­¨ï
  25.   td dd ?   ; +14 ¢à¥¬. 㤠«¥­¨ï
  26. ends
  27.  
  28.  
  29. hed db 'TextEditor 25.08.10',0 ;¯®¤¯¨áì ®ª­ 
  30. sc system_colors
  31.  
  32. fn_icon db 'te_icon.bmp',0
  33. bmp_icon dd 0
  34. run_file_70 FileInfoBlock        
  35.  
  36.  
  37. ;input:
  38. ; al = ª®¤ ®è¨¡ª¨
  39. align 4
  40. ted_on_init_synt_err:
  41.         mov byte[msgbox_3.err],al
  42.         stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file!
  43.         ret
  44.  
  45.  
  46. align 4
  47. ted_but_new_file:
  48.   push eax ebx
  49.   stdcall [ted_can_save], tedit0
  50.   cmp al,1
  51.   jne @f
  52.     stdcall [mb_create],msgbox_2,thread ;message: save changes in file?
  53.     ;mov eax,5
  54.     ;mov ebx,50
  55.     ;int 0x40
  56.     stdcall [mb_setfunctions],msgbox_2_funct
  57.     jmp .ret_f
  58.   @@:
  59.   call On_NewFile
  60.   .ret_f:
  61.   pop ebx eax
  62.   ret
  63.  
  64. align 4
  65. On_NewFile:
  66.   stdcall [ted_clear], tedit0,1
  67.   call draw_but_toolbar
  68.   stdcall [ted_draw], tedit0
  69.   ret
  70.  
  71. align 4
  72. On_SaveAndNewFile:
  73.   push edi
  74.   mov edi, tedit0
  75.  
  76.   stdcall [ted_but_save_file],edi,run_file_70,[edit1.text]
  77.   cmp ted_err_save,0
  78.   jne @f
  79.     call On_NewFile
  80.   @@:
  81.   pop edi
  82.   ret
  83.  
  84. ;description:
  85. ; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  ¡¥§ ®ª®­  á®®¡é¥­¨ï
  86. align 4
  87. but_no_msg_OpenFile:
  88.         push eax ebx
  89.         stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
  90.         call ted_messages_after_open_file
  91.         pop ebx eax
  92.         ret
  93.  
  94. ;description:
  95. ; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  á ¢®§¬®¦­ë¬ ®ª­®¬ á®®¡é¥­¨ï (® ¢®§¬®¦­®á⨠®â¬¥­¨âì ®âªàë⨥)
  96. align 4
  97. ted_but_open_file:
  98.         pushad
  99.  
  100.         stdcall [ted_can_save], tedit0
  101.         cmp al,1
  102.         jne @f
  103.                 stdcall [mb_create],msgbox_5,thread ;message: save changes in file?
  104.                 stdcall [mb_setfunctions],msgbox_5_funct
  105.                 jmp .ret_f
  106.         @@:
  107.  
  108.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  109.         mov [OpenDialog_data.type],0
  110.         stdcall [OpenDialog_Start],OpenDialog_data
  111.         cmp [OpenDialog_data.status],2
  112.         jne @f
  113.                 stdcall mem_spac, msgbox_9.fdp,100
  114.                 mov esi,file_name
  115.                 call strlen
  116.                 cmp eax,100
  117.                 jle .no_crop
  118.                         mov eax,100
  119.                 .no_crop:
  120.                 stdcall mem_copy, esi,msgbox_9.fdp,eax
  121.                 stdcall [mb_create],msgbox_9,thread ;message: error run 'open file dialog'
  122.                 jmp .ret_f
  123.         @@:
  124.         mov esi,[OpenDialog_data.openfile_path]
  125.         call strlen
  126.         mov [edit1.size],eax
  127.         mov [edit1.pos],eax
  128.         stdcall [edit_box_draw], edit1
  129.         stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
  130.         call ted_messages_after_open_file
  131.         .ret_f:
  132.         popad
  133.         ret
  134.  
  135. align 4
  136. proc mem_copy, source:dword, destination:dword, len:dword
  137.   push ecx esi edi
  138.     cld
  139.     mov esi, dword[source]
  140.     mov edi, dword[destination]
  141.     mov ecx, dword[len]
  142.     rep movsb
  143.   pop edi esi ecx
  144.   ret
  145. endp
  146.  
  147. align 4
  148. proc mem_spac, mem:dword, len:dword
  149.   push eax ecx edi
  150.     cld
  151.     mov al,' '
  152.     mov edi, dword[mem]
  153.     mov ecx, dword[len]
  154.     repne stosb
  155.   pop edi ecx eax
  156.   ret
  157. endp
  158.  
  159. ;input:
  160. ; eax = ª®¤ ®è¨¡ª¨
  161. ; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
  162. ; edi = pointer to tedit struct
  163. align 4
  164. ted_messages_after_open_file:
  165.         push ecx
  166.         cmp eax,0
  167.         je @f
  168.         cmp eax,6
  169.         je @f
  170.                 cmp ax,10
  171.                 jl .zifra_0_9
  172.                         mov al,'?'
  173.                         sub ax,48
  174.                 .zifra_0_9:
  175.                 add ax,48
  176.  
  177.                 mov byte[msgbox_4.err],al
  178.                 stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file!
  179.                 jmp .ret_f
  180.         @@:
  181.         cmp ebx,-1
  182.         je .ret_f
  183.                 ;if open file
  184.                 mov ecx,ted_max_chars
  185.                 sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
  186.                 cmp ebx,ecx
  187.                 jl .ret_f
  188.                         stdcall [mb_create],msgbox_1,thread
  189.         .ret_f:
  190.         pop ecx
  191.         ret
  192.  
  193. align 4
  194. ted_save_err_msg:
  195.         mov byte[msgbox_6.err],al
  196.         stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
  197.         ret
  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. 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. align 4
  245. but_replace:
  246.   ret
  247.  
  248. align 4
  249. but_find_key_w:
  250.   ret
  251.  
  252. align 4
  253. proc but_sumb_invis, edit:dword
  254.   push edi
  255.   mov edi,dword[edit]
  256.  
  257.   xor ted_mode_invis,1
  258.   call draw_but_toolbar
  259.   stdcall [ted_draw],edi
  260.   pop edi
  261.   ret
  262. endp
  263.  
  264. align 4
  265. proc but_k_words_show, edit:dword
  266.   push edi
  267.   mov edi,dword[edit]
  268.  
  269.   xor ted_mode_color,1
  270.   cmp ted_mode_color,0
  271.   je @f
  272.     call [ted_text_colored]
  273.   @@:
  274.   call draw_but_toolbar
  275.   stdcall [ted_draw],edi
  276.   pop edi
  277.   ret
  278. endp
  279.  
  280. align 4
  281. proc but_synt_show, edit:dword
  282.   push edi
  283.   mov edi,[edit]
  284.  
  285.   cmp ted_panel_id,TED_PANEL_NULL
  286.   je @f
  287.     mov ted_panel_id,TED_PANEL_NULL
  288.     mov ted_wnd_l,0
  289.     jmp .e_if
  290.   @@:
  291.     mov ted_panel_id,TED_PANEL_SYNTAX
  292.     mov ted_wnd_l,TED_PANEL_WIDTH
  293.   .e_if:
  294.   stdcall EvSize,edi
  295.   stdcall [ted_draw],edi
  296.   pop edi
  297.   ret
  298. endp
  299.