Subversion Repositories Kolibri OS

Rev

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