Subversion Repositories Kolibri OS

Rev

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     edx,[esp]              ; __:_X
  149.         and     edx,15
  150.         add     ebx,10*65536
  151.         add     edx,text
  152.         mcall   4,,0x40ffffff,,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.         sub     edx,[Clock_color]       ;time_bgr_color;[wcolor]
  193.         imul    ecx,edx
  194.         add     ecx,[Clock_color]       ;time_bgr_color;[wcolor]
  195.  
  196.         mcall   4,,,sec,1
  197.  
  198.         call    draw_cpu_usage
  199. ;--------------------------------------
  200. align 4
  201. .exit:
  202.         ret
  203. ;------------------------------------------------------------------------------
  204. align 4
  205. draw_list_button:
  206.         cmp     [page_list_enable],dword 0
  207.         je      .exit
  208. ; draw page list button  "skin"
  209.         mov     ebx,[pos_x_page_list]
  210.         mov     bx,10
  211.        
  212.         mov     ecx,3 shl 16
  213.         add     ecx,[height]
  214.         sub     cx,6
  215.  
  216.         xor     edx,edx
  217. ;       mcall   13
  218.  
  219.         mov     edx,[PageList_color]    ;0xffffff
  220.         mov     esi,[wcolor]
  221.         call    draw_appl_button
  222.        
  223.         add     ebx,24 shl 16 ; 18 shl 16
  224. ;       mcall
  225.  
  226.         mov     edx,[PageList_color]    ;0xffffff
  227.         mov     esi,[wcolor]
  228.         call    draw_appl_button
  229.        
  230. ;       sub     ebx,23 shl 16 ; 19 shl 16
  231. ;       sub     bx,2
  232.  
  233. ;       add     ecx,1 shl 16
  234. ;       sub     ecx,2
  235. ;       mcall   ,,,0xffffff
  236.  
  237. ;       add     ebx,24 shl 16
  238. ;       mcall
  239. ;--------------------------------------
  240. ; draw page list button  text <>
  241.         mov     ebx,[pos_x_page_list]
  242.         add     ebx,2 shl 16
  243.         mov     eax,[height]
  244.         shr     eax,1
  245.         sub     eax,4
  246.         mov     bx,ax
  247.         xor     ecx,ecx
  248.         mcall   4,,,page_a1,5
  249.  
  250.         add     ebx,1 shl 16
  251.         mcall
  252. ;--------------------------------------
  253. ; draw page list number
  254.         mov     edx,ebx
  255.         add     edx,9 shl 16
  256.         mcall   47,0x20000,[page_list],,0xffffff
  257. .exit: 
  258.         ret
  259. ;------------------------------------------------------------------------------
  260. align 4
  261. draw_cpu_usage:
  262.         cmp     [cpu_usage_enable],dword 0
  263.         je      .exit
  264.  
  265.         pushad
  266.         mov     eax,[height]
  267.         sub     eax,[button_top_offset]
  268.         sub     eax,[button_bottom_offset]
  269.         sub     eax,2
  270.        
  271.         mov     [ysi],eax       ;12
  272.         mcall   18,5    ; TSC / SEC
  273.  
  274.         shr     eax,20
  275.         push    eax
  276.         mcall   18,4    ; IDLE / SEC
  277.  
  278.         shr     eax,20
  279.         xor     edx,edx
  280.         imul    eax,[ysi]
  281.         cdq
  282.         pop     ebx
  283.         inc     ebx
  284.         div     ebx
  285.         cmp     eax,[ysi]
  286.         jng     .no_bug
  287.  
  288.         mov     eax,[ysi]
  289. ;--------------------------------------
  290. align 4
  291. .no_bug:
  292.         push    eax
  293.  
  294.         mov     ebx,[pos_x_cpu_usage]
  295.         mov     ecx,[button_top_offset]
  296.         shl     ecx,16
  297.         add     ecx,[ysi]
  298.         add     ecx,2
  299.  
  300.         mov     edx,[CpuUsageBckgr_color]       ;0xdd2222
  301.         mov     esi,[wcolor]
  302.         call    draw_appl_button
  303.  
  304.         pop     eax
  305.  
  306. ;       mov     ecx,4 shl 16
  307.         mov     ecx,[button_top_offset]
  308.         inc     ecx
  309.         shl     ecx,16
  310.         add     ecx,eax
  311.        
  312.        
  313.         add     ebx,1 shl 16
  314.         sub     ebx,2
  315.        
  316.         mcall   13,,,[CpuUsage_color]   ;0x44aa44
  317.  
  318.         popad
  319. .exit:
  320.         ret
  321. ;------------------------------------------------------------------------------
  322. align 4
  323. ; eax = number (1 or 2)
  324. ; ebx = language id
  325. draw_flag:
  326.         cmp     [chlang_enable],dword 0
  327.         je      .exit
  328.  
  329.         cmp     [draw_flag_certainly],0
  330.         je      .exit
  331.  
  332.         pusha
  333. ;--------------------------------------
  334. ; get and draw keyboard layout
  335.         mcall   26,2,9
  336.  
  337.         mov     ebx,eax
  338.  
  339. ;       mov     eax,2
  340.         mov     [type_lang],al
  341. ; eax = 2 BIG
  342. ; eax = 1 small
  343.         mov     edx,ebx
  344.  
  345.         pushad
  346.         mov     ebx,[pos_x_cpu_chlang]
  347.         call    calculate_button_y_coordinate_and_size
  348.  
  349. ;       cmp     [type_lang],1
  350. ;       je      .label_1
  351.  
  352.         mov     edx,[ChangeLang_color]  ;time_bgr_color ;0xff ;[wcolor]
  353. ;       jmp     .label_2
  354. ;--------------------------------------
  355. ;align 4
  356. ;.label_1:
  357. ;       mov     edx,0x7700
  358. ;--------------------------------------
  359. ;align 4
  360. ;.label_2:
  361.         mov     esi,[wcolor]
  362.         call    draw_appl_button
  363.  
  364.         popad
  365.  
  366.         mov     ebx,[pos_x_cpu_chlang]
  367.         mov     ax,bx
  368.         shr     eax,1
  369.         shl     eax,16
  370.         add     ebx,eax
  371.         sub     ebx,6 shl 16
  372.  
  373.         call    calculate_button_y_coordinate_and_size
  374.         movzx   eax,cx
  375.         shr     eax,1
  376.         sub     eax,4
  377.         shr     ecx,16
  378.         add     eax,ecx
  379.         mov     bx,ax
  380.  
  381.         mov     ecx,[bte] ; color
  382.  
  383. if caps_lock_check
  384. ; make flag_text 'enfigerufretua' or 'ENFIGERUFRETUA' depending on CapsLock state.
  385.         call    flag_text_setup
  386. end if
  387.         dec     edx
  388.         shl     edx,1
  389.         add     edx,flag_text
  390.         mcall   4,,,,2
  391.         popa
  392.         mov     [draw_flag_certainly],0
  393. .exit:
  394.         ret
  395. ;------------------------------------------------------------------------------
  396. align 4
  397. if caps_lock_check
  398. flag_text_setup:
  399.         pusha
  400.         mcall   66,3
  401.         mov     edi, flag_text
  402.         mov     esi, flag_text_caps_off
  403.         test    eax, 0x40
  404.         jz      @f
  405.        
  406.         add     esi, 14
  407. ;--------------------------------------
  408. align 4
  409. @@:
  410.         mov     ecx, 14
  411.         rep     movsb
  412.        
  413.         popa
  414.         ret
  415.  
  416. ;flag_text_caps_off db 'enfigerufretua'
  417. flag_text_caps_off:
  418. db 'EnFiGeRuFrEtUa'
  419. db 'ENFIGERUFRETUA'
  420. end if
  421. ;------------------------------------------------------------------------------
  422.