Subversion Repositories Kolibri OS

Rev

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