Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. ;-----------------------------------------------------------------------------
  3. func draw_editor ;////////////////////////////////////////////////////////////
  4. ;-----------------------------------------------------------------------------
  5.  
  6.         mov     ebx,[cur_tab.Editor.Bounds.Left-2]
  7.         mov     bx,word[cur_tab.Editor.Bounds.Right]
  8.         sub     bx,word[cur_tab.Editor.Bounds.Left]
  9.         inc     ebx
  10.         mov     ecx,[cur_tab.Editor.Bounds.Top-2]
  11.         mov     cx,word[cur_tab.Editor.Bounds.Bottom]
  12.         sub     cx,word[cur_tab.Editor.Bounds.Top]
  13.         inc     ecx
  14.         mov     edx,[cl_3d_inset]
  15.         call    draw_framerect
  16. @^
  17.         mov     ebx,[cur_tab.Editor.Bounds.Left-2]
  18.         mov     bx,word[cur_tab.Editor.Bounds.Right]
  19.         mov     ecx,[cur_tab.Editor.Bounds.Top-2]
  20.         mov     cx,word[cur_tab.Editor.Bounds.Top]
  21.         mcall   38,,,[cl_3d_inset]
  22.         mov     ecx,[cur_tab.Editor.Bounds.Bottom-2]
  23.         mov     cx,word[cur_tab.Editor.Bounds.Bottom]
  24.         mcall
  25.         mov     bx,word[cur_tab.Editor.Bounds.Left]
  26.         mov     cx,word[cur_tab.Editor.Bounds.Top]
  27.         mcall
  28.         mov     ebx,[cur_tab.Editor.Bounds.Right-2]
  29.         mov     bx,word[cur_tab.Editor.Bounds.Right]
  30.         mov     cx,word[cur_tab.Editor.Bounds.Top]
  31.         mcall
  32. ^@
  33.         mov     [cur_tab.Editor.Gutter.Visible],0
  34.         test    [options],OPTS_LINENUMS
  35.         jnz     @f
  36.         xor     eax,eax ;! mov eax,2+LCHGW
  37.         jmp     .lp1
  38.     @@: inc     [cur_tab.Editor.Gutter.Visible]
  39.         mov     edi,p_info+100
  40.         mov     eax,[cur_tab.Editor.Lines] ;! eax,[lines]
  41.         mov     ecx,10
  42.         call    uint2str
  43.         lea     eax,[edi-p_info-100]
  44.         cmp     eax,3
  45.         jae     @f
  46.         mov     eax,3
  47.     @@: imul    eax,6
  48.         add     eax,8
  49.   .lp1: mov     [cur_tab.Editor.Gutter.Width],eax ;! [left_ofs],eax
  50.         mov     [left_ofs],eax
  51.  
  52.         call    draw_editor_gutter
  53.         call    draw_editor_vscroll
  54.         call    draw_editor_hscroll
  55.         call    draw_editor_text
  56.         call    draw_editor_caret
  57.  
  58.         ret
  59. endf
  60.  
  61. ;-----------------------------------------------------------------------------
  62. func draw_editor_gutter ;/////////////////////////////////////////////////////
  63. ;-----------------------------------------------------------------------------
  64.         cmp     [cur_tab.Editor.Gutter.Visible],0
  65.         je      .exit
  66.  
  67.         add     esp,-4*8*2
  68.  
  69.         mov     ebx,[cur_tab.Editor.Bounds.Left-2]
  70.         mov     bx,word[cur_tab.Editor.Gutter.Width]
  71.         add     ebx,0x00010000
  72.         mov     ecx,[cur_tab.Editor.Bounds.Top-2]
  73.         mov     cx,word[cur_tab.Editor.Bounds.Bottom]
  74.         sub     cx,word[cur_tab.Editor.Bounds.Top]
  75.         add     cx,-SCRLW
  76.         add     ecx,0x00010000
  77.         dec     cx
  78.         mcall   13,,,[cl_3d_normal]
  79.  
  80.         add     bx,word[cur_tab.Editor.Bounds.Left]
  81.         push    bx
  82.         shl     ebx,16
  83.         pop     bx
  84.         add     ecx,[cur_tab.Editor.Bounds.Top]
  85.         mcall   38,,,[cl_3d_inset]
  86.  
  87.         add     ebx,-2*65536
  88.         mov     bx,word[cur_tab.Editor.Bounds.Top]
  89.         add     bx,3
  90.         mov     edi,[sc.work_text]
  91.         mov     ecx,[cur_tab.Editor.TopLeft.Y]
  92.         inc     ecx
  93.         mov     edx,p_info+100
  94.     @@: pushad
  95.         push    eax edx edi
  96.         mov     eax,ecx
  97.         mov     ecx,10
  98.         mov     edi,edx
  99.         call    uint2str
  100.         mov     esi,edi
  101.         pop     edi edx eax
  102.         sub     esi,edx
  103.         imul    eax,esi,6*65536
  104.         sub     ebx,eax
  105.         mcall   4,,edi
  106.         popad
  107.         add     ebx,LINEH
  108.         inc     ecx
  109.         cmp     ecx,[cur_tab.Editor.Lines]
  110.         jg      @f
  111.         mov     esi,ecx
  112.         sub     esi,[cur_tab.Editor.TopLeft.Y]
  113.         cmp     esi,[lines.scr]
  114.         jbe     @b
  115.     @@: add     esp,4*8*2
  116.  
  117.   .exit:
  118.         ret
  119. endf
  120.  
  121. ;-----------------------------------------------------------------------------
  122. func draw_editor_vscroll ;////////////////////////////////////////////////////
  123. ;-----------------------------------------------------------------------------
  124. ;!!!!!!!!!!!!!!!!!!
  125.         mov     ebx,[cur_tab.Editor.Bounds.Right]
  126.         shl     ebx,16
  127.         add     ebx,(-SCRLW)*65536+SCRLW
  128.         mov     ecx,[cur_tab.Editor.Bounds.Top-2]
  129.         mov     cx,SCRLW
  130.         mcall   8,,,'UP' or 0x40000000
  131.         pushad
  132.         sar     ebx,16
  133.         sar     ecx,16
  134.         push    ebx ecx SCRLW SCRLW
  135.         call    draw_3d_panel
  136.         popad
  137.         mov     eax,8
  138. ;!!!!!!!!!!!!!!!!!!
  139.  
  140.         pushad
  141.         push    0x18
  142.         shr     ecx,16
  143.         mov     bx,cx
  144.         add     ebx,(SCRLW/2-2)*65536+SCRLW/2-3
  145.         mcall   4,,[sc.work_text],esp,1
  146.         add     esp,4
  147.         popad
  148.  
  149. ;!!!!!!!!!!!!!!!!!!
  150.         mov     ecx,[cur_tab.Editor.Bounds.Bottom]
  151.         shl     ecx,16
  152.         add     ecx,(-SCRLW*2)*65536+SCRLW
  153.         mcall   ,,,'DN' or 0x40000000
  154.         pushad
  155.         sar     ebx,16
  156.         sar     ecx,16
  157.         push    ebx ecx SCRLW SCRLW
  158.         call    draw_3d_panel
  159.         popad
  160.         mov     eax,8
  161. ;!!!!!!!!!!!!!!!!!!
  162.  
  163.         pushad
  164.         push    0x19
  165.         shr     ecx,16
  166.         mov     bx,cx
  167.         add     ebx,(SCRLW/2-2)*65536+SCRLW/2-3
  168.         mcall   4,,[sc.work_text],esp,1
  169.         add     esp,4
  170.         popad
  171.  
  172.         push    ebx
  173.         mov     eax,[cur_tab.Editor.Lines]
  174.         mov     ebx,[lines.scr]
  175.         mov     ecx,[cur_tab.Editor.TopLeft.Y]
  176.         mov     edx,[cur_tab.Editor.Bounds.Bottom]
  177.         sub     edx,[cur_tab.Editor.Bounds.Top]
  178.         add     edx,-SCRLW*3+1
  179.         call    get_scroll_vars
  180.         mov     [cur_tab.Editor.VScroll.Top],eax
  181.         mov     [cur_tab.Editor.VScroll.Size],ebx
  182.         pop     ebx
  183.  
  184.         mov     ecx,eax
  185.         add     ecx,[cur_tab.Editor.Bounds.Top]
  186.         add     ecx,SCRLW+1
  187.  
  188. ;!!!!!!!!!!!!!!!!!!
  189.         pushad
  190.         sar     ebx,16
  191.         push    ebx ecx SCRLW [cur_tab.Editor.VScroll.Size]
  192.         dec     dword[esp]
  193.         call    draw_3d_panel
  194.         popad
  195.         mov     eax,13
  196. ;!!!!!!!!!!!!!!!!!!
  197.         add     ebx,1*65536-1
  198.  
  199.         mov     ecx,[cur_tab.Editor.Bounds.Top-2]
  200.         mov     cx,word[cur_tab.Editor.VScroll.Top]
  201.         add     ecx,(SCRLW+1)*65536
  202.         mov     edx,[sc.work]
  203.         or      cx,cx
  204.         jle     @f
  205.         mcall   13
  206.     @@:
  207.         mov     ecx,[cur_tab.Editor.Bounds.Top]
  208.         add     ecx,[cur_tab.Editor.VScroll.Top]
  209.         add     ecx,[cur_tab.Editor.VScroll.Size]
  210.         add     ecx,SCRLW+1
  211.         mov     di,cx
  212.         shl     ecx,16
  213.         mov     cx,word[cur_tab.Editor.Bounds.Bottom]
  214.         sub     cx,di
  215.         sub     cx,SCRLW*2;+1
  216.         jle     @f
  217.         mcall
  218.     @@:
  219.         rol     ebx,16
  220.         dec     bx
  221.         push    bx
  222.         rol     ebx,16
  223.         pop     bx
  224.         mov     ecx,[cur_tab.Editor.Bounds.Top-2]
  225.         mov     cx,word[cur_tab.Editor.Bounds.Bottom]
  226.         add     ecx,(SCRLW)*65536-SCRLW*2-1
  227.         mcall   38,,,[cl_3d_inset]
  228.  
  229.         ret
  230. endf
  231.  
  232. ;-----------------------------------------------------------------------------
  233. func draw_editor_hscroll ;////////////////////////////////////////////////////
  234. ;-----------------------------------------------------------------------------
  235.         mov     ebx,[cur_tab.Editor.Bounds.Left-2]
  236.         mov     bx,SCRLW
  237.         mov     ecx,[cur_tab.Editor.Bounds.Bottom]
  238.         shl     ecx,16
  239.         add     ecx,(-SCRLW)*65536+SCRLW
  240.         mcall   8,,,'LT' or 0x40000000
  241.         pushad
  242.         sar     ebx,16
  243.         sar     ecx,16
  244.         push    ebx ecx SCRLW SCRLW
  245.         call    draw_3d_panel
  246.         popad
  247. ;!!!!!!!!!!!!!!!!!!
  248.  
  249.         pushad
  250.         push    0x1B
  251.         shr     ecx,16
  252.         mov     bx,cx
  253.         add     ebx,(SCRLW/2-2)*65536+SCRLW/2-3
  254.         mcall   4,,[sc.work_text],esp,1
  255.         add     esp,4
  256.         popad
  257.  
  258. ;!!!!!!!!!!!!!!!!!!
  259.         mov     ebx,[cur_tab.Editor.Bounds.Right]
  260.         shl     ebx,16
  261.         add     ebx,(-SCRLW*2)*65536+SCRLW
  262.         mcall   8,,,'RT' or 0x40000000
  263.         pushad
  264.         sar     ebx,16
  265.         sar     ecx,16
  266.         push    ebx ecx SCRLW SCRLW
  267.         call    draw_3d_panel
  268.         popad
  269. ;!!!!!!!!!!!!!!!!!!
  270.  
  271.         pushad
  272.         push    0x1A
  273.         shr     ecx,16
  274.         mov     bx,cx
  275.         add     ebx,(SCRLW/2-2)*65536+SCRLW/2-3
  276.         mcall   4,,[sc.work_text],esp,1
  277.         add     esp,4
  278.         popad
  279.  
  280.         push    ecx
  281.         mov     eax,[cur_tab.Editor.Columns]
  282.         mov     ebx,[columns.scr]
  283.         mov     ecx,[cur_tab.Editor.TopLeft.X]
  284.         mov     edx,[cur_tab.Editor.Bounds.Right]
  285.         add     edx,-(SCRLW*3)
  286.         call    get_scroll_vars
  287.         mov     [cur_tab.Editor.HScroll.Top],eax
  288.         mov     [cur_tab.Editor.HScroll.Size],ebx
  289.         pop     ecx
  290.  
  291.         mov     ebx,eax
  292.         add     ebx,[cur_tab.Editor.Bounds.Left]
  293.         add     ebx,SCRLW+1
  294.         shl     ebx,16
  295.         mov     bx,word[cur_tab.Editor.HScroll.Size]
  296.  
  297. ;!!!!!!!!!!!!!!!!!!
  298.         pushad
  299.         sar     ecx,16
  300.         rol     ebx,16
  301.         movsx   eax,bx
  302.         sar     ebx,16
  303.         dec     ebx
  304.         push    eax ecx ebx SCRLW
  305.         call    draw_3d_panel
  306.         popad
  307. ;!!!!!!!!!!!!!!!!!!
  308.         add     ecx,1*65536-1
  309.  
  310.         mov     ebx,[cur_tab.Editor.Bounds.Left-2]
  311.         mov     bx,word[cur_tab.Editor.Bounds.Left]
  312.         mov     bx,word[cur_tab.Editor.HScroll.Top]
  313.         add     ebx,(1+SCRLW)*65536
  314.         mcall   13,,,[sc.work]
  315.         mov     ebx,[cur_tab.Editor.Bounds.Left]
  316.         add     ebx,1+SCRLW
  317.         add     ebx,[cur_tab.Editor.HScroll.Top]
  318.         add     ebx,[cur_tab.Editor.HScroll.Size]
  319.         mov     di,bx
  320.         shl     ebx,16
  321.         mov     bx,word[cur_tab.Editor.Bounds.Right]
  322.         sub     bx,di
  323.         sub     bx,SCRLW*2
  324.         jle     @f
  325.         mcall
  326.     @@:
  327.         mov     ebx,[cur_tab.Editor.Bounds.Left-2]
  328.         mov     bx,word[cur_tab.Editor.Bounds.Right]
  329.         add     ebx,(SCRLW)*65536-SCRLW*2-1
  330.         rol     ecx,16
  331.         dec     cx
  332.         push    cx
  333.         rol     ecx,16
  334.         pop     cx
  335.         mcall   38,,,[cl_3d_inset]
  336.  
  337.         ret
  338. endf
  339.  
  340. ;-----------------------------------------------------------------------------
  341. func draw_editor_text ;///////////////////////////////////////////////////////
  342. ;-----------------------------------------------------------------------------
  343.         mov     eax,[cur_tab.Editor.Bounds.Bottom]
  344.         sub     eax,[cur_tab.Editor.Bounds.Top]
  345.         cmp     eax,LINEH
  346.         jge     @f
  347.         ret
  348.     @@:
  349.         call    init_sel_vars
  350.         call    check_bottom_right
  351.  
  352.         pushad
  353.  
  354.         mov     eax,[cur_tab.Editor.Bounds.Left]
  355.         add     eax,[cur_tab.Editor.Gutter.Width]
  356.         add     eax,LCHGW+3
  357.         mov     [left_ofs],eax
  358.         mov     eax,[cur_tab.Editor.Bounds.Top]
  359.         add     eax,3
  360.         mov     [top_ofs],eax
  361.  
  362.         mov     ebx,[top_ofs]
  363.         add     ebx,[left_ofs-2]
  364.  
  365.         mov     ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
  366.         push    ecx
  367.         call    get_line_offset
  368.  
  369.   .start:
  370.         add     esp,4
  371.         mov     ecx,[lines.scr]
  372.         or      ecx,ecx
  373.         jle     .exit
  374.         add     esp,-4
  375.  
  376.         imul    ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
  377.         mov     eax,[lines.scr]
  378.         sub     eax,[cur_tab.Editor.Lines] ;! eax,[lines]
  379.         mov     [draw_blines],eax
  380.  
  381.   .next_line:
  382.  
  383.         push    ecx ebx
  384.  
  385.         mov     ecx,ebx
  386.         shl     ecx,16
  387.         mov     cl,LINEH
  388.         mov     ebx,[cur_tab.Editor.Bounds.Right]
  389.         ;sub     ebx,[cur_tab.Editor.Bounds.Left]
  390.         add     ebx,-SCRLW
  391.         add     ebx,[left_ofs-2]
  392.         sub     ebx,[left_ofs]
  393.         add     ebx,-2*65536+2
  394.  
  395.   ; selection (text background)
  396.         mov     [in_sel],0
  397.         mov     edx,[color_tbl+4*5]
  398.         mov     eax,[esp+4*2]
  399.         cmp     eax,[sel.begin.y]
  400.         jl      .lp6
  401.         je      .lp1
  402.         cmp     eax,[sel.end.y]
  403.         jg      .lp6
  404.         je      .lp3
  405.         jmp     .lp6.2
  406.   .lp1: mov     eax,[sel.begin.y]
  407.         cmp     eax,[sel.end.y]
  408.         je      .lp5
  409.   .lp2: mov     eax,[sel.begin.x]
  410.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  411.         jle     .lp6.2
  412.         cmp     eax,[columns.scr]
  413.         jge     .lp6
  414.         imul    eax,6
  415.         pushad
  416.         sub     bx,ax
  417.         rol     ebx,16
  418.         mov     bx,ax
  419.         add     ebx,[left_ofs]
  420.         add     ebx,-2
  421.         rol     ebx,16
  422.         mov     edx,[color_tbl+4*7]
  423.         mcall   13
  424.         popad
  425.         mov     bx,ax
  426.         mov     [in_sel],2
  427.         jmp     .lp6
  428.   .lp3: mov     eax,[sel.begin.y]
  429.         cmp     eax,[sel.end.y]
  430.         je      .lp5
  431.   .lp4: mov     eax,[sel.end.x]
  432.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  433.         jle     .lp6
  434.         cmp     eax,[columns.scr]
  435.         jg      .lp6.2
  436.         imul    eax,6
  437.         pushad
  438.         sub     bx,ax
  439.         rol     ebx,16
  440.         add     eax,[left_ofs];OLEFT-1
  441.         add     eax,-2
  442.         mov     bx,ax
  443.         rol     ebx,16
  444.         mcall   13
  445.         popad
  446.         inc     eax
  447.         mov     edx,[color_tbl+4*7]
  448.         mov     bx,ax
  449.         mov     [in_sel],3
  450.         jmp     .lp6
  451.   .lp5: mov     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  452.         cmp     eax,[sel.begin.x]
  453.         jge     .lp4
  454.         add     eax,[columns.scr]
  455.         cmp     eax,[sel.end.x]
  456.         jl      .lp2
  457.         mov     eax,[sel.begin.x]
  458.         cmp     eax,[sel.end.x]
  459.         je      .lp6
  460.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  461.         imul    eax,6
  462.         pushad
  463.         mov     ebx,[sel.end.x]
  464.         sub     ebx,[sel.begin.x]
  465.         imul    ebx,6
  466.         sal     ebx,16
  467.         dec     eax
  468.         add     eax,[left_ofs]
  469.         mov     bx,ax
  470.         rol     ebx,16
  471.         mov     edx,[color_tbl+4*7]
  472.         mcall   13
  473.         movzx   eax,bx
  474.         sar     ebx,16
  475.         add     eax,ebx
  476.         mov     ebx,eax
  477.         sal     ebx,16
  478.         sub     ax,[esp+4*4]
  479.         neg     ax
  480.         add     ax,word[left_ofs]
  481.         add     ax,-2
  482.         mov     bx,ax
  483.         mov     edx,[color_tbl+4*5]
  484.         mcall   13
  485.         popad
  486.         mov     bx,ax
  487.         mov     [in_sel],4
  488.         jmp     .lp6
  489.  
  490.   .lp6.2:
  491.         mov     edx,[color_tbl+4*7]
  492.         inc     [in_sel]
  493.   .lp6:
  494.         mcall   13
  495.  
  496.         lodsd
  497.  
  498.         pushad
  499.         mov     edx,[color_tbl+4*5]
  500.         test    eax,0x00010000
  501.         jz      @f
  502.         mov     edx,[color_tbl+4*8]
  503.         test    eax,0x00020000
  504.         jz      @f
  505.         mov     edx,[color_tbl+4*9]
  506.     @@: mov     ebx,[left_ofs]
  507.         add     ebx,-LCHGW-2;-4
  508.         shl     ebx,16
  509.         mov     bx,LCHGW
  510.         mcall   13
  511.         popad
  512.  
  513.         xor     ecx,ecx
  514.         and     eax,0x0000FFFF
  515.         mov     [cur_line_len],eax
  516.  
  517.         or      eax,eax
  518.         ja      .next_block
  519.         add     esp,4*2
  520.         jmp     .exit ; .draw_cursor
  521.  
  522.   .next_block:
  523.  
  524.         push    esi ecx
  525.         call    get_next_part
  526.         pop     ebx
  527.  
  528.         push    ecx
  529.         mov     ecx,eax
  530.  
  531.         push    esi ebx
  532.         mov     eax,ebx
  533.         sub     ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
  534.         cmp     ebx,[columns.scr]
  535.         jge     .skip_t
  536.         add     ebx,esi
  537.         jle     .skip_t
  538.         mov     ebx,[esp+8+4*2] ;// 4*2=esi+ebx
  539.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  540.         jge     .qqq
  541.         sub     edx,eax
  542.         add     esi,eax
  543. ;       mov     eax,OLEFT*65536
  544.         xor     eax,eax
  545.         jmp     .qqq2
  546.   .qqq:
  547. ;       inc     eax
  548.         imul    eax,6*65536
  549.   .qqq2:
  550.         and     ebx,0x0000FFFF
  551.         add     eax,[left_ofs-2];OLEFT*65536
  552.         add     ebx,eax
  553.  
  554.         mov     eax,[esp]   ; ebx
  555.         add     eax,[esp+4] ; esi
  556.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  557.         sub     eax,[columns.scr]
  558.         jle     .qweqwe
  559.         sub     esi,eax
  560.   .qweqwe:
  561.  
  562.         mov     al,[in_sel]
  563.         cmp     al,0
  564.         je      .draw_t
  565.         dec     al
  566.         jz      .ya4
  567.   .nt1: dec     al
  568.         jnz     .nt2
  569.         mov     eax,[esp]
  570.         cmp     eax,[sel.begin.x]
  571.         jge     .ya4
  572.         add     eax,[esp+4]
  573.         cmp     eax,[sel.begin.x]
  574.         jl      .draw_t
  575. ;---[ selection crosses block from the right ]-(-
  576.   .ya1: mov     eax,esi
  577.         mov     esi,[sel.begin.x]
  578.         sub     esi,[esp]
  579.         pushad
  580.         mov     ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col]
  581.         sub     ecx,[esp+4*8]
  582.         jle     @f
  583.         sub     esi,ecx
  584.         sub     [esp+4],ecx
  585.     @@: sub     eax,esi
  586.         add     edx,esi
  587.         imul    esi,6
  588.         rol     ebx,16
  589.         add     bx,si
  590.         rol     ebx,16
  591.         mov     esi,eax
  592.         mov     ecx,[color_tbl+4*6]
  593.         mcall   4
  594.         popad
  595.         jmp     .draw_t
  596. ;----------------------------------------------)-
  597.   .nt2: dec     al
  598.         jnz     .nt3
  599.         mov     eax,[esp]
  600.         cmp     eax,[sel.end.x]
  601.         jge     .draw_t
  602.         add     eax,[esp+4]
  603.         cmp     eax,[sel.end.x]
  604.         jl      .ya4
  605. ;---[ selection crosses block from the left ]--(-
  606.   .ya2: mov     eax,[sel.end.x]
  607.         sub     eax,[esp]
  608.         push    ebx
  609.         mov     ebx,[esp+4]
  610.         sub     ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
  611.         jge     .ya2.1
  612.         add     eax,ebx
  613.   .ya2.1:
  614.         pop     ebx
  615.         pushad
  616.         mov     esi,eax
  617.         mov     ecx,[color_tbl+4*6]
  618.         mcall   4
  619.         popad
  620.         sub     esi,eax
  621.         add     edx,eax
  622.         imul    eax,6*65536
  623.         add     ebx,eax
  624.         jmp     .draw_t
  625. ;----------------------------------------------)-
  626.   .nt3: mov     eax,[esp]
  627.         cmp     eax,[sel.end.x]
  628.         jge     .draw_t
  629.         cmp     eax,[sel.begin.x]
  630.         jge     @f
  631.         add     eax,[esp+4]
  632.         cmp     eax,[sel.begin.x]
  633.         jl      .draw_t
  634.         cmp     eax,[sel.end.x]
  635.         jl      .ya1
  636. ;---[ selection inside block ]-----------------(-
  637.         mov     eax,esi
  638.         mov     esi,[sel.begin.x]
  639.         sub     esi,[esp]
  640.         push    eax
  641.         mov     eax,[esp+4]
  642.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  643.         jge     .nt3.1
  644.         add     esi,eax
  645.   .nt3.1:
  646.         pop     eax
  647.         sub     eax,esi
  648.         pushad
  649.         add     edx,esi
  650.         imul    esi,6*65536
  651.         add     ebx,esi
  652.         mov     esi,[sel.end.x]
  653.         sub     esi,[sel.begin.x]
  654.         mov     ecx,[color_tbl+4*6]
  655.         sub     eax,esi
  656.         push    eax
  657.         mcall   4
  658.         add     edx,esi
  659.         imul    esi,6*65536
  660.         add     ebx,esi
  661.         pop     esi
  662.         mov     ecx,[esp+4*6]
  663.         mcall   4
  664.         popad
  665.         jmp     .draw_t
  666. ;----------------------------------------------)-
  667.     @@: add     eax,esi
  668.         dec     eax
  669.         cmp     eax,[sel.end.x]
  670.         jge     .ya2
  671. ;---[ block inside selection ]-----------------(-
  672.   .ya4: mov     ecx,[color_tbl+4*6]
  673. ;----------------------------------------------)-
  674.  
  675.   .draw_t:
  676.         mcall   4;[esp+8]
  677.   .skip_t:
  678.         pop     eax eax ; ebx esi
  679.         imul    eax,6
  680.         add     [esp+4*2+2],ax
  681.         pop     ecx esi
  682.         cmp     ecx,[cur_line_len];LINE_WIDTH
  683.         jl      .next_block
  684.  
  685.         pop     ebx ecx
  686.         and     ebx,0x0000FFFF
  687.         add     ebx,[left_ofs-2]
  688.         add     ebx,LINEH
  689.         add     esi,[cur_line_len];LINE_WIDTH
  690.         inc     dword[esp]
  691.         dec     ecx
  692.         jg      .next_line
  693.  
  694.   .exit:
  695.  
  696.         cmp     [draw_blines],0
  697.         jl      @f
  698.         mov     ecx,[esp-8]
  699.         shl     ecx,16
  700.         mov     cx,word[cur_tab.Editor.Bounds.Bottom]
  701.         sub     cx,[esp-8]
  702.         add     cx,-SCRLW
  703.         mov     eax,[cur_tab.Editor.Bounds.Left]
  704.         add     eax,[cur_tab.Editor.Gutter.Width]
  705.         inc     eax
  706.         mov     ebx,eax
  707.         shl     ebx,16
  708.         mov     bx,word[cur_tab.Editor.Bounds.Right]
  709.         sub     bx,ax
  710.         add     ebx,-SCRLW
  711.         mcall   13,,,[color_tbl+4*5]
  712.     @@:
  713.  
  714.         popad
  715.         add     esp,4
  716.         ret
  717. endf
  718.  
  719. ;-----------------------------------------------------------------------------
  720. func draw_editor_caret ;//////////////////////////////////////////////////////
  721. ;-----------------------------------------------------------------------------
  722.         cmp     [bot_mode],0
  723.         jne     @f
  724.         mov     ebx,[cur_tab.Editor.Caret.X]
  725.         sub     ebx,[cur_tab.Editor.TopLeft.X]
  726.         js      @f
  727.         cmp     ebx,[columns.scr]
  728.         ja      @f
  729.         imul    ebx,6
  730.         add     ebx,[left_ofs]
  731.         dec     ebx
  732.         push    bx
  733.         shl     ebx,16
  734.         pop     bx
  735.         mov     eax,[cur_tab.Editor.Caret.Y]
  736.         sub     eax,[cur_tab.Editor.TopLeft.Y]
  737.         js      @f
  738.         cmp     eax,[lines.scr]
  739.         jge     @f
  740.         imul    eax,LINEH
  741.         add     eax,[top_ofs]
  742.         mov     esi,eax
  743.         shl     esi,16
  744.         add     eax,LINEH-2
  745.         mov     si,ax
  746.         mov     ecx,2
  747.         cmp     [ins_mode],0
  748.         jne     .lp8
  749.         add     cl,4
  750.   .lp8: push    ecx
  751.         mcall   38,,esi,0x01000000
  752.         add     ebx,0x00010001
  753.         pop     ecx
  754.         loop    .lp8
  755.     @@:
  756.         ret
  757. endf