Subversion Repositories Kolibri OS

Rev

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