Subversion Repositories Kolibri OS

Rev

Rev 2649 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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