Subversion Repositories Kolibri OS

Rev

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

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