Subversion Repositories Kolibri OS

Rev

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

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