Subversion Repositories Kolibri OS

Rev

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