Subversion Repositories Kolibri OS

Rev

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

  1. ;------------------------------------------------------------------------------
  2. align 4
  3. draw_tray:    ; draw cpu usage, time, date etc.
  4.         pusha
  5.  
  6.         call    draw_tray_buttons
  7.         call    draw_time_skin
  8.         call    draw_time
  9.        
  10.         mov     [draw_flag_certainly],1
  11.         call    draw_flag       ; language
  12.  
  13.         call    draw_list_button
  14.  
  15.         popa
  16.         ret
  17. ;------------------------------------------------------------------------------
  18. draw_tray_buttons:
  19.         mov     [offset_x_tray],0
  20.  
  21.         cmp     [minimize_right],dword 0
  22.         je      @f
  23.        
  24.         add     [offset_x_tray],MR_SIZE
  25. ;--------------------------------------
  26. align 4
  27. @@:
  28. ;       mov     ecx,3 shl 16
  29. ;       add     ecx,[height]
  30. ;       sub     cx,6
  31.         mov     ecx,[height]
  32.         mov     esi,[wcolor]
  33.         mov     eax,8
  34. ;--------------------------------------
  35.         cmp     [clock_enable],dword 0
  36.         je      @f
  37.        
  38.         add     [offset_x_tray],CLOCK_SIZE
  39.  
  40.         mov     ebx,[max_x]
  41.         sub     ebx,[offset_x_tray]
  42.         shl     ebx,16
  43.         add     ebx,CLOCK_SIZE+1
  44.         mcall   ,,,0x60000000+2 ; time/date button
  45.         sub     ebx,3
  46.         mov     [pos_x_clock],ebx
  47. ;--------------------------------------
  48. align 4
  49. @@:
  50.         cmp     [cpu_usage_enable],dword 0
  51.         je      @f
  52.        
  53.         add     [offset_x_tray],CPU_USAGE_SIZE
  54.  
  55.         mov     ebx,[max_x]
  56.         sub     ebx,[offset_x_tray]
  57.         shl     ebx,16
  58.         add     ebx,CPU_USAGE_SIZE+1
  59.         mcall   ,,,0x60000000+18        ;button 18 - sysmeter_name (GMON)
  60.         sub     ebx,3
  61.         mov     [pos_x_cpu_usage],ebx
  62. ;--------------------------------------
  63. align 4
  64. @@:
  65.         cmp     [chlang_enable],dword 0
  66.         je      @f
  67.        
  68.         add     [offset_x_tray],CHLANG_SIZE
  69.  
  70.         mov     ebx,[max_x]
  71.         sub     ebx,[offset_x_tray]
  72.         shl     ebx,16
  73.         add     ebx,CHLANG_SIZE+1
  74.         mcall   ,,,0x60000000+16        ;button 16 - chang language
  75.         sub     ebx,3
  76.         mov     [pos_x_cpu_chlang],ebx
  77. ;--------------------------------------
  78. align 4
  79. @@:
  80.         cmp     [page_list_enable],dword 0
  81.         je      @f
  82.        
  83.         add     [offset_x_tray],PAGE_LIST_SIZE
  84.  
  85.         mov     ebx,[max_x]
  86.         sub     ebx,[offset_x_tray]
  87.         shl     ebx,16
  88.         add     ebx,10
  89.         mov     [pos_x_page_list],ebx
  90.         mcall   ,,,0x60000000+22        ;button 22 - page list decrease
  91.        
  92.         add     ebx,24 shl 16
  93.        
  94.         mcall   ,,,0x60000000+21        ;button 21 - page list decrease
  95. ;--------------------------------------
  96. align 4
  97. @@:
  98.         ret
  99. ;------------------------------------------------------------------------------
  100. align 4
  101. draw_time_skin:
  102.         cmp     [clock_enable],dword 0
  103.         je      .exit
  104.        
  105.  
  106.         mov     ebx,[pos_x_clock]
  107.         call    calculate_button_y_coordinate_and_size
  108.        
  109.         mov     edx,[Clock_color]       ;time_bgr_color
  110.         mov     esi,[wcolor]
  111.         call    draw_appl_button
  112. ;--------------------------------------
  113. align 4
  114. .exit:
  115.         ret
  116. ;------------------------------------------------------------------------------
  117. align 4
  118. draw_time:
  119.         cmp     [clock_enable],dword 0
  120.         je      .exit
  121.        
  122.         mcall   3
  123.         cmp     eax,[ptime]
  124.         jz      .exit
  125.  
  126.         mov     [ptime],eax
  127. ;--------------------------------------
  128. ; draw hours and minutes
  129.         movzx   ebx,al
  130.         shr     eax,8
  131.         movzx   ecx,al
  132.         shr     eax,8
  133.         movzx   edx,al
  134. ; ebx ecx edx h m s
  135.         push    ebx
  136.         push    ecx
  137.  
  138.         mov     ebx,[pos_x_clock]
  139.         call    calculate_button_y_coordinate_and_size
  140.         movzx   eax,cx
  141.         shr     eax,1
  142.         sub     eax,4
  143.         shr     ecx,16
  144.         add     eax,ecx
  145.         mov     bx,ax
  146.        
  147.         add     ebx,18 shl 16
  148.        
  149. ;       mov     ecx,[bte]
  150.         mov     ecx,[PanelText_color]
  151.         or      ecx,0x40000000
  152.         mov     edx,[esp]              ; __:_X
  153.         and     edx,15
  154.         add     ebx,10*65536
  155.         add     edx,text
  156.         mcall   4,,,,1,[Clock_color]    ;time_bgr_color
  157.  
  158.         pop     edx                     ; __:X_
  159.         shr     edx,4
  160.         and     edx,15
  161.         sub     ebx,6*65536
  162.         add     edx,text
  163.         mcall  
  164.  
  165.         mov     edx,[esp]              ; _X:__
  166.         and     edx,15
  167.         sub     ebx,11*65536
  168.         add     edx,text
  169.         mcall
  170.  
  171.         pop     edx                     ; X_:__
  172.         shr     edx,4
  173.         and     edx,15
  174.         sub     ebx,6*65536
  175.         add     edx,text
  176.         mcall
  177. ;--------------------------------------
  178. ; draw seconds
  179.         mov     ebx,[pos_x_clock]
  180.         call    calculate_button_y_coordinate_and_size
  181.         movzx   eax,cx
  182.         shr     eax,1
  183.         sub     eax,4
  184.         shr     ecx,16
  185.         add     eax,ecx
  186.         mov     bx,ax
  187.  
  188.         add     ebx,17 shl 16
  189.        
  190.         mcall   3
  191.  
  192.         mov     ecx,eax
  193.         shr     ecx,16
  194.         and     ecx,1
  195. ;       mov     edx,[bte]
  196.         mov     edx,[PanelText_color]
  197.         sub     edx,[Clock_color]       ;time_bgr_color;[wcolor]
  198.         imul    ecx,edx
  199.         add     ecx,[Clock_color]       ;time_bgr_color;[wcolor]
  200.  
  201.         mcall   4,,,sec,1
  202.  
  203.         call    draw_cpu_usage
  204. ;--------------------------------------
  205. align 4
  206. .exit:
  207.         ret
  208. ;------------------------------------------------------------------------------
  209. align 4
  210. draw_list_button:
  211.         cmp     [page_list_enable],dword 0
  212.         je      .exit
  213. ; draw page list button  "skin"
  214.         mov     ebx,[pos_x_page_list]
  215.         mov     bx,10
  216.        
  217.         call    calculate_button_y_coordinate_and_size
  218.  
  219. ;       mov     ecx,3 shl 16
  220. ;       add     ecx,[height]
  221. ;       sub     cx,6
  222.  
  223.         xor     edx,edx
  224. ;       mcall   13
  225.  
  226.         mov     edx,[PageList_color]    ;0xffffff
  227.         mov     esi,[wcolor]
  228.         call    draw_appl_button
  229.        
  230.         add     ebx,24 shl 16 ; 18 shl 16
  231. ;       mcall
  232.  
  233.         mov     edx,[PageList_color]    ;0xffffff
  234.         mov     esi,[wcolor]
  235.         call    draw_appl_button
  236.        
  237. ;       sub     ebx,23 shl 16 ; 19 shl 16
  238. ;       sub     bx,2
  239.  
  240. ;       add     ecx,1 shl 16
  241. ;       sub     ecx,2
  242. ;       mcall   ,,,0xffffff
  243.  
  244. ;       add     ebx,24 shl 16
  245. ;       mcall
  246. ;--------------------------------------
  247. ; draw page list button  text <>
  248.         mov     ebx,[pos_x_page_list]
  249.         add     ebx,2 shl 16
  250. ;       mov     eax,[height]
  251. ;       shr     eax,1
  252. ;       sub     eax,4
  253. ;       mov     bx,ax
  254.  
  255.         call    calculate_button_y_coordinate_and_size
  256.         movzx   eax,cx
  257.         shr     eax,1
  258.         sub     eax,4
  259.         shr     ecx,16
  260.         add     eax,ecx
  261.         mov     bx,ax
  262.  
  263.         xor     ecx,ecx
  264.         mcall   4,,,page_a1,5
  265.  
  266.         add     ebx,1 shl 16
  267.         mcall
  268. ;--------------------------------------
  269. ; draw page list number
  270.         mov     edx,ebx
  271.         add     edx,9 shl 16
  272.         mcall   47,0x20000,[page_list],,[system_colours.work_button_text]
  273. ;--------------------------------------
  274. align 4
  275. .exit: 
  276.         ret
  277. ;------------------------------------------------------------------------------
  278. align 4
  279. draw_cpu_usage:
  280.         cmp     [cpu_usage_enable],dword 0
  281.         je      .exit
  282.  
  283.         pushad
  284.         mov     eax,[height]
  285.         sub     eax,[button_top_offset]
  286.         sub     eax,[button_bottom_offset]
  287.         sub     eax,2
  288.        
  289.         mov     [ysi],eax       ;12
  290.         mcall   18,5    ; TSC / SEC
  291.  
  292.         shr     eax,20
  293.         push    eax
  294.         mcall   18,4    ; IDLE / SEC
  295.  
  296.         shr     eax,20
  297.         xor     edx,edx
  298.         imul    eax,[ysi]
  299.         cdq
  300.         pop     ebx
  301.         inc     ebx
  302.         div     ebx
  303.         cmp     eax,[ysi]
  304.         jng     .no_bug
  305.  
  306.         mov     eax,[ysi]
  307. ;--------------------------------------
  308. align 4
  309. .no_bug:
  310.         push    eax
  311.  
  312.         mov     ebx,[pos_x_cpu_usage]
  313.         mov     ecx,[button_top_offset]
  314.         shl     ecx,16
  315.         add     ecx,[ysi]
  316.         add     ecx,2
  317.  
  318.         mov     edx,[CpuUsageBckgr_color]       ;0xdd2222
  319.         mov     esi,[wcolor]
  320.         call    draw_appl_button
  321.  
  322.         pop     eax
  323.  
  324. ;       mov     ecx,4 shl 16
  325.         mov     ecx,[button_top_offset]
  326.         inc     ecx
  327.         shl     ecx,16
  328.         add     ecx,eax
  329.        
  330.        
  331.         add     ebx,1 shl 16
  332.         sub     ebx,2
  333.        
  334.         mcall   13,,,[CpuUsage_color]   ;0x44aa44
  335.  
  336.         popad
  337. ;--------------------------------------
  338. align 4
  339. .exit:
  340.         ret
  341. ;------------------------------------------------------------------------------
  342. align 4
  343. ; eax = number (1 or 2)
  344. ; ebx = language id
  345. draw_flag:
  346.         cmp     [chlang_enable],dword 0
  347.         je      .exit
  348.  
  349.         cmp     [draw_flag_certainly],0
  350.         je      .exit
  351.  
  352.         pusha
  353. ;--------------------------------------
  354. ; get and draw keyboard layout
  355.         mcall   26,2,9
  356.  
  357.         mov     ebx,eax
  358.  
  359. ;       mov     eax,2
  360.         mov     [type_lang],al
  361. ; eax = 2 BIG
  362. ; eax = 1 small
  363.         mov     edx,ebx
  364.  
  365.         pushad
  366.         mov     ebx,[pos_x_cpu_chlang]
  367.         call    calculate_button_y_coordinate_and_size
  368.  
  369. ;       cmp     [type_lang],1
  370. ;       je      .label_1
  371.  
  372.         mov     edx,[ChangeLang_color]  ;time_bgr_color ;0xff ;[wcolor]
  373. ;       jmp     .label_2
  374. ;--------------------------------------
  375. ;align 4
  376. ;.label_1:
  377. ;       mov     edx,0x7700
  378. ;--------------------------------------
  379. ;align 4
  380. ;.label_2:
  381.         mov     esi,[wcolor]
  382.         call    draw_appl_button
  383.  
  384.         popad
  385.  
  386.         mov     ebx,[pos_x_cpu_chlang]
  387.         mov     ax,bx
  388.         shr     eax,1
  389.         shl     eax,16
  390.         add     ebx,eax
  391.         sub     ebx,6 shl 16
  392.  
  393.         call    calculate_button_y_coordinate_and_size
  394.         movzx   eax,cx
  395.         shr     eax,1
  396.         sub     eax,4
  397.         shr     ecx,16
  398.         add     eax,ecx
  399.         mov     bx,ax
  400.  
  401. ;       mov     ecx,[bte] ; color
  402.         mov     ecx,[PanelText_color]
  403.  
  404. if caps_lock_check
  405. ; make flag_text 'enfigerufretua' or 'ENFIGERUFRETUA' depending on CapsLock state.
  406.         call    flag_text_setup
  407. end if
  408.         dec     edx
  409.         shl     edx,1
  410.         add     edx,flag_text
  411.         mcall   4,,,,2
  412.         popa
  413.         mov     [draw_flag_certainly],0
  414. ;--------------------------------------
  415. align 4
  416. .exit:
  417.         ret
  418. ;------------------------------------------------------------------------------
  419. align 4
  420. if caps_lock_check
  421. flag_text_setup:
  422.         pusha
  423.         mcall   66,3
  424.         mov     edi, flag_text
  425.         mov     esi, flag_text_caps_off
  426.         test    eax, 0x40
  427.         jz      @f
  428.        
  429.         add     esi, 14
  430. ;--------------------------------------
  431. align 4
  432. @@:
  433.         mov     ecx, 14
  434.         rep     movsb
  435.        
  436.         popa
  437.         ret
  438.  
  439. ;flag_text_caps_off db 'enfigerufretua'
  440. flag_text_caps_off:
  441. db 'EnFiGeRuFrEtUa'
  442. db 'ENFIGERUFRETUA'
  443. end if
  444. ;------------------------------------------------------------------------------
  445.