Subversion Repositories Kolibri OS

Rev

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

  1. but_NewFile:
  2.   push eax ebx
  3.   call CanSave
  4.   cmp al,1
  5.   jne @f
  6.     push thread
  7.     push msgbox_2
  8.     call [mb_create] ;message: save changes in file?
  9.     ;mov eax,5
  10.     ;mov ebx,50
  11.     ;int 0x40
  12.     push msgbox_2_funct
  13.     call [mb_setfunctions]
  14.     jmp .ret_f
  15.   @@:
  16.   call On_NewFile
  17.   .ret_f:
  18.   pop ebx eax
  19.   ret
  20.  
  21. On_NewFile:
  22.   push eax
  23.   mov al,1
  24.   call Clear
  25.   call draw_but_toolbar
  26.   call draw_main_win
  27.   pop eax
  28.   ret
  29.  
  30. On_SaveAndNewFile:
  31.   call but_SaveFile
  32.   cmp byte[err_sav],0
  33.   jne @f
  34.     call On_NewFile
  35.   @@:
  36.   ret
  37.  
  38. but_OpenFile:
  39.   push eax
  40.   call CanSave
  41.   cmp al,1
  42.   jne @f
  43.     push thread
  44.     push msgbox_5
  45.     call [mb_create] ;message: save changes in file?
  46.     push msgbox_5_funct
  47.     call [mb_setfunctions]
  48.     jmp .ret_f
  49.   @@:
  50.   call On_OpenFile
  51.   .ret_f:
  52.   pop eax
  53.   ret
  54.  
  55. On_OpenFile:
  56.   push eax ebx
  57.   mov eax,70
  58.   mov [run_file_70.func_n], 0
  59.   mov [run_file_70.param1], 0
  60.   mov [run_file_70.param2], 0
  61.   mov [run_file_70.param3], maxChars-2 ;sizeof.symbol
  62.   m2m [run_file_70.param4], [tex]
  63.   mov [run_file_70.rezerv], 0
  64.   push dword[edit1.text]
  65.   pop dword[run_file_70.name]
  66.   mov ebx,run_file_70
  67.   int 0x40
  68.  
  69.   cmp eax,0
  70.   je @f
  71.   cmp eax,6
  72.   je @f
  73.     cmp ax,10
  74.     jl .zifra_0_9
  75.       mov al,'?'
  76.       sub ax,48
  77.     .zifra_0_9:
  78.     add ax,48
  79.  
  80.     mov byte[msgbox_4.err],al
  81.     push thread
  82.     push msgbox_4
  83.     call [mb_create] ;message: Can-t open text file!
  84.     jmp .ret_f
  85.   @@:
  86.   mov [err_opn],1
  87.   cmp ebx,-1
  88.   je .ret_f
  89.     ;if open file
  90.     call OpenFile
  91.     call draw_but_toolbar
  92.     call draw_main_win
  93.     cmp ebx,maxChars-2
  94.     jl .ret_f
  95.     push thread
  96.     push msgbox_1
  97.     call [mb_create]
  98.   .ret_f:
  99.   pop ebx eax
  100.   ret
  101.  
  102. but_SaveFile:
  103.   push eax ebx ecx edx
  104.   call CanSave
  105.   cmp al,0
  106.   je .no_save
  107.  
  108.   mov   ecx,maxChars
  109.   call mem_Alloc
  110.   push eax
  111.  
  112.   mov edx,[tex]
  113.   xor ecx,ecx
  114.   @@:
  115.     call IteratNext
  116.     cmp edx,[tex_1]
  117.     jle @f ;edx = [tex] or edx = [tex]+sizeof.symbol
  118.     mov bl,[edx]
  119.     mov byte[eax],bl
  120.     inc eax
  121.     inc ecx
  122.     jmp @b
  123.   @@:
  124.  
  125.   cmp ecx,0
  126.   je @f
  127.     pop eax
  128.     mov [run_file_70.param4],eax
  129.     push eax
  130.     mov eax,70
  131.     mov [run_file_70.func_n], 2
  132.     mov [run_file_70.param1], 0
  133.     mov [run_file_70.param2], 0
  134.     mov [run_file_70.param3], ecx
  135.     mov [run_file_70.rezerv], 0
  136.     push [edit1.text]
  137.     pop [run_file_70.name]
  138.     mov ebx,run_file_70
  139.     int 0x40
  140.  
  141.     mov [err_sav],al
  142.  
  143.     cmp eax,0
  144.     je .no_msg
  145. ;    cmp eax,6
  146. ;    je @f
  147.       cmp ax,10
  148.       jl .zifra_0_9
  149.         mov al,'?'
  150.         sub ax,48
  151.       .zifra_0_9:
  152.       add ax,48
  153.  
  154.       mov byte[msgbox_6.err],al
  155.       push thread
  156.       push msgbox_6
  157.       call [mb_create] ;message: Can-t save text file!
  158.       jmp @f
  159.     .no_msg:
  160.     m2m [ls_tim],[ch_tim]
  161.   @@:
  162.  
  163.   pop ecx
  164.   call mem_Free
  165.   .no_save:
  166.   pop edx ecx ebx eax
  167.   ret
  168.  
  169. but_FindText:
  170.   push eax ebx ecx edx edi
  171.     call GetPos
  172.     mov eax,[edit2.text]
  173.     mov bl,byte[eax]
  174.     @@:
  175.       call GetFindRezult
  176.       cmp bh,1
  177.       je @f ; find
  178.  
  179.       call IteratNext
  180.       cmp edx,[tex_1]
  181.       jle @f
  182.       jmp @b
  183.     @@:
  184.     cmp bh,0
  185.     je @f
  186.       call GetTexCoords
  187.       inc ebx ;move cursor right
  188.       mov [sel.x1],ebx
  189.       mov [sel.y1],eax
  190.       mov edx,eax
  191.       mov ecx,ebx
  192.       call GoToPos
  193.       mov edx,edi
  194.       call GetTexCoords
  195.       mov [sel.x0],ebx
  196.       mov [sel.y0],eax
  197.       call draw_main_win
  198.       jmp .end_find
  199.     @@:
  200.       push thread
  201.       push msgbox_7
  202.       call [mb_create] ;message: Can not find text
  203.     .end_find:
  204.   pop edi edx ecx ebx eax
  205.   ret
  206.  
  207. ;input:
  208. ; eax - text need find
  209. ; bl - first symbol to find
  210. ; edx - first symbol pointer
  211. ;output:
  212. ; bh - rezult
  213. ; edx - last text position (if find sucess)
  214. ; edi - first symbol pointer
  215. GetFindRezult:
  216.   push eax
  217.     mov bh,1
  218.     mov edi,edx ;copy edx
  219.     @@:
  220.       cmp byte[edx],bl
  221.       jne .no_text
  222.  
  223.       inc eax ;*** get next symbol (in find text) ***
  224.       mov bl,byte[eax]
  225.       cmp bl,0
  226.       je @f ;end of find text
  227.  
  228.       call IteratNext ;*** get next symbol (in editor text) ***
  229.       cmp edx,[tex_1]
  230.       jle @f ;end of editor text
  231.  
  232.       jmp @b
  233.       .no_text:
  234.         xor bh,bh
  235.         mov edx,edi ;restore edx
  236.     @@:
  237.   pop eax
  238.   mov bl,byte[eax] ;restore bl
  239.   ret
  240.  
  241. but_OpenSyntax:
  242.   cmp byte[panel_id],TE_PANEL_SYNTAX
  243.   jne @f
  244.     push dword tree1
  245.     call dword [tl_node_get_data]
  246.     pop  dword [fn_col_option]
  247.     call InitColText
  248.     call CmColored
  249.     call draw_main_win
  250.   @@:
  251.   ret
  252.  
  253. but_select_word:
  254.   push eax ebx ecx edx
  255.  
  256.   call GetPos
  257.   push edx
  258.     call ItPervColorTag
  259.     cmp edx,[tex_1]
  260.     jle @f
  261.       call GetTexCoords
  262.       mov [sel.x0],ebx
  263.       mov [sel.y0],eax
  264.     @@:
  265.   pop edx
  266.     call ItNextColorTag
  267.     cmp edx,[tex_1]
  268.     jle @f
  269.       call GetTexCoords
  270.       mov [sel.x1],ebx
  271.       mov [sel.y1],eax
  272.     @@:
  273.   pop edx ecx ebx eax
  274.   call draw_but_toolbar
  275.   call draw_main_win
  276.   jmp still
  277.  
  278. but_cut:
  279.   call but_Copy
  280.   call SetUndo
  281.   push bx
  282.     mov bl,1
  283.     call SelTextDel
  284.   pop bx
  285.   cmp al,1
  286.   jne @f
  287.     call draw_but_toolbar
  288.     call draw_main_win
  289.   @@:
  290.   jmp still
  291.  
  292. ;output:
  293. ; al = 1 if copy text
  294. but_Copy:
  295.   push ax
  296.   call IsSel
  297.   cmp al,0
  298.   jne @f
  299.     pop ax
  300.     ret ;if not selected text
  301.   @@:
  302.   call SelNormalize
  303.  
  304.   push ebx ecx edx esi
  305.   mov esi,[seln.x1]
  306.   mov ecx,[seln.y1]
  307.   call GetPosByParam
  308.   mov ebx,edx
  309.   mov esi,[seln.x0]
  310.   mov ecx,[seln.y0]
  311.   call GetPosByParam
  312.   mov esi,ebx
  313.  
  314.   xor ecx,ecx
  315.   mov ebx,buf
  316.   ;mov edx,[tex]
  317.   @@:
  318.     cmp edx,[tex_1] ;end of file
  319.     jle @f
  320.     cmp edx,esi ;end of select
  321.     je @f
  322.     inc ecx
  323.     cmp ecx,BUF_SIZE ;owerflow bufer
  324.     je @f
  325.  
  326.     mov al,byte[edx]
  327.     mov byte[ebx],al
  328.     inc ebx
  329.  
  330.     call IteratNext
  331.     jmp @b
  332.   @@:
  333.   add ecx,buf
  334.   mov byte[ebx],0
  335.  
  336.   cmp ecx,0
  337.   je @f
  338.     call draw_but_toolbar
  339.     call draw_bufer
  340.   @@:
  341.   pop esi edx ecx ebx ax
  342.   ret
  343.  
  344. but_paste:
  345.   push eax bx esi edi
  346.     mov esi,buf
  347.     call strlen
  348.     cmp eax,1
  349.     jl @f
  350.       call SetUndo
  351.       mov esi,eax
  352.       mov bx,0x0101
  353.       call SelTextDel
  354.       mov edi,buf
  355.       call TextAdd
  356.       call draw_but_toolbar
  357.       call draw_main_win
  358.     @@:
  359.   pop edi esi bx eax
  360.   jmp still
  361.  
  362. but_find:
  363.   cmp byte[panel_id],TE_PANEL_NULL
  364.   je @f
  365.     mov byte[panel_id],TE_PANEL_NULL
  366.     mov word[wndMain.left],0
  367.     jmp .e_if
  368.   @@:
  369.     mov byte[panel_id],TE_PANEL_FIND
  370.     mov word[wndMain.left],TE_PANEL_WIDTH
  371.   .e_if:
  372.   call EvSize
  373.   call draw_main_win
  374.   jmp still
  375.  
  376. but_replace:
  377.   jmp still
  378.  
  379. but_find_key_w:
  380.   jmp still
  381.  
  382. but_sumb_upper:
  383.   push edi
  384.   mov [conv_table],EvUpper
  385.   call ConvertSelText
  386.   cmp edi,0
  387.   je @f
  388.     call draw_main_win
  389.   @@:
  390.   pop edi
  391.   jmp still
  392.  
  393. but_sumb_lover:
  394.   push edi
  395.   mov [conv_table],EvLover
  396.   call ConvertSelText
  397.   cmp edi,0
  398.   je @f
  399.     call draw_main_win
  400.   @@:
  401.   pop edi
  402.   jmp still
  403.  
  404. but_reverse:
  405.   push eax ebx
  406.   call IsSel
  407.   cmp al,0
  408.   je @f
  409.     call SelNormalize
  410.     push esi ecx edx
  411.       mov esi,[seln.x0]
  412.       mov ecx,[seln.y0]
  413.       call GetPosByParam
  414.       mov eax,edx
  415.       mov esi,[seln.x1]
  416.       cmp esi,0
  417.       je .beg_str
  418.         dec esi
  419.       .beg_str:
  420.       mov ecx,[seln.y1]
  421.       call GetPosByParam
  422.       ;call GetTexPervPos
  423.       mov ebx,edx
  424.     pop edx ecx esi
  425.     ;cmp eax,...
  426.     ;je @f
  427.     call Revers
  428.   @@:
  429.   pop ebx eax
  430.   call draw_main_win
  431.   jmp still
  432.  
  433. but_undo:
  434.   mov eax,[tim_Undo]
  435.   cmp [ch_tim],eax
  436.   jbe still
  437.   inc [tim_Undo]
  438.   ;call CmColored
  439.   jmp red_win
  440.  
  441. but_redo:
  442.   cmp [tim_Undo],1
  443.   jb still
  444.   dec [tim_Undo]
  445.   ;call CmColored
  446.   jmp red_win
  447.  
  448.  
  449. but_sumb_invis:
  450.   xor [invis],1
  451.   jmp red_win
  452.  
  453. but_k_words_show:
  454.   xor byte[mode_colored],1
  455.   cmp byte[mode_colored],0
  456.   je red_win
  457.   call CmColored
  458.  
  459. ;  push eax ebx ecx esi edi
  460. ;  mov eax,dword[cur_x]
  461. ;  ColToIndexOffset eax,edx
  462. ;  mov eax,4
  463. ;  mov ebx,50*65536+75
  464. ;  mov ecx,0x40ffffff
  465. ;  mov edi,0x404040
  466. ;  mov esi,10
  467. ;  int 0x40
  468. ;
  469. ;  mov eax,47
  470. ;  mov ecx,250
  471. ;  mov esi,0xffff80
  472. ;  mov edx,50*65536+80
  473. ;  mov esi,FkPos;[keyW]
  474. ;  @@:
  475. ;    mov ebx,0x30001
  476. ;    cmp dx,300
  477. ;    jl .no_br
  478. ;      mov dx,80
  479. ;      add edx,0x200000
  480. ;    .no_br:
  481. ;    add dx,10
  482. ;    push ecx esi
  483. ;      mov ecx,esi
  484. ;      cmp dword[ecx],-1
  485. ;      jne .no_minus
  486. ;       mov ebx,0x10000
  487. ;       mov ecx,1
  488. ;      .no_minus:
  489. ;      mov esi,0xffff00
  490. ;      int 0x40
  491. ;    pop esi ecx
  492. ;    add esi,4
  493. ;  loop @b
  494. ;  pop edi esi ecx ebx eax
  495.   jmp red_win
  496.  
  497. but_CtrlHome:
  498.   mov [cur_x],0
  499.   mov [cur_y],0
  500.   mov [wScr.position],0
  501.   mov [hScr.position],0
  502.  
  503.   call draw_but_toolbar
  504.   call draw_main_win
  505.   ret
  506.  
  507. but_synt_show:
  508.   cmp byte[panel_id],TE_PANEL_NULL
  509.   je @f
  510.     mov byte[panel_id],TE_PANEL_NULL
  511.     mov word[wndMain.left],0
  512.     jmp .e_if
  513.   @@:
  514.     mov byte[panel_id],TE_PANEL_SYNTAX
  515.     mov word[wndMain.left],TE_PANEL_WIDTH
  516.   .e_if:
  517.   call EvSize
  518.   call draw_main_win
  519.   jmp still
  520.  
  521. sel_KeyUp:
  522.   cmp [dragk],1
  523.   je @f
  524.     call SelStart
  525.     mov [dragk],1
  526.   @@:
  527.   push dx
  528.     call CurMoveUp
  529.     cmp dl,8
  530.     jne @f
  531.       call OnInitialUpdate
  532.     @@:
  533.   pop dx
  534.   call SelMove
  535.   call draw_main_win
  536.   ret
  537.  
  538. sel_KeyDown:
  539.   cmp [dragk],1
  540.   je @f
  541.     call SelStart
  542.     mov [dragk],1
  543.   @@:
  544.   push dx
  545.     call CurMoveDown
  546.     cmp dl,8
  547.     jne @f
  548.       call OnInitialUpdate
  549.     @@:
  550.   pop dx
  551.   call SelMove
  552.   call draw_main_win
  553.   ret
  554.  
  555. sel_KeyLeft:
  556.   cmp [dragk],1
  557.   je @f
  558.     call SelStart
  559.   @@:
  560.   push dx
  561.     call CurMoveLeft
  562.     call SelMove
  563.     cmp [dragk],1
  564.     je @f
  565.       mov [dragk],1
  566.       mov dl,8
  567.     @@:
  568.     cmp dl,8
  569.     jne @f
  570.       call OnInitialUpdate
  571.       call draw_main_win
  572.       jmp .end_f
  573.     @@:
  574.       call draw_cur_line
  575.     .end_f:
  576.   pop dx
  577.   ret
  578.  
  579. sel_KeyRight:
  580.   cmp [dragk],1
  581.   je @f
  582.     call SelStart
  583.   @@:
  584.   push dx
  585.     call CurMoveRight
  586.     call SelMove
  587.     cmp [dragk],1
  588.     je @f
  589.       mov [dragk],1
  590.       mov dl,8
  591.     @@:
  592.     cmp dl,8
  593.     jne @f
  594.       call OnInitialUpdate
  595.       call draw_main_win
  596.       jmp .end_f
  597.     @@:
  598.       call draw_cur_line
  599.     .end_f:
  600.   pop dx
  601.   ret