Subversion Repositories Kolibri OS

Rev

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