Subversion Repositories Kolibri OS

Rev

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

  1. diff16 'tp-draw.asm',0,$
  2.  
  3. ;-----------------------------------------------------------------------------
  4. proc drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
  5. ;-----------------------------------------------------------------------------
  6.  
  7.         cmp     [just_from_popup],1
  8.         jne     @f
  9.         ret
  10.     @@:
  11.  
  12.         mcall   48,3,sc,sizeof.system_colors
  13.         call    calc_3d_colors
  14.  
  15.         ;mcall   12,1
  16.         invoke  gfx.open,TRUE
  17.         mov     [ctx],eax
  18.  
  19.         ;m2m     [sc.work],dword[color_tbl.back]
  20.  
  21.         mov     edx,[sc.work]
  22.         add     edx,0x73000000
  23.         mov     ebx,[mainwnd_pos.x-2]
  24.         mov     bx,word[mainwnd_pos.w]
  25.         mov     ecx,[mainwnd_pos.y-2]
  26.         mov     cx,word[mainwnd_pos.h]
  27.         mcall   0,,,,,s_title
  28.  
  29.         mcall   9,p_info,-1
  30.        
  31.         mov     eax,[p_info+70] ;status of window
  32.         test    eax,100b
  33.         jne     .exit.2
  34.        
  35.         mov     esi,p_info.box.left
  36.         mov     edi,mainwnd_pos
  37.         mov     ecx,4
  38.         cld
  39.         rep     movsd
  40.  
  41.         cmp     [p_info.client_box.height],LINEH
  42.         jl      .exit.2
  43.  
  44.         mov     [tab_bar.Bounds.Left],0
  45.         mov     [tab_bar.Bounds.Top],ATOPH
  46.         mov     eax,[p_info.client_box.width]
  47.         mov     [tab_bar.Bounds.Right],eax
  48.         mov     eax,[p_info.client_box.height]
  49.         sub     eax,[bot_dlg_height]
  50.         add     eax,-STATH-1
  51.         mov     [tab_bar.Bounds.Bottom],eax
  52.  
  53.         call    align_editor_in_tab
  54.  
  55.         mov     [top_ofs],ATOPH;+1
  56.  
  57.         mov     eax,[p_info.client_box.height]
  58.         add     eax,-STATH+1;*3-2-2
  59.         sub     eax,[bot_dlg_height]
  60.         mov     [bot_ofs],eax
  61.  
  62.         call    draw_bottom_dialog
  63.  
  64. ;        mov     [do_not_draw],1 ; do_not_draw = true
  65.  
  66. ;        mov     ebx,eax
  67. ;        sub     ebx,[top_ofs]
  68. ;        sub     ebx,SCRLW*3+AMINS+5
  69. ;        js      .no_draw
  70.  
  71. ;        dec     [do_not_draw]    ; do_not_draw = false
  72. ;        sub     eax,SCRLW+3
  73. ;        sub     eax,[top_ofs]
  74. ;        cdq
  75. ;        mov     ebx,LINEH
  76. ;        div     ebx
  77. ;        mov     [lines.scr],eax
  78.  
  79.         inc     [top_ofs]
  80.  
  81.         call    draw_main_menu
  82.  
  83.         jmp     .exit
  84.  
  85.   .no_draw:
  86.         mov     [top_ofs],2
  87.         mov     eax,[p_info.client_box.height]
  88.         inc     eax
  89.         mov     [bot_ofs],eax
  90.         sub     eax,2
  91.         push    eax
  92.         add     eax,-2-SCRLW
  93.         cdq
  94.         mov     ebx,LINEH
  95.         idiv    ebx
  96.         mov     [lines.scr],eax
  97.         pop     eax
  98.  
  99.         mov     ebx,[p_info.client_box.height]
  100.         sub     ebx,SCRLW*3+AMINS+2
  101.         jns     @f
  102.  
  103.         inc     [do_not_draw]
  104.  
  105.         dec     eax
  106.         cdq
  107.         mov     ebx,LINEH
  108.         idiv    ebx
  109.         mov     [lines.scr],eax
  110.  
  111.         mov     eax,[p_info.client_box.width]
  112.         cdq
  113.         mov     ebx,6
  114.         idiv    ebx
  115.         mov     [columns.scr],eax
  116.     @@:
  117.  
  118.   .exit:
  119.         call    draw_editor
  120.         call    draw_tabctl
  121.   .exit.2:
  122.         ;mcall   12,2
  123.         invoke  gfx.close,[ctx]
  124.         ret
  125. endp
  126.  
  127. ;-----------------------------------------------------------------------------
  128. proc draw_bottom_dialog ;/////////////////////////////////////////////////////
  129. ;-----------------------------------------------------------------------------
  130.         cmp     [bot_dlg_height],0
  131.         je      .exit
  132.         pushad
  133.         invoke  gfx.pen.color,[ctx],[cl_3d_inset]
  134.         mov     ecx,[bot_ofs]
  135.         dec     ecx
  136.         invoke  gfx.line,[ctx],0,ecx,[p_info.client_box.width],ecx
  137.         invoke  gfx.brush.color,[ctx],[cl_3d_normal]
  138.         inc     ecx
  139.         mov     eax,ecx
  140.         add     eax,[bot_dlg_height]
  141.         invoke  gfx.fillrect,[ctx],0,ecx,[p_info.client_box.width],eax
  142.         ;mov     ebx,[p_info.client_box.width]
  143.         ;mov     ecx,[bot_ofs]
  144.         ;dec     ecx
  145.         ;push    cx
  146.         ;shl     ecx,16
  147.         ;pop     cx
  148.         ;mcall   38,,,[cl_3d_inset]
  149.         ;mov     ecx,[bot_ofs-2]
  150.         ;mov     cx,word[bot_dlg_height]
  151.         ;dec     ecx
  152.         ;mov     ebx,[p_info.client_box.width]
  153.         ;inc     ebx
  154.         ;mcall   13,,,[cl_3d_normal]
  155.         mov     al,1
  156.         call    [bot_dlg_handler]
  157.         popad
  158.  
  159.   .exit:
  160.         ret
  161. endp
  162.  
  163. mi_sel   dd ?
  164. mi_cur   dd -1
  165.  
  166. ;-----------------------------------------------------------------------------
  167. proc draw_main_menu ;/////////////////////////////////////////////////////////
  168. ;-----------------------------------------------------------------------------
  169.         mov     ebx,[p_info.client_box.width]
  170.         inc     ebx
  171.         mcall   13,,ATOPH-1,[cl_3d_normal]
  172.  
  173.         mcall   38,[p_info.client_box.width],<ATOPH-1,ATOPH-1>,[cl_3d_inset]
  174.  
  175.         mov     edx,main_menu
  176.         mov     ebx,9*65536+ATOPH/2-3;4
  177.         mov     [mi_sel],0
  178.         mov     edi,[mi_cur]
  179.     @@: inc     [mi_sel]
  180.         cmp     [mi_sel],main_menu.cnt_item
  181.         ja      .exit
  182.         mov     ecx,[sc.work_text]
  183.         cmp     edi,[mi_sel]
  184.         jne     .lp1
  185.         pushad
  186.         push    edx
  187.         mov     ecx,[edx+4]
  188.         add     ecx,2*65536-2
  189.         mcall   13,[edx+0],,[sc.work]
  190.         mov     edx,[esp]
  191.         mov     cx,[edx+6]
  192.         add     ecx,-1*65536+1
  193.         add     bx,[edx+2]
  194.         mcall   38,,,[cl_3d_inset]
  195.  
  196.         mov     edx,[esp]
  197.         add     cx,[edx+4]
  198.         add     cx,-2
  199.         mov     bx,[edx+2]
  200.         mcall   ,,,[cl_3d_inset]
  201.         pop     edx
  202.         movzx   eax,word[edx]
  203.         add     ebx,eax
  204.         shl     eax,16
  205.         add     ebx,eax
  206.         mcall   38,,,[cl_3d_inset]
  207.         popad
  208.         mov     ecx,[color_tbl.text]
  209.   .lp1: add     edx,8+1
  210.         movzx   esi,byte[edx-1]
  211.         mcall   4
  212.         add     edx,esi
  213.         add     esi,2
  214.         imul    esi,6*65536
  215.         add     ebx,esi
  216.         jmp     @b
  217.  
  218.   .exit:
  219.         mov     ebx,[mainwnd_pos.w]
  220.         add     ebx,-10-(ATOPH-6)-3
  221.         push    ebx 2 (ATOPH-6) (ATOPH-6)
  222.         call    draw_3d_panel
  223.         shl     ebx,16
  224.         add     ebx,ATOPH-6
  225.         mcall   8,,<2,ATOPH-6>,<0x4000,2>
  226.         and     ebx,0xFFFF0000
  227.         add     ebx,(ATOPH-8)/2*65536+(ATOPH-8)/2
  228.         mcall   4,,[sc.work_text],.cross,1
  229.  
  230.         ret
  231.  
  232. .cross db 'x'
  233. endp
  234.  
  235. ;-----------------------------------------------------------------------------
  236. proc draw_statusbar ;///// DRAW POSITION, MODIFIED STATE, HINT ///////////////
  237. ;-----------------------------------------------------------------------------
  238.         cmp     [do_not_draw],1  ; return if drawing is not permitted
  239.         jae     .exit
  240.         pusha
  241.  
  242.        mcall   9,p_info,-1
  243.  
  244.         mov     eax,[p_info+70] ;status of window
  245.         test    eax,100b
  246.         jne     .exit_1
  247.        
  248.         mov     ecx,[p_info.client_box.height-2]
  249.         mov     cx,word[p_info.client_box.height]
  250.         sub     ecx,STATH*65536+STATH
  251.         mcall   38,[p_info.client_box.width],,[cl_3d_inset]
  252.  
  253. ;       mcall   9,p_info,-1
  254.  
  255.         mov     ecx,[p_info.client_box.height-2]
  256.         mov     cx,word[p_info.client_box.height]
  257.         sub     ecx,STATH*65536
  258.         mcall   38,<6*13,6*13>,,[cl_3d_inset]
  259.  
  260.         pushad
  261.         add     ecx,1*65536
  262.         mov     cx,STATH
  263.         mcall   13,<0,6*13>,,[cl_3d_normal]
  264.         mcall   ,<6*13+1,6*(s_modified.size+2)-1>
  265.         mov     ebx,(6*(s_modified.size+15)+1)*65536
  266.         mov     bx,word[p_info.client_box.width]
  267.         sub     bx,6*(s_modified.size+15)
  268.         mcall
  269.         popad
  270.  
  271.         add     ebx,6*(s_modified.size+2)*65536+6*(s_modified.size+2)
  272.         mcall
  273.  
  274.         and     ecx,0x0000FFFF
  275.         push    ecx
  276.  
  277.         mov     eax,[cur_editor.Caret.Y]
  278.         inc     eax
  279.         mov     ecx,10
  280.         mov     edi,p_info+0x100
  281.         cld
  282.         call    uint2str
  283.         mov     al,','
  284.         stosb
  285.         mov     eax,[cur_editor.Caret.X]
  286.         inc     eax
  287.         call    uint2str
  288.  
  289.         pop     ebx
  290.  
  291.         lea     esi,[edi-p_info-0x100]
  292.         lea     edi,[esi*3]
  293.         shl     edi,16
  294.  
  295.         add     ebx,(1+6*6+3)*65536-STATH/2-3
  296.         sub     ebx,edi
  297.         mcall   4,,[sc.work_text],p_info+0x100
  298.  
  299.         cmp     [cur_editor.Modified],0
  300.         je      @f
  301.         and     ebx,0x0000FFFF
  302.         add     ebx,(1+12*6+12+1)*65536
  303.         mcall   ,,,s_modified,s_modified.size
  304.  
  305.     @@: cmp     [s_status],0
  306.         je      @f
  307.         and     ebx,0x0000FFFF
  308.         add     ebx,6*(s_modified.size+16)*65536
  309.         or      ecx, 80000000h
  310.         mcall   ,,,[s_status]
  311. .exit_1:
  312.     @@: popa
  313.  
  314.   .exit:
  315.         ret
  316. endp
  317.  
  318. proc draw_fillrect ; ebx,ecx,edx
  319.         ; ebx = <left,width>
  320.         ; ecx = <top,height>
  321.         push    ebx ecx edx
  322.         call    draw_framerect
  323.         add     ebx,1*65536-2
  324.         add     ecx,1*65536-2
  325.         mcall   13,,,esi
  326.         pop     edx ecx ebx
  327.         ret
  328. endp
  329.  
  330. proc draw_framerect ; ebx,ecx,edx
  331.         ; ebx = <left,width>
  332.         ; ecx = <top,height>
  333.         push    ebx ecx
  334.  
  335.         add     bx,[esp+6]       ; ebx = <left,right>
  336.         mov     cx,[esp+2]       ; ecx = <top,top>
  337.         dec     ebx
  338.         mcall   38
  339.         add     cx,[esp]         ; ecx = <top,bottom>
  340.         rol     ecx,16
  341.         add     cx,[esp]         ; ecx = <bottom,bottom>
  342.         sub     ecx,0x00010001
  343.         mcall
  344.  
  345.         mov     ebx,[esp+4]      ; ebx = <width,left>
  346.         mov     ecx,[esp]        ; ecx = <height,top>
  347.         mov     bx,[esp+6]       ; ebx = <width,>
  348.         add     cx,[esp+2]
  349.         dec     ecx
  350.         mcall
  351.         add     bx,[esp+4]
  352.         rol     ebx,16
  353.         add     bx,[esp+4]
  354.         sub     ebx,0x00010001
  355.         mcall
  356.  
  357.         pop     ecx ebx
  358.         ret
  359. endp
  360.  
  361. proc draw_check
  362.         push    bx
  363.         shl     ebx,16
  364.         pop     bx
  365.         add     ebx,0x00010000
  366.         push    cx
  367.         shl     ecx,16
  368.         pop     cx
  369.         add     ecx,0x00020001
  370.         mcall   38
  371.         add     ecx,0x00010001
  372.         mcall
  373.         add     ebx,4
  374.         sub     ecx,2
  375.         mcall
  376.         sub     ecx,0x00010001
  377.         mcall
  378.         ret
  379. endp
  380.  
  381. proc calc_middle
  382.         shr     eax,1
  383.         shr     ebx,1
  384.         and     eax,0x007F7F7F
  385.         and     ebx,0x007F7F7F
  386.         add     eax,ebx
  387.         ret
  388. endp
  389.  
  390. proc calc_3d_colors
  391.         pushad
  392.         m2m     [cl_3d_normal],[sc.work]
  393.         m2m     [cl_3d_inset],[sc.work_graph]
  394.         push    [cl_3d_normal]
  395.         add     byte[esp],48
  396.         jnc     @f
  397.         mov     byte[esp],255
  398.     @@: add     byte[esp+1],48
  399.         jnc     @f
  400.         mov     byte[esp+1],255
  401.     @@: add     byte[esp+2],48
  402.         jnc     @f
  403.         mov     byte[esp+2],255
  404.     @@: pop     [cl_3d_outset]
  405.         mov     eax,[cl_3d_inset]
  406.         mov     ebx,[cl_3d_outset]
  407.         call    calc_middle
  408.         mov     ebx,[cl_3d_normal]
  409.         call    calc_middle
  410.         mov     [cl_3d_pushed],eax
  411.         mov     eax,[cl_3d_normal]
  412.         mov     ebx,[sc.work_text]
  413.         call    calc_middle
  414.         mov     [cl_3d_grayed],eax
  415.         popad
  416.         ret
  417. endp
  418.  
  419. proc draw_3d_panel ; x,y,w,h
  420.         push    eax ebx ecx edx
  421.         cmp     dword[esp+16+8],4
  422.         jl      .exit
  423.         cmp     dword[esp+16+4],4
  424.         jl      .exit
  425.         mov     ebx,[esp+16+16-2]
  426.         mov     bx,[esp+16+8]
  427.         inc     ebx
  428.         mov     ecx,[esp+16+12-2]
  429.         mov     cx,[esp+16+4]
  430.         inc     ecx
  431.         mcall   13,,,[cl_3d_normal]
  432.         dec     ebx
  433.         add     bx,[esp+16+16]
  434.         mov     cx,[esp+16+12]
  435.         mcall   38,,,[cl_3d_inset]
  436.         add     ecx,[esp+16+4-2]
  437.         add     cx,[esp+16+4]
  438.         mcall
  439.         mov     bx,[esp+16+16]
  440.         mov     ecx,[esp+16+12-2]
  441.         mov     cx,[esp+16+4]
  442.         add     cx,[esp+16+12]
  443.         mcall
  444.         add     ebx,[esp+16+8-2]
  445.         add     bx,[esp+16+8]
  446.         mcall
  447.         mov     ebx,[esp+16+16-2]
  448.         mov     bx,[esp+16+8]
  449.         add     bx,[esp+16+16]
  450.         add     ebx,1*65536-1
  451.         mov     ecx,[esp+16+12-2]
  452.         mov     cx,[esp+16+12]
  453.         add     ecx,0x00010001
  454.         mcall   ,,,[cl_3d_outset]
  455.         mov     bx,[esp+16+16]
  456.         inc     ebx
  457.         mov     ecx,[esp+16+12-2]
  458.         mov     cx,[esp+16+4]
  459.         add     cx,[esp+16+12]
  460.         add     ecx,2*65536-1
  461.         mcall
  462.   .exit:
  463.         pop     edx ecx ebx eax
  464.         ret     4*4
  465. endp
  466.