Subversion Repositories Kolibri OS

Rev

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