Subversion Repositories Kolibri OS

Rev

Rev 7181 | Rev 8427 | 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 LCtrl+LShift ;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   66,4,0,2        ; LShift+RShift
  589.         mcall   66,,,33h        ; LCtrl+LShift
  590.         mcall   66,,88,110h     ; Alt+Ctrl+F12
  591.         mcall   66,,91,0h       ; RWin DOWN
  592.         mcall   66,,92          ; LWin DOWN
  593.         mcall   66,,219         ; RWin UP
  594.         mcall   66,,220         ; LWin UP
  595.         mcall   66,,19,0h       ; Win+R DOWN
  596.         mcall   66,,32,0h       ; Win+D DOWN
  597.         mcall   66,,55,10h      ; Ctrl+PrintScreen DOWN
  598.         mcall   66,,62,300h     ; Alt+F4
  599.         mcall   66,,2           ; Alt+1
  600.         mcall   66,,3           ; Alt+2
  601.         mcall   66,,4           ; Alt+3
  602.         mcall   66,,5           ; Alt+4
  603.         mcall   66,,6           ; Alt+5
  604.         mcall   66,,7           ; Alt+6
  605.         mcall   66,,8           ; Alt+7
  606.         mcall   66,,9           ; Alt+8
  607.         mcall   66,,10          ; Alt+9
  608.         mcall   66,,15          ; Alt+Tab DOWN
  609.         mcall   66,,15,301h     ; Alt+Shift+Tab DOWN
  610.         mcall   66,,69          ; Alt+Shift+NumLock
  611.  
  612. if caps_lock_check
  613.         xor     edx,edx
  614.         mcall   66,4,58
  615. end if
  616.         mcall   14
  617.         mov     [screen_size],eax
  618.  
  619.         call    set_work_ares_pf_screen
  620.  
  621.         mcall   9,process_info_buffer,-1
  622.         mov     ecx,[process_info_buffer+30]
  623.         mcall   18,21
  624.         mov     [this_slot],eax
  625.         mov     [max_slot],255
  626. ;--------------------------------------
  627. align 4
  628. start_after_minimize:
  629.         call    draw_window
  630.         call    draw_running_applications
  631.  
  632.         mcall   23,30
  633.         call    load_ini
  634. ;------------------------------------------------------------------------------
  635. align 4
  636. still:
  637.         call    draw_time
  638.         call    draw_cpu_usage
  639.         call    draw_running_applications
  640.  
  641.         mcall   18,7    ; check if active window changed
  642.         cmp     eax, [last_active_window]
  643.         jz      @f
  644. ; need_window_tab:
  645. ; in: ebx->process info
  646. ; out: ZF set <=> do not draw
  647.         mov     ebx,[last_active_window]
  648.         mov     [prev_active_window], ebx
  649.         mov     [last_active_window], eax
  650.  
  651.         mov     ecx, eax
  652.         mcall   9,process_info_buffer
  653.  
  654.         call    need_window_tab
  655.         jnz     .need_repaint
  656.  
  657.         mcall   9,process_info_buffer,[prev_active_window]
  658.         call    need_window_tab
  659.         jz      @f
  660. ;--------------------------------------
  661. align 4
  662. .need_repaint:
  663.         mov     dword [active_window_changed], 1
  664. ;--------------------------------------
  665. align 4
  666. @@:
  667.         mcall   23,20
  668.  
  669.         push    eax
  670.         mcall   18,7
  671.         cmp     [my_active_slot],eax
  672.         je      @f
  673.  
  674.         mov     [current_active_slot],eax
  675. ;--------------------------------------
  676. align 4
  677. @@:
  678.         pop     eax
  679.  
  680.         cmp     eax,1           ; redraw ?
  681.         jz      red
  682.  
  683.         push    eax
  684.         mov     eax,[redraw_window_flag]
  685.         test    eax,eax
  686.         jz      @f
  687.  
  688.         call    draw_window
  689. ;--------------------------------------
  690. align 4
  691. @@:
  692.         pop     eax
  693.  
  694.         cmp     eax,2
  695.         jnz     @f
  696.         call    handle_key
  697.         jmp     .key
  698. ;--------------------------------------
  699. align 4
  700. @@:
  701.         cmp     eax,3           ; button ?
  702.         jz      button
  703. ;--------------------------------------
  704. align 4
  705. .key:
  706.         cmp     dword [active_window_changed], 0
  707.         jnz     red_active
  708.  
  709.         call    draw_flag       ; language
  710.         jmp     still
  711. ;------------------------------------------------------------------------------
  712. align 4
  713. set_work_ares_pf_screen:
  714. ;eax = [xsize]*65536 + [ysize]
  715.         mov     ecx,eax
  716.         shr     ecx,16
  717.         and     eax,0xFFFF
  718.         cmp     [place_attachment],1
  719.         je      @f
  720.  
  721.         ror     eax,16
  722.         add     eax,[height]
  723.         rol     eax,16
  724.         mov     edx,eax
  725.         jmp     .selected
  726. ;--------------------------------------
  727. align 4
  728. @@:
  729.         sub     eax,[height]
  730.         mov     edx, eax
  731. ;--------------------------------------
  732. align 4
  733. .selected:
  734.         mcall   48,6
  735.         ret
  736. ;------------------------------------------------------------------------------
  737. align 4
  738. red_active:
  739. red:
  740.         mov     dword [active_window_changed], 0
  741.  
  742.         mcall   14
  743.         movzx   ecx,ax
  744.         mov     edx,eax
  745.         shr     edx,16
  746.         cmp     [screen_size.height],ax
  747.         jne     @f
  748.  
  749.         rol     eax,16
  750.         cmp     [screen_size.width],ax
  751.         je      .lp1
  752.  
  753.         rol     eax,16
  754. ;--------------------------------------
  755. align 4
  756. @@:
  757.         mov     [screen_size],eax
  758.  
  759.         push    ecx edx
  760.         call    set_work_ares_pf_screen
  761.         pop     edx ecx
  762.  
  763.         sub     ecx,[height]
  764.         mcall   67,0,,,[height]
  765. ;--------------------------------------
  766. align 4
  767. .lp1:
  768.         call    draw_window
  769.         jmp     still
  770. ;------------------------------------------------------------------------------
  771. align 4
  772. button:
  773.         mcall   17
  774.         test    eax,0xfffffe00  ; is it close button? (signal from @taskbar)
  775.         jz      still           ; if so - wait for another event, because @taskbar shouldn't be closed
  776.  
  777.         cmp     al, 0
  778.         jnz     right_mouse
  779.  
  780.         cmp     ah,50
  781.         jb      no_activate
  782.         cmp     ah,70
  783.         jg      no_activate
  784.  
  785.         movzx   ecx,byte ah
  786.         sub     ecx,52
  787.         shl     ecx,2
  788.  
  789.         mov     ecx,[app_list+ecx]
  790.  
  791.         mcall   9,process_info_buffer
  792.  
  793.         test    [ebx+70],dword 10b      ; window is minimized to panel
  794.         jnz     @f
  795.  
  796.         cmp     ecx,[current_active_slot]
  797.         je      .turn_off
  798. ;--------------------------------------
  799. align 4
  800. @@:
  801.         mcall   18,3,
  802.         jmp     .task_switching
  803. ;--------------------------------------
  804. align 4
  805. .turn_off:
  806.         mov     edx,ecx
  807.         mcall   18,22,0
  808. ;--------------------------------------
  809. align 4
  810. .task_switching:
  811.         mcall   68,1
  812.         jmp     still
  813. ;------------------------------------------------------------------------------
  814. align 4
  815. right_mouse:
  816.         cmp     ah,50
  817.         jb      still
  818.  
  819.         cmp     ah,70
  820.         jg      still
  821.  
  822.         movzx   ecx,byte ah
  823.         sub     ecx,52
  824.  
  825.         cmp     ecx, [app_tab_count]
  826.         jge     still
  827.  
  828.         shl     ecx,2
  829.         mcall   37,0
  830.         mov     ebx, eax
  831.         shr     eax, 16
  832.         mov     [x_coord], ax
  833.         and     ebx, 0xFFFF
  834.         mov     [y_coord], bx
  835.  
  836.         mov     ecx,[app_list+ecx]      ; ecx->selected app.slot
  837.         mov     [n_slot], ecx
  838.         mcall   9,procinfo_for_detect
  839.  
  840.         mcall   51,1,context_menu_start,ctx_menu_stack
  841.  
  842.         mov     [ctx_menu_PID], eax
  843.         jmp     still
  844. ;------------------------------------------------------------------------------
  845. align 4
  846. no_activate:
  847.         cmp     ah,101    ; minimize to left
  848.         je      left_button
  849.  
  850.         cmp     ah,102    ; minimize to right
  851.         je      right_button
  852.  
  853.         cmp     ah, 103
  854.         je      clean_desktop_1             ; minimize all windows
  855.  
  856.         cmp     ah,byte 1         ; start/terminate menu
  857.         jnz     noselect
  858.  
  859.         call    menu_handler
  860.  
  861.         jmp     still
  862. ;--------------------------------------
  863. align 4
  864. clean_desktop_1:
  865.         call    clean_desktop
  866.         jmp     still
  867. ;--------------------------------------
  868. align 4
  869. noselect:
  870.         mov     ebx, exec_fileinfo
  871.         cmp     ah,byte 2              ; start calendar
  872.         jnz     noid15  ;noclock
  873.  
  874.         mov     esi,calendar_name
  875.         call    algorithm_anti_duplication
  876.         test    eax,eax
  877.         jz      @f
  878.  
  879.         mcall   18,2,edi
  880.         jmp     still
  881. ;--------------------------------------
  882. align 4
  883. @@:
  884.         mov     ebx, exec_fileinfo
  885.         mov     dword [ebx+21], calendar_name
  886.         mcall   70
  887.         jmp     still
  888. ;--------------------------------------
  889. align 4
  890. noid15:
  891.         cmp     ah,16
  892.         jne     noid16
  893.  
  894.         call    karu
  895.         call    draw_flag       ; language
  896.         jmp     still
  897. ;--------------------------------------
  898. align 4
  899. noid16:
  900.         cmp     ah,18
  901.         jne     noid18
  902.  
  903.         mov     esi,sysmeter_name
  904.         call    algorithm_anti_duplication
  905.         test    eax,eax
  906.         jz      @f
  907.  
  908.         mcall   18,2,edi
  909.         jmp     still
  910. ;--------------------------------------
  911. align 4
  912. @@:
  913.         mov     ebx, exec_fileinfo
  914.         mov     dword [ebx+21], sysmeter_name
  915.         mcall   70
  916.         jmp     still
  917. ;--------------------------------------
  918. align 4
  919. noid18:
  920.         cmp     ah,21
  921.         jnz     noid21
  922.  
  923.         cmp     [page_list],50
  924.         jnc     still
  925.         inc     [page_list]
  926.         jmp     red
  927. ;--------------------------------------
  928. align 4
  929. noid21:
  930.         cmp     ah,22
  931.         jnz     still
  932.  
  933.         cmp     [page_list],0
  934.         je      still
  935.  
  936.         dec     [page_list]
  937.         jmp     red
  938. ;------------------------------------------------------------------------------
  939. align 4
  940. restore_desktop:
  941.         mcall   9,process_info_buffer,-1
  942.         mov     [max_slot], eax
  943.         mov     ecx, 2
  944.         mov     edx, 2
  945. ;--------------------------------------
  946. align 4
  947. @@:
  948.         mcall   18, 22
  949.         inc     edx
  950.         cmp     edx, [max_slot]
  951.         jbe     @b
  952.         ret
  953. ;------------------------------------------------------------------------------
  954. align 4
  955. clean_desktop:
  956.         mcall   18,23
  957.         test    eax,eax
  958.         jnz     @f
  959.         call    restore_desktop
  960. ;--------------------------------------
  961. align 4
  962. @@:
  963.         ret
  964. ;------------------------------------------------------------------------------
  965. align 4
  966. conversion_HEX_to_ASCII:
  967.         ror     eax,12
  968.         mov     ecx,4
  969. ;--------------------------------------
  970. align 4
  971. .loop:
  972.         mov     bl,al
  973.         rol     eax,4
  974.         and     bl,0xf
  975.         cmp     bl,0xA  ; check for ABCDEF
  976.         jae     @f
  977.  
  978.         add     bl,0x30 ; 0-9
  979.         jmp     .store
  980. ;--------------------------------------
  981. align 4
  982. @@:
  983.         add     bl,0x57 ; A-F
  984. ;--------------------------------------
  985. align 4
  986. .store:
  987. ;       dps     "param_store: "
  988.         mov     [edi],bl
  989.         inc     edi
  990.         dec     ecx
  991.         jnz     .loop
  992.         ret
  993. ;------------------------------------------------------------------------------
  994. align 4
  995. menu_handler:
  996.         mov     edi,bootparam
  997.  
  998.         mov     eax,[menu_button_x.start]
  999.         call    conversion_HEX_to_ASCII
  1000.  
  1001.         mov     eax,[menu_button_x.size]
  1002.         call    conversion_HEX_to_ASCII
  1003.  
  1004.         mov     eax,[menu_button_y.start]
  1005.         call    conversion_HEX_to_ASCII
  1006.  
  1007.         mov     eax,[menu_button_y.size]
  1008.         call    conversion_HEX_to_ASCII
  1009.  
  1010.         mov     eax,[height]
  1011.         call    conversion_HEX_to_ASCII
  1012.  
  1013.         mov     eax,[place_attachment]
  1014.         call    conversion_HEX_to_ASCII
  1015.  
  1016.         xor     eax,eax ; terminator for boot parameters string
  1017.         stosd
  1018.  
  1019.         mov     ebx, exec_fileinfo
  1020.         mov     [ebx+21],dword menu_name
  1021.         mov     [ebx+8],dword bootparam
  1022.         mcall   70
  1023.         mov     [ebx+8],dword 0
  1024.         ret
  1025. ;------------------------------------------------------------------------------
  1026. align 4
  1027. draw_small_right:
  1028.         pusha
  1029.         mcall   12,1
  1030.  
  1031.         xor     eax,eax
  1032.         mov     edx,[wcolor]
  1033.         mov     esi,edx
  1034.         mov     edi,edx
  1035.         or      edx, 0x01000000
  1036.         mcall
  1037.  
  1038.         xor     ecx,ecx
  1039.         mov     cx,[height]
  1040.         mcall   8,<0,10>,,1,[wcolor]
  1041.  
  1042.         mov     ebx,2*65536     ;+6
  1043.         mov     bx,[height]
  1044.         shr     bx,1
  1045.         sub     bx,3
  1046.         mov     edx,[wcolor]
  1047.         mov     eax,COLOR_CHANGE_MAGNITUDE_2
  1048.         call    add_color_change_magnitude
  1049.         mov     ecx,edx
  1050.         mcall   4,,,hidetext,1
  1051.  
  1052.         mcall   12,2
  1053.         popa
  1054.         ret
  1055. ;------------------------------------------------------------------------------
  1056. align 4
  1057. draw_small_left:
  1058.         pusha
  1059.         mcall   12,1
  1060.  
  1061.         xor     eax,eax
  1062.         mov     edx,[wcolor]
  1063.         mov     esi,edx
  1064.         mov     edi,edx
  1065.         or      edx, 0x01000000
  1066.         mcall
  1067.  
  1068.         xor     ecx,ecx
  1069.         mov     cx,[height]
  1070.         mcall   8,<0,9>,,1,[wcolor]
  1071.  
  1072.         mov     ebx,3*65536     ;+6
  1073.         mov     bx,[height]
  1074.         shr     bx,1
  1075.         sub     bx,3
  1076.         mov     edx,[wcolor]
  1077.         mov     eax,COLOR_CHANGE_MAGNITUDE_2
  1078.         call    add_color_change_magnitude
  1079.         mov     ecx,edx
  1080.         mcall   4,,,hidetext+1,1
  1081.  
  1082.         mcall   12,2
  1083.         popa
  1084.         ret
  1085. ;------------------------------------------------------------------------------
  1086. align 4
  1087. right_button:
  1088.         mov     [small_draw],dword draw_small_right
  1089.  
  1090.         mcall   14
  1091.  
  1092.         shr     eax, 16
  1093.         mov     ebx, eax
  1094.         mov     ecx, -1
  1095.         mov     edx, 9
  1096.         sub     ebx, edx
  1097.         mov     esi, -1
  1098.         mcall   67
  1099.  
  1100.         call    draw_small_right
  1101.         jmp     small_wait
  1102. ;------------------------------------------------------------------------------
  1103. align 4
  1104. left_button:
  1105.         mov     [small_draw],dword draw_small_left
  1106.  
  1107.         xor     ebx,ebx
  1108.         mcall   67,,-1,9,-1
  1109.  
  1110.         call    draw_small_left
  1111. ;--------------------------------------
  1112. align 4
  1113. small_wait:
  1114.         mcall   10
  1115.         cmp     eax,1
  1116.         jne     no_win
  1117.  
  1118.         call    [small_draw]
  1119.         jmp     small_wait
  1120. ;--------------------------------------
  1121. align 4
  1122. no_win:
  1123.         cmp     eax,2
  1124.         jne     no_key
  1125.  
  1126.         call    handle_key
  1127.         jmp     small_wait
  1128. ;--------------------------------------
  1129. align 4
  1130. no_key:
  1131.         mcall   17
  1132.         cmp     ah,1
  1133.         jne     no_full
  1134.  
  1135.         mcall   14      ; get screen max x & max y
  1136.  
  1137.         mov     edx, eax
  1138.         shr     edx, 16
  1139.         xor     ebx, ebx
  1140.         mcall   67,,-1,,-1 ; x0 y0 xs ys
  1141.  
  1142.         jmp     still
  1143. ;--------------------------------------
  1144. align 4
  1145. no_full:
  1146.         call    menu_handler
  1147.         jmp     small_wait
  1148. ;------------------------------------------------------------------------------
  1149. include 'libini.inc'
  1150. ;------------------------------------------------------------------------------
  1151. include '../../../dll.inc'
  1152. ;------------------------------------------------------------------------------
  1153. include 'drawappl.inc'
  1154. ;------------------------------------------------------------------------------
  1155. include 'drawbutt.inc'
  1156. ;------------------------------------------------------------------------------
  1157. include 'drawwind.inc'
  1158. ;------------------------------------------------------------------------------
  1159. include 'drawtray.inc'
  1160. ;------------------------------------------------------------------------------
  1161. include 'ctx_menu.asm'
  1162. ;------------------------------------------------------------------------------
  1163. include 'i_data.inc'
  1164. ;------------------------------------------------------------------------------
  1165. IM_END:
  1166. ;------------------------------------------------------------------------------
  1167. include 'u_data.inc'
  1168. ;------------------------------------------------------------------------------
  1169. I_END:
  1170. ;------------------------------------------------------------------------------
  1171.