Subversion Repositories Kolibri OS

Rev

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