Subversion Repositories Kolibri OS

Rev

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