Subversion Repositories Kolibri OS

Rev

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