Subversion Repositories Kolibri OS

Rev

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