Subversion Repositories Kolibri OS

Rev

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