Subversion Repositories Kolibri OS

Rev

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