Subversion Repositories Kolibri OS

Rev

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