Subversion Repositories Kolibri OS

Rev

Rev 258 | Rev 267 | 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.         jmp     still.skip_write
  24.  
  25.   btn.scroll_up:
  26.         dec     [cur_tab.Editor.TopLeft.Y] ;! [top_line]
  27.         jns     @f
  28.         inc     [cur_tab.Editor.TopLeft.Y] ;! [top_line]
  29.         ret
  30.     @@: call    check_inv_all.skip_check
  31.         ret
  32.  
  33.   btn.scroll_down:
  34.         inc     [cur_tab.Editor.TopLeft.Y] ;! [top_line]
  35.         mov     eax,[cur_tab.Editor.Lines] ;! eax,[lines]
  36.         sub     eax,[lines.scr]
  37.         cmp     eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
  38.         jge     @f
  39.         dec     [cur_tab.Editor.TopLeft.Y] ;! [top_line]
  40.         ret
  41.     @@: call    check_inv_all.skip_check
  42.         ret
  43.  
  44.   btn.scroll_left:
  45.         dec     [cur_tab.Editor.TopLeft.X] ;! [left_col]
  46.         jns     @f
  47.         inc     [cur_tab.Editor.TopLeft.X] ;! [left_col]
  48.         ret;jmp     still.skip_write
  49.     @@: call    check_inv_all.skip_check
  50.         ret
  51.  
  52.   btn.scroll_right:
  53.         inc     [cur_tab.Editor.TopLeft.X] ;! [left_col]
  54.         mov     eax,[cur_tab.Editor.Columns] ;! eax,[columns]
  55.         sub     eax,[columns.scr]
  56.         cmp     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  57.         jge     @f
  58.         dec     [cur_tab.Editor.TopLeft.X] ;! [left_col]
  59.         ret
  60.     @@: call    check_inv_all.skip_check
  61.         ret
  62.  
  63.   btn.search:
  64.   key.f3:
  65.         call    search
  66.         jc      @f
  67.         call    check_inv_all
  68.     @@: ret
  69.  
  70.  
  71. func search
  72.         cld
  73.         mov     ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
  74.         mov     edx,ecx
  75.         call    get_line_offset
  76.         cmp     word[esi],0
  77.         je      .exit
  78.         call    get_real_length
  79.         add     esi,4
  80.         or      eax,eax
  81.         jz      .end_line.2
  82.         mov     ecx,eax
  83.         sub     ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
  84.         push    esi
  85.         add     esi,[cur_tab.Editor.Caret.X] ;! esi,[pos.x]
  86.         jmp     @f
  87.  
  88.   .next_line:
  89.         push    esi
  90.     @@: sub     ecx,[s_search.size]
  91.         inc     ecx
  92.  
  93.   .next_char:
  94.         dec     ecx
  95.         js      .end_line
  96.         xor     edi,edi
  97.  
  98.   .next_ok:
  99.         movzx   eax,byte[edi+esi]
  100.         movzx   ebx,byte[edi+s_search]
  101.  
  102.         cmp     al,$61
  103.         jb      @f
  104.         add     al,[eax+add_table-$61]
  105.     @@: cmp     bl,$61
  106.         jb      @f
  107.         add     bl,[ebx+add_table-$61]
  108.     @@:
  109.         cmp     al,bl
  110.         je      @f
  111.  
  112.         inc     esi
  113.         jmp     .next_char
  114.     @@:
  115.         inc     edi
  116.         cmp     edi,[s_search.size]
  117.         jne     .next_ok
  118.  
  119.   .found:
  120.         add     esp,4
  121.         mov     [cur_tab.Editor.Caret.Y],edx ;! [pos.y],edx
  122.         mov     [cur_tab.Editor.SelStart.Y],edx ;! [sel.y],edx
  123.         mov     ecx,edx
  124.         lea     eax,[esi-4]
  125.         call    get_line_offset
  126.         sub     eax,esi
  127.         mov     [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
  128.         add     eax,[s_search.size]
  129.         mov     [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
  130.         mov     [s_status],0
  131.         clc
  132.         ret
  133.  
  134.   .end_line:
  135.         pop     esi
  136.   .end_line.2:
  137.         movzx   eax,word[esi-4]
  138.         add     esi,eax;[esi-4]
  139.         inc     edx
  140.         call    get_real_length
  141.         mov     ecx,eax
  142.         lodsd
  143.         or      eax,eax
  144.         jnz     .next_line
  145.   .exit:
  146.         mov     [s_status],s_text_not_found
  147.         stc
  148.         ret
  149. endf
  150.  
  151.   btn.compile:
  152.   key.ctrl_f9:
  153.         mov     bl,0
  154.         call    start_fasm
  155.         ret
  156.   btn.compile_run:
  157.   key.f9:
  158.         mov     bl,1
  159.         call    start_fasm
  160.         ret
  161.   btn.debug_board:
  162.         call    open_debug_board
  163.         ret
  164.   btn.sysfuncs_txt:
  165.         call    open_sysfuncs_txt
  166.         ret
  167.  
  168.   btn.load_file:
  169.   key.ctrl_l:
  170.         call    load_file
  171.         jnc     @f
  172.         ret
  173.     @@:
  174.  
  175.         xor     eax,eax
  176.         mov     [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
  177.         mov     [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
  178.         mov     [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
  179.         mov     [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
  180.         mov     [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
  181.         mov     [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
  182.  
  183.         mov     [cur_tab.Editor.Modified],al ;! [modified],al
  184.  
  185. ; enable color syntax for ASM and INC files:
  186.         mov     [cur_tab.Editor.AsmMode],al ;! [asm_mode],al
  187.  
  188.         mov     eax,[f_info.length]
  189.         add     eax,f_info.path
  190.         mov     byte[eax],0
  191.         mov     ecx, dword [eax-3]
  192.         or      ecx, 0x202020
  193.         cmp     ecx, 'asm'
  194.         jne     @f
  195.         inc     [cur_tab.Editor.AsmMode] ;! [asm_mode]
  196.         jmp     .nocol
  197.     @@: cmp     ecx, 'inc'
  198.         jne     .nocol
  199.         inc     [cur_tab.Editor.AsmMode] ;! [asm_mode]
  200.     .nocol:
  201.  
  202.   update_caption:
  203.         lea     esi,[cur_tab.Editor.FilePath] ;! mov     esi,f_info.path
  204.         mov     edi,s_title
  205.  
  206.     @@: lodsb
  207.         cmp     al,0
  208.         je      @f
  209.         stosb
  210.         jmp     @b
  211.     @@:
  212.         ;cld
  213.         ;mov     ecx,[f_info.length]
  214.         ;jecxz   @f
  215.         ;rep     movsb
  216.  
  217.         mov     dword[edi],' - '
  218.         add     edi,3
  219.     @@: mov     esi,htext
  220.         mov     ecx,htext.size
  221.         cld
  222.         rep     movsb
  223.  
  224.         mov     al,0
  225.         stosb
  226.  
  227.         mcall   71,1,s_title
  228.  
  229.         clc
  230.         ret
  231.  
  232.   btn.close_main_window:
  233.   key.alt_x:
  234.         mov     esi,self_path
  235.         mov     byte[esi+PATHL-1],0
  236.         mov     edi,f_info.path
  237.         cld
  238.     @@: lodsb
  239.         stosb
  240.         or      al,al
  241.         jnz     @b
  242.  
  243.         mov     [f_info70+0],2
  244.         mov     [f_info70+4],0
  245.         mov     [f_info70+8],0
  246.         mov     [f_info70+12],TINYPAD_END
  247.         mov     [f_info70+16],0
  248.         mov     byte[f_info70+20],0
  249.         mov     [f_info70+21],f_info.path
  250.         mcall   70,f_info70
  251.  
  252.   .close:
  253.         mov     [main_closed],1
  254.         mcall   -1
  255.