Subversion Repositories Kolibri OS

Rev

Rev 3823 | Blame | Last modification | View Log | Download | RSS feed

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