Subversion Repositories Kolibri OS

Rev

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