1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
\r
3 ; TASK PANEL for KolibriOS - Compile with fasm ;
\r
5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
\r
6 ;------------------------------------------------------------------------------
\r
8 ; last update: 14/07/2013
\r
9 ; changed by: Marat Zakiyanov aka Mario79, aka Mario
\r
10 ; changes: Reinstall screen work area after change screen resolution
\r
11 ;------------------------------------------------------------------------------
\r
13 ; last update: 16/06/2013
\r
14 ; changed by: hidnplayr
\r
15 ; changes: Changed keymap hotkeys to only use left alt
\r
16 ; (Right alt has special function on some keyboards)
\r
17 ;------------------------------------------------------------------------------
\r
19 ; last update: 26/04/2012
\r
20 ; changed by: Marat Zakiyanov aka Mario79, aka Mario
\r
21 ; changes: Using new f18.23 - minimize all windows
\r
22 ;------------------------------------------------------------------------------
\r
24 ; last update: 20/04/2012
\r
25 ; changed by: Marat Zakiyanov aka Mario79, aka Mario
\r
26 ; changes: Activation mechanism when trying to run an existing appl.
\r
27 ; Forced redrawing the background after the clean desktop (Win+D)
\r
28 ;------------------------------------------------------------------------------
\r
30 ; last update: 19/04/2012
\r
31 ; changed by: Marat Zakiyanov aka Mario79, aka Mario
\r
32 ; changes: Support PrintScreen for SCRSHOOT.
\r
33 ; Path to run applications from the INI file.
\r
34 ; Algorithm anti-duplication of applications for run with hotkey.
\r
35 ; Added color selection for the Alt+Tab.
\r
36 ; Alt+Ctrl+ArrowLeft - Page list next
\r
37 ; Alt+Ctrl+ArrowRight - Page list previous
\r
38 ;------------------------------------------------------------------------------
\r
40 ; last update: 18/04/2012
\r
41 ; changed by: Marat Zakiyanov aka Mario79, aka Mario
\r
42 ; changes: Added color selection for the text.
\r
43 ; Show "change page list" only if the applications
\r
44 ; does not fit in the panel.
\r
45 ; Display file names up to 11 char previously displ. only 8 char.
\r
46 ;------------------------------------------------------------------------------
\r
48 ; last update: 17/04/2012
\r
49 ; changed by: Marat Zakiyanov aka Mario79, aka Mario
\r
50 ; changes: New logic of switching windows (turnoff/restore)
\r
51 ; New logic of button "clear desktop".
\r
52 ; Win+D (restore/clear desktop), Win+R (start RUN application).
\r
53 ; Using the library LibINI to set the parameters.
\r
54 ; New style of panel. Start application Menu with boot options.
\r
55 ; two versions of the location of the panel -
\r
56 ; the bottom of the desktop and on top of the desktop.
\r
57 ;------------------------------------------------------------------------------
\r
58 ; last update: 31/03/2012
\r
59 ; changed by: Marat Zakiyanov aka Mario79, aka Mario
\r
60 ; changes: The program uses only 20 Kb memory is now.
\r
61 ; Code optimizing and refactoring.
\r
62 ;------------------------------------------------------------------------------
\r
67 db 'MENUET01' ; 8 byte id
\r
68 dd 0x01 ; header version
\r
69 dd START ; program start
\r
70 dd IM_END ; program image size
\r
71 dd I_END ; reguired amount of memory - 10 Kb
\r
73 dd 0x0 ; boot parameters
\r
74 dd path ; application pach
\r
75 ;------------------------------------------------------------------------------
\r
77 include '../../../macros.inc'
\r
78 include '../../../proc32.inc'
\r
79 ;include '../../../debug.inc'
\r
80 include 'MOI.INC' ;à ᪫ ¤ª¨ ª« ¢¨ âãàë
\r
81 include '../../../develop/libraries/box_lib/load_lib.mac'
\r
82 @use_library ;use load lib macros
\r
83 ;------------------------------------------------------------------------------
\r
84 caps_lock_check fix 1
\r
85 ;------------------------------------------------------------------------------
\r
86 time_bgr_color = 0x66cc
\r
100 CPU_USAGE_SIZE = 10
\r
102 PAGE_LIST_SIZE = 36
\r
103 ;------------------------------------------------------------------------------
\r
107 mov [active_process],eax
\r
111 ; dps "panel key: "
\r
118 mov ebx, exec_fileinfo
\r
129 cmp al,58 ;CAPS LOCK DOWN
\r
136 mov [draw_flag_certainly],1
\r
137 call draw_flag ; language
\r
143 cmp al, 15 ; Alt+Tab DOWN
\r
146 cmp al, 88 ; Ctrl+Alt+F12
\r
147 jz start_end_application
\r
149 cmp al, 91 ; RWin DOWN
\r
150 jz set_win_key_flag
\r
152 cmp al, 92 ; LWin DOWN
\r
153 jz set_win_key_flag
\r
155 cmp al, 1 ; LCtrl+Esc DOWN
\r
156 jz set_win_key_flag
\r
158 cmp al, 219 ; RWin UP
\r
159 jz cut_win_key_flag ;start_menu_application
\r
161 cmp al, 220 ; LWin UP
\r
162 jz cut_win_key_flag ;start_menu_application
\r
164 cmp al, 129 ; LCtrl+Esc UP
\r
165 jz cut_win_key_flag ;start_menu_application
\r
167 cmp al, 62 ; Alt+F4
\r
168 jz kill_active_application
\r
176 cmp al, 69 ; Alt+Shift+NumLock
\r
177 jz start_mousemul_application
\r
180 jz start_run_application
\r
183 jz minimize_all_windows
\r
185 cmp al, 55 ; PrintScreen DOWN
\r
186 jz start_PrintScreen_application
\r
187 ;--------------------------------------
\r
190 cmp [current_alt_tab_app], -1
\r
193 test ah, 0x30 ; Alt+Tab UP
\r
194 jz alt_tab_released
\r
195 ;--------------------------------------
\r
198 ; this is hotkey LCtrl+LShift ;or LShift+RShift
\r
200 ;------------------------------------------------------------------------------
\r
203 mov [win_key_flag],1
\r
205 ;------------------------------------------------------------------------------
\r
209 mov [win_key_flag],al
\r
210 xchg [start_menu_flag],al
\r
212 jz start_menu_application
\r
214 ;------------------------------------------------------------------------------
\r
217 mov dword [ebx+8], chlang
\r
219 ;--------------------------------------
\r
222 mov ecx,[active_process]
\r
225 ;--------------------------------------
\r
229 ;------------------------------------------------------------------------------
\r
231 start_end_application:
\r
233 call algorithm_anti_duplication
\r
239 ;--------------------------------------
\r
242 mov ebx, exec_fileinfo
\r
243 mov dword [ebx + 21],end_name
\r
246 ;------------------------------------------------------------------------------
\r
248 start_mousemul_application:
\r
249 mov esi,mousemul_name
\r
250 call algorithm_anti_duplication
\r
254 ;--------------------------------------
\r
257 mov ebx, exec_fileinfo
\r
258 mov dword [ebx + 21],mousemul_name
\r
261 ;------------------------------------------------------------------------------
\r
263 kill_active_application:
\r
266 ;------------------------------------------------------------------------------
\r
269 start_menu_application:
\r
272 ;------------------------------------------------------------------------------
\r
274 start_run_application:
\r
275 cmp [win_key_flag],1
\r
278 ;--------------------------------------
\r
281 mov [start_menu_flag],1
\r
284 call algorithm_anti_duplication
\r
290 ;--------------------------------------
\r
293 mov ebx, exec_fileinfo
\r
294 mov dword [ebx + 21], run_name
\r
297 ;------------------------------------------------------------------------------
\r
299 start_PrintScreen_application:
\r
300 mov esi,printscreen_name
\r
301 call algorithm_anti_duplication
\r
306 ;--------------------------------------
\r
309 mov ebx, exec_fileinfo
\r
310 mov dword [ebx + 21],printscreen_name
\r
311 mov [ebx+8],dword bootparam_printscreen
\r
314 ;------------------------------------------------------------------------------
\r
316 minimize_all_windows:
\r
317 cmp [win_key_flag],1
\r
320 ;--------------------------------------
\r
323 mov [start_menu_flag],1
\r
326 ;------------------------------------------------------------------------------
\r
328 algorithm_anti_duplication:
\r
330 ;--------------------------------------
\r
336 ;--------------------------------------
\r
347 ;--------------------------------------
\r
352 mcall 9,procinfo_window_tabs
\r
361 ;--------------------------------------
\r
373 ;--------------------------------------
\r
378 ;------------------------------------------------------------------------------
\r
385 cmp [page_list_enable],eax
\r
389 mov [redraw_window_flag],1
\r
390 ;--------------------------------------
\r
394 ;------------------------------------------------------------------------------
\r
398 cmp [page_list],eax
\r
401 cmp [page_list_enable],eax
\r
405 mov [redraw_window_flag],1
\r
406 ;--------------------------------------
\r
410 ;------------------------------------------------------------------------------
\r
413 ; handle Alt+Tab and Alt+Shift+Tab
\r
415 cmp [current_alt_tab_app], -1
\r
416 jnz has_alt_tab_app
\r
417 ; § ¯®«ï¥¬ â ¡«¨æ㠯ਫ®¦¥¨©, ¯®¤«¥¦ é¨å ¯¥à¥ª«î票î
\r
419 mov ebx, procinfo_window_tabs
\r
421 ;--------------------------------------
\r
426 call need_window_tab
\r
432 mov [alt_tab_list+edx*8], ecx
\r
433 movzx esi, word [ebx+4]
\r
434 mov [alt_tab_list+edx*8+4], esi
\r
436 ;--------------------------------------
\r
442 mov [alt_tab_list_size], edx
\r
446 mcall 66,4,0,0 ; «®¢¨¬ ¬®¬¥â ®â¯ã᪠¨ï ¢á¥å ã¯à ¢«ïîé¨å ª« ¢¨è
\r
451 mov eax, [alt_tab_list+4]
\r
454 ;--------------------------------------
\r
457 cmp [alt_tab_list+ecx*8+4], eax
\r
461 mov eax, [alt_tab_list+ecx*8+4]
\r
462 ;--------------------------------------
\r
466 cmp ecx, [alt_tab_list_size]
\r
469 mov [current_alt_tab_app], edx
\r
470 ;--------------------------------------
\r
473 mov eax, [current_alt_tab_app]
\r
474 mov edx, [alt_tab_list+eax*8+4] ; slot
\r
481 ;--------------------------------------
\r
484 cmp [alt_tab_list+ecx*8+4], edx
\r
487 cmp [alt_tab_list+ecx*8+4], esi
\r
491 mov esi, [alt_tab_list+ecx*8+4]
\r
492 ;--------------------------------------
\r
496 cmp ecx, [alt_tab_list_size]
\r
505 ;--------------------------------------
\r
509 ;--------------------------------------
\r
512 cmp [alt_tab_list+ecx*8+4], edx
\r
515 cmp [alt_tab_list+ecx*8+4], esi
\r
519 mov esi, [alt_tab_list+ecx*8+4]
\r
520 ;--------------------------------------
\r
524 cmp ecx, [alt_tab_list_size]
\r
533 ;--------------------------------------
\r
536 mov [current_alt_tab_app], eax
\r
539 div [max_applications]
\r
540 mov [page_list], eax
\r
549 ;--------------------------------------
\r
552 cmp ecx, [alt_tab_list_size]
\r
553 jae redraw_window_tabs
\r
555 mov eax, [alt_tab_list+ecx*8]
\r
559 ;--------------------------------------
\r
562 mcall 66,5,0,0 ; 㦥 ¯®©¬ «¨, å¢ â¨â :)
\r
565 xchg eax, [current_alt_tab_app]
\r
566 mov ecx, [alt_tab_list+eax*8]
\r
569 jmp redraw_window_tabs
\r
570 ;------------------------------------------------------------------------------
\r
572 active_process dd 0
\r
576 ;------------------------------------------------------------------------------
\r
581 mcall 9,process_info_buffer,-1
\r
582 mov ecx, [ebx + process_information.PID] ; PID
\r
584 mov [my_active_slot],eax ; WINDOW SLOT
\r
587 load_libraries l_libs_start,end_l_libs
\r
594 mcall 66,4,0,2 ; LShift+RShift
\r
595 mcall 66,,,33h ; LCtrl+LShift
\r
596 mcall 66,,88,110h ; Alt+Ctrl+F12
\r
597 mcall 66,,91,0h ; RWin DOWN
\r
598 mcall 66,,92 ; LWin DOWN
\r
599 mcall 66,,219 ; RWin UP
\r
600 mcall 66,,220 ; LWin UP
\r
601 mcall 66,,19,0h ; Win+R DOWN
\r
602 mcall 66,,32,0h ; Win+D DOWN
\r
603 mcall 66,,55,10h ; Ctrl+PrintScreen DOWN
\r
604 mcall 66,,1,30h ; LCtrl+Esc DOWN
\r
605 mcall 66,,129 ; LCtrl+Esc UP
\r
606 mcall 66,,62,300h ; Alt+F4
\r
607 mcall 66,,2 ; Alt+1
\r
608 mcall 66,,3 ; Alt+2
\r
609 mcall 66,,4 ; Alt+3
\r
610 mcall 66,,5 ; Alt+4
\r
611 mcall 66,,6 ; Alt+5
\r
612 mcall 66,,7 ; Alt+6
\r
613 mcall 66,,8 ; Alt+7
\r
614 mcall 66,,9 ; Alt+8
\r
615 mcall 66,,10 ; Alt+9
\r
616 mcall 66,,15 ; Alt+Tab DOWN
\r
617 mcall 66,,15,301h ; Alt+Shift+Tab DOWN
\r
618 mcall 66,,69 ; Alt+Shift+NumLock
\r
625 mov [screen_size],eax
\r
627 call set_work_ares_pf_screen
\r
629 mcall 9,process_info_buffer,-1
\r
630 mov ecx,[process_info_buffer.PID]
\r
632 mov [this_slot],eax
\r
634 ;--------------------------------------
\r
636 start_after_minimize:
\r
638 call draw_running_applications
\r
642 ;------------------------------------------------------------------------------
\r
646 call draw_cpu_usage
\r
647 call draw_running_applications
\r
649 mcall 18,7 ; check if active window changed
\r
650 cmp eax, [last_active_window]
\r
653 ; in: ebx->process info
\r
654 ; out: ZF set <=> do not draw
\r
655 mov ebx,[last_active_window]
\r
656 mov [prev_active_window], ebx
\r
657 mov [last_active_window], eax
\r
660 mcall 9,process_info_buffer
\r
662 call need_window_tab
\r
665 mcall 9,process_info_buffer,[prev_active_window]
\r
666 call need_window_tab
\r
668 ;--------------------------------------
\r
671 mov dword [active_window_changed], 1
\r
672 ;--------------------------------------
\r
679 cmp [my_active_slot],eax
\r
682 mov [current_active_slot],eax
\r
683 ;--------------------------------------
\r
688 cmp eax,1 ; redraw ?
\r
692 mov eax,[redraw_window_flag]
\r
697 ;--------------------------------------
\r
706 ;--------------------------------------
\r
709 cmp eax,3 ; button ?
\r
711 ;--------------------------------------
\r
714 cmp dword [active_window_changed], 0
\r
717 call draw_flag ; language
\r
719 ;------------------------------------------------------------------------------
\r
721 set_work_ares_pf_screen:
\r
722 ;eax = [xsize]*65536 + [ysize]
\r
726 cmp [place_attachment],1
\r
734 ;--------------------------------------
\r
739 ;--------------------------------------
\r
744 ;------------------------------------------------------------------------------
\r
748 mov dword [active_window_changed], 0
\r
754 cmp [screen_size.height],ax
\r
758 cmp [screen_size.width],ax
\r
762 ;--------------------------------------
\r
765 mov [screen_size],eax
\r
768 call set_work_ares_pf_screen
\r
772 mcall 67,0,,,[height]
\r
773 ;--------------------------------------
\r
778 ;------------------------------------------------------------------------------
\r
782 test eax,0xfffffe00 ; is it close button? (signal from @taskbar)
\r
783 jz still ; if so - wait for another event, because @taskbar shouldn't be closed
\r
797 mov ecx,[app_list+ecx]
\r
799 mcall 9,process_info_buffer
\r
801 test [ebx + process_information.wnd_state], byte 10b ; window is minimized to panel
\r
804 cmp ecx,[current_active_slot]
\r
806 ;--------------------------------------
\r
810 jmp .task_switching
\r
811 ;--------------------------------------
\r
816 ;--------------------------------------
\r
821 ;------------------------------------------------------------------------------
\r
833 cmp ecx, [app_tab_count]
\r
844 mov ecx,[app_list+ecx] ; ecx->selected app.slot
\r
846 mcall 9,procinfo_for_detect
\r
848 mcall 51,1,context_menu_start,ctx_menu_stack
\r
850 mov [ctx_menu_PID], eax
\r
852 ;------------------------------------------------------------------------------
\r
855 cmp ah,101 ; minimize to left
\r
858 cmp ah,102 ; minimize to right
\r
862 je clean_desktop_1 ; minimize all windows
\r
864 cmp ah,byte 1 ; start/terminate menu
\r
870 ;--------------------------------------
\r
875 ;--------------------------------------
\r
878 mov ebx, exec_fileinfo
\r
879 cmp ah,byte 2 ; start calendar
\r
880 jnz noid15 ;noclock
\r
882 mov esi,calendar_name
\r
883 call algorithm_anti_duplication
\r
889 ;--------------------------------------
\r
892 mov ebx, exec_fileinfo
\r
893 mov dword [ebx+21], calendar_name
\r
896 ;--------------------------------------
\r
903 call draw_flag ; language
\r
905 ;--------------------------------------
\r
911 mov esi,sysmeter_name
\r
912 call algorithm_anti_duplication
\r
918 ;--------------------------------------
\r
921 mov ebx, exec_fileinfo
\r
922 mov dword [ebx+21], sysmeter_name
\r
925 ;--------------------------------------
\r
935 ;--------------------------------------
\r
946 ;------------------------------------------------------------------------------
\r
949 mcall 9,process_info_buffer,-1
\r
950 mov [max_slot], eax
\r
953 ;--------------------------------------
\r
958 cmp edx, [max_slot]
\r
961 ;------------------------------------------------------------------------------
\r
967 call restore_desktop
\r
968 ;--------------------------------------
\r
972 ;------------------------------------------------------------------------------
\r
974 conversion_HEX_to_ASCII:
\r
977 ;--------------------------------------
\r
983 cmp bl,0xA ; check for ABCDEF
\r
988 ;--------------------------------------
\r
992 ;--------------------------------------
\r
995 ; dps "param_store: "
\r
1001 ;------------------------------------------------------------------------------
\r
1006 mov eax,[menu_button_x.start]
\r
1007 call conversion_HEX_to_ASCII
\r
1009 mov eax,[menu_button_x.size]
\r
1010 call conversion_HEX_to_ASCII
\r
1012 mov eax,[menu_button_y.start]
\r
1013 call conversion_HEX_to_ASCII
\r
1015 mov eax,[menu_button_y.size]
\r
1016 call conversion_HEX_to_ASCII
\r
1019 call conversion_HEX_to_ASCII
\r
1021 mov eax,[place_attachment]
\r
1022 call conversion_HEX_to_ASCII
\r
1024 xor eax,eax ; terminator for boot parameters string
\r
1027 mov ebx, exec_fileinfo
\r
1028 mov [ebx+21],dword menu_name
\r
1029 mov [ebx+8],dword bootparam
\r
1031 mov [ebx+8],dword 0
\r
1033 ;------------------------------------------------------------------------------
\r
1043 or edx, 0x01000000
\r
1048 mcall 8,<0,10>,,1,[wcolor]
\r
1050 mov ebx,2*65536 ;+6
\r
1055 mov eax,COLOR_CHANGE_MAGNITUDE_2
\r
1056 call add_color_change_magnitude
\r
1058 mcall 4,,,hidetext,1
\r
1063 ;------------------------------------------------------------------------------
\r
1073 or edx, 0x01000000
\r
1078 mcall 8,<0,9>,,1,[wcolor]
\r
1080 mov ebx,3*65536 ;+6
\r
1085 mov eax,COLOR_CHANGE_MAGNITUDE_2
\r
1086 call add_color_change_magnitude
\r
1088 mcall 4,,,hidetext+1,1
\r
1093 ;------------------------------------------------------------------------------
\r
1096 mov [small_draw],dword draw_small_right
\r
1108 call draw_small_right
\r
1110 ;------------------------------------------------------------------------------
\r
1113 mov [small_draw],dword draw_small_left
\r
1118 call draw_small_left
\r
1119 ;--------------------------------------
\r
1128 ;--------------------------------------
\r
1136 ;--------------------------------------
\r
1143 mcall 14 ; get screen max x & max y
\r
1148 mcall 67,,-1,,-1 ; x0 y0 xs ys
\r
1151 ;--------------------------------------
\r
1156 ;------------------------------------------------------------------------------
\r
1157 include 'libini.inc'
\r
1158 ;------------------------------------------------------------------------------
\r
1159 include '../../../dll.inc'
\r
1160 ;------------------------------------------------------------------------------
\r
1161 include 'drawappl.inc'
\r
1162 ;------------------------------------------------------------------------------
\r
1163 include 'drawbutt.inc'
\r
1164 ;------------------------------------------------------------------------------
\r
1165 include 'drawwind.inc'
\r
1166 ;------------------------------------------------------------------------------
\r
1167 include 'drawtray.inc'
\r
1168 ;------------------------------------------------------------------------------
\r
1169 include 'ctx_menu.asm'
\r
1170 ;------------------------------------------------------------------------------
\r
1171 include 'i_data.inc'
\r
1172 ;------------------------------------------------------------------------------
\r
1174 ;------------------------------------------------------------------------------
\r
1175 include 'u_data.inc'
\r
1176 ;------------------------------------------------------------------------------
\r
1178 ;------------------------------------------------------------------------------
\r