Subversion Repositories Kolibri OS

Rev

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

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