Subversion Repositories Kolibri OS

Rev

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