Subversion Repositories Kolibri OS

Rev

Rev 2817 | Rev 2855 | 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 edi
  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 edi,tedit0
  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 edi 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 uses eax ebx ecx edi, edit:dword
  199.         mov edi,dword[edit]
  200.         cmp ted_panel_id,TED_PANEL_SYNTAX
  201.         jne @f
  202.                 stdcall dword[tl_node_get_data], tree1
  203.                 pop dword[fn_col_option]
  204.                 mov ebx,dword[fn_col_option]
  205.                 copy_path ebx,fn_syntax_dir,file_name_rez,0x0
  206.                 copy_path file_name_rez,sys_path,file_name,0x0
  207.  
  208.                 call open_unpac_synt_file
  209.                 cmp ebx,-1
  210.                 je @f
  211.  
  212.                 call [ted_text_colored]
  213.                 stdcall [ted_draw],edi
  214.         @@:
  215.         ret
  216. endp
  217.  
  218. ;®âªàë⨥ ¨ à á¯ ª®¢ª  ä ©«  ¯®¤á¢¥âª¨ ᨭ⠪á¨á 
  219. ;output:
  220. ; ebx - ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â ¨§ ä ©« 
  221. align 4
  222. open_unpac_synt_file:
  223. push eax edi esi
  224.         mov edi, tedit0
  225.         mov [run_file_70.Function], 0
  226.         mov [run_file_70.Position], 0
  227.         mov [run_file_70.Flags], 0
  228.         mov ecx, ted_syntax_file_size
  229.         mov dword[run_file_70.Count], ecx
  230.         m2m dword[run_file_70.Buffer], ted_syntax_file
  231.         mov byte[run_file_70+20], 0
  232.         mov [run_file_70.FileName], file_name
  233.         mcall 70, run_file_70
  234.         cmp ebx,-1
  235.         jne .end_0
  236.                 call ted_on_init_synt_err
  237.                 jmp @f
  238.         .end_0:
  239.                 mov eax,ted_syntax_file
  240.                 cmp dword[eax],'KPCK'
  241.                 jne .end_unpack
  242.                 cmp dword[eax+4],ecx
  243.                 jg @f ;¥á«¨ ¤«ï à á¯ ª®¢ ­®£® ä ©«  ­¥ 墠⠥⠢뤥«¥­­®© ¯ ¬ïâ¨
  244.                 cmp dword[unpac_mem],0
  245.                 jne .end_1
  246.                         ;¢ë¤¥«¥­¨¥ ¯ ¬ï⨠¤«ï à á¯ ª®¢ª¨ ä ©« 
  247.                         stdcall mem.Alloc,ecx
  248.                         mov [unpac_mem],eax
  249.                 .end_1:
  250.                 stdcall unpack,ted_syntax_file,[unpac_mem]
  251.                 mov edi,ted_syntax_file
  252.                 mov esi,[unpac_mem]
  253.                 mov ecx,[edi+4]
  254.                 cld
  255.                 rep movsb
  256.                 .end_unpack:
  257.                 stdcall [ted_init_syntax_file], tedit0
  258.         @@:
  259. pop esi edi eax
  260.         ret
  261.  
  262. ;description:
  263. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
  264. align 4
  265. proc ted_but_find
  266.   push edi
  267.   mov edi,tedit0
  268.  
  269.   cmp ted_panel_id,TED_PANEL_NULL
  270.   je @f
  271.     mov ted_panel_id,TED_PANEL_NULL
  272.     mov ted_wnd_l,0
  273.     jmp .e_if
  274.   @@:
  275.     mov ted_panel_id,TED_PANEL_FIND
  276.     mov ted_wnd_l,TED_PANEL_WIDTH
  277.   .e_if:
  278.   call EvSize
  279.   stdcall [ted_draw],edi
  280.   pop edi
  281.   ret
  282. endp
  283.  
  284. align 4
  285. ted_on_find_err:
  286.         stdcall [mb_create],msgbox_7,thread ;message: Can not find text
  287.         ret
  288.  
  289. ;description:
  290. ; ª­®¯ª  [‡ ¬¥­¨âì] ­  ¯ ­¥«¨
  291. align 4
  292. but_replace:
  293.         ; ¯®ª  ­¥ ᤥ« ­®
  294.         ret
  295.  
  296. ;description:
  297. ; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
  298. align 4
  299. but_find_key_w:
  300.         ; ¯®ª  ­¥ ᤥ« ­®
  301.         ret
  302.  
  303. ;description:
  304. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
  305. align 4
  306. proc but_sumb_invis, edit:dword
  307.   push edi
  308.   mov edi,dword[edit]
  309.  
  310.   xor ted_mode_invis,1
  311.   call draw_but_toolbar
  312.   stdcall [ted_draw],edi
  313.   pop edi
  314.   ret
  315. endp
  316.  
  317. ;description:
  318. ; ¢ë¤¥«¥­¨¥/áªàë⨥ ª«î祢ëå á«®¢
  319. align 4
  320. proc but_k_words_show, edit:dword
  321.   push edi
  322.   mov edi,dword[edit]
  323.  
  324.   xor ted_mode_color,1
  325.   cmp ted_mode_color,0
  326.   je @f
  327.     call [ted_text_colored]
  328.   @@:
  329.   call draw_but_toolbar
  330.   stdcall [ted_draw],edi
  331.   pop edi
  332.   ret
  333. endp
  334.  
  335. ;description:
  336. ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
  337. align 4
  338. proc but_synt_show, edit:dword
  339.   push edi
  340.   mov edi,[edit]
  341.  
  342.   cmp ted_panel_id,TED_PANEL_NULL
  343.   je @f
  344.     mov ted_panel_id,TED_PANEL_NULL
  345.     mov ted_wnd_l,0
  346.     jmp .e_if
  347.   @@:
  348.     mov ted_panel_id,TED_PANEL_SYNTAX
  349.     mov ted_wnd_l,TED_PANEL_WIDTH
  350.   .e_if:
  351.   call EvSize
  352.   stdcall [ted_draw],edi
  353.   pop edi
  354.   ret
  355. endp
  356.