Subversion Repositories Kolibri OS

Rev

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