Subversion Repositories Kolibri OS

Rev

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