Subversion Repositories Kolibri OS

Rev

Rev 2619 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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