Subversion Repositories Kolibri OS

Rev

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