Subversion Repositories Kolibri OS

Rev

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

  1. ;------------------------------------------------------------------------------
  2. ; ***************************************************
  3. ; ********* WINDOW DEFINITIONS AND DRAW *************
  4. ; ***************************************************
  5. align 4
  6. draw_window:
  7.         pusha
  8.         mov     [running_applications],-1
  9.         mcall   12,1
  10.  
  11.         mcall   48,3,system_colours,10*4
  12.  
  13.         mov     eax, [system_colours+4*6]
  14. ;       sub     eax, 0x101010
  15. ;       mov     [wcolor], eax
  16.  
  17.         mov     edx,[system_colours+4*6]
  18.         mov     eax,COLOR_CHANGE_MAGNITUDE
  19.         call    subtract_color_change_magnitude
  20.         mov     [wcolor], edx
  21.  
  22.         mcall   14      ; get screen max x & max y
  23.  
  24.         cmp     [width],dword 0
  25.         je      no_def_width
  26.  
  27.         and     eax,0xffff
  28.         mov     ebx,[width]
  29.         shl     ebx,16
  30.         add     eax,ebx
  31. ;--------------------------------------
  32. align 4
  33. no_def_width:
  34.         mov     ebx,eax
  35.         mov     [screenxy],ebx
  36.         shr     ebx,16
  37.         mov     ecx,eax
  38.  
  39.         cmp     [place_attachment],1
  40.         je      @f
  41.        
  42.         xor     ecx,ecx
  43.         mov     cx,[height]
  44.         dec     cx
  45.         jmp     .attachment_selected
  46. ;--------------------------------------
  47. align 4
  48. @@:
  49.         sub     ecx,[height]
  50.         inc     ecx
  51.         shl     ecx,16
  52.         mov     cx,[height]
  53.         dec     cx
  54. ;--------------------------------------
  55. align 4
  56. .attachment_selected:
  57.         xor     eax,eax                     ; DEFINE AND DRAW WINDOW
  58.         mov     edx, [wcolor]
  59.         or      edx, 0x01000000 ; do not draw the window
  60.         mov     esi, [wcolor]
  61.         or      esi, 0x01000000 ; unmovable window
  62.         mov     edi, [wcolor]
  63.         mov     [panel_x_pos], ebx
  64.         mov     [panel_y_pos], ecx       ; Ïîêà ÷òî òàê.
  65.         mcall
  66.  
  67.         movzx   eax,word [screenxy+2]
  68.         mov     [max_x],eax
  69.        
  70.         call    fill_window
  71.         call    minimize_left_button
  72.         call    minimize_right_button
  73.         call    draw_menu_and_clean_desktop
  74.         mov     [ptime],0
  75.         call    draw_tray
  76.         call    draw_application_buttons
  77.  
  78.         mov     [redraw_window_flag],0
  79.         mcall   12,2
  80.         popa
  81.         ret
  82. ;------------------------------------------------------------------------------
  83. align 4
  84. fill_window:   
  85.         movzx   ebx,word [screenxy+2]
  86.         xor     ecx,ecx
  87.         mov     edx,[wcolor]
  88. ;       add     edx,0x161616
  89.         mov     eax,COLOR_CHANGE_MAGNITUDE_0
  90.         imul    eax,dword [soften_height]
  91.         call    subtract_color_change_magnitude
  92.         cmp     [soften_up],dword 0
  93.         je      no_su
  94. ;--------------------------------------
  95. align 4
  96. @@:                     ; debug.inc has macros with the same name
  97. ;       sub     edx,0x040404
  98.         mov     eax,COLOR_CHANGE_MAGNITUDE_0
  99.         call    add_color_change_magnitude
  100. ; draw soften_up - the width of 5 pixels
  101.         and     edx,0x00FFFFFF
  102.         mcall   38
  103.  
  104.         add     ecx,1*65536+1
  105.         cmp     cx,[soften_height]      ;5
  106.         jb      @r
  107. ;--------------------------------------
  108. align 4
  109. no_su:
  110.         cmp     [soften_down],dword 0
  111.         je      no_sd
  112. ; draw soften_down - the width of 5 pixels
  113.         pusha
  114.         mov     esi,[soften_height]
  115.         mov     ecx,[height]
  116.         dec     ecx
  117.         shl     ecx,16
  118.         add     ecx,[height]
  119.         dec     ecx
  120.         mov     edx,[wcolor]
  121.         mov     eax,COLOR_CHANGE_MAGNITUDE_0
  122.         imul    eax,dword [soften_height]
  123.         call    subtract_color_change_magnitude
  124. ;--------------------------------------
  125. align 4
  126. @@:
  127.         mov     eax,COLOR_CHANGE_MAGNITUDE_0
  128.         call    add_color_change_magnitude
  129.         and     edx,0x00FFFFFF
  130.         mcall   38
  131.         sub     ecx,1*65536+1
  132.         dec     esi
  133.         jnz     @r
  134.         popa
  135. ;--------------------------------------
  136. align 4
  137. no_sd:
  138.         movzx   ebx,word [screenxy+2]
  139.         xor     ecx,ecx
  140.         cmp     [soften_up],dword 0
  141.         je      @f
  142.  
  143.         add     ecx,[soften_height]
  144.         rol     ecx,16
  145.         add     ecx,[soften_height]
  146. ;--------------------------------------
  147. align 4
  148. @@:
  149. ;       mov     esi,stripe
  150.         mov     edx,[wcolor]
  151. ;--------------------------------------
  152. align 4
  153. newline3:
  154.         and     edx,0x00FFFFFF
  155.         mov     eax,[height]
  156.         cmp     [soften_up],dword 0
  157.         je      @f
  158.  
  159.         sub     eax,[soften_height]
  160. ;--------------------------------------
  161. align 4
  162. @@:
  163.         cmp     [soften_down],dword 0
  164.         je      @f
  165.  
  166.         sub     eax,[soften_height]
  167. ;--------------------------------------
  168. align 4
  169. @@:
  170.         mov     cx,ax
  171.         inc     ebx
  172.         mcall   13
  173.         ret
  174. ;------------------------------------------------------------------------------
  175. align 4
  176. minimize_left_button:
  177.         cmp     [minimize_left],dword 0
  178.         je      .exit
  179.  
  180.         mov     ecx,1 *65536
  181.         add     ecx,[height]
  182.         dec     ecx
  183.         mov     edx,101
  184. ;       add     edx,[button_frames]
  185.         or      edx,0x40000000
  186.         mcall   8,<0,9>,,,[wcolor]      ; ABS LEFT
  187.  
  188.         mov     ebx,2*65536     ;+6
  189.         mov     bx,[height]
  190.         shr     bx,1
  191.         sub     bx,3
  192. ;       mov     ecx,[wcolor]
  193. ;       add     ecx,0x303030
  194.         mov     edx,[wcolor]
  195.         mov     eax,COLOR_CHANGE_MAGNITUDE_2
  196.         call    add_color_change_magnitude
  197.         mov     ecx,edx
  198.         mcall   4,,,hidetext,1  ; HIDE TEXT
  199. ;--------------------------------------
  200. align 4
  201. .exit:
  202.         ret
  203. ;------------------------------------------------------------------------------
  204. align 4
  205. minimize_right_button:
  206.         cmp     [minimize_right],dword 0
  207.         je      .exit
  208.         mov     eax,[max_x]
  209.         sub     eax,77
  210.         shl     eax,16
  211.         mov     ebx,eax
  212.         add     ebx,67
  213.  
  214.         mov     ecx,1 *65536
  215.         add     ecx,[height]
  216.         dec     ecx
  217.         add     ebx,68*65536
  218.         mov     bx,10 ;9
  219.         mov     edx,102
  220. ;       add     edx,[button_frames]
  221.         or      edx,0x40000000
  222.         mcall   8,,,,[wcolor]   ; ABS RIGHT
  223.  
  224.         mov     ebx,[max_x]
  225.         sub     ebx,6
  226.         shl     ebx,16
  227.         mov     bx,[height]
  228.         shr     bx,1
  229.         sub     bx,3
  230. ;       mov     ecx,[wcolor]
  231. ;       add     ecx,0x303030
  232.         mov     edx,[wcolor]
  233.         mov     eax,COLOR_CHANGE_MAGNITUDE_2
  234.         call    add_color_change_magnitude
  235.         mov     ecx,edx
  236.         mov     esi,1
  237.         mcall   4,,,hidetext+1
  238. ;--------------------------------------
  239. align 4
  240. .exit:
  241.         ret
  242. ;------------------------------------------------------------------------------
  243. align 4
  244. draw_menu_and_clean_desktop:
  245.         pusha
  246. ; check draw for menu
  247.         cmp     [menu_enable],dword  0
  248.         je      no_menu
  249. ; calculate and draw menu
  250.         mov     ebx, (0 shl 16) + MENU_SIZE-3
  251. ; check for left minimize button enabled
  252.         cmp     [minimize_left],dword 0
  253.         je      @f
  254.  
  255.         add     ebx, ML_SIZE shl 16
  256. ;--------------------------------------
  257. align 4
  258. @@:
  259. ;       call    calculate_button_y_coordinate_and_size
  260.         mov     ecx, [height]
  261.         mov     edx, 0x60d1ff01
  262. ;       mov     edx, 0xd1ff01
  263. ;       add     edx, [button_frames]
  264.         mcall   8,,,,[wcolor]   ; MENU BUTTON
  265.        
  266.         mov     eax,ebx
  267.         shr     eax,16
  268.         mov     [menu_button_x.start],eax
  269.        
  270.         mov     eax,ebx
  271.         and     eax,0xffff
  272.         mov     [menu_button_x.size],eax
  273.        
  274.         mov     eax,ecx
  275.         shr     eax,16
  276.         mov     [menu_button_y.start],eax
  277.        
  278.         mov     eax,ecx
  279.         and     eax,0xffff
  280.         mov     [menu_button_y.size],eax
  281.  
  282.         call    calculate_button_y_coordinate_and_size
  283.         mov     edx,[MenuButton_color]  ;0x44aa44
  284.         mov     esi,[wcolor]
  285.         add     ebx,3 shl 16 - 5
  286.         call    draw_appl_button       
  287.  
  288.         add     ebx, 6*65536
  289.         mov     bx,[height]
  290.         shr     bx,1
  291.         sub     bx,3
  292.         mov     ecx,[PanelText_color]
  293.         or      ecx,0x10000000
  294.         if lang eq et
  295.         mcall   4,,,m_text,5
  296.         else
  297.         mcall   4,,,m_text,4
  298.         end if
  299. ;--------------------------------------
  300. align 4
  301. no_menu:
  302. ; check draw for clean desktop button
  303.         cmp     [clean_desktop_enable],dword 0
  304.         je      .exit
  305. ; calculate and draw clean desktop button
  306.         mov     ebx, (0 shl 16) + CLD_SIZE-5
  307. ; check for left minimize button enabled       
  308.         cmp     [minimize_left],dword 0
  309.         je      @f
  310.  
  311.         add     ebx, ML_SIZE shl 16
  312. ;--------------------------------------
  313. align 4
  314. @@:
  315. ; check for menu button enabled
  316.         cmp     [menu_enable],dword 0
  317.         je      @f
  318.        
  319.         add     ebx, MENU_SIZE shl 16
  320. ;--------------------------------------
  321. align 4
  322. @@:
  323. ; Inserted code for drawing buttons 103, 104, 105 (Clean, Restore, Exchange windows)
  324.         mov     esi, dword [system_colours+24]    ; drawing buttons
  325.         and     esi, 0x00ffffff
  326.         mov     edx, 0x60000000 + 103
  327. ;       call    calculate_button_y_coordinate_and_size
  328.         mov     ecx, [height]
  329.         mcall   8       ;,,<3,13>
  330.        
  331.         call    calculate_button_y_coordinate_and_size
  332.         mov     edx,[CleanDesktopButton_color]  ;time_bgr_color
  333.         mov     esi,[wcolor]
  334.         call    draw_appl_button
  335.        
  336. ;       mov     ecx, dword [system_colours+28]
  337. ;       and     ecx, 0x00ffffff
  338.         mov     ecx,[PanelText_color]
  339.         add     ebx,5 shl 16
  340. ;       mov     bx,6
  341.         mov     bx,[height]
  342.         shr     bx,1
  343.         sub     bx,2
  344.         mcall   4,,,page_clean_but,1
  345.         sub     bx,2
  346.         mcall   ,,,page_clean_but+1
  347. ;--------------------------------------
  348. align 4
  349. .exit:
  350.         popa
  351.         ret
  352. ;------------------------------------------------------------------------------
  353. align 4
  354. draw_application_buttons:
  355.         pusha
  356.  
  357.         cmp     [run_appl],dword 0      ; do not draw application buttons
  358.         je      .exit
  359.  
  360.         call    calculate_offset_X
  361.  
  362. ;       mcall   14
  363.         mov     eax,[screenxy]
  364.         shr     eax,16
  365.  
  366.         sub     eax,[offset_X]
  367. ; check for left minimize button enabled
  368.         cmp     [minimize_right],dword 0
  369.         je      @f
  370.  
  371.         sub     eax, MR_SIZE
  372. ;--------------------------------------
  373. align 4
  374. @@:
  375.         cmp     [clock_enable],dword 0
  376.         je      @f
  377.        
  378.         sub     eax,CLOCK_SIZE
  379. ;--------------------------------------
  380. align 4
  381. @@:
  382.         cmp     [cpu_usage_enable],dword 0
  383.         je      @f
  384.        
  385.         sub     eax,CPU_USAGE_SIZE
  386. ;--------------------------------------
  387. align 4
  388. @@:
  389.         cmp     [chlang_enable],dword 0
  390.         je      @f
  391.        
  392.         sub     eax,CHLANG_SIZE
  393. ;--------------------------------------
  394. align 4
  395. @@:
  396.         cmp     [page_list_enable],dword 0
  397.         je      @f
  398.        
  399.         sub     eax,PAGE_LIST_SIZE
  400. ;--------------------------------------
  401. align 4
  402. @@:
  403.         mov     ebx, TAB_SIZE
  404.         xor     edx,edx
  405.         div     ebx
  406.         mov     [max_applications], eax
  407.         xor     edi,edi
  408. ;--------------------------------------
  409. align 4
  410. .nb:
  411.         mov     ebx,edi
  412.         imul    ebx,TAB_SIZE
  413.         add     ebx,[offset_X]
  414.         shl     ebx,16
  415.         mov     bx, TAB_SIZE-1
  416.         mov     edx,edi
  417.         add     edx,52
  418.         or      edx,0x60000000
  419. ;       mov     ecx, 1*65536
  420. ;       add     ecx, [height]
  421. ;       sub     ecx,3
  422.         mov     ecx, [height]
  423.         mcall   8,,,,[wcolor]
  424.  
  425.         inc     edi
  426.         cmp     edi,[max_applications]
  427.         jb      .nb
  428. ;--------------------------------------
  429. align 4
  430. .exit:
  431.         popa
  432.         ret
  433. ;------------------------------------------------------------------------------
  434. align 4
  435. calculate_offset_X:
  436.         push    eax
  437.         xor     eax,eax
  438. ; check for left minimize button enabled
  439.         cmp     [minimize_left],dword 0
  440.         je      @f
  441.  
  442.         add     eax, ML_SIZE
  443. ;--------------------------------------
  444. align 4
  445. @@:    
  446. ; check for menu button enabled
  447.         cmp     [menu_enable],dword 0
  448.         je      @f
  449.        
  450.         add     eax, MENU_SIZE
  451. ;--------------------------------------
  452. align 4
  453. @@:
  454. ; check for clean desktop button enabled
  455.         cmp     [clean_desktop_enable],dword 0
  456.         je      @f
  457.  
  458.         add     eax, CLD_SIZE
  459. ;--------------------------------------
  460. align 4
  461. @@:
  462.         mov     [offset_X],eax
  463.         pop     eax
  464.         ret
  465. ;------------------------------------------------------------------------------
  466.