Subversion Repositories Kolibri OS

Rev

Rev 5452 | Rev 7181 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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