Subversion Repositories Kolibri OS

Rev

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

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;                                                   ;
  3. ;   TASK PANEL for KolibriOS  - Compile with fasm   ;
  4. ;                                                   ;
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6. ;------------------------------------------------------------------------------
  7. ; version:      2.24
  8. ; last update:  16/06/2013
  9. ; changed by:   hidnplayr
  10. ; changes:      Changed keymap hotkeys to only use left alt
  11. ;               (Right alt has special function on some keyboards)
  12. ;------------------------------------------------------------------------------
  13. ; version:      2.23
  14. ; last update:  26/04/2012
  15. ; changed by:   Marat Zakiyanov aka Mario79, aka Mario
  16. ; changes:      Using new  f18.23 - minimize all windows
  17. ;------------------------------------------------------------------------------
  18. ; version:      2.22
  19. ; last update:  20/04/2012
  20. ; changed by:   Marat Zakiyanov aka Mario79, aka Mario
  21. ; changes:      Activation mechanism when trying to run an existing appl.
  22. ;               Forced redrawing the background after the clean desktop (Win+D)
  23. ;------------------------------------------------------------------------------
  24. ; version:      2.2
  25. ; last update:  19/04/2012
  26. ; changed by:   Marat Zakiyanov aka Mario79, aka Mario
  27. ; changes:      Support PrintScreen for SCRSHOOT.
  28. ;               Path to run applications from the INI file.
  29. ;               Algorithm anti-duplication of applications for run with hotkey.
  30. ;               Added color selection for the Alt+Tab.
  31. ;               Alt+Ctrl+ArrowLeft - Page list next
  32. ;               Alt+Ctrl+ArrowRight - Page list previous
  33. ;------------------------------------------------------------------------------
  34. ; version:      2.1
  35. ; last update:  18/04/2012
  36. ; changed by:   Marat Zakiyanov aka Mario79, aka Mario
  37. ; changes:      Added color selection for the text.
  38. ;               Show "change page list" only if the applications
  39. ;               does not fit in the panel.
  40. ;               Display file names up to 11 char previously displ. only 8 char.
  41. ;------------------------------------------------------------------------------
  42. ; version:      2.0
  43. ; last update:  17/04/2012
  44. ; changed by:   Marat Zakiyanov aka Mario79, aka Mario
  45. ; changes:      New logic of switching windows (turnoff/restore)
  46. ;               New logic of button "clear desktop".
  47. ;               Win+D (restore/clear desktop), Win+R (start RUN application).
  48. ;               Using the library LibINI to set the parameters.
  49. ;               New style of panel. Start application Menu with boot options.
  50. ;               two versions of the location of the panel -
  51. ;               the bottom of the desktop and on top of the desktop.
  52. ;------------------------------------------------------------------------------
  53. ; last update:  31/03/2012
  54. ; changed by:   Marat Zakiyanov aka Mario79, aka Mario
  55. ; changes:      The program uses only 20 Kb memory is now.
  56. ;               Code optimizing and refactoring.
  57. ;------------------------------------------------------------------------------
  58. format binary as ""
  59.  
  60.         use32
  61.         org 0x0
  62.         db 'MENUET01'   ; 8 byte id
  63.         dd 0x01         ; header version
  64.         dd START        ; program start
  65.         dd IM_END       ; program image size
  66.         dd I_END        ; reguired amount of memory - 10 Kb
  67.         dd stack_top    ; esp
  68.         dd 0x0          ; boot parameters
  69.         dd path         ; application pach
  70. ;------------------------------------------------------------------------------
  71. include 'lang.inc'
  72. include '../../../macros.inc'
  73. include '../../../proc32.inc'
  74. ;include '../../../debug.inc'
  75. include 'MOI.INC'       ;à áª« ¤ª¨ ª« ¢¨ âãàë
  76. include '../../../develop/libraries/box_lib/load_lib.mac'
  77.         @use_library    ;use load lib macros
  78. ;------------------------------------------------------------------------------
  79. caps_lock_check fix 1
  80. ;------------------------------------------------------------------------------
  81. time_bgr_color = 0x66cc
  82. ;PANEL_HEIGHT = 18
  83. ML_SIZE = 10
  84. MR_SIZE = 10
  85. MENU_SIZE = 50
  86. CLD_SIZE = 20
  87. TAB_SIZE = 75   ;60
  88. TRAY_SIZE = 140
  89.  
  90. CLOCK_SIZE = 40
  91. CPU_USAGE_SIZE = 10
  92. CHLANG_SIZE = 20
  93. PAGE_LIST_SIZE = 36
  94. ;------------------------------------------------------------------------------
  95. align 4
  96. handle_key:
  97.         mcall   18,7
  98.         mov     [active_process],eax
  99.  
  100.         mcall   2
  101.        
  102. ;       dps     "panel key: "
  103. ;       dph     eax
  104. ;       newline
  105.  
  106.         cmp     al, 2
  107.         jnz     begin_1.ret
  108.  
  109.         mov     ebx, exec_fileinfo
  110.         shr     eax, 8
  111.         cmp     al, 0
  112.         je      prod
  113.  
  114.         mov     [key_r],al
  115.         sub     [key_r],2
  116.         cmp     al, 2
  117.         jz      alter
  118.  
  119.         cmp     al, 3
  120.         jz      alter
  121.  
  122.         cmp     al, 4
  123.         jz      alter
  124.  
  125.         cmp     al, 5
  126.         jz      alter
  127.  
  128.         cmp     al, 6
  129.         jz      alter
  130.  
  131.         cmp     al, 7
  132.         jz      alter
  133.  
  134.         cmp     al, 8
  135.         jz      alter
  136. ;--------------------------------------
  137. ;align 4
  138. ;prod:
  139. if caps_lock_check
  140.         cmp     al,58   ;CAPS LOCK DOWN
  141.         jne     @f
  142.  
  143.         pusha
  144.         mcall   26,2,9
  145.         mov     ebx,eax
  146.         mov     eax,2
  147. ;       call    draw_window ;;;???
  148.         mov     [draw_flag_certainly],1
  149.         call    draw_flag       ; language
  150.         popa
  151.         ret
  152. @@:
  153. end if
  154.         cmp     al, 15  ; Alt+Tab DOWN
  155.         jz      alt_tab_pressed
  156.  
  157.         cmp     al, 88  ; Ctrl+Alt+F12
  158.         jz      start_end_application
  159.  
  160.        
  161.        
  162.         cmp     al, 91  ; RWin DOWN
  163.         jz      set_win_key_flag
  164.  
  165.         cmp     al, 92  ; LWin DOWN
  166.         jz      set_win_key_flag
  167.        
  168.        
  169.         cmp     al, 219 ; RWin UP
  170.         jz      cut_win_key_flag        ;start_menu_application
  171.  
  172.         cmp     al, 220 ; LWin UP
  173.         jz      cut_win_key_flag        ;start_menu_application
  174.        
  175.  
  176.         cmp     al, 62  ; Alt+F4
  177.         jz      kill_active_application
  178.  
  179.         cmp     al, 205
  180.         jz      page_list_next
  181.  
  182.         cmp     al, 203
  183.         jz      page_list_prev
  184.  
  185.         cmp     al, 69  ; Alt+Shift+NumLock
  186.         jz      start_mousemul_application
  187.        
  188.         cmp     al, 19  ; Win+R
  189.         jz      start_run_application
  190.  
  191.         cmp     al, 32  ; Win+D
  192.         jz      minimize_all_windows
  193.        
  194.         cmp     al, 55  ; PrintScreen DOWN
  195.         jz      start_PrintScreen_application
  196. ;--------------------------------------
  197. align 4
  198. prod:
  199. ;       cmp     eax,0x20000
  200. ;       je      start_menu_application
  201.        
  202. ;       cmp     eax,0x40000
  203. ;       je      start_menu_application
  204.  
  205.         cmp     [current_alt_tab_app], -1
  206.         jz      @f
  207.  
  208.         test    ah, 0x30        ; Alt+Tab UP
  209.         jz      alt_tab_released
  210. ;--------------------------------------
  211. align 4
  212. @@:
  213. ; this is hotkey Ctrl+Shift ;or LShift+RShift
  214.         jmp     karu
  215. ;       mov     ebx, setup_exec
  216. ;       test    ah, 001100b
  217. ;       jz      change_sys_lang
  218. ;------------------------------------------------------------------------------
  219. align 4
  220. set_win_key_flag:
  221.         mov     [win_key_flag],1
  222.         ret
  223. ;------------------------------------------------------------------------------
  224. align 4
  225. cut_win_key_flag:
  226.         xor     eax,eax
  227.         mov     [win_key_flag],al
  228.         xchg    [start_menu_flag],al
  229.         test    al,al
  230.         jz      start_menu_application
  231.         ret
  232. ;------------------------------------------------------------------------------
  233. align 4
  234. change_key_lang:
  235.         mov     dword [ebx+8], chlang
  236.         mcall   70
  237. ;--------------------------------------
  238. align 4
  239. begin_1:
  240.         mov     ecx,[active_process]
  241.         mcall   18, 3
  242.         mcall   5, 25
  243. ;--------------------------------------
  244. align 4
  245. .ret:
  246.         ret
  247. ;------------------------------------------------------------------------------
  248. ;align 4
  249. ;change_sys_lang:
  250. ;       mov        dword [ebx+8], syslang
  251. ;        mcall   70
  252. ;        jmp     begin_1
  253. ;------------------------------------------------------------------------------
  254. align 4
  255. start_end_application:
  256.         mov     esi,end_name
  257.         call    algorithm_anti_duplication
  258.         test    eax,eax
  259.         jz      @f
  260.  
  261.         mcall   18,3,edi
  262.         ret
  263. ;--------------------------------------
  264. align 4
  265. @@:
  266.         mov     ebx, exec_fileinfo
  267.         mov     dword [ebx+21],end_name
  268.         mcall   70
  269.         ret
  270. ;------------------------------------------------------------------------------
  271. align 4
  272. start_mousemul_application:
  273.         mov     esi,mousemul_name
  274.         call    algorithm_anti_duplication
  275.         test    eax,eax
  276.         jz      @f
  277.         ret
  278. ;--------------------------------------
  279. align 4
  280. @@:
  281.         mov     ebx, exec_fileinfo
  282.         mov     dword [ebx+21],mousemul_name
  283.         mcall   70
  284.         ret
  285. ;------------------------------------------------------------------------------
  286. align 4
  287. kill_active_application:
  288.         mcall   72,1,3,1
  289.         jmp     begin_1.ret
  290. ;------------------------------------------------------------------------------
  291.  
  292. align 4
  293. start_menu_application:
  294.         call    menu_handler
  295.         jmp     begin_1.ret
  296. ;------------------------------------------------------------------------------
  297. align 4
  298. start_run_application:
  299.         cmp     [win_key_flag],1
  300.         je      @f
  301.         ret
  302. ;--------------------------------------
  303. align 4
  304. @@:
  305.         mov     [start_menu_flag],1
  306.        
  307.         mov     esi,run_name
  308.         call    algorithm_anti_duplication
  309.         test    eax,eax
  310.         jz      @f
  311.  
  312.         mcall   18,3,edi
  313.         ret
  314. ;--------------------------------------
  315. align 4
  316. @@:
  317.         mov     ebx, exec_fileinfo
  318.         mov     dword [ebx+21], run_name
  319.         mcall   70
  320.         jmp     begin_1.ret
  321. ;------------------------------------------------------------------------------
  322. align 4
  323. start_PrintScreen_application:
  324.         mov     esi,printscreen_name
  325.         call    algorithm_anti_duplication
  326.         test    eax,eax
  327.         jz      @f
  328.         mcall   18,3,edi
  329.         ret
  330. ;--------------------------------------
  331. align 4
  332. @@:
  333.         mov     ebx, exec_fileinfo
  334.         mov     dword [ebx+21],printscreen_name
  335.         mov     [ebx+8],dword bootparam_printscreen
  336.         mcall   70
  337.         jmp     begin_1.ret
  338. ;------------------------------------------------------------------------------
  339. align 4
  340. minimize_all_windows:
  341.         cmp     [win_key_flag],1
  342.         je      @f
  343.         ret
  344. ;--------------------------------------
  345. align 4
  346. @@:
  347.         mov     [start_menu_flag],1
  348.         call    clean_desktop
  349.         ret
  350. ;------------------------------------------------------------------------------
  351. align 4
  352. algorithm_anti_duplication:
  353.         cld
  354. ;--------------------------------------
  355. align 4
  356. @@:
  357.         lodsb
  358.         test    al,al
  359.         jnz     @r
  360. ;--------------------------------------
  361. align 4
  362. @@:
  363.         std
  364.         lodsb
  365.         cmp     al,'/'
  366.         jnz     @r
  367.         add     esi,2
  368.         mov     edx,esi
  369.        
  370.         mov     edi,1
  371. ;--------------------------------------
  372. align 4
  373. @@:
  374.         inc     edi
  375.         mov     ecx,edi
  376.         mcall   9,procinfo_window_tabs
  377.  
  378.         cmp     edi,eax
  379.         jg      .apply_changes
  380.  
  381. ;       mov     eax,[ebx+10]
  382. ;       and     eax,not 20202020h
  383. ;       cmp     eax,'SCRS'
  384. ;       jz      @f
  385.        
  386. ;       mov     eax,[ebx+14]
  387. ;       and     eax,not 20202020h
  388. ;       cmp     eax,'HOOT'
  389. ;       jne     @r
  390.         mov     esi,edx
  391.         mov     ecx,11
  392.         add     ebx,9
  393.         cld
  394. ;--------------------------------------
  395. align 4
  396. .loop:
  397.         lodsb
  398.         inc     ebx
  399.         cmp     al,[ebx]
  400.         jne     @r
  401.  
  402.         loop    .loop
  403.  
  404.         mov     eax,1
  405.         ret
  406. ;--------------------------------------
  407. align 4
  408. .apply_changes:
  409.         xor     eax,eax
  410.         ret
  411. ;------------------------------------------------------------------------------
  412. align 4
  413. page_list_next:
  414.         cmp     [page_list],50
  415.         je      @f
  416.  
  417.         xor     eax,eax
  418.         cmp     [page_list_enable],eax
  419.         je      @f
  420.  
  421.         inc     [page_list]
  422.         mov     [redraw_window_flag],1
  423. ;--------------------------------------
  424. align 4
  425. @@:
  426.         jmp     begin_1.ret
  427. ;------------------------------------------------------------------------------
  428. align 4
  429. page_list_prev:
  430.         xor     eax,eax
  431.         cmp     [page_list],eax
  432.         je      @f
  433.  
  434.         cmp     [page_list_enable],eax
  435.         je      @f
  436.  
  437.         dec     [page_list]
  438.         mov     [redraw_window_flag],1
  439. ;--------------------------------------
  440. align 4
  441. @@:
  442.         jmp     begin_1.ret
  443. ;------------------------------------------------------------------------------
  444. align 4
  445. alt_tab_pressed:
  446. ; handle Alt+Tab and Alt+Shift+Tab
  447.         mov     ebp, eax
  448.         cmp     [current_alt_tab_app], -1
  449.         jnz     has_alt_tab_app
  450. ; § ¯®«­ï¥¬ â ¡«¨æ㠯ਫ®¦¥­¨©, ¯®¤«¥¦ é¨å ¯¥à¥ª«î祭¨î
  451.         xor     edx, edx
  452.         mov     ebx, procinfo_window_tabs
  453.         mov     ecx, 1
  454. ;--------------------------------------
  455. align 4
  456. .fill:
  457.         inc     ecx
  458.         mcall   9
  459.         call    need_window_tab
  460.         jz      @f
  461.  
  462.         cmp     edx, 256
  463.         jz      @f
  464.  
  465.         mov     [alt_tab_list+edx*8], ecx
  466.         movzx   esi, word [ebx+4]
  467.         mov     [alt_tab_list+edx*8+4], esi
  468.         inc     edx
  469. ;--------------------------------------
  470. align 4
  471. @@:
  472.         cmp     ecx,eax
  473.         jb      .fill
  474.  
  475.         mov     [alt_tab_list_size], edx
  476.         test    edx, edx
  477.         jz      begin_1.ret
  478.  
  479.         mcall   66,4,0,0        ; «®¢¨¬ ¬®¬¥­â ®â¯ã᪠­¨ï ¢á¥å ã¯à ¢«ïîé¨å ª« ¢¨è
  480.         test    eax, eax
  481.         jnz     begin_1.ret
  482.  
  483.         xor     edx, edx
  484.         mov     eax, [alt_tab_list+4]
  485.         xor     ecx, ecx
  486.         inc     ecx
  487. ;--------------------------------------
  488. align 4
  489. .findmax:
  490.         cmp     [alt_tab_list+ecx*8+4], eax
  491.         jb      @f
  492.  
  493.         mov     edx, ecx
  494.         mov     eax, [alt_tab_list+ecx*8+4]
  495. ;--------------------------------------
  496. align 4
  497. @@:
  498.         inc     ecx
  499.         cmp     ecx, [alt_tab_list_size]
  500.         jb      .findmax
  501.  
  502.         mov     [current_alt_tab_app], edx
  503. ;--------------------------------------
  504. align 4
  505. has_alt_tab_app:
  506.         mov     eax, [current_alt_tab_app]
  507.         mov     edx, [alt_tab_list+eax*8+4]     ; slot
  508.         xor     ecx, ecx
  509.         or      eax, -1
  510.         test    ebp, 300h
  511.         jz      .notshift
  512.  
  513.         or      esi, -1
  514. ;--------------------------------------
  515. align 4
  516. .loop1:
  517.         cmp     [alt_tab_list+ecx*8+4], edx
  518.         jbe     @f
  519.  
  520.         cmp     [alt_tab_list+ecx*8+4], esi
  521.         jae     @f
  522.  
  523.         mov     eax, ecx
  524.         mov     esi, [alt_tab_list+ecx*8+4]
  525. ;--------------------------------------
  526. align 4
  527. @@:
  528.         inc     ecx
  529.         cmp     ecx, [alt_tab_list_size]
  530.         jb      .loop1
  531.  
  532.         cmp     eax, -1
  533.         jnz     .found
  534.  
  535.         xor     edx, edx
  536.         xor     ecx, ecx
  537.         jmp     .loop1
  538. ;--------------------------------------
  539. align 4
  540. .notshift:
  541.         xor     esi, esi
  542. ;--------------------------------------
  543. align 4
  544. .loop2:
  545.         cmp     [alt_tab_list+ecx*8+4], edx
  546.         jae     @f
  547.  
  548.         cmp     [alt_tab_list+ecx*8+4], esi
  549.         jbe     @f
  550.  
  551.         mov     eax, ecx
  552.         mov     esi, [alt_tab_list+ecx*8+4]
  553. ;--------------------------------------
  554. align 4
  555. @@:
  556.         inc     ecx
  557.         cmp     ecx, [alt_tab_list_size]
  558.         jb      .loop2
  559.  
  560.         cmp     eax, -1
  561.         jnz     .found
  562.  
  563.         or      edx, -1
  564.         xor     ecx, ecx
  565.         jmp     .loop2
  566. ;--------------------------------------
  567. align 4
  568. .found:
  569.         mov     [current_alt_tab_app], eax
  570.         push    eax
  571.         xor     edx, edx
  572.         div     [max_applications]
  573.         mov     [page_list], eax
  574.         mov     edi, app_list
  575.         push    edi
  576.         mov     ecx, 20
  577.         or      eax, -1
  578.         rep     stosd
  579.         pop     edi
  580.         pop     ecx
  581.         sub     ecx, edx
  582. ;--------------------------------------
  583. align 4
  584. @@:
  585.         cmp     ecx, [alt_tab_list_size]
  586.         jae     redraw_window_tabs
  587.  
  588.         mov     eax, [alt_tab_list+ecx*8]
  589.         stosd
  590.         inc     ecx
  591.         jmp     @b
  592. ;--------------------------------------
  593. align 4
  594. alt_tab_released:
  595.         mcall   66,5,0,0        ; 㦥 ¯®©¬ «¨, 墠â¨â :)
  596.  
  597.         or      eax, -1
  598.         xchg    eax, [current_alt_tab_app]
  599.         mov     ecx, [alt_tab_list+eax*8]
  600.         mcall   18,3
  601.  
  602.         jmp     redraw_window_tabs
  603. ;------------------------------------------------------------------------------
  604. align 4
  605. active_process  dd 0
  606.  
  607. exit:
  608.         mcall -1
  609. ;------------------------------------------------------------------------------
  610. START:
  611.         mcall   68,11
  612.         mcall   66,1,1
  613.        
  614.         mcall   9,process_info_buffer,-1
  615.         mov     ecx,[ebx+30]    ; PID
  616.         mcall   18,21
  617.         mov     [my_active_slot],eax    ; WINDOW SLOT
  618.        
  619.        
  620. load_libraries l_libs_start,end_l_libs
  621.  
  622.         test    eax,eax
  623.         jnz     exit
  624.  
  625.         call    Get_ini
  626.  
  627.         mcall   48,1,[button_style]
  628.        
  629.         mcall   66,4,0,2        ; LShift+RShift
  630.         mcall   66,,,11h        ; Ctrl+Shift
  631.         mcall   66,,88,110h     ; Alt+Ctrl+F12
  632. ;       mcall   66,,75          ; Alt+Ctrl+ArrowLeft DOWN
  633.         mcall   66,,203         ; Alt+Ctrl+ArrowLeft UP
  634. ;       mcall   66,,77          ; Alt+Ctrl+ArrowRight DOWN
  635.         mcall   66,,205         ; Alt+Ctrl+ArrowRight UP
  636.        
  637.         mcall   66,,91,0h       ; RWin DOWN
  638.         mcall   66,,92          ; LWin DOWN
  639.         mcall   66,,219         ; RWin UP
  640.         mcall   66,,220         ; LWin UP
  641.  
  642. ;       mcall   66,,147,0h      ; Win+R UP
  643.         mcall   66,,19,0h       ; Win+R DOWN
  644.  
  645. ;       mcall   66,,23,0h       ; Win+I DOWN
  646.  
  647.         mcall   66,,32,0h       ; Win+D DOWN
  648. ;       mcall   66,,160,0h      ; Win+D UP
  649.  
  650.         mcall   66,,55,10h      ; Ctrl+PrintScreen DOWN
  651. ;       mcall   66,,183,10h      ; Ctrl+PrintScreen UP
  652.  
  653.  
  654. ;       mcall   66,,91,100h     ; Alt+LWin
  655. ;       mcall   66,,92          ; Alt+RWin
  656.         mcall   66,,62,300h     ; Alt+F4
  657. ;       mcall   66,,71          ; Alt+Home
  658. ;       mcall   66,,72          ; Alt+Up
  659.         mcall   66,,2           ; Alt+1
  660.         mcall   66,,3           ; Alt+2
  661.         mcall   66,,4           ; Alt+3
  662.         mcall   66,,5           ; Alt+4
  663.         mcall   66,,6           ; Alt+5
  664.         mcall   66,,7           ; Alt+6
  665.         mcall   66,,8           ; Alt+7
  666.         mcall   66,,15          ; Alt+Tab DOWN
  667.         mcall   66,,15,301h     ; Alt+Shift+Tab DOWN
  668.         mcall   66,,69          ; Alt+Shift+NumLock
  669.  
  670. if caps_lock_check
  671.         xor     edx,edx
  672.         mcall   66,4,58
  673. end if
  674.         mcall   14
  675.         mov     [screen_size],eax
  676.  
  677.        
  678.         mov     ecx,eax
  679. ;eax = [xsize]*65536 + [ysize], £¤¥
  680.         shr     ecx,16
  681.         and     eax,0xFFFF
  682.        
  683.         cmp     [place_attachment],1
  684.         je      @f
  685.         ror     eax,16
  686.         add     eax,[height]
  687.         rol     eax,16
  688.         mov     edx,eax
  689.         jmp     .selected
  690. ;--------------------------------------
  691. align 4
  692. @@:
  693.         sub     eax,[height]
  694.         mov     edx, eax
  695. ;--------------------------------------
  696. align 4
  697. .selected:
  698.         mcall   48,6
  699.  
  700.         mcall   9,process_info_buffer,-1
  701.         mov     ecx,[process_info_buffer+30]
  702.         mcall   18,21
  703.         mov     [this_slot],eax
  704.         mov     [max_slot],255
  705. ;--------------------------------------
  706. align 4
  707. start_after_minimize:
  708.         call    draw_window
  709. ;       call    draw_tray
  710.         call    draw_running_applications
  711.  
  712.         mcall   23,30
  713.         call    load_ini
  714.         call    fir_lng
  715. ;------------------------------------------------------------------------------
  716. align 4
  717. still:
  718. ;       call    draw_tray
  719.         call    draw_time
  720.         call    draw_cpu_usage
  721.         call    draw_running_applications
  722.  
  723.         mcall   18,7    ; check if active window changed
  724.         cmp     eax, [last_active_window]
  725.         jz      @f
  726. ; need_window_tab:
  727. ; in: ebx->process info
  728. ; out: ZF set <=> do not draw
  729.         mov     ebx,[last_active_window]
  730.         mov     [prev_active_window], ebx
  731.         mov     [last_active_window], eax
  732.  
  733.         mov     ecx, eax
  734.         mcall   9,process_info_buffer
  735.  
  736.         call    need_window_tab
  737.         jnz     .need_repaint
  738.  
  739.         mcall   9,process_info_buffer,[prev_active_window]
  740.         call    need_window_tab
  741.         jz      @f
  742. ;--------------------------------------
  743. align 4
  744. .need_repaint:
  745.         mov     dword [active_window_changed], 1
  746. ;--------------------------------------
  747. align 4
  748. @@:
  749.         mcall   23,20
  750.        
  751.         push    eax
  752.         mcall   18,7
  753.         cmp     [my_active_slot],eax
  754.         je      @f
  755.  
  756.         mov     [current_active_slot],eax
  757. ;--------------------------------------
  758. align 4
  759. @@:
  760.         pop     eax
  761.        
  762.         cmp     eax,1           ; redraw ?
  763.         jz      red
  764.  
  765.         push    eax
  766.         mov     eax,[redraw_window_flag]
  767.         test    eax,eax
  768.         jz      @f
  769.  
  770.         call    draw_window
  771. ;--------------------------------------
  772. align 4
  773. @@:
  774.         pop     eax
  775.        
  776.         cmp     eax,2
  777.         jnz     @f
  778.         call    handle_key
  779.         jmp     .key
  780. ;--------------------------------------
  781. align 4
  782. @@:
  783.         cmp     eax,3           ; button ?
  784.         jz      button
  785.  
  786. ;       call    handle_key
  787. ;--------------------------------------
  788. align 4
  789. .key:
  790.         cmp     dword [active_window_changed], 0
  791.         jnz     red_active
  792.  
  793.         call    draw_flag       ; language
  794.         jmp     still
  795. ;------------------------------------------------------------------------------
  796. align 4
  797. red_active:
  798. red:
  799.         mov     dword [active_window_changed], 0
  800.  
  801.         mcall   14
  802.         movzx   ecx,ax
  803.         mov     edx,eax
  804.         shr     edx,16
  805.         cmp     [screen_size.height],ax
  806.         jne     @f
  807.  
  808.         rol     eax,16
  809.         cmp     [screen_size.width],ax
  810.         je      .lp1
  811.  
  812.         rol     eax,16
  813. ;--------------------------------------
  814. align 4
  815. @@:
  816.         mov     [screen_size],eax
  817.         sub     ecx,[height]
  818.         mcall   67,0,,,[height]
  819. ;--------------------------------------
  820. align 4
  821. .lp1:
  822.         call    draw_window
  823. ;       call    draw_tray
  824.         jmp     still
  825. ;------------------------------------------------------------------------------
  826. align 4
  827. button:
  828.         mcall   17
  829.         test    eax,0xfffffe00  ; is it close button? (signal from @panel)
  830.         jz      still           ; if so - wait for another event, because @panel shouldn't be closed
  831.  
  832.         cmp     al, 0
  833.         jnz     right_mouse
  834.  
  835.         cmp     ah,50
  836.         jb      no_activate
  837.         cmp     ah,70
  838.         jg      no_activate
  839.  
  840.         movzx   ecx,byte ah
  841.         sub     ecx,52
  842.         shl     ecx,2
  843.  
  844.         mov     ecx,[app_list+ecx]
  845.        
  846.         mcall   9,process_info_buffer
  847.  
  848.         test    [ebx+70],dword 10b      ; window is minimized to panel
  849.         jnz     @f
  850.  
  851.         cmp     ecx,[current_active_slot]
  852.         je      .turn_off
  853. ;--------------------------------------
  854. align 4
  855. @@:
  856.         mcall   18,3,
  857.         jmp     .task_switching
  858. ;--------------------------------------
  859. align 4
  860. .turn_off:
  861.         mov     edx,ecx
  862.         mcall   18,22,0
  863. ;--------------------------------------
  864. align 4
  865. .task_switching:
  866.         mcall   68,1
  867.         jmp     still  
  868. ;------------------------------------------------------------------------------
  869. align 4
  870. right_mouse:
  871.         cmp     ah,50
  872.         jb      still
  873.  
  874.         cmp     ah,70
  875.         jg      still
  876.  
  877.         movzx   ecx,byte ah
  878.         sub     ecx,52
  879.  
  880.         cmp     ecx, [app_tab_count]
  881.         jge     still
  882.  
  883.         shl     ecx,2
  884.         mcall   37,0
  885.         mov     ebx, eax
  886.         shr     eax, 16
  887.         mov     [x_coord], ax
  888.         and     ebx, 0xFFFF
  889.         mov     [y_coord], bx
  890.  
  891.         mov     ecx,[app_list+ecx]      ; ecx->selected app.slot
  892.         mov     [n_slot], ecx
  893.         mcall   9,procinfo_for_detect
  894.  
  895.         mcall   51,1,context_menu_start,ctx_menu_stack
  896.  
  897.         mov     [ctx_menu_PID], eax
  898.         jmp     still
  899. ;------------------------------------------------------------------------------
  900. align 4
  901. no_activate:
  902.         cmp     ah,101    ; minimize to left
  903.         je      left_button
  904.  
  905.         cmp     ah,102    ; minimize to right
  906.         je      right_button
  907.  
  908.         cmp     ah, 103
  909.         je      clean_desktop_1             ; minimize all windows
  910.  
  911. ;       cmp     ah, 104
  912. ;       je      restore_desktop     ; restore minimized windows
  913.  
  914. ;       cmp     ah, 105
  915. ;       je      swap_minimized_desktop     ; minimize normal windows, and restore minimized windows
  916.  
  917.         cmp     ah,byte 1         ; start/terminate menu
  918.         jnz     noselect
  919.  
  920.         call    menu_handler
  921.  
  922.         jmp     still
  923. ;--------------------------------------
  924. align 4
  925. clean_desktop_1:
  926.         call    clean_desktop  
  927.         jmp     still
  928. ;--------------------------------------
  929. align 4
  930. noselect:
  931.         mov     ebx, exec_fileinfo
  932.         cmp     ah,byte 2              ; start calendar
  933.         jnz     noid15  ;noclock
  934.  
  935.         mov     esi,calendar_name
  936.         call    algorithm_anti_duplication
  937.         test    eax,eax
  938.         jz      @f
  939.  
  940.         mcall   18,3,edi       
  941.         jmp     still
  942. ;--------------------------------------
  943. align 4
  944. @@:
  945.         mov     ebx, exec_fileinfo
  946.         mov     dword [ebx+21], calendar_name
  947.         mcall   70
  948.         jmp     still
  949. ;--------------------------------------
  950. align 4
  951. noid15:
  952.         cmp     ah,16
  953.         jne     noid16
  954.  
  955. ;       mov     ebx, setup_exec
  956. ;       mov     dword [ebx+8], chlang
  957. ;       mcall   70
  958.         call    karu
  959.         call    draw_flag       ; language
  960.         jmp     still
  961. ;--------------------------------------
  962. align 4
  963. noid16:
  964. ;       cmp     ah,17
  965. ;       jne     noid17
  966. ;
  967. ;       mov     ebx, setup_exec
  968. ;       mov     dword [ebx+8], syslang
  969. ;       mcall   70
  970. ;       jmp     still
  971. ;--------------------------------------
  972. ;align 4        
  973. ;  noid17:
  974.         cmp     ah,18
  975.         jne     noid18
  976.  
  977.         mov     esi,sysmeter_name
  978.         call    algorithm_anti_duplication
  979.         test    eax,eax
  980.         jz      @f
  981.  
  982.         mcall   18,3,edi
  983.         jmp     still
  984. ;--------------------------------------
  985. align 4
  986. @@:
  987.         mov     ebx, exec_fileinfo
  988.         mov     dword [ebx+21], sysmeter_name
  989.         mcall   70
  990.         jmp     still
  991. ;--------------------------------------
  992. align 4
  993. noid18:
  994. ;       cmp     ah,19   ; speaker
  995. ;       jne     noid19
  996.  
  997. ;       mcall   18,8,2
  998. ;       mcall   15,3
  999. ;       jmp     red
  1000. ;--------------------------------------
  1001. ;align 4        
  1002. ;noid19:
  1003. ;       cmp     ah,20              ; start system setup
  1004. ;       jnz     noid20
  1005. ;
  1006. ;       mov     ebx, setup_exec
  1007. ;       and     dword [ebx+8], 0
  1008. ;       mcall   70
  1009. ;       jmp     still
  1010. ;--------------------------------------
  1011. ;align 4        
  1012. ;noid20:
  1013.         cmp     ah,21
  1014.         jnz     noid21
  1015.  
  1016.         cmp     [page_list],50
  1017.         jnc     still
  1018.         inc     [page_list]
  1019.         jmp     red
  1020. ;--------------------------------------
  1021. align 4
  1022. noid21:
  1023.         cmp     ah,22
  1024.         jnz     still
  1025.  
  1026.         cmp     [page_list],0
  1027.         je      still
  1028.  
  1029.         dec     [page_list]
  1030.         jmp     red
  1031. ;------------------------------------------------------------------------------
  1032. align 4
  1033. restore_desktop:
  1034.         mcall   9,process_info_buffer,-1
  1035.         mov     [max_slot], eax
  1036.         mov     ecx, 2
  1037.         mov     edx, 2
  1038. ;--------------------------------------
  1039. align 4
  1040. @@:
  1041.         mcall   18, 22
  1042.         inc     edx
  1043.         cmp     edx, [max_slot]
  1044.         jbe     @b
  1045.         ret
  1046. ;------------------------------------------------------------------------------
  1047. align 4
  1048. clean_desktop:
  1049.         mcall   18,23
  1050.         test    eax,eax
  1051.         jnz     @f
  1052.         call    restore_desktop
  1053. ;--------------------------------------
  1054. align 4
  1055. @@:
  1056.         ret
  1057. ;------------------------------------------------------------------------------
  1058. align 4
  1059. conversion_HEX_to_ASCII:
  1060.         ror     eax,12
  1061.         mov     ecx,4
  1062. ;--------------------------------------
  1063. align 4
  1064. .loop:
  1065.         mov     bl,al
  1066.         rol     eax,4
  1067.         and     bl,0xf
  1068.         cmp     bl,0xA  ; check for ABCDEF
  1069.         jae     @f
  1070.  
  1071.         add     bl,0x30 ; 0-9
  1072.         jmp     .store
  1073. ;--------------------------------------
  1074. align 4
  1075. @@:
  1076.         add     bl,0x57 ; A-F
  1077. ;--------------------------------------
  1078. align 4
  1079. .store:
  1080. ;       dps     "param_store: "
  1081.         mov     [edi],bl
  1082.         inc     edi
  1083.         dec     ecx
  1084.         jnz     .loop
  1085.         ret
  1086. ;------------------------------------------------------------------------------
  1087. align 4
  1088. menu_handler:
  1089.         mov     edi,bootparam
  1090.        
  1091.         mov     eax,[menu_button_x.start]
  1092.         call    conversion_HEX_to_ASCII
  1093.  
  1094.         mov     eax,[menu_button_x.size]
  1095.         call    conversion_HEX_to_ASCII
  1096.        
  1097.         mov     eax,[menu_button_y.start]
  1098.         call    conversion_HEX_to_ASCII
  1099.        
  1100.         mov     eax,[menu_button_y.size]
  1101.         call    conversion_HEX_to_ASCII
  1102.        
  1103.         mov     eax,[height]
  1104.         call    conversion_HEX_to_ASCII
  1105.        
  1106.         mov     eax,[place_attachment]
  1107.         call    conversion_HEX_to_ASCII
  1108.        
  1109.         xor     eax,eax ; terminator for boot parameters string
  1110.         stosd
  1111.        
  1112.         mov     ebx, exec_fileinfo
  1113.         mov     [ebx+21],dword menu_name
  1114.         mov     [ebx+8],dword bootparam
  1115.         mcall   70
  1116.         mov     [ebx+8],dword 0
  1117.         ret
  1118. ;------------------------------------------------------------------------------
  1119. align 4
  1120. draw_small_right:
  1121.         pusha
  1122.         mcall   12,1
  1123.  
  1124.         xor     eax,eax
  1125.         mov     edx,[wcolor]
  1126.         mov     esi,edx
  1127.         mov     edi,edx
  1128.         or      edx, 0x01000000
  1129.         mcall
  1130.  
  1131.         xor     ecx,ecx
  1132.         mov     cx,[height]
  1133.         mcall   8,<0,10>,,1,[wcolor]
  1134.  
  1135.         mov     ebx,2*65536     ;+6
  1136.         mov     bx,[height]
  1137.         shr     bx,1
  1138.         sub     bx,3
  1139. ;       mov     ecx,[wcolor]
  1140. ;       add     ecx,0x303030
  1141.         mov     edx,[wcolor]
  1142.         mov     eax,COLOR_CHANGE_MAGNITUDE_2
  1143.         call    add_color_change_magnitude
  1144.         mov     ecx,edx
  1145.         mcall   4,,,hidetext,1
  1146.  
  1147.         mcall   12,2
  1148.         popa
  1149.         ret
  1150. ;------------------------------------------------------------------------------
  1151. align 4
  1152. draw_small_left:
  1153.         pusha
  1154.         mcall   12,1
  1155.  
  1156.         xor     eax,eax
  1157.         mov     edx,[wcolor]
  1158.         mov     esi,edx
  1159.         mov     edi,edx
  1160.         or      edx, 0x01000000
  1161.         mcall
  1162.  
  1163.         xor     ecx,ecx
  1164.         mov     cx,[height]
  1165.         mcall   8,<0,9>,,1,[wcolor]
  1166.  
  1167.         mov     ebx,3*65536     ;+6
  1168.         mov     bx,[height]
  1169.         shr     bx,1
  1170.         sub     bx,3
  1171. ;       mov     ecx,[wcolor]
  1172. ;       add     ecx,0x303030
  1173.         mov     edx,[wcolor]
  1174.         mov     eax,COLOR_CHANGE_MAGNITUDE_2
  1175.         call    add_color_change_magnitude
  1176.         mov     ecx,edx
  1177.         mcall   4,,,hidetext+1,1
  1178.  
  1179.         mcall   12,2
  1180.         popa
  1181.         ret
  1182. ;------------------------------------------------------------------------------
  1183. align 4
  1184. right_button:
  1185.         mov     [small_draw],dword draw_small_right
  1186.  
  1187.         mcall   14
  1188.  
  1189.         shr     eax, 16
  1190.         mov     ebx, eax
  1191.         mov     ecx, -1
  1192.         mov     edx, 9
  1193.         sub     ebx, edx
  1194.         mov     esi, -1
  1195.         mcall   67
  1196.  
  1197.         call    draw_small_right
  1198.         jmp     small_wait
  1199. ;------------------------------------------------------------------------------
  1200. align 4
  1201. left_button:
  1202.         mov     [small_draw],dword draw_small_left
  1203.  
  1204.         xor     ebx,ebx
  1205.         mcall   67,,-1,9,-1
  1206.  
  1207.         call    draw_small_left
  1208. ;--------------------------------------
  1209. align 4
  1210. small_wait:
  1211.         mcall   10
  1212.         cmp     eax,1
  1213.         jne     no_win
  1214.  
  1215.         call    [small_draw]
  1216.         jmp     small_wait
  1217. ;--------------------------------------
  1218. align 4
  1219. no_win:
  1220.         cmp     eax,2
  1221.         jne     no_key
  1222.  
  1223.         call    handle_key
  1224.         jmp     small_wait
  1225. ;--------------------------------------
  1226. align 4
  1227. no_key:
  1228.         mcall   17
  1229.         cmp     ah,1
  1230.         jne     no_full
  1231.  
  1232.         mcall   14      ; get screen max x & max y
  1233.  
  1234.         mov     edx, eax
  1235.         shr     edx, 16
  1236.         xor     ebx, ebx
  1237.         mcall   67,,-1,,-1 ; x0 y0 xs ys
  1238.  
  1239.         jmp     still
  1240. ;--------------------------------------
  1241. align 4
  1242. no_full:
  1243.         call    menu_handler
  1244.         jmp     small_wait
  1245. ;------------------------------------------------------------------------------
  1246. include 'libini.inc'
  1247. ;------------------------------------------------------------------------------
  1248. include '../../../dll.inc'
  1249. ;------------------------------------------------------------------------------
  1250. include 'drawappl.inc'
  1251. ;------------------------------------------------------------------------------
  1252. include 'drawbutt.inc'
  1253. ;------------------------------------------------------------------------------
  1254. include 'drawwind.inc'
  1255. ;------------------------------------------------------------------------------
  1256. include 'drawtray.inc'
  1257. ;------------------------------------------------------------------------------
  1258. include 'ctx_menu.asm'
  1259. ;------------------------------------------------------------------------------
  1260. include 'i_data.inc'
  1261. ;------------------------------------------------------------------------------
  1262. IM_END:
  1263. ;------------------------------------------------------------------------------
  1264. include 'u_data.inc'
  1265. ;------------------------------------------------------------------------------
  1266. I_END:
  1267. ;------------------------------------------------------------------------------
  1268.