Subversion Repositories Kolibri OS

Rev

Rev 1449 | Rev 1457 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. align 4
  2. but_NewFile:
  3.   push eax ebx
  4.   stdcall ted_can_save, tedit0
  5.   cmp al,1
  6.   jne @f
  7.     stdcall [mb_create],msgbox_2,thread ;message: save changes in file?
  8.     ;mov eax,5
  9.     ;mov ebx,50
  10.     ;int 0x40
  11.     stdcall [mb_setfunctions],msgbox_2_funct
  12.     jmp .ret_f
  13.   @@:
  14.   call On_NewFile
  15.   .ret_f:
  16.   pop ebx eax
  17.   ret
  18.  
  19. align 4
  20. On_NewFile:
  21.   stdcall ted_clear, tedit0,1
  22.   call draw_but_toolbar
  23.   stdcall draw_main_win, tedit0
  24.   ret
  25.  
  26. align 4
  27. On_SaveAndNewFile:
  28.   push edi
  29.   mov edi, tedit0
  30.  
  31.   stdcall but_SaveFile,edi
  32.   cmp ted_err_save,0
  33.   jne @f
  34.     call On_NewFile
  35.   @@:
  36.   pop edi
  37.   ret
  38.  
  39. align 4
  40. but_no_msg_OpenFile: ;äã­ªæ¨ï ®âªàëâ¨ï ä ©«  ç¥à¥§ ¡¥§ ®ª®­  á®®¡é¥­¨ï
  41.   stdcall ted_on_open_file, tedit0
  42.   ret
  43.  
  44.  
  45. ;äã­ªæ¨ï ®âªàëâ¨ï ä ©«  á ¢®§¬®¦­ë¬ ®ª­®¬ á®®¡é¥­¨ï (® ¢®§¬®¦­®á⨠®â¬¥­¨âì ®âªàë⨥)
  46. align 4
  47. but_OpenFile:
  48.   push eax
  49.   stdcall ted_can_save, tedit0
  50.   cmp al,1
  51.   jne @f
  52.     stdcall [mb_create],msgbox_5,thread ;message: save changes in file?
  53.     stdcall [mb_setfunctions],msgbox_5_funct
  54.     jmp .ret_f
  55.   @@:
  56.   stdcall ted_on_open_file, tedit0
  57.   .ret_f:
  58.   pop eax
  59.   ret
  60.  
  61. align 4
  62. proc ted_on_open_file, edit:dword ;äã­ªæ¨ï ®âªàëâ¨ï ä ©« 
  63.   push eax ebx edi
  64.   mov edi,dword[edit]
  65.  
  66.   mov eax,70
  67.   mov [run_file_70.func_n], 0
  68.   mov [run_file_70.param1], 0
  69.   mov [run_file_70.param2], 0
  70.   mov [run_file_70.param3], maxChars-2 ;sizeof.symbol
  71.   m2m [run_file_70.param4], ted_tex
  72.   mov [run_file_70.rezerv], 0
  73.   push dword[edit1.text]
  74.   pop dword[run_file_70.name]
  75.   mov ebx,run_file_70
  76.   int 0x40
  77.  
  78.   cmp eax,0
  79.   je @f
  80.   cmp eax,6
  81.   je @f
  82.     cmp ax,10
  83.     jl .zifra_0_9
  84.       mov al,'?'
  85.       sub ax,48
  86.     .zifra_0_9:
  87.     add ax,48
  88.  
  89.     mov byte[msgbox_4.err],al
  90.     stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file!
  91.     jmp .ret_f
  92.   @@:
  93.   cmp ebx,-1
  94.   je .ret_f
  95.     ;if open file
  96.     call OpenFile
  97.     cmp ebx,maxChars-2
  98.     jl .ret_f
  99.     stdcall [mb_create],msgbox_1,thread
  100.   .ret_f:
  101.   pop edi ebx eax
  102.   ret
  103. endp
  104.  
  105.  
  106. align 4
  107. proc but_SaveFile, edit:dword
  108.   pushad
  109.  
  110.   stdcall ted_can_save,edi
  111.   cmp al,0
  112.   je .no_save
  113.  
  114.   mov edi,dword[edit]
  115.  
  116.   mov ecx,maxChars
  117.   call mem_Alloc
  118.   push eax
  119.  
  120.   mov edx,ted_tex
  121.   xor ecx,ecx
  122.   @@:
  123.     call IteratNext
  124.     cmp edx,ted_tex_1
  125.     jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol
  126.     mov bl,[edx]
  127.     mov byte[eax],bl
  128.     inc eax
  129.     inc ecx
  130.     jmp @b
  131.   @@:
  132.  
  133.   cmp ecx,0
  134.   je @f
  135.     pop eax
  136.     mov [run_file_70.param4],eax
  137.     push eax
  138.     mov eax,70
  139.     mov [run_file_70.func_n], 2
  140.     mov [run_file_70.param1], 0
  141.     mov [run_file_70.param2], 0
  142.     mov [run_file_70.param3], ecx
  143.     mov [run_file_70.rezerv], 0
  144.     push [edit1.text]
  145.     pop [run_file_70.name]
  146.     mov ebx,run_file_70
  147.     int 0x40
  148.  
  149.     mov ted_err_save,ax
  150.  
  151.     cmp eax,0
  152.     je .no_msg
  153. ;    cmp eax,6
  154. ;    je @f
  155.       cmp ax,10
  156.       jl .zifra_0_9
  157.         mov al,'?'
  158.         sub ax,48
  159.       .zifra_0_9:
  160.       add ax,48
  161.  
  162.       mov byte[msgbox_6.err],al
  163.       stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
  164.       jmp @f
  165.     .no_msg:
  166.     m2m ted_tim_ls,ted_tim_ch
  167.   @@:
  168.  
  169.   pop ecx
  170.   call mem_Free
  171.   .no_save:
  172.   popad
  173.   ret
  174. endp
  175.  
  176.  
  177. align 4
  178. proc but_FindText, edit:dword
  179.   pushad
  180.     mov edi,dword[edit]
  181.  
  182.     call GetPos
  183.     mov eax,[edit2.text]
  184.     mov bl,byte[eax]
  185.     @@:
  186.       call GetFindRezult
  187.       cmp bh,1
  188.       je @f ; find
  189.  
  190.       call IteratNext
  191.       cmp edx,ted_tex_1
  192.       jle @f
  193.       jmp @b
  194.     @@:
  195.     cmp bh,0
  196.     je @f
  197.       call GetTexCoords
  198.       inc ebx ;move cursor right
  199.       mov ted_sel_x1,ebx
  200.       mov ted_sel_y1,eax
  201.       mov edx,eax
  202.       mov ecx,ebx
  203.       call GoToPos
  204.       mov edx,esi ;esi ¡ë«® ãáâ ­®¢«¥® ¢ GetFindRezult
  205.       call GetTexCoords
  206.       mov ted_sel_x0,ebx
  207.       mov ted_sel_y0,eax
  208.       stdcall draw_main_win,edi
  209.       jmp .end_find
  210.     @@:
  211.       stdcall [mb_create],msgbox_7,thread ;message: Can not find text
  212.     .end_find:
  213.   popad
  214.   ret
  215. endp
  216.  
  217. ;input:
  218. ; eax - text need find
  219. ; bl - first symbol to find
  220. ; edx - first symbol pointer
  221. ; edi - pointer to tedit struct
  222. ;output:
  223. ; bh - rezult
  224. ; edx - last text position (if find sucess)
  225. ; esi - first symbol pointer
  226. ;description:
  227. ; ”ã­ªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ eax
  228. ; á ⥪á⮬ । ªâ®à  ¯® 㪠§ â¥«î edx.
  229. ; ‘â ­¤ àâ­ë¥ ä㭪樨 (­ ¯à. strcmp) âãâ ­¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ®
  230. ; ¢ ¯ ¬ï⨠। ªâ®à  ⥪áâ ᮤ¥à¦¨âáï ­¥ ¢ ¢¨¤¥ ascii áâப.
  231. align 4
  232. GetFindRezult:
  233.   push eax
  234.     mov bh,1
  235.     mov esi,edx ;copy edx
  236.     @@:
  237.       cmp byte[edx],bl
  238.       jne .no_text
  239.  
  240.       inc eax ;*** get next symbol (in find text) ***
  241.       mov bl,byte[eax]
  242.       cmp bl,0
  243.       je @f ;end of find text
  244.  
  245.       call IteratNext ;*** get next symbol (in editor text) ***
  246.       cmp edx,ted_tex_1
  247.       jle @f ;end of editor text
  248.  
  249.       jmp @b
  250.       .no_text:
  251.         xor bh,bh
  252.         mov edx,esi ;restore edx
  253.     @@:
  254.   pop eax
  255.   mov bl,byte[eax] ;restore bl
  256.   ret
  257.  
  258. align 4
  259. proc ted_but_open_syntax, edit:dword
  260.   push edi
  261.   mov edi,dword[edit]
  262.  
  263.   cmp ted_panel_id,TE_PANEL_SYNTAX
  264.   jne @f
  265.     stdcall dword[tl_node_get_data], tree1
  266.     pop dword[fn_col_option]
  267.     stdcall InitColText,edi
  268.     call CmColored
  269.     stdcall draw_main_win,edi
  270.   @@:
  271.   pop edi
  272.   ret
  273. endp
  274.  
  275. align 4
  276. proc ted_but_select_word, edit:dword
  277.   pushad
  278.   mov edi,dword[edit]
  279.  
  280.   call GetPos
  281.   push edx
  282.     call ItPervColorTag
  283.     cmp edx,ted_tex_1
  284.     jle @f
  285.       call GetTexCoords
  286.       mov ted_sel_x0,ebx
  287.       mov ted_sel_y0,eax
  288.     @@:
  289.   pop edx
  290.     call ItNextColorTag
  291.     cmp edx,ted_tex_1
  292.     jle @f
  293.       call GetTexCoords
  294.       mov ted_sel_x1,ebx
  295.       mov ted_sel_y1,eax
  296.     @@:
  297.  
  298.   call draw_but_toolbar
  299.   stdcall draw_main_win,edi
  300.   popad
  301.   ret
  302. endp
  303.  
  304. align 4
  305. proc ted_but_cut, edit:dword
  306.   push edi
  307.   mov edi,dword[edit]
  308.  
  309.   stdcall ted_but_copy,edi
  310.   stdcall ted_set_undo,edi
  311.   stdcall SelTextDel,ted_opt_ed_change_time
  312.  
  313.   cmp al,1
  314.   jne @f
  315.     call draw_but_toolbar
  316.     stdcall draw_main_win,edi
  317.   @@:
  318.   pop edi
  319.   ret
  320. endp
  321.  
  322. ;output:
  323. ; al = 1 if copy text
  324. align 4
  325. proc ted_but_copy, edit:dword
  326.   pushad
  327.   mov edi,dword[edit]
  328.  
  329.   stdcall IsSel,edi
  330.   cmp al,0
  331.   je .end_f ;if not selected text
  332.   stdcall SelNormalize,edi
  333.  
  334.   mov esi,ted_seln_x1
  335.   mov ecx,ted_seln_y1
  336.   call GetPosByParam
  337.   mov ebx,edx
  338.   mov esi,ted_seln_x0
  339.   mov ecx,ted_seln_y0
  340.   call GetPosByParam
  341.   mov esi,ebx
  342.  
  343.   xor ecx,ecx
  344.   mov ebx,buf
  345.   ;mov edx,ted_tex
  346.   @@:
  347.     cmp edx,ted_tex_1 ;end of file
  348.     jle @f
  349.     cmp edx,esi ;end of select
  350.     je @f
  351.     inc ecx
  352.     cmp ecx,BUF_SIZE ;owerflow bufer
  353.     je @f
  354.  
  355.     mov al,byte[edx]
  356.     mov byte[ebx],al
  357.     inc ebx
  358.  
  359.     call IteratNext
  360.     jmp @b
  361.   @@:
  362.   add ecx,buf
  363.   mov byte[ebx],0
  364.  
  365.   cmp ecx,0
  366.   je .end_f
  367.     call draw_but_toolbar
  368.     stdcall draw_bufer,edi
  369.   .end_f:
  370.   popad
  371.   ret
  372. endp
  373.  
  374.  
  375. align 4
  376. proc ted_but_paste, edit:dword
  377.   push eax ebx esi edi
  378.   mov edi,dword[edit]
  379.  
  380.     mov esi,buf
  381.     call strlen
  382.     cmp eax,1
  383.     jl @f
  384.       stdcall ted_set_undo,edi
  385.       mov esi,eax
  386.       mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor
  387.       stdcall SelTextDel,ebx
  388.           cmp al,1
  389.           jne .del
  390.             mov ebx,ted_opt_ed_move_cursor
  391.           .del:
  392.       stdcall ted_text_add,edi,buf,esi,ebx
  393.       call draw_but_toolbar
  394.       stdcall draw_main_win,edi
  395.     @@:
  396.   pop edi esi ebx eax
  397.   ret
  398. endp
  399.  
  400. align 4
  401. proc but_find, edit:dword ;¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
  402.   push edi
  403.   mov edi,dword[edit]
  404.  
  405.   cmp ted_panel_id,TE_PANEL_NULL
  406.   je @f
  407.     mov ted_panel_id,TE_PANEL_NULL
  408.     mov ted_wnd_l,0
  409.     jmp .e_if
  410.   @@:
  411.     mov ted_panel_id,TE_PANEL_FIND
  412.     mov ted_wnd_l,TE_PANEL_WIDTH
  413.   .e_if:
  414.   stdcall EvSize,edi
  415.   stdcall draw_main_win,edi
  416.   pop edi
  417.   ret
  418. endp
  419.  
  420. align 4
  421. but_replace:
  422.   ret
  423.  
  424. align 4
  425. but_find_key_w:
  426.   ret
  427.  
  428. align 4
  429. proc but_sumb_upper, edit:dword
  430.   push edi esi
  431.   mov edi,dword[edit]
  432.  
  433.   mov [conv_table],EvUpper
  434.   call ConvertSelText
  435.   cmp esi,0
  436.   je @f
  437.     stdcall draw_main_win,edi
  438.   @@:
  439.   pop esi edi
  440.   ret
  441. endp
  442.  
  443. align 4
  444. proc but_sumb_lover, edit:dword
  445.   push edi esi
  446.   mov edi,dword[edit]
  447.  
  448.   mov [conv_table],EvLover
  449.   call ConvertSelText
  450.   cmp esi,0
  451.   je @f
  452.     stdcall draw_main_win,edi
  453.   @@:
  454.   pop esi edi
  455.   ret
  456. endp
  457.  
  458. align 4
  459. proc but_reverse, edit:dword
  460.   push eax ebx edi
  461.   mov edi,dword[edit]
  462.  
  463.   stdcall IsSel,edi
  464.   cmp al,0
  465.   je @f
  466.     stdcall SelNormalize,edi
  467.     push esi ecx edx
  468.       mov esi,ted_seln_x0
  469.       mov ecx,ted_seln_y0
  470.       call GetPosByParam
  471.       mov eax,edx
  472.       mov esi,ted_seln_x1
  473.       cmp esi,0
  474.       je .beg_str
  475.         dec esi
  476.       .beg_str:
  477.       mov ecx,ted_seln_y1
  478.       call GetPosByParam
  479.       ;call GetTexPervPos
  480.       mov ebx,edx
  481.     pop edx ecx esi
  482.     ;cmp eax,...
  483.     ;je @f
  484.     call Revers
  485.   @@:
  486.   stdcall draw_main_win,edi
  487.   pop edi ebx eax
  488.   ret
  489. endp
  490.  
  491. align 4
  492. proc ted_but_undo, edit:dword
  493.   push eax edi
  494.   mov edi,dword[edit]
  495.  
  496.   mov eax,ted_tim_undo
  497.   cmp ted_tim_ch,eax
  498.   jbe @f
  499.     inc ted_tim_undo
  500.     ;call CmColored
  501.         stdcall draw_main_win,edi
  502.         call draw_but_toolbar
  503.   @@:
  504.   pop edi eax
  505.   ret
  506. endp
  507.  
  508. align 4
  509. proc ted_but_redo, edit:dword
  510.   push edi
  511.   mov edi,dword[edit]
  512.  
  513.   cmp ted_tim_undo,1
  514.   jb @f
  515.     dec ted_tim_undo
  516.     ;call CmColored
  517.         stdcall draw_main_win,edi
  518.         call draw_but_toolbar
  519.   @@:
  520.   pop edi
  521.   ret
  522. endp
  523.  
  524. align 4
  525. proc but_sumb_invis, edit:dword
  526.   push edi
  527.   mov edi,dword[edit]
  528.  
  529.   xor ted_mode_invis,1
  530.   call draw_but_toolbar
  531.   stdcall draw_main_win,edi
  532.   pop edi
  533.   ret
  534. endp
  535.  
  536. align 4
  537. proc but_k_words_show, edit:dword
  538.   push edi
  539.   mov edi,dword[edit]
  540.  
  541.   xor ted_mode_color,1
  542.   cmp ted_mode_color,0
  543.   je @f
  544.     call CmColored
  545.   @@:
  546.   call draw_but_toolbar
  547.   stdcall draw_main_win,edi
  548.   pop edi
  549.   ret
  550. endp
  551.  
  552.  
  553. ;input:
  554. ; edi = pointer to tedit struct
  555. align 4
  556. but_CtrlHome:
  557.         mov ted_cur_x,0
  558.         mov ted_cur_y,0
  559.         push eax
  560.                 mov eax,ted_scr_w
  561.                 mov dword[eax+sb_offs_position],0
  562.                 mov eax,ted_scr_h
  563.                 mov dword[eax+sb_offs_position],0
  564.         pop eax
  565.         call draw_but_toolbar
  566.         stdcall draw_main_win,edi
  567.         ret
  568.  
  569. align 4
  570. proc but_synt_show, edit:dword
  571.   push edi
  572.   mov edi,[edit]
  573.  
  574.   cmp ted_panel_id,TE_PANEL_NULL
  575.   je @f
  576.     mov ted_panel_id,TE_PANEL_NULL
  577.     mov ted_wnd_l,0
  578.     jmp .e_if
  579.   @@:
  580.     mov ted_panel_id,TE_PANEL_SYNTAX
  581.     mov ted_wnd_l,TE_PANEL_WIDTH
  582.   .e_if:
  583.   stdcall EvSize,edi
  584.   stdcall draw_main_win,edi
  585.   pop edi
  586.   ret
  587. endp
  588.  
  589. align 4
  590. proc ted_sel_key_up, edit:dword
  591.   push edi
  592.   mov edi,dword[edit]
  593.  
  594.   cmp ted_drag_k,1
  595.   je @f
  596.     stdcall SelStart,edi
  597.     mov ted_drag_k,1
  598.   @@:
  599.   push dx
  600.     call CurMoveUp
  601.     cmp dl,8
  602.     jne @f
  603.       call OnInitialUpdate
  604.     @@:
  605.   pop dx
  606.   stdcall SelMove,edi
  607.   stdcall draw_main_win,edi
  608.   pop edi
  609.   ret
  610. endp
  611.  
  612. align 4
  613. proc ted_sel_key_down, edit:dword
  614.   push edi
  615.   mov edi,dword[edit]
  616.  
  617.   cmp ted_drag_k,1
  618.   je @f
  619.     stdcall SelStart,edi
  620.     mov ted_drag_k,1
  621.   @@:
  622.   push dx
  623.     call CurMoveDown
  624.     cmp dl,8
  625.     jne @f
  626.       call OnInitialUpdate
  627.     @@:
  628.   pop dx
  629.   stdcall SelMove,edi
  630.   stdcall draw_main_win,edi
  631.   pop edi
  632.   ret
  633. endp
  634.  
  635. align 4
  636. proc ted_sel_key_left, edit:dword
  637.   push edi
  638.   mov edi,dword[edit]
  639.  
  640.   cmp ted_drag_k,1
  641.   je @f
  642.     stdcall SelStart,edi
  643.   @@:
  644.   push dx
  645.     call CurMoveLeft
  646.     stdcall SelMove,edi
  647.     cmp ted_drag_k,1
  648.     je @f
  649.       mov ted_drag_k,1
  650.       mov dl,8
  651.     @@:
  652.     cmp dl,8
  653.     jne @f
  654.       call OnInitialUpdate
  655.       stdcall draw_main_win,edi
  656.       jmp .end_f
  657.     @@:
  658.       stdcall draw_cur_line,edi
  659.     .end_f:
  660.   pop dx
  661.   pop edi
  662.   ret
  663. endp
  664.  
  665. align 4
  666. proc ted_sel_key_right, edit:dword
  667.   push edi
  668.   mov edi,dword[edit]
  669.  
  670.   cmp ted_drag_k,1
  671.   je @f
  672.     stdcall SelStart,edi
  673.   @@:
  674.   push dx
  675.     call CurMoveRight
  676.     stdcall SelMove,edi
  677.     cmp ted_drag_k,1
  678.     je @f
  679.       mov ted_drag_k,1
  680.       mov dl,8
  681.     @@:
  682.     cmp dl,8
  683.     jne @f
  684.       call OnInitialUpdate
  685.       stdcall draw_main_win,edi
  686.       jmp .end_f
  687.     @@:
  688.       stdcall draw_cur_line,edi
  689.     .end_f:
  690.   pop dx
  691.   pop edi
  692.   ret
  693. endp
  694.