Subversion Repositories Kolibri OS

Rev

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