Subversion Repositories Kolibri OS

Rev

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

  1. button:
  2.         mcall   17
  3.         cmp     al,0
  4.         jne     still
  5.         shr     eax,8
  6.  
  7.         cmp     [bot_mode],0
  8.         je      @f
  9.         mov     ebx,eax
  10.         mov     al,3
  11.         call    [bot_dlg_handler]
  12.         jmp     still
  13.  
  14.     @@: mov     esi,accel_table2
  15.   .acc: cmp     eax,[esi]
  16.         jne     @f
  17.         call    dword[esi+4]
  18.         jmp     still.skip_write
  19.     @@: add     esi,8
  20.         cmp     byte[esi],0
  21.         jne     .acc
  22.  
  23.         cmp     eax,[tab_bar.Buttons.First]
  24.         jb      @f
  25.         cmp     eax,[tab_bar.Buttons.Last]
  26.         ja      @f
  27.  
  28.         ;// TAB CONTROL BUTTONS
  29.  
  30.         add     eax,-1000
  31.         imul    ebp,eax,sizeof.TABITEM
  32.         add     ebp,[tab_bar.Items]
  33.         cmp     ebp,[tab_bar.Current.Ptr]
  34.         je      @f
  35.         call    set_cur_tab
  36.         call    align_editor_in_tab
  37.         call    draw_editor
  38.         call    draw_statusbar
  39.         call    draw_tabctl
  40.  
  41.     @@:
  42.         jmp     still.skip_write
  43.  
  44.   btn.vscroll_up:
  45.         dec     [cur_editor.TopLeft.Y] ;! [top_line]
  46.         jns     @f
  47.         inc     [cur_editor.TopLeft.Y] ;! [top_line]
  48.         ret
  49.     @@: call    check_inv_all.skip_check
  50.         ret
  51.  
  52.   btn.vscroll_down:
  53.         inc     [cur_editor.TopLeft.Y] ;! [top_line]
  54.         mov     eax,[cur_editor.Lines.Count] ;! eax,[lines]
  55.         sub     eax,[lines.scr]
  56.         cmp     eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
  57.         jge     @f
  58.         dec     [cur_editor.TopLeft.Y] ;! [top_line]
  59.         ret
  60.     @@: call    check_inv_all.skip_check
  61.         ret
  62.  
  63.   btn.hscroll_up:
  64.         dec     [cur_editor.TopLeft.X] ;! [left_col]
  65.         jns     @f
  66.         inc     [cur_editor.TopLeft.X] ;! [left_col]
  67.         ret;jmp     still.skip_write
  68.     @@: call    check_inv_all.skip_check
  69.         ret
  70.  
  71.   btn.hscroll_down:
  72.         inc     [cur_editor.TopLeft.X] ;! [left_col]
  73.         mov     eax,[cur_editor.Columns.Count] ;! eax,[columns]
  74.         sub     eax,[columns.scr]
  75.         cmp     eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
  76.         jge     @f
  77.         dec     [cur_editor.TopLeft.X] ;! [left_col]
  78.         ret
  79.     @@: call    check_inv_all.skip_check
  80.         ret
  81.  
  82.   btn.tabctl_right:
  83.         call    get_hidden_tabitems_number
  84.         or      eax,eax
  85.         jz      @f
  86.         inc     [tab_bar.Items.Left]
  87.         call    draw_tabctl
  88.     @@: ret
  89.   btn.tabctl_left:
  90.         dec     [tab_bar.Items.Left]
  91.         jns     @f
  92.         inc     [tab_bar.Items.Left]
  93.     @@: call    draw_tabctl
  94.         ret
  95.  
  96.   btn.search:
  97.   key.f3:
  98.         call    search
  99.         jc      @f
  100.         call    check_inv_all
  101.     @@: ret
  102.  
  103.  
  104. func search
  105.         cld
  106.         mov     ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
  107.         mov     edx,ecx
  108.         call    get_line_offset
  109.         cmp     word[esi],0
  110.         je      .exit
  111.         call    get_real_length
  112.         add     esi,4
  113.         or      eax,eax
  114.         jz      .end_line.2
  115.         mov     ecx,eax
  116.         sub     ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
  117.         push    esi
  118.         add     esi,[cur_editor.Caret.X] ;! esi,[pos.x]
  119.         jmp     @f
  120.  
  121.   .next_line:
  122.         push    esi
  123.     @@: sub     ecx,[s_search.size]
  124.         inc     ecx
  125.  
  126.   .next_char:
  127.         dec     ecx
  128.         js      .end_line
  129.         xor     edi,edi
  130.  
  131.   .next_ok:
  132.         movzx   eax,byte[edi+esi]
  133.         movzx   ebx,byte[edi+s_search]
  134.  
  135.         cmp     al,$61
  136.         jb      @f
  137.         add     al,[eax+add_table-$61]
  138.     @@: cmp     bl,$61
  139.         jb      @f
  140.         add     bl,[ebx+add_table-$61]
  141.     @@:
  142.         cmp     al,bl
  143.         je      @f
  144.  
  145.         inc     esi
  146.         jmp     .next_char
  147.     @@:
  148.         inc     edi
  149.         cmp     edi,[s_search.size]
  150.         jne     .next_ok
  151.  
  152.   .found:
  153.         add     esp,4
  154.         mov     [cur_editor.Caret.Y],edx ;! [pos.y],edx
  155.         mov     [cur_editor.SelStart.Y],edx ;! [sel.y],edx
  156.         mov     ecx,edx
  157.         lea     eax,[esi-4]
  158.         call    get_line_offset
  159.         sub     eax,esi
  160.         mov     [cur_editor.SelStart.X],eax ;! [sel.x],eax
  161.         add     eax,[s_search.size]
  162.         mov     [cur_editor.Caret.X],eax ;! [pos.x],eax
  163.         mov     [s_status],0
  164.         clc
  165.         ret
  166.  
  167.   .end_line:
  168.         pop     esi
  169.   .end_line.2:
  170.         movzx   eax,word[esi-4]
  171.         add     esi,eax;[esi-4]
  172.         inc     edx
  173.         call    get_real_length
  174.         mov     ecx,eax
  175.         lodsd
  176.         or      eax,eax
  177.         jnz     .next_line
  178.   .exit:
  179.         mov     [s_status],s_text_not_found
  180.         stc
  181.         ret
  182. endf
  183.  
  184.   btn.compile:
  185.   key.ctrl_f9:
  186.         mov     bl,0
  187.         call    start_fasm
  188.         ret
  189.   btn.compile_run:
  190.   key.f9:
  191.         mov     bl,1
  192.         call    start_fasm
  193.         ret
  194.   btn.debug_board:
  195.         call    open_debug_board
  196.         ret
  197.   btn.sysfuncs_txt:
  198.         call    open_sysfuncs_txt
  199.         ret
  200.  
  201.   btn.load_file:
  202.   key.ctrl_l:
  203.         call    load_file
  204.         jnc     @f
  205.         ret
  206.     @@:
  207.  
  208.         xor     eax,eax
  209.         mov     [cur_editor.TopLeft.Y],eax ;! [top_line],eax
  210.         mov     [cur_editor.TopLeft.X],eax ;! [left_col],eax
  211.         mov     [cur_editor.Caret.X],eax ;! [pos.x],eax
  212.         mov     [cur_editor.Caret.Y],eax ;! [pos.y],eax
  213.         mov     [cur_editor.SelStart.X],eax ;! [sel.x],eax
  214.         mov     [cur_editor.SelStart.Y],eax ;! [sel.y],eax
  215.  
  216.         mov     [cur_editor.Modified],al ;! [modified],al
  217.  
  218. ; enable color syntax for ASM and INC files:
  219.         mov     [cur_editor.AsmMode],al ;! [asm_mode],al
  220.  
  221. ;       mov     eax,[f_info.length]
  222. ;       add     eax,f_info.path
  223. ;       mov     byte[eax],0
  224.         lea     ebx,[cur_editor.FilePath]
  225.         mov     eax,ebx
  226.         call    strlen
  227.         mov     ecx,dword[ebx+eax-3]
  228.         or      ecx,0x202020
  229.         cmp     ecx,'asm'
  230.         jne     @f
  231.         inc     [cur_editor.AsmMode] ;! [asm_mode]
  232.         jmp     .nocol
  233.     @@: cmp     ecx,'inc'
  234.         jne     .nocol
  235.         inc     [cur_editor.AsmMode] ;! [asm_mode]
  236.     .nocol:
  237.  
  238.   update_caption:
  239.         lea     esi,[cur_editor.FilePath] ;! mov     esi,f_info.path
  240.         mov     edi,s_title
  241.  
  242.     @@: lodsb
  243.         cmp     al,0
  244.         je      @f
  245.         stosb
  246.         jmp     @b
  247.     @@:
  248.         ;cld
  249.         ;mov     ecx,[f_info.length]
  250.         ;jecxz   @f
  251.         ;rep     movsb
  252.  
  253.         mov     dword[edi],' - '
  254.         add     edi,3
  255.     @@: mov     esi,htext
  256.         mov     ecx,htext.size
  257.         cld
  258.         rep     movsb
  259.  
  260.         mov     al,0
  261.         stosb
  262.  
  263.         mcall   71,1,s_title
  264.  
  265.         clc
  266.         ret
  267.  
  268.   btn.close_main_window:
  269.   key.alt_x:
  270.         mov     esi,self_path
  271.         mov     byte[esi+PATHL-1],0
  272.         mov     edi,f_info.path
  273.         cld
  274.     @@: lodsb
  275.         stosb
  276.         or      al,al
  277.         jnz     @b
  278.  
  279.         mov     [f_info70+0],2
  280.         mov     [f_info70+4],0
  281.         mov     [f_info70+8],0
  282.         mov     [f_info70+12],TINYPAD_END
  283.         mov     [f_info70+16],0
  284.         mov     byte[f_info70+20],0
  285.         mov     [f_info70+21],f_info.path
  286.         mcall   70,f_info70
  287.  
  288.   .close:
  289.         mov     [main_closed],1
  290.         mcall   -1
  291.