Subversion Repositories Kolibri OS

Rev

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