Subversion Repositories Kolibri OS

Rev

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