Subversion Repositories Kolibri OS

Rev

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

  1. ;-----------------------------------------------------------------------------
  2. func drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
  3. ;-----------------------------------------------------------------------------
  4.  
  5.         cmp     [just_from_popup],1
  6.         jne     @f
  7.         ret
  8.     @@:
  9.  
  10.         mcall   48,3,sc,sizeof.system_colors
  11.         call    calc_3d_colors
  12.  
  13.         mcall   12,1
  14.  
  15.         push    [color_tbl+4*5]
  16.         pop     [sc.work]
  17.  
  18.         mov     edx,[sc.work]
  19.         add     edx,0x33000000
  20.         mov     ebx,[mainwnd_pos.x-2]
  21.         mov     bx,word[mainwnd_pos.w]
  22.         mov     ecx,[mainwnd_pos.y-2]
  23.         mov     cx,word[mainwnd_pos.h]
  24.         mcall   0,,,,,s_title
  25.  
  26.         mcall   9,p_info,-1
  27.         mov     esi,p_info.box.left
  28.         mov     edi,mainwnd_pos
  29.         mov     ecx,4
  30.         cld
  31.         rep     movsd
  32.  
  33. ;       mcall   9,p_info,-1
  34.         cmp     [p_info.client_box.height],LINEH
  35.         jl      .exit.2
  36.  
  37. ;++ calculate editor bounds ++
  38.         mov     [tab_bar.Bounds.Left],0
  39.         mov     [tab_bar.Bounds.Top],ATOPH
  40.         mov     eax,[p_info.client_box.width]
  41.         mov     [tab_bar.Bounds.Right],eax
  42.         mov     eax,[p_info.client_box.height]
  43.         sub     eax,[bot_dlg_height]
  44.         add     eax,-STATH-1
  45.         mov     [tab_bar.Bounds.Bottom],eax
  46.  
  47.         call    align_editor_in_tab
  48.  
  49.         mov     [top_ofs],ATOPH;+1
  50.  
  51.         mov     eax,[cur_tab.Editor.Bounds.Right]
  52.         sub     eax,[cur_tab.Editor.Bounds.Left]
  53.         sub     eax,[cur_tab.Editor.Gutter.Width]
  54.         sub     eax,SCRLW+LCHGW+4
  55.         cdq
  56.         mov     ebx,6
  57.         div     ebx
  58.         mov     [columns.scr],eax
  59.  
  60.         mov     eax,[cur_tab.Editor.Bounds.Bottom]
  61.         sub     eax,[cur_tab.Editor.Bounds.Top]
  62.         sub     eax,SCRLW+3
  63.         cdq
  64.         mov     ebx,LINEH
  65.         div     ebx
  66.         mov     [lines.scr],eax
  67.  
  68.         mov     eax,[p_info.client_box.height]
  69.         add     eax,-STATH+1;*3-2-2
  70.         sub     eax,[bot_dlg_height]
  71.         mov     [bot_ofs],eax
  72.  
  73.         call    draw_bottom_dialog
  74.  
  75. ;        mov     [do_not_draw],1 ; do_not_draw = true
  76.  
  77. ;        mov     ebx,eax
  78. ;        sub     ebx,[top_ofs]
  79. ;        sub     ebx,SCRLW*3+AMINS+5
  80. ;        js      .no_draw
  81.  
  82. ;        dec     [do_not_draw]    ; do_not_draw = false
  83. ;        sub     eax,SCRLW+3
  84. ;        sub     eax,[top_ofs]
  85. ;        cdq
  86. ;        mov     ebx,LINEH
  87. ;        div     ebx
  88. ;        mov     [lines.scr],eax
  89.  
  90. ;-- horizontal lines for menubar and statusbar --
  91.         ;mov     ebx,[p_info.client_box.width]
  92.         ;mov     ecx,[top_ofs-2]
  93.         ;mov     cx,word[top_ofs]
  94.         ;sub     ecx,1*65536+1
  95.         ;mcall   38,,,[cl_3d_inset];[sc.work_text]
  96.         ;mov     ecx,[p_info.client_box.height]
  97.         ;sub     ecx,STATH+1
  98.         ;push    cx
  99.         ;shl     ecx,16
  100.         ;pop     cx
  101.         ;mcall
  102.  
  103.         inc     [top_ofs]
  104.  
  105.         call    draw_main_menu
  106.  
  107.         jmp     .exit
  108.  
  109.   .no_draw:
  110.         mov     [top_ofs],2
  111.         mov     eax,[p_info.client_box.height]
  112.         inc     eax
  113.         mov     [bot_ofs],eax
  114.         sub     eax,2
  115.         push    eax
  116.         add     eax,-2-SCRLW
  117.         cdq
  118.         mov     ebx,LINEH
  119.         idiv    ebx
  120.         mov     [lines.scr],eax
  121.         pop     eax
  122.  
  123.         mov     ebx,[p_info.client_box.height]
  124.         sub     ebx,SCRLW*3+AMINS+2
  125.         jns     @f
  126.  
  127.         inc     [do_not_draw]
  128.  
  129.         dec     eax
  130.         cdq
  131.         mov     ebx,LINEH
  132.         idiv    ebx
  133.         mov     [lines.scr],eax
  134.  
  135.         mov     eax,[p_info.client_box.width]
  136.         cdq
  137.         mov     ebx,6
  138.         idiv    ebx
  139.         mov     [columns.scr],eax
  140.     @@:
  141.  
  142.   .exit:
  143. ;-- draw file --
  144.         ;call    draw_file
  145. ;++ draw editor control ++
  146.         call    draw_editor
  147.         call    draw_tabctl
  148.   .exit.2:
  149.         mcall   12,2
  150.         ret
  151. endf
  152.  
  153. ;-----------------------------------------------------------------------------
  154. func draw_bottom_dialog ;/////////////////////////////////////////////////////
  155. ;-----------------------------------------------------------------------------
  156.         cmp     [bot_dlg_height],0
  157.         je      .exit
  158.         pushad
  159.         mov     ebx,[p_info.client_box.width]
  160.         mov     ecx,[bot_ofs]
  161.         dec     ecx
  162.         push    cx
  163.         shl     ecx,16
  164.         pop     cx
  165.         mcall   38,,,[cl_3d_inset]
  166.         mov     ecx,[bot_ofs-2]
  167.         mov     cx,word[bot_dlg_height]
  168.         dec     ecx
  169.         mov     ebx,[p_info.client_box.width]
  170.         inc     ebx
  171.         mcall   13,,,[cl_3d_normal]
  172.         mov     al,1
  173.         call    [bot_dlg_handler]
  174.         popad
  175.  
  176.   .exit:
  177.         ret
  178. endf
  179.  
  180. mi_sel   dd ?
  181. mi_cur   dd -1
  182.  
  183. ;-----------------------------------------------------------------------------
  184. func draw_main_menu ;/////////////////////////////////////////////////////////
  185. ;-----------------------------------------------------------------------------
  186.         mov     ebx,[p_info.client_box.width]
  187.         inc     ebx
  188.         mcall   13,,ATOPH-1,[cl_3d_normal]
  189.  
  190.         mcall   38,[p_info.client_box.width],<ATOPH-1,ATOPH-1>,[sc.frame];[cl_3d_pushed]
  191.  
  192.         mov     edx,main_menu
  193.         mov     ebx,9*65536+ATOPH/2-4
  194.         mov     ecx,[sc.work_text]
  195.         mov     [mi_sel],0
  196.         mov     edi,[mi_cur]
  197.     @@: inc     [mi_sel]
  198.         cmp     [mi_sel],main_menu.cnt_item
  199.         ja      .exit
  200.         cmp     edi,[mi_sel]
  201.         jne     .lp1
  202.         pushad
  203.         push    edx
  204.         mcall   13,[edx+0],[edx+4],[cl_3d_pushed]
  205.         mov     edx,[esp]
  206.         mov     bx,[edx+2]
  207.         mcall   38,,,[cl_3d_inset]
  208.         pop     edx
  209.         movzx   eax,word[edx]
  210.         add     ebx,eax
  211.         shl     eax,16
  212.         add     ebx,eax
  213.         mcall   38,,,[cl_3d_inset]
  214.         popad
  215.   .lp1: add     edx,8+1
  216.         movzx   esi,byte[edx-1]
  217.         mcall   4
  218.         add     edx,esi
  219.         add     esi,2
  220.         imul    esi,6*65536
  221.         add     ebx,esi
  222.         jmp     @b
  223.  
  224.   .exit:
  225.         ret
  226. endf
  227.  
  228. ;-----------------------------------------------------------------------------
  229. func draw_file.ex ;///////////////////////////////////////////////////////////
  230. ;-----------------------------------------------------------------------------
  231. ; Input:
  232. ;  EAX = start line
  233. ;  EBX = end line
  234. ;-----------------------------------------------------------------------------
  235.         call    draw_editor;_text
  236.         ret
  237. macro unused {
  238.         cmp     [p_info.client_box.height],LINEH
  239.         jge     @f
  240.         ret
  241.     @@:
  242.         call    init_sel_vars
  243.         call    check_bottom_right
  244.  
  245.         pushad
  246.  
  247.         cmp     [lines.scr],0
  248.         jle     draw_file.exit
  249.  
  250.         cmp     eax,ebx
  251.         jle     @f
  252.         xchg    eax,ebx
  253.     @@: cmp     eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
  254.         jge     @f
  255.         mov     eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
  256.     @@: mov     ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
  257.         add     ecx,[lines.scr]
  258.         cmp     ebx,ecx
  259.         jl      @f
  260.         dec     ecx
  261.         mov     ebx,ecx
  262.     @@: cmp     eax,ebx
  263.         jg      draw_file.exit
  264.  
  265.         mov     ecx,eax
  266.         push    eax
  267.         call    get_line_offset
  268.  
  269.   .start:
  270.         mov     ecx,ebx
  271.         sub     ecx,eax
  272.         inc     ecx
  273.  
  274.         mov     ebx,[top_ofs]
  275.         add     ebx,[left_ofs-2]
  276.         sub     eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
  277.         imul    eax,LINEH
  278.         add     ebx,eax
  279.  
  280.         imul    ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
  281.         or      [draw_blines],-1
  282.  
  283.         jmp     draw_file.next_line
  284. }
  285. endf
  286.  
  287. ;-----------------------------------------------------------------------------
  288. func draw_file ;//////////////////////////////////////////////////////////////
  289. ;-----------------------------------------------------------------------------
  290.         call    draw_editor;_text
  291.         ret
  292. macro unused {
  293.         cmp     [p_info.client_box.height],LINEH
  294.         jge     @f
  295.         ret
  296.     @@:
  297.         call    init_sel_vars
  298.         call    check_bottom_right
  299.  
  300.         pushad
  301.  
  302.         mov     ebx,[top_ofs]
  303.         add     ebx,[left_ofs-2]
  304.  
  305.         mov     ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
  306.         push    ecx
  307.         call    get_line_offset
  308.  
  309.   .start:
  310.         add     esp,4
  311.         mov     ecx,[lines.scr]
  312.         or      ecx,ecx
  313.         jle     .exit
  314.         add     esp,-4
  315.  
  316.         imul    ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
  317.         mov     eax,[lines.scr]
  318.         sub     eax,[cur_tab.Editor.Lines] ;! eax,[lines]
  319.         mov     [draw_blines],eax
  320.  
  321.   .next_line:
  322.  
  323.         push    ecx ebx
  324.  
  325.         mov     ecx,ebx
  326.         shl     ecx,16
  327.         mov     cl,LINEH
  328.         mov     ebx,[p_info.client_box.width]
  329.         add     ebx,-SCRLW
  330.         add     ebx,[left_ofs-2]
  331.         sub     ebx,[left_ofs]
  332.         add     ebx,-1*65536+1
  333.  
  334.   ; selection (text background)
  335.         mov     [in_sel],0
  336.         mov     edx,[color_tbl+4*5]
  337.         mov     eax,[esp+4*2]
  338.         cmp     eax,[sel.begin.y]
  339.         jl      .lp6
  340.         je      .lp1
  341.         cmp     eax,[sel.end.y]
  342.         jg      .lp6
  343.         je      .lp3
  344.         jmp     .lp6.2
  345.   .lp1: mov     eax,[sel.begin.y]
  346.         cmp     eax,[sel.end.y]
  347.         je      .lp5
  348.   .lp2: mov     eax,[sel.begin.x]
  349.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  350.         jle     .lp6.2
  351.         cmp     eax,[columns.scr]
  352.         jge     .lp6
  353.         imul    eax,6
  354.         pushad
  355.         sub     bx,ax
  356.         rol     ebx,16
  357.         mov     bx,ax
  358.         add     ebx,[left_ofs];OLEFT-1
  359.         dec     ebx
  360.         rol     ebx,16
  361.         mov     edx,[color_tbl+4*7]
  362.         mcall   13
  363.         popad
  364. ;       inc     eax
  365.         mov     bx,ax
  366.         mov     [in_sel],2
  367.         jmp     .lp6
  368.   .lp3: mov     eax,[sel.begin.y]
  369.         cmp     eax,[sel.end.y]
  370.         je      .lp5
  371.   .lp4: mov     eax,[sel.end.x]
  372.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  373.         jle     .lp6
  374.         cmp     eax,[columns.scr]
  375.         jg      .lp6.2
  376.         imul    eax,6
  377.         pushad
  378.         sub     bx,ax
  379.         rol     ebx,16
  380.         add     eax,[left_ofs];OLEFT-1
  381.         dec     eax
  382.         mov     bx,ax
  383.         rol     ebx,16
  384. ;       inc     ebx
  385.         mcall   13
  386.         popad
  387.         mov     edx,[color_tbl+4*7]
  388.         mov     bx,ax
  389.         mov     [in_sel],3
  390.         jmp     .lp6
  391.   .lp5: mov     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  392.         cmp     eax,[sel.begin.x]
  393.         jge     .lp4
  394.         add     eax,[columns.scr]
  395.         cmp     eax,[sel.end.x]
  396.         jl      .lp2
  397.         mov     eax,[sel.begin.x]
  398.         cmp     eax,[sel.end.x]
  399.         je      .lp6
  400.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  401.         imul    eax,6
  402.         pushad
  403.         mov     ebx,[sel.end.x]
  404.         sub     ebx,[sel.begin.x]
  405. ;       inc     ebx
  406.         imul    ebx,6
  407.         sal     ebx,16
  408.         dec     eax
  409.         add     eax,[left_ofs]
  410.         mov     bx,ax
  411.         rol     ebx,16
  412.         mov     edx,[color_tbl+4*7]
  413.         mcall   13
  414.         movzx   eax,bx
  415.         sar     ebx,16
  416.         add     eax,ebx
  417.         mov     ebx,eax
  418.         sal     ebx,16
  419.         sub     ax,[esp+4*4]
  420.         neg     ax
  421.         add     ax,word[left_ofs]
  422.         mov     bx,ax
  423.         mov     edx,[color_tbl+4*5]
  424.         mcall   13
  425.         popad
  426.         mov     bx,ax
  427.         mov     [in_sel],4
  428.         jmp     .lp6
  429.  
  430.   .lp6.2:
  431.         mov     edx,[color_tbl+4*7]
  432.         inc     [in_sel]
  433.   .lp6:
  434.         mcall   13
  435.  
  436.         lodsd
  437.  
  438.         pushad
  439.         mov     edx,[color_tbl+4*5]
  440.         test    eax,0x00010000
  441.         jz      @f
  442.         mov     edx,[color_tbl+4*8]
  443.         test    eax,0x00020000
  444.         jz      @f
  445.         mov     edx,[color_tbl+4*9]
  446.     @@: mov     ebx,[left_ofs]
  447.         add     ebx,-4
  448.         shl     ebx,16
  449.         mov     bx,LCHGW
  450.         mcall   13
  451.         popad
  452.  
  453.  
  454.         xor     ecx,ecx
  455.         and     eax,0x0000FFFF
  456.         mov     [cur_line_len],eax
  457.  
  458.         or      eax,eax
  459.         ja      .next_block
  460.         add     esp,4*2
  461.         jmp     .draw_cursor
  462.  
  463.   .next_block:
  464.  
  465.         push    esi ecx
  466.         call    get_next_part
  467.         pop     ebx
  468.  
  469.         push    ecx
  470.         mov     ecx,eax
  471.  
  472.         push    esi ebx
  473.         mov     eax,ebx
  474.         sub     ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
  475.         cmp     ebx,[columns.scr]
  476.         jge     .skip_t
  477.         add     ebx,esi
  478.         jle     .skip_t
  479.         mov     ebx,[esp+8+4*2] ;// 4*2=esi+ebx
  480.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  481.         jge     .qqq
  482.         sub     edx,eax
  483.         add     esi,eax
  484. ;       mov     eax,OLEFT*65536
  485.         xor     eax,eax
  486.         jmp     .qqq2
  487.   .qqq:
  488. ;       inc     eax
  489.         imul    eax,6*65536
  490.   .qqq2:
  491.         and     ebx,0x0000FFFF
  492.         add     eax,[left_ofs-2];OLEFT*65536
  493.         add     ebx,eax
  494.  
  495.         mov     eax,[esp]   ; ebx
  496.         add     eax,[esp+4] ; esi
  497.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  498.         sub     eax,[columns.scr]
  499.         jle     .qweqwe
  500.         sub     esi,eax
  501.   .qweqwe:
  502.  
  503.         mov     al,[in_sel]
  504.         cmp     al,0
  505.         je      .draw_t
  506.         dec     al
  507.         jz      .ya4
  508.   .nt1: dec     al
  509.         jnz     .nt2
  510.         mov     eax,[esp]
  511.         cmp     eax,[sel.begin.x]
  512.         jge     .ya4
  513.         add     eax,[esp+4]
  514.         cmp     eax,[sel.begin.x]
  515.         jl      .draw_t
  516. ;---[ selection crosses block from the right ]-(-
  517.   .ya1: mov     eax,esi
  518.         mov     esi,[sel.begin.x]
  519.         sub     esi,[esp]
  520.         pushad
  521.         mov     ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col]
  522.         sub     ecx,[esp+4*8]
  523.         jle     @f
  524.         sub     esi,ecx
  525.         sub     [esp+4],ecx
  526.     @@: sub     eax,esi
  527.         add     edx,esi
  528.         imul    esi,6
  529.         rol     ebx,16
  530.         add     bx,si
  531.         rol     ebx,16
  532.         mov     esi,eax
  533.         mov     ecx,[color_tbl+4*6]
  534.         mcall   4
  535.         popad
  536.         jmp     .draw_t
  537. ;----------------------------------------------)-
  538.   .nt2: dec     al
  539.         jnz     .nt3
  540.         mov     eax,[esp]
  541.         cmp     eax,[sel.end.x]
  542.         jge     .draw_t
  543.         add     eax,[esp+4]
  544.         cmp     eax,[sel.end.x]
  545.         jl      .ya4
  546. ;---[ selection crosses block from the left ]--(-
  547.   .ya2: mov     eax,[sel.end.x]
  548.         sub     eax,[esp]
  549.         push    ebx
  550.         mov     ebx,[esp+4]
  551.         sub     ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
  552.         jge     .ya2.1
  553.         add     eax,ebx
  554.   .ya2.1:
  555.         pop     ebx
  556.         pushad
  557.         mov     esi,eax
  558.         mov     ecx,[color_tbl+4*6]
  559.         mcall   4
  560.         popad
  561.         sub     esi,eax
  562.         add     edx,eax
  563.         imul    eax,6*65536
  564.         add     ebx,eax
  565.         jmp     .draw_t
  566. ;----------------------------------------------)-
  567.   .nt3: mov     eax,[esp]
  568.         cmp     eax,[sel.end.x]
  569.         jge     .draw_t
  570.         cmp     eax,[sel.begin.x]
  571.         jge     @f
  572.         add     eax,[esp+4]
  573.         cmp     eax,[sel.begin.x]
  574.         jl      .draw_t
  575.         cmp     eax,[sel.end.x]
  576.         jl      .ya1
  577. ;---[ selection inside block ]-----------------(-
  578.         mov     eax,esi
  579.         mov     esi,[sel.begin.x]
  580.         sub     esi,[esp]
  581.         push    eax
  582.         mov     eax,[esp+4]
  583.         sub     eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
  584.         jge     .nt3.1
  585.         add     esi,eax
  586.   .nt3.1:
  587.         pop     eax
  588.         sub     eax,esi
  589.         pushad
  590.         add     edx,esi
  591.         imul    esi,6*65536
  592.         add     ebx,esi
  593.         mov     esi,[sel.end.x]
  594.         sub     esi,[sel.begin.x]
  595.         mov     ecx,[color_tbl+4*6]
  596.         sub     eax,esi
  597.         push    eax
  598.         mcall   4
  599.         add     edx,esi
  600.         imul    esi,6*65536
  601.         add     ebx,esi
  602.         pop     esi
  603.         mov     ecx,[esp+4*6]
  604.         mcall   4
  605.         popad
  606.         jmp     .draw_t
  607. ;----------------------------------------------)-
  608.     @@: add     eax,esi
  609.         dec     eax
  610.         cmp     eax,[sel.end.x]
  611.         jge     .ya2
  612. ;---[ block inside selection ]-----------------(-
  613.   .ya4: mov     ecx,[color_tbl+4*6]
  614. ;----------------------------------------------)-
  615.  
  616.   .draw_t:
  617.         mcall   4;[esp+8]
  618.   .skip_t:
  619.         pop     eax eax ; ebx esi
  620.         imul    eax,6
  621.         add     [esp+4*2+2],ax
  622.         pop     ecx esi
  623.         cmp     ecx,[cur_line_len];LINE_WIDTH
  624.         jl      .next_block
  625.  
  626.         pop     ebx ecx
  627.         and     ebx,0x0000FFFF
  628.         add     ebx,[left_ofs-2]
  629.         add     ebx,LINEH
  630.         add     esi,[cur_line_len];LINE_WIDTH
  631.         inc     dword[esp]
  632.         dec     ecx
  633.         jg      .next_line
  634.  
  635. ;------------------------------------------------
  636.   .draw_cursor:
  637.  
  638. ;------------------------------------------------
  639.         mov     ebx,[left_ofs]
  640.         cmp     ebx,2+LCHGW
  641.         je      .no_gutter
  642.         add     esp,-4*8*2
  643.         sub     ebx,3+LCHGW
  644.         mov     ecx,[top_ofs]
  645.         dec     ecx
  646.         shl     ecx,16
  647.         add     ecx,[bot_ofs]
  648.         sub     ecx,[top_ofs]
  649.         sub     ecx,SCRLW
  650.         mcall   13,,,[cl_3d_normal]
  651.  
  652.         push    bx
  653.         shl     ebx,16
  654.         pop     bx
  655.         add     ecx,[top_ofs]
  656.         dec     ecx
  657.         mcall   38,,,[cl_3d_inset]
  658.  
  659.         mov     ebx,[left_ofs]
  660.         add     ebx,-3-LCHGW
  661.         shl     ebx,16
  662.         add     ebx,[top_ofs]
  663.         mov     edi,[sc.work_text]
  664.         mov     ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
  665.         inc     ecx
  666.         mov     edx,p_info+100
  667.     @@: pushad
  668.         push    eax edx edi
  669.         mov     eax,ecx
  670.         mov     ecx,10
  671.         mov     edi,edx
  672.         call    uint2str
  673.         mov     esi,edi
  674.         pop     edi edx eax
  675.         sub     esi,edx
  676.         imul    eax,esi,6*65536
  677.         sub     ebx,eax
  678.         mcall   4,,edi
  679.         popad
  680.         add     ebx,LINEH
  681.         inc     ecx
  682.         cmp     ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
  683.         jg      @f
  684.         mov     esi,ecx
  685.         sub     esi,[cur_tab.Editor.TopLeft.Y] ;! esi,[top_line]
  686.         cmp     esi,[lines.scr]
  687.         jbe     @b
  688.     @@: add     esp,4*8*2
  689.  
  690.   .no_gutter:
  691. ;------------------------------------------------
  692.  
  693.         mov     ebx,[draw_blines]
  694.         or      ebx,ebx
  695.         js      @f
  696.         imul    ebx,LINEH
  697.         mov     ecx,[esp-8]
  698.         shl     ecx,16
  699.         mov     cx,bx
  700.         mov     ebx,[p_info.client_box.width]
  701.         add     ebx,[left_ofs-2]
  702.         sub     ebx,[left_ofs]
  703.         add     ebx,-1*65536-SCRLW+1 ; <OLEFT-1,LINE_WIDTH*6+2>
  704.         mcall   13,,,[color_tbl+4*5]
  705.     @@:
  706.  
  707.         add     esp,4
  708.         cmp     [bot_mode],0
  709.         jne     @f
  710.         mov     ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x]
  711.         sub     ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
  712.         js      @f
  713.         cmp     ebx,[columns.scr]
  714.         ja      @f
  715.         imul    ebx,6
  716.         add     ebx,[left_ofs]
  717.         dec     ebx
  718.         push    bx
  719.         shl     ebx,16
  720.         pop     bx
  721.         mov     eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
  722.         sub     eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
  723.         js      @f
  724.         cmp     eax,[lines.scr]
  725.         jge     @f
  726.         imul    eax,LINEH
  727.         add     eax,[top_ofs]
  728. ;       inc     eax
  729.         mov     esi,eax
  730.         shl     esi,16
  731.         add     eax,LINEH-2
  732.         mov     si,ax
  733.         mov     ecx,2
  734.         cmp     [ins_mode],0
  735.         jne     .lp8
  736.         add     cl,4
  737.   .lp8: push    ecx
  738.         mcall   38,,esi,0x01000000
  739.         add     ebx,0x00010001
  740.         pop     ecx
  741.         loop    .lp8
  742.     @@:
  743. ;------------------------------------------------
  744.         cmp     [do_not_draw],2
  745.         je      .exit
  746.  
  747. ;        mov     ebx,[p_info.x_size]
  748. ;        shl     ebx,16
  749. ;        add     ebx,(-SCRLW-5+2)*65536+SCRLW-2
  750. ;        mov     ecx,[top_ofs-2]
  751. ;        mov     cx,SCRLW-1
  752. ;        mcall   8,,,'UP',[sc.work_button]
  753. ;!!!!!!!!!!!!!!!!!!
  754.         mov     ebx,[p_info.client_box.width]
  755.         shl     ebx,16
  756.         add     ebx,(-SCRLW)*65536+SCRLW
  757.         mov     ecx,[top_ofs-2]
  758.         mov     cx,SCRLW
  759.         sub     ecx,0x00020000
  760.         mcall   8,,,'UP' or 0x40000000
  761.         pushad
  762.         sar     ebx,16
  763.         sar     ecx,16
  764.         push    ebx ecx SCRLW SCRLW
  765.         call    draw_3d_panel
  766.         popad
  767.         mov     eax,8
  768. ;!!!!!!!!!!!!!!!!!!
  769.  
  770.         pushad
  771.         push    0x18
  772.         shr     ecx,16
  773.         mov     bx,cx
  774.         add     ebx,(SCRLW/2-2)*65536+SCRLW/2-3
  775.         mcall   4,,[sc.work_text],esp,1
  776.         add     esp,4
  777.         popad
  778.  
  779. ;        mov     ecx,[bot_ofs]
  780. ;        shl     ecx,16
  781. ;        add     ecx,(-SCRLW*2-1)*65536+SCRLW-1
  782. ;        mcall   ,,,'DN'
  783. ;!!!!!!!!!!!!!!!!!!
  784.         mov     ecx,[bot_ofs]
  785.         shl     ecx,16
  786.         add     ecx,(-SCRLW*2-1)*65536+SCRLW
  787.         mcall   ,,,'DN' or 0x40000000
  788.         pushad
  789.         sar     ebx,16
  790.         sar     ecx,16
  791.         push    ebx ecx SCRLW SCRLW
  792.         call    draw_3d_panel
  793.         popad
  794.         mov     eax,8
  795. ;!!!!!!!!!!!!!!!!!!
  796.  
  797.         pushad
  798.         push    0x19
  799.         shr     ecx,16
  800.         mov     bx,cx
  801.         add     ebx,(SCRLW/2-2)*65536+SCRLW/2-3
  802.         mcall   4,,[sc.work_text],esp,1
  803.         add     esp,4
  804.         popad
  805. ;        sub     ebx,1*65536-2
  806.  
  807.         push    ebx
  808.         mov     eax,[cur_tab.Editor.Lines] ;! eax,[lines]
  809.         mov     ebx,[lines.scr]
  810.         mov     ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
  811.         mov     edx,[bot_ofs]
  812.         sub     edx,[top_ofs]
  813.         add     edx,-SCRLW*3+1
  814.         call    get_scroll_vars
  815.         mov     [cur_tab.Editor.VScroll.Top],eax ;! [vscrl_top],eax
  816.         mov     [cur_tab.Editor.VScroll.Size],ebx ;! [vscrl_size],ebx
  817.         pop     ebx
  818.  
  819.         mov     ecx,eax
  820.         add     ecx,[top_ofs]
  821.         add     ecx,SCRLW-1
  822. ;        shl     ecx,16
  823. ;        mov     cx,word[vscrl_size]
  824.  
  825. ;       mcall   13,,,[sc.work_button]
  826. ;!!!!!!!!!!!!!!!!!!
  827.         pushad
  828.         sar     ebx,16
  829. ;        rol     ecx,16
  830. ;        movsx   eax,cx
  831. ;        sar     ecx,16
  832.         push    ebx ecx SCRLW [cur_tab.Editor.VScroll.Size] ;! ebx ecx SCRLW [vscrl_size]
  833.         dec     dword[esp]
  834.         call    draw_3d_panel
  835.         popad
  836.         mov     eax,13
  837. ;!!!!!!!!!!!!!!!!!!
  838.         inc     ebx
  839.  
  840.         mov     ecx,[top_ofs-2]
  841.         mov     cx,word[cur_tab.Editor.VScroll.Top] ;! cx,word[vscrl_top]
  842.         add     ecx,(SCRLW-1)*65536
  843.         mov     edx,[sc.work];[color_tbl+4*5]
  844.         or      cx,cx
  845.         jle     @f
  846.         mcall   13
  847.     @@:
  848.         mov     ecx,[top_ofs]
  849.         add     ecx,[cur_tab.Editor.VScroll.Top] ;! ecx,[vscrl_top]
  850.         add     ecx,[cur_tab.Editor.VScroll.Size] ;! ecx,[vscrl_size]
  851.         add     ecx,SCRLW-1
  852.         mov     di,cx
  853.         shl     ecx,16
  854.         mov     cx,word[bot_ofs]
  855.         sub     cx,di
  856.         sub     cx,SCRLW*2+1
  857.         jle     @f
  858.         mcall
  859.     @@:
  860. ;-----------------------
  861. ;        mov     eax,ebx
  862. ;        shr     eax,16
  863. ;        add     bx,ax
  864. ;        mov     ecx,[top_ofs-2]
  865. ;        mov     cx,word[top_ofs]
  866. ;        add     ecx,SCRLW*65536+SCRLW
  867. ;        mcall   38,,,[sc.work_graph];[sc.work_text]
  868. ;        mov     ecx,[bot_ofs-2]
  869. ;        mov     cx,word[bot_ofs]
  870. ;        sub     ecx,(SCRLW*2+2)*65536+(SCRLW*2+2)
  871. ;        mcall
  872.         rol     ebx,16
  873.         push    bx
  874.         rol     ebx,16
  875.         pop     bx
  876.         mov     ecx,[top_ofs-2]
  877.         mov     cx,word[bot_ofs]
  878.         add     ecx,(SCRLW-1)*65536-SCRLW*2-2
  879.         mcall   38,,,[cl_3d_inset]
  880. ;------------------------------------------------
  881. ;        mov     ebx,5*65536+SCRLW-1
  882. ;        mov     ecx,[bot_ofs]
  883. ;        shl     ecx,16
  884. ;        add     ecx,(-SCRLW)*65536+SCRLW-2
  885. ;        mcall   8,,,'LT',[sc.work_button]
  886. ;!!!!!!!!!!!!!!!!!!
  887.         mov     ebx,SCRLW
  888.         mov     ecx,[bot_ofs]
  889.         shl     ecx,16
  890.         add     ecx,(-SCRLW-1)*65536+SCRLW
  891.         mcall   8,,,'LT' or 0x40000000
  892.         pushad
  893.         sar     ebx,16
  894.         sar     ecx,16
  895.         push    ebx ecx SCRLW SCRLW
  896.         call    draw_3d_panel
  897.         popad
  898. ;!!!!!!!!!!!!!!!!!!
  899.  
  900.         pushad
  901.         push    0x1B
  902.         shr     ecx,16
  903.         mov     bx,cx
  904.         add     ebx,(SCRLW/2-2)*65536+SCRLW/2-3
  905.         mcall   4,,[sc.work_text],esp,1
  906.         add     esp,4
  907.         popad
  908.  
  909. ;        mov     ebx,[p_info.x_size]
  910. ;        shl     ebx,16
  911. ;        add     ebx,(-SCRLW*2-5)*65536+SCRLW
  912. ;        mcall   ,,,'RT'
  913. ;!!!!!!!!!!!!!!!!!!
  914.         mov     ebx,[p_info.client_box.width]
  915.         shl     ebx,16
  916.         add     ebx,(-SCRLW*2)*65536+SCRLW
  917.         mcall   8,,,'RT' or 0x40000000
  918.         pushad
  919.         sar     ebx,16
  920.         sar     ecx,16
  921.         push    ebx ecx SCRLW SCRLW
  922.         call    draw_3d_panel
  923.         popad
  924. ;!!!!!!!!!!!!!!!!!!
  925.  
  926.         pushad
  927.         push    0x1A
  928.         shr     ecx,16
  929.         mov     bx,cx
  930.         add     ebx,(SCRLW/2-2)*65536+SCRLW/2-3
  931.         mcall   4,,[sc.work_text],esp,1
  932.         add     esp,4
  933.         popad
  934. ;       inc     ecx
  935.  
  936.         push    ecx
  937.         mov     eax,[cur_tab.Editor.Columns] ;! eax,[columns]
  938.         mov     ebx,[columns.scr]
  939.         mov     ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col]
  940.         mov     edx,[p_info.client_box.width]
  941.         add     edx,-(SCRLW*3)
  942.         call    get_scroll_vars
  943.         mov     [cur_tab.Editor.HScroll.Top],eax ;! [hscrl_top],eax
  944.         mov     [cur_tab.Editor.HScroll.Size],ebx ;! [hscrl_size],ebx
  945.         pop     ecx
  946.  
  947.         mov     ebx,eax
  948.         add     ebx,1+SCRLW
  949.         shl     ebx,16
  950.         mov     bx,word[cur_tab.Editor.HScroll.Size] ;! bx,word[hscrl_size]
  951.  
  952. ;        mcall   13,,,[sc.work_button]
  953. ;!!!!!!!!!!!!!!!!!!
  954.         pushad
  955.         sar     ecx,16
  956.         rol     ebx,16
  957.         movsx   eax,bx
  958.         sar     ebx,16
  959.         dec     ebx
  960.         push    eax ecx ebx SCRLW
  961.         call    draw_3d_panel
  962.         popad
  963. ;!!!!!!!!!!!!!!!!!!
  964.  
  965.         mov     ebx,(1+SCRLW)*65536
  966.         mov     bx,word[cur_tab.Editor.HScroll.Top] ;! bx,word[hscrl_top]
  967.         mcall   13,,,[sc.work];[color_tbl+4*5]
  968.         mov     ebx,1+SCRLW
  969.         add     ebx,[cur_tab.Editor.HScroll.Top] ;! ebx,[hscrl_top]
  970.         add     ebx,[cur_tab.Editor.HScroll.Size] ;! ebx,[hscrl_size]
  971.         mov     di,bx
  972.         shl     ebx,16
  973.         mov     bx,word[p_info.client_box.width]
  974.         sub     bx,di
  975.         sub     bx,SCRLW*2
  976.         jle     @f
  977.         mcall
  978.     @@:
  979. ;        mov     eax,ebx
  980. ;        shr     eax,16
  981. ;        add     bx,ax
  982. ;        mov     ecx,[bot_ofs-2]
  983. ;        mov     cx,word[bot_ofs]
  984. ;        sub     ecx,SCRLW*65536+2
  985. ;        mcall   38,<OLEFT+SCRLW-1,OLEFT+SCRLW-1>,,[sc.work_graph];[sc.work_text]
  986. ;        mov     ebx,[p_info.x_size-2]
  987. ;        mov     bx,word[p_info.x_size]
  988. ;        sub     ebx,(SCRLW*2+6)*65536+(SCRLW*2+6)
  989. ;        mcall
  990.         mov     ebx,[p_info.client_box.width]
  991. ;       add     ebx,5*65536-5
  992.         mov     ecx,[bot_ofs-2]
  993.         mov     cx,word[bot_ofs]
  994.         sub     ecx,(SCRLW+1)*65536+(SCRLW+1)
  995.         mcall   38,,,[cl_3d_inset]
  996. ;------------------------------------------------
  997.   .exit:
  998.         popad
  999.         ret
  1000. }
  1001. endf
  1002.  
  1003. ;-----------------------------------------------------------------------------
  1004. func get_next_part ;//////////////////////////////////////////////////////////
  1005. ;-----------------------------------------------------------------------------
  1006. ; Input:
  1007. ;  ECX = current letter
  1008. ;  ESI = string
  1009. ; Output:
  1010. ;  ECX = color
  1011. ;  EDX = string
  1012. ;  ESI = length
  1013. ;-----------------------------------------------------------------------------
  1014.         cmp     [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0
  1015.         je      .plain.text
  1016.         xor     ebx,ebx
  1017.         mov     edx,ecx
  1018.         add     esi,ecx
  1019.         mov     edi,symbols
  1020.         mov     al,[esi]
  1021.         cmp     al,';'
  1022.         je      .comment
  1023.         mov     ecx,symbols.size
  1024.         repne   scasb
  1025.         je      .symbol
  1026.         cmp     al,'$'
  1027.         jne     @f
  1028.         mov     edi,symbols
  1029.         mov     al,[esi+1]
  1030.         mov     ecx,symbols.size
  1031.         repne   scasb
  1032.         je      .not_symbol
  1033.         jmp     .number
  1034.     @@: cmp     al,'0'
  1035.         jb      @f
  1036.         cmp     al,'9'
  1037.         jbe     .number
  1038.     @@: cmp     al,"'"
  1039.         je      .string
  1040.         cmp     al,'"'
  1041.         je      .string
  1042.   .not_symbol:
  1043.         inc     ebx
  1044.         inc     edx
  1045.         cmp     edx,[cur_line_len];LINE_WIDTH
  1046.         jge     @f
  1047.         mov     edi,symbols
  1048.         mov     al,[esi+ebx]
  1049.         cmp     al,';'
  1050.         je      @f
  1051.         mov     ecx,symbols.size
  1052.         repne   scasb
  1053.         jne     .not_symbol
  1054.     @@: mov     ecx,edx
  1055.         mov     edx,esi
  1056.         mov     esi,ebx
  1057.         mov     eax,[color_tbl+4*0]
  1058.         ret
  1059.   .symbol:
  1060.         inc     ebx
  1061.         inc     edx
  1062.         cmp     edx,[cur_line_len];LINE_WIDTH
  1063.         jge     @f
  1064.         mov     edi,symbols
  1065.         mov     al,[esi+ebx]
  1066.         mov     ecx,symbols.size
  1067.         repne   scasb
  1068.         je      .symbol
  1069.     @@: mov     ecx,edx
  1070.         mov     edx,esi
  1071.         mov     esi,ebx
  1072.         mov     eax,[color_tbl+4*4]
  1073.         ret
  1074.   .comment:
  1075.         neg     edx
  1076.         add     edx,[cur_line_len];LINE_WIDTH
  1077.         xchg    edx,esi
  1078.         mov     ecx,[cur_line_len];LINE_WIDTH
  1079.         mov     eax,[color_tbl+4*3]
  1080.         ret
  1081.   .number:
  1082.         inc     ebx
  1083.         inc     edx
  1084.         cmp     edx,[cur_line_len];LINE_WIDTH
  1085.         jge     @f
  1086.         mov     edi,symbols
  1087.         mov     al,[esi+ebx]
  1088.         cmp     al,';'
  1089.         je      @f
  1090.         mov     ecx,symbols.size
  1091.         repne   scasb
  1092.         jne     .number
  1093.     @@: mov     ecx,edx
  1094.         mov     edx,esi
  1095.         mov     esi,ebx
  1096.         mov     eax,[color_tbl+4*1]
  1097.         ret
  1098.   .string:
  1099.         inc     ebx
  1100.         inc     edx
  1101.         cmp     edx,[cur_line_len];LINE_WIDTH
  1102.         jge     @f
  1103.         cmp     [esi+ebx],al
  1104.         jne     .string
  1105.         inc     ebx
  1106.         inc     edx
  1107.     @@:
  1108.         mov     ecx,edx
  1109.         mov     edx,esi
  1110.         mov     esi,ebx
  1111.         mov     eax,[color_tbl+4*2]
  1112.         ret
  1113.   .plain.text:
  1114.         mov     edx,[cur_line_len];LINE_WIDTH
  1115.         xchg    edx,esi
  1116.         mov     ecx,[cur_line_len];LINE_WIDTH
  1117.         mov     eax,[color_tbl+4*0]
  1118.         ret
  1119. endf
  1120.  
  1121. ;-----------------------------------------------------------------------------
  1122. func draw_statusbar ;///// WRITE POSITION ////////////////////////////////////
  1123. ;-----------------------------------------------------------------------------
  1124.         cmp     [do_not_draw],1  ; return if drawing is not permitted
  1125.         jae     .exit
  1126.         pusha
  1127.  
  1128.         mov     ecx,[p_info.client_box.height-2]
  1129.         mov     cx,word[p_info.client_box.height]
  1130.         sub     ecx,STATH*65536+STATH
  1131.         mcall   38,[p_info.client_box.width],,[sc.frame];[cl_3d_pushed]
  1132.  
  1133. ;       mcall   9,p_info,-1
  1134.  
  1135.         mov     ecx,[p_info.client_box.height-2]
  1136.         mov     cx,word[p_info.client_box.height]
  1137.         sub     ecx,STATH*65536
  1138. ;        mpack   ebx,6*13,6*13
  1139. ;        add     ebx,[left_ofs-2]
  1140. ;        add     ebx,[left_ofs]
  1141.         mcall   38,<6*13,6*13>,,[cl_3d_inset]
  1142.  
  1143.         pushad
  1144.         add     ecx,1*65536
  1145. ;       sub     ebx,(6*13+1)*65536-1
  1146. ;       sub     ebx,[left_ofs]
  1147.         mov     cx,STATH
  1148.         mcall   13,<0,6*13>,,[cl_3d_normal]
  1149.         mcall   ,<6*13+1,6*(s_modified.size+2)-1>
  1150.         mov     ebx,(6*(s_modified.size+15)+1)*65536
  1151.         mov     bx,word[p_info.client_box.width]
  1152.         sub     bx,6*(s_modified.size+15)
  1153.         mcall
  1154.         popad
  1155.  
  1156.         add     ebx,6*(s_modified.size+2)*65536+6*(s_modified.size+2)
  1157.         mcall
  1158.  
  1159.         and     ecx,0x0000FFFF
  1160.         push    ecx
  1161.  
  1162.         mov     eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
  1163.         inc     eax
  1164.         mov     ecx,10
  1165.         mov     edi,p_info+0x100;htext2.pos1
  1166.         cld
  1167.         call    uint2str
  1168.         mov     al,','
  1169.         stosb
  1170.         mov     eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
  1171.         inc     eax
  1172.         call    uint2str
  1173.  
  1174.         pop     ebx
  1175.  
  1176.         lea     esi,[edi-p_info-0x100]
  1177.         lea     edi,[esi*3]
  1178.         shl     edi,16
  1179.  
  1180. ;       add     ebx,[left_ofs-2]
  1181.         add     ebx,(1+6*6+3)*65536-STATH/2-3
  1182.         sub     ebx,edi
  1183.         mcall   4,,[sc.work_text],p_info+0x100
  1184.  
  1185.         cmp     [cur_tab.Editor.Modified],0 ;! [modified],0
  1186.         je      @f
  1187.         and     ebx,0x0000FFFF
  1188. ;       add     ebx,[left_ofs-2]
  1189.         add     ebx,(1+12*6+12+1)*65536
  1190.         mcall   ,,,s_modified,s_modified.size
  1191.  
  1192.     @@: cmp     [s_status],0
  1193.         je      @f
  1194.         and     ebx,0x0000FFFF
  1195.         add     ebx,6*(s_modified.size+16)*65536
  1196.         or      ecx, 80000000h
  1197.         mcall   ,,,[s_status]
  1198.  
  1199.     @@: popa
  1200.  
  1201.   .exit:
  1202.         ret
  1203. endf
  1204.  
  1205. func draw_framerect ; ebx,ecx,edx
  1206.         push    ebx ecx
  1207.         ; x1 = esp+6
  1208.         ; x2 = esp+4 (width)
  1209.         ; y1 = esp+2
  1210.         ; y2 = esp+0 (height)
  1211.  
  1212.         add     bx,[esp+6]
  1213.         mov     cx,[esp+2]
  1214.         dec     ebx
  1215.         mcall   38
  1216.         add     cx,[esp]
  1217.         rol     ecx,16
  1218.         add     cx,[esp]
  1219.         sub     ecx,0x00010001
  1220.         mcall
  1221.  
  1222.         mov     ebx,[esp+4]
  1223.         mov     ecx,[esp]
  1224.         mov     bx,[esp+6]
  1225.         add     cx,[esp+2]
  1226.         dec     ecx
  1227.         mcall
  1228.         add     bx,[esp+4]
  1229.         rol     ebx,16
  1230.         add     bx,[esp+4]
  1231.         sub     ebx,0x00010001
  1232.         mcall
  1233.  
  1234.         pop     ecx ebx
  1235.         ret
  1236. endf