Subversion Repositories Kolibri OS

Rev

Rev 1464 | Rev 1468 | 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,sys_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 [mb_create],msgbox_9,thread ;message: error run 'open file dialog'
  145.                 jmp .ret_f
  146.         @@:
  147.         mov esi,[OpenDialog_data.openfile_path]
  148.         call strlen
  149.         mov [edit1.size],eax
  150.         mov [edit1.pos],eax
  151.         stdcall [edit_box_draw], edit1
  152.         stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
  153.         call ted_messages_after_open_file
  154.         .ret_f:
  155.         popad
  156.         ret
  157.  
  158. ;input:
  159. ; eax = ª®¤ ®è¨¡ª¨
  160. ; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
  161. ; edi = pointer to tedit struct
  162. align 4
  163. ted_messages_after_open_file:
  164.         push ecx
  165.         cmp eax,0
  166.         je @f
  167.         cmp eax,6
  168.         je @f
  169.                 cmp ax,10
  170.                 jl .zifra_0_9
  171.                         mov al,'?'
  172.                         sub ax,48
  173.                 .zifra_0_9:
  174.                 add ax,48
  175.  
  176.                 mov byte[msgbox_4.err],al
  177.                 stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file!
  178.                 jmp .ret_f
  179.         @@:
  180.         cmp ebx,-1
  181.         je .ret_f
  182.                 ;if open file
  183.                 mov ecx,ted_max_chars
  184.                 sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
  185.                 cmp ebx,ecx
  186.                 jl .ret_f
  187.                         stdcall [mb_create],msgbox_1,thread
  188.         .ret_f:
  189.         pop ecx
  190.         ret
  191.  
  192. align 4
  193. ted_save_err_msg:
  194.         mov byte[msgbox_6.err],al
  195.         stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
  196.         ret
  197.  
  198. align 4
  199. proc ted_but_open_syntax, edit:dword
  200.   push ebx edi
  201.   mov edi,dword[edit]
  202.  
  203.   cmp ted_panel_id,TED_PANEL_SYNTAX
  204.   jne @f
  205.     stdcall dword[tl_node_get_data], tree1
  206.     pop dword[fn_col_option]
  207.         mov ebx,dword[fn_col_option]
  208.         copy_path ebx,fn_syntax_dir,file_name_rez,0x0
  209.         copy_path file_name_rez,sys_path,file_name,0x0
  210.     stdcall [ted_init_syntax_file],edi,run_file_70,file_name
  211.     call [ted_text_colored]
  212.     stdcall [ted_draw],edi
  213.   @@:
  214.   pop edi ebx
  215.   ret
  216. endp
  217.  
  218. align 4
  219. proc ted_but_find ;¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
  220.   push edi
  221.   mov edi,tedit0
  222.  
  223.   cmp ted_panel_id,TED_PANEL_NULL
  224.   je @f
  225.     mov ted_panel_id,TED_PANEL_NULL
  226.     mov ted_wnd_l,0
  227.     jmp .e_if
  228.   @@:
  229.     mov ted_panel_id,TED_PANEL_FIND
  230.     mov ted_wnd_l,TED_PANEL_WIDTH
  231.   .e_if:
  232.   stdcall EvSize,edi
  233.   stdcall [ted_draw],edi
  234.   pop edi
  235.   ret
  236. endp
  237.  
  238. align 4
  239. ted_on_find_err:
  240.         stdcall [mb_create],msgbox_7,thread ;message: Can not find text
  241.         ret
  242.  
  243. align 4
  244. but_replace:
  245.   ret
  246.  
  247. align 4
  248. but_find_key_w:
  249.   ret
  250.  
  251. align 4
  252. proc but_sumb_invis, edit:dword
  253.   push edi
  254.   mov edi,dword[edit]
  255.  
  256.   xor ted_mode_invis,1
  257.   call draw_but_toolbar
  258.   stdcall [ted_draw],edi
  259.   pop edi
  260.   ret
  261. endp
  262.  
  263. align 4
  264. proc but_k_words_show, edit:dword
  265.   push edi
  266.   mov edi,dword[edit]
  267.  
  268.   xor ted_mode_color,1
  269.   cmp ted_mode_color,0
  270.   je @f
  271.     call [ted_text_colored]
  272.   @@:
  273.   call draw_but_toolbar
  274.   stdcall [ted_draw],edi
  275.   pop edi
  276.   ret
  277. endp
  278.  
  279. align 4
  280. proc but_synt_show, edit:dword
  281.   push edi
  282.   mov edi,[edit]
  283.  
  284.   cmp ted_panel_id,TED_PANEL_NULL
  285.   je @f
  286.     mov ted_panel_id,TED_PANEL_NULL
  287.     mov ted_wnd_l,0
  288.     jmp .e_if
  289.   @@:
  290.     mov ted_panel_id,TED_PANEL_SYNTAX
  291.     mov ted_wnd_l,TED_PANEL_WIDTH
  292.   .e_if:
  293.   stdcall EvSize,edi
  294.   stdcall [ted_draw],edi
  295.   pop edi
  296.   ret
  297. endp
  298.