Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
31 halyavin 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;                                                   ;
93 diamond 3
;    MENUBAR for KolibriOS  - Compile with fasm     ;
31 halyavin 4
;                                                   ;
5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
 
7
use32
8
  org  0x0
9
  db   'MENUET01'   ; 8 byte id
601 Rus 10
  dd   0x01	    ; header version
11
  dd   START	    ; program start
12
  dd   I_END	    ; program image size
13
  dd   0xA000	    ; reguired amount of memory - 10 Kb
14
  dd   0xA000	    ; esp
15
  dd   0x0,0x0	    ; param, icon
31 halyavin 16
 
17
include 'lang.inc'
485 heavyiron 18
include '..\..\..\macros.inc'
31 halyavin 19
 
601 Rus 20
width		dd  305
21
buttons 	dd    1  ;  0 no frames  ; 1 frames
22
soften_up	dd    1  ;  0 no         ; 1 yes
23
soften_down	dd    0  ;  0 no         ; 1 yes
24
minimize_left	dd    1
25
minimize_right	dd    1
26
icons_position	dd   95
27
menu_enable	dd    1
28
setup_enable	dd    0
29
graph_text	dd    1
30
soften_middle	dd    1  ;  0 no         ; 1 yes
31
icons		dd    1  ;  0 defaults   ; 1 activate
31 halyavin 32
 
42 mikedld 33
PANEL_HEIGHT = 18
31 halyavin 34
 
93 diamond 35
handle_key:
31 halyavin 36
 
37
    mcall 18, 7
38
    mov  [active_process],eax
39
 
601 Rus 40
	mcall 2
41
	cmp	al, 2
42
	jnz	begin_1.ret
43
	mov	ebx, exec_fileinfo
44
	shr	eax, 8
45
	cmp	al, 15
46
	jz	alt_tab_pressed
47
	cmp	al, 88
48
	jz	start_end_application
49
	cmp	al, 91
50
	jz	start_menu_application
51
	cmp	al, 92
52
	jz	start_menu_application
53
	cmp	al, 62
54
	jz	kill_active_application
55
	cmp	al, 71
56
	jz	page_list_next
57
	cmp	al, 72
58
	jz	page_list_prev
59
	cmp	[current_alt_tab_app], -1
60
	jz	@f
61
	test	ah, 0x30
62
	jz	alt_tab_released
443 diamond 63
@@:
304 diamond 64
; this is hotkey Ctrl+Shift ;or LShift+RShift
601 Rus 65
	mov	ebx, setup_exec
304 diamond 66
;        test    ah, 001100b
67
;        jz      change_sys_lang
68
change_key_lang:
601 Rus 69
	mov	dword [ebx+8], chlang
70
	mcall	70
71
	call	chlang_music
93 diamond 72
;       mcall   5, 25
31 halyavin 73
begin_1:
74
    mov  ecx,[active_process]
75
    mcall 18, 3
76
    mcall 5, 25
93 diamond 77
.ret:
601 Rus 78
	ret
93 diamond 79
 
304 diamond 80
;change_sys_lang:
81
;        mov     dword [ebx+8], syslang
82
;        mcall   70
83
;        call    syslang_music
84
;;       mcall   5, 25
85
;        jmp     begin_1
93 diamond 86
 
31 halyavin 87
  start_end_application:
601 Rus 88
	mov	dword [ebx+21], end_name
89
	mcall	70
31 halyavin 90
     mcall 5 ,50
93 diamond 91
     jmp   begin_1.ret
31 halyavin 92
 
93
   kill_active_application:
94
     mcall  18, 7
95
     mov    ecx,eax
494 spraid 96
 
97
     ;//{SPraid.simba do not kill panel and icon
98
     push eax
99
     mov eax,9
100
     mov ebx, process_info_buffer
101
     int 0x40
102
     mov eax,process_info_buffer
103
     add eax,10
104
     mov ebx,[eax]
105
     cmp ebx,'ICON'
106
     je  no_kill
107
     cmp ebx,'@PAN'
108
     jne  kill_app
109
     add eax,4
110
     mov ebx,[eax]
111
     and ebx,0x0000FFFF
112
     cmp ebx,'EL'
113
     je  no_kill
114
   kill_app:
115
     pop ecx
31 halyavin 116
     mcall  18, 2
494 spraid 117
     jmp if_kill
118
   no_kill:
119
     pop eax
120
   if_kill:
121
     ;// }SPraid.simba
122
 
93 diamond 123
     jmp    begin_1.ret
124
 
31 halyavin 125
   start_menu_application:
601 Rus 126
	mov	[draw_window_1], 1
127
	mov	dword [ebx+21], menu_name
128
	mcall	70
129
	call	menu_music
31 halyavin 130
     mcall 5,50
93 diamond 131
     jmp   begin_1.ret
132
 
133
page_list_next:
51 mikedld 134
    cmp  [page_list],15
601 Rus 135
    je	   @f
51 mikedld 136
    inc  [page_list]
137
    mov  [draw_window_1],1
138
  @@:
93 diamond 139
    jmp  begin_1.ret
51 mikedld 140
 
93 diamond 141
page_list_prev:
51 mikedld 142
    cmp  [page_list],0
601 Rus 143
    je	   @f
51 mikedld 144
    dec  [page_list]
145
    mov  [draw_window_1],1
146
  @@:
93 diamond 147
    jmp  begin_1.ret
51 mikedld 148
 
443 diamond 149
alt_tab_pressed:
150
; handle Alt+Tab and Alt+Shift+Tab
601 Rus 151
	mov	ebp, eax
152
	cmp	[current_alt_tab_app], -1
153
	jnz	has_alt_tab_app
443 diamond 154
; заполняем таблицу приложений, подлежащих переключению
601 Rus 155
	xor	edx, edx
156
	mov	ebx, 0x8000
157
	mov	ecx, 1
158
	mov	eax, 9
443 diamond 159
.fill:
601 Rus 160
	inc	ecx
161
	int	0x40
162
	call	need_window_tab
163
	jz	@f
164
	cmp	edx, 256
165
	jz	@f
166
	mov	[alt_tab_list+edx*8], ecx
167
	movzx	esi, word [ebx+4]
168
	mov	[alt_tab_list+edx*8+4], esi
169
	inc	edx
443 diamond 170
@@:
601 Rus 171
	cmp	ecx, eax
172
	mov	eax, 9
173
	jb	.fill
174
	mov	[alt_tab_list_size], edx
175
	test	edx, edx
176
	jz	begin_1.ret
177
	mcall	66,4,0,0	; ловим момент отпускания всех управляющих клавиш
178
	test	eax, eax
179
	jnz	begin_1.ret
180
	xor	edx, edx
181
	mov	eax, [alt_tab_list+4]
182
	xor	ecx, ecx
183
	inc	ecx
443 diamond 184
.findmax:
601 Rus 185
	cmp	[alt_tab_list+ecx*8+4], eax
186
	jb	@f
187
	mov	edx, ecx
188
	mov	eax, [alt_tab_list+ecx*8+4]
443 diamond 189
@@:
601 Rus 190
	inc	ecx
191
	cmp	ecx, [alt_tab_list_size]
192
	jb	.findmax
193
	mov	[current_alt_tab_app], edx
443 diamond 194
has_alt_tab_app:
601 Rus 195
	mov	eax, [current_alt_tab_app]
196
	mov	edx, [alt_tab_list+eax*8+4]	; slot
197
	xor	ecx, ecx
198
	or	eax, -1
199
	test	ebp, 300h
200
	jz	.notshift
201
	or	esi, -1
443 diamond 202
.loop1:
601 Rus 203
	cmp	[alt_tab_list+ecx*8+4], edx
204
	jbe	@f
205
	cmp	[alt_tab_list+ecx*8+4], esi
206
	jae	@f
207
	mov	eax, ecx
208
	mov	esi, [alt_tab_list+ecx*8+4]
443 diamond 209
@@:
601 Rus 210
	inc	ecx
211
	cmp	ecx, [alt_tab_list_size]
212
	jb	.loop1
213
	cmp	eax, -1
214
	jnz	.found
215
	xor	edx, edx
216
	xor	ecx, ecx
217
	jmp	.loop1
443 diamond 218
.notshift:
601 Rus 219
	xor	esi, esi
443 diamond 220
.loop2:
601 Rus 221
	cmp	[alt_tab_list+ecx*8+4], edx
222
	jae	@f
223
	cmp	[alt_tab_list+ecx*8+4], esi
224
	jbe	@f
225
	mov	eax, ecx
226
	mov	esi, [alt_tab_list+ecx*8+4]
443 diamond 227
@@:
601 Rus 228
	inc	ecx
229
	cmp	ecx, [alt_tab_list_size]
230
	jb	.loop2
231
	cmp	eax, -1
232
	jnz	.found
233
	or	edx, -1
234
	xor	ecx, ecx
235
	jmp	.loop2
443 diamond 236
.found:
601 Rus 237
	mov	[current_alt_tab_app], eax
238
	push	eax
239
	xor	edx, edx
240
	div	[max_applications]
241
	mov	[page_list], eax
242
	mov	[draw_window_1], 1
243
	mov	edi, app_list
244
	push	edi
245
	mov	ecx, 20
246
	or	eax, -1
247
	rep	stosd
248
	pop	edi
249
	pop	ecx
250
	sub	ecx, edx
443 diamond 251
@@:
601 Rus 252
	cmp	ecx, [alt_tab_list_size]
253
	jae	redraw_window_tabs
254
	mov	eax, [alt_tab_list+ecx*8]
255
	stosd
256
	inc	ecx
257
	jmp	@b
443 diamond 258
 
259
alt_tab_released:
601 Rus 260
	mcall	66,5,0,0	; уже поймали, хватит :)
261
	or	eax, -1
262
	xchg	eax, [current_alt_tab_app]
263
	mov	ecx, [alt_tab_list+eax*8]
264
	mov	eax, 18
265
	mov	ebx, 3
266
	int	0x40
267
	jmp	redraw_window_tabs
443 diamond 268
 
601 Rus 269
active_process	dd 0
31 halyavin 270
 
271
calendar_music:
272
    mcall 55, eax, , , calendarmusic
273
    ret
274
setup_music:
275
    mcall 55,eax, , ,setupmusic
276
    ret
277
sysmeter_music:
278
    mcall 55,eax, , ,sysmetermusic
279
    ret
280
button_music:
281
    mcall 55,eax, , ,buttonmusic
282
    ret
304 diamond 283
;syslang_music:
284
;    mcall 55, eax, , , syslangmusic
285
;    ret
31 halyavin 286
chlang_music:
287
    mcall 55, eax, , , chlangmusic
288
    ret
289
menu_music:
290
    mcall 55,eax, , ,menumusic
291
    ret
292
 
601 Rus 293
chlangmusic:	db 0x82,0x60,0x83,0x65,0x82,0x60,0
31 halyavin 294
 
304 diamond 295
;syslangmusic:   db 0x82,0x65,0x83,0x70,0x82,0x65,0
31 halyavin 296
 
601 Rus 297
menumusic:	db 0x82,0x50,0x84,0x48,0x82,0x50,0x84,0x53,0x82,0x51,0
31 halyavin 298
 
601 Rus 299
activatemusic:	db 0x83,0x30,0x85,0x60,0
31 halyavin 300
 
601 Rus 301
buttonmusic:	db 0x85,0x25,0x85,0x40,0
31 halyavin 302
 
601 Rus 303
sysmetermusic:	db 0x85,0x35,0x85,0x45,0
31 halyavin 304
 
601 Rus 305
setupmusic:	db 0x85,0x40,0x85,0x50,0
31 halyavin 306
 
601 Rus 307
calendarmusic:	db 0x85,0x37,0x85,0x48,0
31 halyavin 308
 
309
;  .exit: mcall -1
310
 
311
 
312
START:
601 Rus 313
	mov	eax, 51
314
	mov	ebx, 1
315
	mov	ecx, detect_start
316
	mov	edx, detect_stack
317
	int	0x40
318
	mcall 66,4,0,2		; LShift+RShift
319
	mcall 66, , ,11h	; Ctrl+Shift
320
	mcall 66,,88,110h	; Alt+Ctrl+F12
321
	mcall 66,,91,100h	; Alt+LWin
322
	mcall 66,,92		; Alt+RWin
323
	mcall 66,,62		; Alt+F4
324
	mcall 66,,71		; Alt+Home
325
	mcall 66,,72		; Alt+Up
326
	mcall 66,,15		; Alt+Tab
327
	mcall 66,,,101h 	; Alt+Shift+Tab
93 diamond 328
    mcall 18, 8, 1
329
    test eax, eax
330
    jne  @f
331
    mcall 18, 8, 2
332
  @@:
601 Rus 333
	mov	eax, 70
334
	mov	ebx, dat_fileinfo
335
	int	0x40
31 halyavin 336
 
337
    mov  edi,width
338
    mov  esi,I_END
93 diamond 339
    xor  eax,eax
31 halyavin 340
  new_number:
341
    cmp  [esi],byte ';'
601 Rus 342
    je	 number_ready
31 halyavin 343
    imul eax,10
344
    movzx ebx,byte [esi]
345
    sub  ebx,'0'
346
    add  eax,ebx
347
    inc  esi
348
    jmp  new_number
349
  number_ready:
93 diamond 350
    stosd
351
    xor  eax,eax
31 halyavin 352
    inc  esi
353
    cmp  [esi],byte 'x'
354
    jne  new_number
355
 
601 Rus 356
	mcall	14
357
	mov	[screen_size],eax
31 halyavin 358
 
601 Rus 359
	mcall	48,5
360
	mov	ecx,eax
361
	lea	edx,[ebx-PANEL_HEIGHT-1]
362
	mcall	48,6
51 mikedld 363
 
31 halyavin 364
    call set_variables
365
 
366
start_after_minimize:
367
 
368
    call draw_window
369
    call draw_info
370
    call draw_running_applications
371
 
372
    mov  eax, 23
373
    mov  ebx, 30
374
    int  0x40
375
 
376
still:
377
;     mcall  13,<390,70>,<3,11>,0xffffff
378
;     mov    ecx,[button_presssed_alt]
379
;     mcall  47,0x80100,ecx ,400 shl 16+5,0
380
 
381
    call draw_info
382
    call draw_running_applications
383
 
384
    mov  eax, 23
385
    mov  ebx, 20
386
    int  0x40
387
 
601 Rus 388
    cmp  eax,1		; redraw ?
389
    jz	 red
390
    cmp  eax,3		; button ?
391
    jz	 button
392
	call	handle_key
393
	jmp	still
31 halyavin 394
 
601 Rus 395
  red:			 ; redraw window
51 mikedld 396
 
601 Rus 397
	mcall	14
398
	movzx	ecx,ax
399
	mov	edx,eax
400
	shr	edx,16
401
	cmp	[screen_size.height],ax
402
	jne	@f
403
	rol	eax,16
404
	cmp	[screen_size.width],ax
405
	je	.lp1
406
	rol	eax,16
407
    @@: mov	[screen_size],eax
408
	sub	ecx,PANEL_HEIGHT
409
	mcall	67,0,,,PANEL_HEIGHT
51 mikedld 410
 
411
  .lp1:
31 halyavin 412
    call draw_window
413
    call draw_info
414
    jmp  still
415
 
601 Rus 416
  button:		 ; button
31 halyavin 417
    mov  eax,17
418
    int  0x40
419
 
420
    cmp  ah,50
601 Rus 421
    jb	 no_activate
31 halyavin 422
    cmp  ah,70
601 Rus 423
    jg	 no_activate
31 halyavin 424
 
425
    movzx ecx,byte ah
426
    sub  ecx,52
427
    shl  ecx,2
428
 
429
    mov  eax,18
430
    mov  ebx,3
431
    mov  ecx,[app_list+ecx]
432
    int  0x40
433
;    cmp  [music_type],0
434
;    je   still
435
    mcall 55,eax, , ,activatemusic
436
    jmp  still
437
  no_activate:
438
 
439
 
601 Rus 440
    cmp  ah,101 	  ; minimize to left
441
    je	 left_button
31 halyavin 442
 
601 Rus 443
    cmp  ah,102 	  ; minimize to right
444
    je	 right_button
31 halyavin 445
 
601 Rus 446
    cmp  ah,byte 1	  ; start/terminate menu
31 halyavin 447
    jnz  noselect
448
    call menu_handler
449
;    cmp  [music_type],0
450
;    je   still
451
    call menu_music
452
    jmp  still
453
  noselect:
454
 
601 Rus 455
	mov	ebx, exec_fileinfo
456
    cmp  ah,byte 2	       ; start calendar
31 halyavin 457
    jnz  noid15  ;noclock
601 Rus 458
	mov	dword [ebx+21], calendar_name
459
	mov	eax, 70
460
	int	0x40
31 halyavin 461
    call calendar_music
462
    jmp  still
463
 
464
  noid15:
465
    cmp  ah,16
466
    jne  noid16
601 Rus 467
	mov	ebx, setup_exec
468
	mov	dword [ebx+8], chlang
469
	mov	eax, 70
470
	int	0x40
31 halyavin 471
    call chlang_music
472
    mcall 5, 25
473
    jmp  still
474
 
475
  noid16:
304 diamond 476
;    cmp  ah,17
477
;    jne  noid17
478
;        mov     ebx, setup_exec
479
;        mov     dword [ebx+8], syslang
480
;        mov     eax, 70
481
;        int     0x40
482
;    call syslang_music
483
;    mcall 5, 25
484
;    jmp  still
485
;
486
;  noid17:
31 halyavin 487
    cmp  ah,18
488
    jne  noid18
601 Rus 489
	mov	dword [ebx+21], sysmeter_name
490
	mov	eax, 70
491
	int	0x40
31 halyavin 492
    call sysmeter_music
493
    jmp  still
494
 
495
  noid18:
496
    cmp  ah,19
497
    jne  noid19
498
;    inc  [music_type]
499
;    and  [music_type],1
500
    mcall 18,8,2
501
;    mcall 18,8
502
;    mov [sound_flag],al
503
 
504
;    mcall 15,4,2
505
    mcall 15,3
506
    jmp  red
507
 
508
  noid19:
601 Rus 509
    cmp  ah,20		   ; start system setup
31 halyavin 510
    jnz  noid20
601 Rus 511
	mov	ebx, setup_exec
512
	and	dword [ebx+8], 0
513
	mov	eax, 70
514
	int	0x40
31 halyavin 515
    call setup_music
93 diamond 516
    jmp still
31 halyavin 517
 
518
 noid20:
51 mikedld 519
    cmp  ah,21
520
    jnz  noid21
521
    cmp  [page_list],15
601 Rus 522
    je	   @f
51 mikedld 523
    inc  [page_list]
524
    jmp  red
525
  @@:
526
    jmp still
31 halyavin 527
 
51 mikedld 528
 noid21:
529
    cmp  ah,22
530
    jnz  noid22
531
    cmp  [page_list],0
601 Rus 532
    je	   @f
51 mikedld 533
    dec  [page_list]
534
    jmp  red
535
  @@:
31 halyavin 536
    jmp  still
537
 
51 mikedld 538
 noid22:
31 halyavin 539
 
51 mikedld 540
    jmp  still
31 halyavin 541
 
51 mikedld 542
 
543
 
31 halyavin 544
draw_running_applications:
545
 
546
    pusha
547
 
548
    cmp  [icons],1
549
    jne  dr_ret
550
 
551
    call calculate_applications
552
 
553
    cmp  edi,[running_applications]
554
    jne  noret
555
    popa
556
    ret
557
  noret:
558
 
559
;    cmp  edi,[running_applications]
560
;    jge  no_application_decrease
561
    call draw_window
562
;  no_application_decrease:
563
 
564
    mov  [running_applications],edi
565
 
601 Rus 566
	call	redraw_window_tabs
31 halyavin 567
 
443 diamond 568
  dr_ret:
51 mikedld 569
 
443 diamond 570
    popa
31 halyavin 571
 
443 diamond 572
    ret
31 halyavin 573
 
443 diamond 574
need_window_tab:
575
; in: ebx->process info
576
; out: ZF set <=> do not draw
601 Rus 577
	cmp	byte [ebx+10], '@'
578
	jz	.nodraw
443 diamond 579
; \begin{diamond}[29.03.2007]
580
; do not draw undefined (zero-sized) windows
601 Rus 581
	cmp	dword [ebx+42], 0
582
	jnz	@f
583
	cmp	dword [ebx+46], 0
584
	jz	.nodraw
443 diamond 585
@@:
586
; \end{diamond}[29.03.2007]
601 Rus 587
	cmp	dword [ebx+10], 'ICON'
588
	jnz	@f
589
	cmp	[ebx+42], dword 51
590
	jnz	@f
591
	cmp	[ebx+46], dword 51
592
	jz	.nodraw
443 diamond 593
@@:
601 Rus 594
	cmp	[ebx+10], dword '    '
443 diamond 595
.nodraw:
601 Rus 596
	ret
31 halyavin 597
 
443 diamond 598
redraw_window_tabs:
601 Rus 599
	xor	edi, edi
600
	mov	[contrast], 0
443 diamond 601
.loop:
601 Rus 602
	mov	ecx, [app_list+edi*4]
603
	cmp	ecx, -1
604
	jz	.done
31 halyavin 605
 
601 Rus 606
	push	ecx
607
	mov	eax, 9
608
	mov	ebx, 0x8000
609
	int	0x40
31 halyavin 610
 
601 Rus 611
	mov	eax, 13
612
	imul	ebx, edi, 6*10*10000h
613
	add	ebx, 6*10*10000h + 7*10000h + 54
614
	mov	ecx, 3*10000h + 14
615
	xor	edx, edx
616
	int	0x40
617
	sub	ebx, 10000h + 53
618
	mov	ecx, 4*10000h + 12
619
	int	0x40
620
	sub	ebx, 10000h
621
	mov	ecx, 5*10000h + 10
622
	int	0x40
623
	add	ebx, 56*10000h
624
	mov	ecx, 4*10000h + 12
625
	int	0x40
626
	add	ebx, 10000h
627
	mov	ecx, 5*10000h + 10
628
	int	0x40
31 halyavin 629
 
601 Rus 630
	mov	edx, 0x88FF
631
	xor	[contrast], 1
632
	jz	@f
633
	mov	dh, 0x55
443 diamond 634
@@:
601 Rus 635
	pop	ecx
636
	mov	esi, [current_alt_tab_app]
637
	cmp	esi, -1
638
	jz	@f
639
	cmp	ecx, [alt_tab_list+esi*8]
640
	jnz	@f
443 diamond 641
;        xor     edx, 0xFFFFFF
601 Rus 642
	mov	edx, 0xFF8000
443 diamond 643
@@:
601 Rus 644
	sub	ebx, 55*10000h - 53
645
	mov	ecx, 4*10000h + 12
646
	int	0x40
647
	sub	ebx, 10000h + 53
648
	mov	ecx, 5*10000h + 10
649
	int	0x40
650
	add	ebx, 55*10000h
651
	int	0x40
31 halyavin 652
 
601 Rus 653
	mov	eax, 4
654
	sub	ebx, 51*10000h - 6
655
	mov	ecx, 0xffffff	;[wcolor]
656
	mov	edx, 0x8000+10
657
	mov	esi, 11
658
	int	0x40
31 halyavin 659
 
601 Rus 660
	inc	edi
661
	cmp	edi, [max_applications]
662
	jb	.loop
443 diamond 663
.done:
601 Rus 664
	ret
31 halyavin 665
 
666
calculate_applications:
667
 
51 mikedld 668
    mov  eax,[max_applications]
93 diamond 669
    mul  [page_list]
670
    test eax,eax
601 Rus 671
    je	  @f
51 mikedld 672
    inc  eax
673
  @@:
674
    mov  [draw_start_position],eax
675
 
31 halyavin 676
    mov  edi,app_list
677
    mov  ecx,20
443 diamond 678
    mov  eax,-1
31 halyavin 679
    cld
680
    rep  stosd
681
 
682
    mov  edi,0
683
    mov  ecx,2
684
 
685
  cnewpr:
686
 
687
    mov  eax,9
688
    mov  ebx,0x8000
689
    int  0x40
690
 
601 Rus 691
	call	need_window_tab
692
	jz	cnorpl
693
	sub	[draw_start_position], 1
694
	jg	cnorpl
31 halyavin 695
 
696
    mov  [app_list+edi*4],ecx
697
 
698
    inc  edi
699
 
700
  cnorpl:
701
    inc  ecx
702
 
703
    cmp  eax,ecx
704
    jge  cnewpr
705
 
706
    ret
707
 
708
 
709
draw_application_buttons:
710
 
711
    pusha
712
 
713
    cmp [icons],1
714
    jne da_ret
715
 
716
    mov  eax,14
717
    int  0x40
718
 
719
    shr  eax,16
720
 
721
    cmp  eax,639
722
    jne  now1
601 Rus 723
    mov  [max_applications],7	;6
31 halyavin 724
  now1:
725
    cmp  eax,799
726
    jne  now2
51 mikedld 727
    mov  [max_applications],9 ;10    ;8
31 halyavin 728
  now2:
729
    cmp  eax,1023
730
    jne  now3
51 mikedld 731
    mov  [max_applications],12 ;13   ;8
31 halyavin 732
  now3:
733
    cmp  eax,1279
734
    jne  now4
51 mikedld 735
    mov  [max_applications],17 ;18    ;8
31 halyavin 736
  now4:
737
    mov  edi,1
738
 
739
  nb:
740
 
741
    mov  eax,8
742
    mov  ebx,edi
743
    shl  ebx,16
601 Rus 744
    imul ebx,6*10	     ;13
31 halyavin 745
    add  ebx,15*65536+10*6-1  ;13
746
    mov  ecx,1*65536+17
747
    mov  edx,edi
748
    add  edx,51
749
    cmp  [buttons],1
601 Rus 750
    je	 bufr
751
    or	 edx,0x60000000
31 halyavin 752
  bufr:
753
    mov  esi,[wcolor]
754
    sub  ebx,11 shl 16
755
    int  0x40
756
 
757
    inc  edi
758
    cmp  edi,[max_applications]
759
    jbe  nb
760
 
761
  da_ret:
762
 
763
    popa
764
 
765
    ret
766
 
767
 
768
menu_handler:
601 Rus 769
	mov	eax, 70
770
	mov	ebx, exec_fileinfo
771
	mov	dword [ebx+21], menu_name
772
	int	0x40
773
	ret
31 halyavin 774
 
775
draw_small_right:
776
 
777
    pusha
778
 
779
    mov  eax,12
780
    mov  ebx,1
781
    int  0x40
782
 
783
    mov  eax,0
784
    mov  edx,[wcolor]
785
    mov  esi,edx
786
    mov  edi,edx
601 Rus 787
    or	 edx, 0x01000000
31 halyavin 788
    int  0x40
789
 
790
    mov  eax,8
791
    mov  ebx,0*65536+9
792
    mov  ecx,0*65536
793
    mov  cx,[b_size_y]
794
    mov  edx,1
795
    mov  esi,[wcolor]
796
    int  0x40
797
 
798
    mov  eax,4
799
    mov  ebx,2*65536+16
800
    cmp  [graph_text],1
801
    jne  nos3
802
    mov  ebx,2*65536+7
803
  nos3:
804
    mov  ecx,[wcolor]
805
    add  ecx,0x303030
806
    mov  edx,hidetext
807
    mov  esi,1
808
    int  0x40
809
 
810
    mov  eax,12
811
    mov  ebx,2
812
    int  0x40
813
 
814
    popa
815
 
816
    ret
817
 
818
 
819
 
820
draw_small_left:
821
 
822
    pusha
823
 
824
    mov  eax,12
825
    mov  ebx,1
826
    int  0x40
827
 
828
    mov  eax,0
829
    mov  edx,[wcolor]
830
    mov  esi,edx
831
    mov  edi,edx
601 Rus 832
    or	 edx, 0x01000000
31 halyavin 833
    int  0x40
834
 
835
    cmp  [graph_text],1
601 Rus 836
    je	 nos4
31 halyavin 837
 
838
    mov  eax,8
839
    mov  ebx,0*65536+9
840
    mov  ecx,0*65536+18-6
841
    mov  edx,2
842
    mov  esi,[wcolor]
843
    int  0x40
844
 
845
    mov  eax,4
846
    mov  ebx,2*65536+4
847
    mov  ecx,[wcolor]
848
    add  ecx,0x303030
849
    mov  edx,hidetext+2
850
    mov  esi,1
851
    int  0x40
852
 
853
  nos4:
854
 
855
    mov  eax,8
856
    mov  ebx,0*65536+9
857
    mov  ecx,13*65536+25
858
    cmp  [graph_text],1
859
    jne  nos6
860
    mov  ecx,0*65536
861
    mov  cx,word [b_size_y]
862
  nos6:
863
    mov  edx,1
864
    mov  esi,[wcolor]
865
    int  0x40
866
 
867
    mov  eax,4
868
    mov  ebx,3*65536+22
869
    cmp  [graph_text],1
870
    jne  nos7
871
    mov  ebx,3*65536+7
872
  nos7:
873
    mov  ecx,[wcolor]
874
    add  ecx,0x303030
875
    mov  edx,hidetext+1
876
    mov  esi,1
877
    int  0x40
878
 
879
    mov  eax,12
880
    mov  ebx,2
881
    int  0x40
882
 
883
    popa
884
    ret
885
 
886
 
887
;-------------------------------------------------
888
 
889
right_button:
890
 
891
    call button_music
892
 
893
    mov  [small_draw],dword draw_small_right
894
 
895
    mcall 14
896
    shr eax, 16
897
    mov ebx, eax
898
    mov ecx, -1
899
    mov edx, 9
900
    sub ebx, edx
901
    mov esi, -1
902
    mcall 67
903
 
904
    call draw_small_right
905
 
906
    jmp  small_wait
907
 
908
;-------------------------------------------------
909
 
910
left_button:
911
 
912
    call  button_music
913
 
914
    mov  [small_draw],dword draw_small_left
915
 
916
    mov   ebx, 0
917
    mov   edx, 9
918
    mov   ecx, -1
919
    mov   esi, -1
920
    mcall 67
921
 
922
    call draw_small_left
923
 
924
;-------------------------------------------------
925
 
926
  small_wait:
927
 
928
    mov  eax, 10
929
    int  0x40
930
 
931
    cmp  eax,1
932
    jne  no_win
933
    call [small_draw]
934
    jmp  small_wait
935
  no_win:
93 diamond 936
    cmp  eax,2
937
    jne  no_key
938
    call handle_key
939
    jmp  small_wait
940
no_key:
31 halyavin 941
 
942
    mov  eax,17
943
    int  0x40
944
 
945
    cmp  ah,1
946
    jne  no_full
947
 
601 Rus 948
    mov   eax, 14		    ; get screen max x & max y
31 halyavin 949
    int   0x40
950
    mov   edx, eax
951
    shr   edx, 16
50 halyavin 952
    xor   ebx, ebx
31 halyavin 953
    mov   ecx, -1
954
    mov   esi, -1
955
    mcall 67 ; x0 y0 xs ys
956
 
957
    call  button_music
958
 
959
    jmp   still
960
 
961
 
962
  no_full:
963
 
964
    call menu_handler
965
 
966
    jmp  small_wait
967
 
968
 
969
 
970
set_variables:
971
 
972
     pusha
973
 
974
     mov  [b_size_y],dword 38
975
     cmp  [graph_text],1
976
     jne  noy2
977
     mov  [b_size_y],dword 18
978
   noy2:
979
 
980
     mov  [button_frames],0x0
981
     cmp  [buttons],0
982
     jne  no_frames
983
     mov  [button_frames],0x40000000
984
   no_frames:
985
 
986
 
601 Rus 987
     mov  eax,48	   ; 3d button look
31 halyavin 988
     mov  ebx,1
989
     mov  ecx,1
990
     int  0x40
991
 
992
     mov  eax,0x40404040   ; dividers for processes
993
     mov  edi,pros
994
     mov  ecx,10
995
     cld
996
     rep  stosd
997
 
998
     popa
999
     ret
1000
 
1001
 
1002
 
1003
; eax = number (1 or 2)
1004
; ebx = language id
1005
draw_flag:
1006
    pusha
1007
 
1008
;    cmp  [graph_text],0
1009
;    je   mini_flag
1010
 
1011
; eax = 2 BIG
1012
; eax = 1 small
1013
 
1014
    mov  edx,ebx
1015
 
1016
    mov  ebx,[maxx]
1017
    and  eax,1
1018
    imul eax,17  ;17
1019
    sub  ebx,eax
1020
    sub  ebx,76 ;79 ;28
1021
 
1022
    pushad
1023
;    dec  ebx
1024
    sub  ebx,2
1025
    shl  ebx, 16
1026
    add  ebx, 15 ;25
1027
    mov  ecx, 4*65536+13
1028
    mov  edx,0
1029
    mov  eax,13
1030
    int  0x40
1031
    add  ebx,1 shl 16
1032
    sub  ebx,2
1033
    mov  ecx, 5 shl 16+11
1034
    cmp  [type_lang],1
601 Rus 1035
    je	label_1
31 halyavin 1036
    mov  edx,0xff ;[wcolor]
1037
    jmp  label_2
1038
label_1:
1039
    mov  edx,0x7700
1040
label_2:
1041
    mov  eax, 13
1042
    int  0x40
1043
    popad
1044
 
1045
    shl  ebx,16
601 Rus 1046
    add  ebx,7	;24
31 halyavin 1047
 
1048
    mov  ecx,[bte] ; color
1049
 
1050
    dec  edx
1051
    shl  edx,1
1052
    add  edx,flag_text
1053
    mov  esi,2
1054
    mov  eax,4
1055
    int  0x40
1056
 
1057
    mov  ebx,[maxx]
1058
    sub  ebx,48
1059
    shl  ebx,16
1060
    mov  bx,34
1061
    mov  ecx,3 shl 16+14
1062
    xor  edx,edx
1063
    mov  eax,13
1064
    int  0x40
1065
    add  ebx,1 shl 16
1066
    sub  ebx,2
1067
    mov  ecx,4 shl 16+12
1068
    mov  edx,0x66cc
1069
    int  0x40
1070
 
1071
    popa
1072
    ret
1073
 
1074
;mini_flag:
1075
;    popa
1076
;    ret
1077
 
1078
 
1079
 
1080
 
1081
; ***************************************************
1082
; ********* WINDOW DEFINITIONS AND DRAW *************
1083
; ***************************************************
1084
 
1085
 
1086
draw_window:
1087
 
1088
    pusha
1089
 
1090
    mov  [running_applications],-1
1091
    mov  [checks],-1
1092
 
601 Rus 1093
    mov  eax, 12		   ; tell os about redraw
31 halyavin 1094
    mov  ebx, 1
1095
    int  0x40
1096
 
1097
    mov  eax, 48
1098
    mov  ebx, 3
1099
    mov  ecx, system_colours
1100
    mov  edx, 10*4
1101
    int  0x40
1102
 
1103
    mov  eax, [system_colours+4*6]
318 heavyiron 1104
    sub  eax, 0x101010
31 halyavin 1105
    mov  [wcolor], eax
1106
 
601 Rus 1107
    mov  eax,14 		   ; get screen max x & max y
31 halyavin 1108
    int  0x40
1109
 
1110
    cmp  [width],0
601 Rus 1111
    je	 no_def_width
31 halyavin 1112
    and  eax,0xffff
1113
    mov  ebx,[width]
1114
    shl  ebx,16
1115
    add  eax,ebx
1116
  no_def_width:
1117
 
1118
    mov  ebx,eax
1119
    mov  [screenxy],ebx
1120
    shr  ebx,16
1121
    sub  ax,38
1122
    shl  eax,16
1123
    mov  ecx,eax
1124
    add  ecx,0*65536+38
1125
    cmp  [graph_text],1
1126
    jne  no_text_1
42 mikedld 1127
    mov  cx,PANEL_HEIGHT
31 halyavin 1128
    add  ecx,20*65536
1129
  no_text_1:
601 Rus 1130
    mov  eax, 0 		    ; DEFINE AND DRAW WINDOW
31 halyavin 1131
    mov  edx, [wcolor]
601 Rus 1132
    or	 edx, 0x01000000 ; do not draw the window
31 halyavin 1133
    mov  esi, [wcolor]
601 Rus 1134
    or	 esi, 0x01000000 ; unmovable window
31 halyavin 1135
    mov  edi, [wcolor]
601 Rus 1136
 
1137
    mov  [panel_x_pos], ebx
1138
    mov  [panel_y_pos], ecx	 ; ╧юър ўЄю Єръ.
1139
 
31 halyavin 1140
    int  0x40
1141
 
1142
    movzx ebx,word [screenxy+2]
1143
    mov  ecx,0*65536+0
1144
    mov  edx,[wcolor]
1145
    add  edx,0x161616
1146
  newline:
1147
    sub  edx,0x040404
1148
    mov  eax,38
1149
    cmp  [soften_up],1
1150
    jne  no_su
51 mikedld 1151
    and  edx,0x00FFFFFF
31 halyavin 1152
    int  0x40
1153
  no_su:
1154
 
1155
    pusha
1156
    cmp  [soften_down],1
1157
    jne  no_sd
1158
    sub  edx,0x141414
1159
    mov  edi,[b_size_y]
1160
    shl  edi,16
1161
    add  edi,[b_size_y]
1162
    add  ecx,edi
1163
    sub  ecx,3*65536+3
51 mikedld 1164
    and  edx,0x00FFFFFF
31 halyavin 1165
    int  0x40
1166
  no_sd:
1167
    popa
1168
 
1169
    add  ecx,1*65536+1
1170
    cmp  cx,5
601 Rus 1171
    jb	 newline
31 halyavin 1172
 
1173
    cmp   [soften_middle],1
1174
    jne   no_sm
1175
 
1176
    movzx ebx,word [screenxy+2]
1177
    mov   ecx,5*65536+5
1178
    mov   esi,stripe
1179
    mov   edx,[wcolor]
1180
  newline3:
1181
    add  edx,[esi]
1182
    add  esi,4
1183
 
1184
    mov  eax,38
51 mikedld 1185
    and  edx,0x00FFFFFF
31 halyavin 1186
    int  0x40
1187
    add  ecx,1*65536+1
1188
    cmp  cx,15
601 Rus 1189
    jb	 newline3
31 halyavin 1190
 
1191
  no_sm:
1192
 
1193
    cmp  [minimize_left],1
1194
    jne  no_mleft
601 Rus 1195
    mov  eax,8				     ; ABS LEFT
31 halyavin 1196
    mov  ebx,0 *65536+9
1197
    mov  ecx,1 *65536
1198
    add  ecx,[b_size_y]
1199
    dec  ecx
1200
    mov  edx,101
1201
    add  edx,[button_frames]
1202
    mov  esi,[wcolor]
1203
    int  0x40
601 Rus 1204
    mov  eax,4				     ; HIDE TEXT
31 halyavin 1205
    mov  ebx,2*65536+17
1206
    cmp  [graph_text],1
1207
    jne  no_y1
1208
    mov  bx,7
1209
  no_y1:
1210
    mov  ecx,[wcolor]
1211
    add  ecx,0x303030
1212
    mov  edx,hidetext
1213
    mov  esi,1
1214
    int  0x40
1215
  no_mleft:
1216
 
1217
    movzx eax,word [screenxy+2]
1218
    mov  [maxx],eax
1219
 
1220
    cmp  [minimize_right],1
1221
    jne  no_mright
1222
    mov  eax,[maxx]
1223
    sub  eax,77
1224
    shl  eax,16
1225
    mov  ebx,eax
1226
    add  ebx,67
601 Rus 1227
    mov  eax,8				     ; ABS RIGHT
31 halyavin 1228
    mov  ecx,1 *65536
1229
    add  ecx,[b_size_y]
1230
    dec  ecx
1231
    add  ebx,68*65536
1232
    mov  bx,9
1233
    mov  edx,102
1234
    add  edx,[button_frames]
1235
    mov  esi,[wcolor]
1236
    int  0x40
1237
    mov  edx,hidetext+1
1238
    mov  eax,4
1239
    mov  ebx,[maxx]
1240
    sub  ebx,6
1241
    shl  ebx,16
1242
    mov  bx,17
1243
    cmp  [graph_text],1
1244
    jne  no_y2
1245
    mov  bx,7
1246
  no_y2:
1247
    mov  ecx,[wcolor]
1248
    add  ecx,0x303030
1249
    mov  esi,1
1250
    int  0x40
1251
  no_mright:
1252
 
1253
    call draw_menuet_icon
1254
 
1255
    call draw_program_icons
1256
 
1257
    mov  [ptime],0
1258
    call draw_info
1259
 
1260
    call draw_application_buttons
1261
 
1262
;     mov    ecx,[button_presssed_alt]
1263
;     mcall  47,0x80100,ecx ,400 shl 16+5,0
1264
 
1265
    mov  eax,12
1266
    mov  ebx,2
1267
    int  0x40
1268
 
1269
    popa
1270
    ret
1271
 
1272
 
1273
 
1274
draw_menuet_icon:
1275
 
1276
    pusha
1277
 
1278
    cmp  [menu_enable],1
1279
    jne  no_menu
1280
 
1281
 
601 Rus 1282
    mov  eax, 8 			      ; M BUTTON
31 halyavin 1283
    mov  ebx, 10*65536 + 47
1284
    cmp  [minimize_left], 0
1285
    jne  @f
1286
    sub  ebx, 10*65536
1287
  @@:
1288
    mov  ecx, 1*65536
1289
    add  ecx, [b_size_y]
1290
    dec  ecx
1291
    mov  edx, 0x20000001
1292
    add  edx, [button_frames]
1293
    mov  esi, [wcolor]
1294
    int  0x40
1295
 
1296
    cmp  [graph_text], 1
1297
    jne  no_mtext
1298
 
1299
    push ebx
1300
    mov  eax,13
1301
    mov  ebx,12 shl 16+44  ;51
1302
    mov  ecx,1 shl 16+17
1303
    xor  edx,edx
1304
    int  0x40
1305
;    mov  ebx,63 shl 16+1
1306
    mov  ebx,56 shl 16+1
1307
    mov  ecx,2 shl 16+15
1308
    int  0x40
1309
    mov  ebx,57 shl 16+1
1310
    mov  ecx,4 shl 16+11
1311
    int  0x40
1312
    mov  ebx,58 shl 16+1
601 Rus 1313
    mov  ecx,6	shl 16+7
31 halyavin 1314
    int  0x40
1315
;    mov  ebx,66  shl 16+1
1316
;    mov  ecx,9 shl 16+1
1317
;    int  0x40
1318
    mov  ebx,13 shl 16+43 ;50
1319
    mov  ecx,2 shl 16+15
1320
    mov  edx,0x7700
1321
    int  0x40
1322
;    mov  ebx,62 shl 16+1
1323
;    mov  ecx,3 shl 16+14
1324
;    int  0x40
1325
    mov  ebx,56 shl 16+1
1326
    mov  ecx,4 shl 16+11
1327
    int  0x40
1328
    mov  ebx,57 shl 16+1
1329
    mov  ecx,6 shl 16+7
1330
    int  0x40
1331
    pop  ebx
1332
 
1333
    mov  eax, 4
1334
    mov  bx,  7
1335
    add  ebx, 8*65536
1336
    mov  ecx, 0x10ffffff
1337
    mov  edx, m_text
1338
    mov  esi, 4
1339
    int  0x40
1340
 
1341
    popa
1342
    ret
1343
 
1344
  no_mtext:
1345
 
1346
 
1347
 
1348
    mov  eax,[wcolor]
1349
    mov  [m_icon+4],eax
1350
 
93 diamond 1351
; load & display menuet.bmp
601 Rus 1352
	mov	eax, 70
1353
	mov	ebx, m_bmp_fileinfo
1354
	int	0x40
31 halyavin 1355
 
1356
    mov  eax,40
1357
    mov  ebx,0
1358
    mov  edi,image+53
1359
 
1360
   new_m_pix:
1361
 
1362
;    movzx ecx,byte [edi]
1363
;    shr  ecx,5
1364
 
93 diamond 1365
    cmp    byte [edi], 10
601 Rus 1366
    jb	   nopix
93 diamond 1367
    cmp    byte [edi+1], 10
601 Rus 1368
    jb	   nopix
93 diamond 1369
    cmp    byte [edi+2], 10
601 Rus 1370
    jb	   nopix
31 halyavin 1371
 
1372
    pusha
1373
    cmp  [minimize_left],0
1374
    jne  no_m_s2
1375
    sub  ebx,10
1376
  no_m_s2:
1377
;    mov  edx,[ecx*4+m_icon]
1378
    mov  edx,[edi+1]
1379
 
1380
    mov  ecx,eax
1381
    mov  eax,1
1382
    add  ebx,12
1383
    int  0x40
1384
    popa
1385
 
1386
   nopix:
1387
 
1388
    add  edi,3
1389
    add  ebx,1
1390
    cmp  ebx,40
1391
    jnz  new_m_pix
1392
 
1393
    mov  ebx,0
1394
    dec  eax
1395
    jnz  new_m_pix
1396
 
1397
  no_menu:
1398
 
1399
    popa
1400
    ret
1401
 
1402
 
1403
draw_program_icons:
1404
 
1405
    pusha
1406
 
1407
    cmp  [icons],0
1408
    jne  dp_ret
1409
 
1410
    mov  edi,1
1411
    push edi
1412
 
1413
  new_icon_file:
1414
 
1415
    pusha
1416
    mov  edx,[esp+32]
1417
    add  edx,10
1418
    push edx
1419
    mov  esi,[wcolor]
1420
    mov  ecx,1*65536
1421
    add  ecx,[b_size_y]
1422
    dec  ecx
1423
    mov  eax,edi
1424
    dec  eax
1425
    imul eax,40
1426
    mov  ebx,eax
1427
    add  ebx,[icons_position]
1428
    shl  ebx,16
1429
    mov  bx,39
1430
    pop  edx
1431
    add  edx,[button_frames]
601 Rus 1432
    or	 edx, 0x20000000
31 halyavin 1433
    mov  eax,8
1434
    int  0x40
1435
    popa
1436
 
1437
    mov  ecx,[esp]
1438
    add  ecx,48
1439
    mov  [iconf+6],cl
1440
 
601 Rus 1441
	mov	eax, 70
1442
	mov	ebx, iconf_fileinfo
1443
	int	0x40
31 halyavin 1444
 
1445
    mov  eax,0
1446
    mov  ebx,32
1447
    mov  edi,image+51+32*33*3
1448
 
601 Rus 1449
   np2: 			    ; new pixel of file
31 halyavin 1450
 
1451
    mov  edx,[edi]
1452
    and  edx,0xffffff
1453
 
601 Rus 1454
    cmp  eax,3			    ; Y draw limits
1455
    jb	 nopix2
31 halyavin 1456
    cmp  eax,36
601 Rus 1457
    jg	 nopix2
1458
    cmp  ebx,38 		    ; X draw limits
1459
    jg	 nopix2
31 halyavin 1460
    cmp  ebx,2
601 Rus 1461
    jb	 nopix2
31 halyavin 1462
 
1463
    cmp  edx,0
601 Rus 1464
    jz	 nopix2
31 halyavin 1465
 
1466
    cmp  [graph_text],1
1467
    jne  no_icon_text
1468
 
1469
    pusha
1470
 
1471
    mov  ebx,[esp+32]
1472
    dec  ebx
1473
    imul ebx,40
1474
    add  ebx,8
1475
    add  ebx,[icons_position]
1476
    shl  ebx,16
1477
    mov  bx,7
1478
 
1479
    mov  eax,4
1480
    mov  ecx,0xffffff
1481
    mov  edx,[esp+32]
1482
    dec  edx
1483
    imul edx,4
1484
    add  edx,mi_text
1485
    mov  esi,4
1486
    int  0x40
1487
 
1488
    popa
1489
 
1490
    jmp  nopix2
1491
 
1492
  no_icon_text:
1493
 
1494
    mov  esi,[esp]
1495
    pusha
1496
    push edx
1497
    mov  ecx,eax
1498
    add  ecx,2
1499
    mov  eax,esi
1500
    dec  eax
1501
    imul eax,40
1502
    add  ebx,eax
1503
    add  ebx,3
1504
    add  ebx,[icons_position]
1505
    pop  edx
1506
    mov  eax,1
1507
    int  0x40
1508
    popa
1509
 
1510
  nopix2:
1511
 
1512
    sub  edi,3
1513
    dec  ebx
1514
    jnz  np2
1515
 
1516
    mov  ebx,32
1517
    add  eax,1
1518
    cmp  eax,32
1519
    jnz  np2
1520
 
1521
    add  dword [esp],1
1522
    mov  edi,[esp]
1523
    cmp  dword [esp],4
1524
    jbe  new_icon_file
1525
    add  esp,4
1526
 
1527
    mov  eax,4
1528
    mov  ebx,40
1529
    imul ebx,3
1530
    add  ebx,[icons_position]
1531
    add  ebx,10
1532
    shl  ebx,16
1533
    mov  bx,23
1534
    mov  ecx,[wcolor]
1535
    mov  edx,gpl
1536
    mov  esi,3
1537
    int  0x40
1538
 
1539
  dp_ret:
1540
 
1541
    popa
1542
    ret
1543
 
1544
 
1545
 
1546
draw_info:    ; draw cpu usage, time, date
1547
 
1548
    pusha
1549
 
1550
    cmp  [setup_enable],1
1551
    jne  no_setup
1552
 
1553
    cmp  [minimize_right],0
1554
    jne  no_m_r
1555
    add  [maxx],10
1556
 
1557
   no_m_r:
1558
 
1559
    mov  eax,3
1560
    int  0x40
1561
    cmp  eax,[ptime]
601 Rus 1562
    jz	 _ret
31 halyavin 1563
    mov  [ptime],eax
1564
 
1565
    call draw_cpu_usage
1566
 
1567
    mov  eax,[maxx]   ; blink sec
1568
    sub  eax,33
1569
    shl  eax,16
1570
    mov  ebx,eax
1571
    add  ebx,9
1572
    mov  eax,3
1573
    int  0x40
1574
    cmp  [graph_text],1
1575
    jne  no_y4
1576
    sub  bx,2
1577
  no_y4:
1578
    mov  ecx,eax
1579
    shr  ecx,16
1580
    and  ecx,1
1581
    mov  edx,[bte]
1582
    sub  edx,[wcolor]
1583
    imul ecx,edx
1584
    add  ecx,[wcolor]
1585
    mov  edx,sec
1586
    mov  eax,4
1587
    mov  esi,1
1588
    int  0x40
1589
 
1590
 
304 diamond 1591
;    mov  eax,26          ; check for change in time or country
1592
;    mov  ebx,5
1593
;    int  0x40
1594
;    mov  edx,eax
31 halyavin 1595
    mov  eax,26
1596
    mov  ebx,2
1597
    mov  ecx,9
1598
    int  0x40
304 diamond 1599
;    add  edx,eax
1600
    mov  edx,eax
31 halyavin 1601
    mov  eax,3
1602
    int  0x40
1603
    and  eax,0xffff
1604
    add  edx,eax
1605
    cmp  edx,[checks]
601 Rus 1606
    je	 _ret
31 halyavin 1607
    mov  [checks],edx
1608
 
1609
    mov  ebx,[maxx]
1610
    sub  ebx,48 ;;94 ;;74
1611
    shl  ebx,16
1612
    add  ebx,33 ;;84 ;;64
1613
 
601 Rus 1614
    mov  eax,8		     ; time/date button
31 halyavin 1615
    mov  ecx,3 *65536
1616
    add  ecx,[b_size_y]
1617
;    dec  ecx
1618
    sub  cx,5
1619
    mov  edx,2+0x20000000
1620
    mov  esi,[wcolor]
1621
    int  0x40
1622
    pusha
1623
    mov  eax,13
1624
    add  ebx,10*65536-16
1625
    add  ecx,5*65536-8
1626
    mov  edx,[wcolor]
1627
    int  0x40
1628
    popa
1629
    and  edx,0xffff
1630
    add  edx,[button_frames]
1631
    int  0x40
1632
 
1633
    mov  eax,8
1634
    mov  ebx,[maxx]
1635
    sub  ebx,77 ;80
1636
    shl  ebx,16
1637
    add  ebx,12
1638
    mov  ecx,5 shl 16+10
1639
    mov  edx,16+0x20000000  ;button 16
1640
    mov  esi,[wcolor]
1641
    int  0x40
1642
    sub  ebx,17 shl 16
601 Rus 1643
    inc  edx		    ;button 17
304 diamond 1644
;    int  0x40
31 halyavin 1645
    add  ebx,33 shl 16
1646
    mov  bx,8
601 Rus 1647
    inc  edx		    ;button 18
31 halyavin 1648
    int  0x40
304 diamond 1649
    sub  ebx,30 shl 16
31 halyavin 1650
    mov  bx,10
601 Rus 1651
    inc  edx		    ;button 19
31 halyavin 1652
    int  0x40
1653
    sub  ebx,14 shl 16
601 Rus 1654
    inc  edx		    ;button 20
31 halyavin 1655
    int  0x40
51 mikedld 1656
    sub  ebx,12 shl 16
1657
    mov  bx,8
1658
    mov  ecx,6 shl 16+10
601 Rus 1659
    inc  edx	    ;button 21
51 mikedld 1660
    int  0x40
1661
    sub  ebx,18 shl 16
601 Rus 1662
    inc  edx	    ;button 22
51 mikedld 1663
    int  0x40
1664
 
31 halyavin 1665
    ; flags
1666
 
304 diamond 1667
;    mov  eax,26
1668
;    mov  ebx,5
1669
;    int  0x40
1670
;    mov  ebx,eax
1671
;
1672
;    mov  eax,1
1673
;    mov  [type_lang],al
1674
;    call draw_flag
31 halyavin 1675
 
1676
    mov  eax,26
1677
    mov  ebx,2
1678
    mov  ecx,9
1679
    int  0x40
1680
    mov  ebx,eax
1681
 
1682
    mov  eax,2
1683
    mov  [type_lang],al
1684
    call draw_flag
1685
 
1686
    mcall 18,8,1
1687
    mov  [sound_flag],al
1688
 
1689
    mov  ebx,[maxx]
304 diamond 1690
    sub  ebx,92 ;109 ;112 ;28
31 halyavin 1691
    shl  ebx,16
1692
    mov  bx,12
1693
    mov  ecx, 4*65536+13
1694
    mov  edx,0
1695
    mov  eax,13
1696
    int  0x40
1697
    add  ebx,1 shl 16
1698
    sub  bx,2
1699
    mov  ecx,5 shl 16+11
1700
    mov  edx,0xcc
1701
    int  0x40
1702
    add  ebx,1 shl 16
1703
    mov  bx,5
1704
    mov  ecx,8 shl 16+5
1705
    mov  edx,0xdddd00
1706
    int  0x40
1707
    add  ebx,5 shl 16
1708
    mov  bx,1
1709
    mov  ecx,7 shl 16+7
1710
    int  0x40
1711
    add  ebx,1 shl 16
1712
    mov  ecx,6 shl 16+9
1713
    int  0x40
1714
    add  ebx,1 shl 16
1715
    mov  ecx,5 shl 16+11
1716
    int  0x40
1717
 
1718
;    cmp  [music_type],0
1719
;    jne   dalshe
1720
    cmp  [sound_flag],0
601 Rus 1721
    je	 dalshe
31 halyavin 1722
 
1723
    sub  ebx,8 shl 16
1724
    ror  ebx,16
1725
    mov  cx,bx
1726
    rol  ebx,16
1727
    mov  bx,cx
1728
    add  bx,8
1729
    mov  ecx,5 shl 16+15
1730
    mov  edx,0xff0000
1731
    mov  eax,38
1732
    int  0x40
1733
    add  ebx,1 shl 16
1734
    inc  bx
1735
    int  0x40
1736
    rol  ecx,16
1737
    int  0x40
1738
    sub  ebx,1 shl 16
1739
    dec  bx
1740
    int  0x40
1741
 
1742
dalshe:
1743
 
1744
    mov  ebx,[maxx]
304 diamond 1745
    sub  ebx,106;123
31 halyavin 1746
    shl  ebx,16
1747
    mov  bx,12
1748
    mov  ecx, 4*65536+13
1749
    mov  edx,0
1750
    mov  eax,13
1751
    int  0x40
1752
    add  ebx,1 shl 16
1753
    sub  bx,2
1754
    mov  ecx,5 shl 16+11
1755
    mov  edx,0xffcc00
1756
    int  0x40
1757
    mov  eax,4
1758
    mov  ebx,[maxx]
304 diamond 1759
    sub  ebx,104;121
31 halyavin 1760
    shl  ebx,16
1761
    mov  bx,7
1762
    mov  ecx,0x10000000
1763
    mov  edx,file_sys
1764
    mov  esi,1
1765
    int  0x40
1766
    add  ebx,1 shl 16
1767
    int  0x40
1768
 
51 mikedld 1769
    mov  edx,0
1770
    mov  eax,13
1771
    mov  ebx,[maxx]
304 diamond 1772
    sub  ebx,117;134
51 mikedld 1773
    shl  ebx,16
1774
    mov  bx,9
1775
    mov  ecx,6 shl 16+11
1776
    int  0x40
1777
    sub  ebx,18 shl 16
1778
    int  0x40
1779
    add  ebx,19 shl 16
1780
    sub  bx,2
1781
    mov  ecx,7 shl 16+9
1782
    mov  edx,0xffffff
1783
    int  0x40
1784
    sub  ebx,18 shl 16
1785
    int  0x40
1786
 
1787
    mov  eax,4
1788
    mov  edx,page_a1
1789
    mov  ebx,[maxx]
304 diamond 1790
    sub  ebx,133;150
51 mikedld 1791
    shl  ebx,16
1792
    mov  bx,8
1793
    mov  esi,4
1794
    int  0x40
1795
    add  ebx,1 shl 16
1796
    int  0x40
1797
 
1798
    mov  eax,47
1799
    mov  ebx,0x10100
1800
    mov  ecx,[page_list]
1801
    mov  edx,[maxx]
304 diamond 1802
    sub  edx,124;141
51 mikedld 1803
    shl  edx,16
1804
    mov  dx,7
1805
    mov  esi,0xffffff
1806
    int  0x40
1807
 
31 halyavin 1808
;    sub  ebx,14 shl 16
1809
;    mov  bx,7
1810
;    mov  edx,turn_text
1811
;    mov  esi,1
1812
 
1813
;    mov  ecx,0x60a060 ;[wcolor]
1814
;    add  ecx,0x303030
1815
;    mov  eax,4
1816
;    int  0x40
1817
;    add  ebx,1 shl 16
1818
;    int  0x40
1819
;    add  ebx,1 shl 16
1820
;    int  0x40
1821
;    add  ebx,1 shl 16
1822
;    int  0x40
1823
 
1824
;    add  ebx,1 shl 16
1825
;    mov  ecx,0x60a060 ;[wcolor]
1826
;    int  0x40
1827
;    add  ebx,1 shl 16
1828
;    int  0x40
1829
;    add  ebx,1 shl 16
1830
;    sub  ecx,0x303030
1831
;    int  0x40
1832
 
1833
;    sub  ebx,6 shl 16
1834
;    mov  bx,1
1835
;    mov  ecx,2 shl 16+15
1836
;    mov  edx,0x60a060  ;[wcolor]
1837
;    add  edx,0x303030
1838
;    mov  eax,13
1839
;    int  0x40
1840
;    add  ebx,1 shl 16
1841
;    mov  bx,1
1842
;    mov  edx,0x60a060  ;[wcolor]
1843
;    int  0x40
1844
;    add  ebx,1 shl 16
1845
;    mov  bx,1
1846
;    sub  edx,0x303030
1847
;    int  0x40
1848
;    add  ebx,1 shl 16
1849
;    mov  edx,[wcolor]
1850
;    int  0x40
1851
 
601 Rus 1852
    mov  eax,3			; get time
31 halyavin 1853
    int  0x40
1854
 
1855
    movzx ebx,al
1856
    shr   eax,8
1857
    movzx ecx,al
1858
    shr   eax,8
1859
    movzx edx,al
1860
 
1861
    ; ebx ecx edx h m s
1862
 
1863
    push ebx
1864
    push ecx
1865
 
1866
    mov  eax,[maxx]
1867
    sub  eax,32
1868
    shl  eax,16
1869
    mov  ebx,eax
1870
    add  ebx,9
1871
 
1872
    mov  ecx,[bte]
1873
 
1874
    cmp  [graph_text],1
1875
    jne  no_y3
1876
    sub  bx,2
1877
    mov  ecx,0xffffff
1878
  no_y3:
1879
 
1880
 
601 Rus 1881
    mov  edx,[esp]	       ; __:_X
31 halyavin 1882
    and  edx,15
1883
    mov  eax,4
1884
    add  ebx,10*65536
1885
    add  edx,text
1886
    mov  esi,1
1887
    int  0x40
1888
 
601 Rus 1889
    pop  edx			; __:X_
31 halyavin 1890
    shr  edx,4
1891
    and  edx,15
1892
    mov  eax,4
1893
    sub  ebx,6*65536
1894
    add  edx,text
1895
    mov  esi,1
1896
    int  0x40
1897
 
601 Rus 1898
    mov  edx,[esp]	       ; _X:__
31 halyavin 1899
    and  edx,15
1900
    mov  eax,4
1901
    sub  ebx,11*65536
1902
    add  edx,text
1903
    mov  esi,1
1904
    int  0x40
1905
 
601 Rus 1906
    pop  edx			; X_:__
31 halyavin 1907
    shr  edx,4
1908
    and  edx,15
1909
    mov  eax,4
1910
    sub  ebx,6*65536
1911
    add  edx,text
1912
    mov  esi,1
1913
    int  0x40
1914
 
1915
    call draw_cpu_usage
1916
 
1917
  _ret:
1918
 
1919
    cmp  [minimize_right],0
1920
    jne  no_m_r2
1921
    sub  [maxx],10
1922
   no_m_r2:
1923
 
1924
   no_setup:
1925
 
1926
    popa
1927
    ret
1928
 
1929
 
1930
 
1931
draw_cpu_usage:
1932
 
318 heavyiron 1933
    pushad
31 halyavin 1934
 
1935
    mov  [ysi],30
1936
    cmp  [graph_text],1
1937
    jne  @f
318 heavyiron 1938
    mov  [ysi],12
31 halyavin 1939
  @@:
1940
 
1941
 
1942
    mov  eax,18    ; TSC / SEC
1943
    mov  ebx,5
1944
    int  0x40
1945
    shr  eax,20
1946
    push eax
1947
    mov  eax,18    ; IDLE / SEC
1948
    mov  ebx,4
1949
    int  0x40
1950
    shr  eax,20
1951
    xor  edx,edx
1952
    imul eax,[ysi]
1953
 
1954
    cdq
1955
    pop  ebx
1956
    inc  ebx
1957
    div  ebx
318 heavyiron 1958
    cmp  eax,[ysi]
1959
    jng  no_bug
1960
    mov  eax,[ysi]
1961
no_bug:
31 halyavin 1962
    push eax
1963
 
1964
    mov  eax,13
1965
    mov  ebx,[maxx]
372 heavyiron 1966
    sub  ebx,60
31 halyavin 1967
    shl  ebx,16
372 heavyiron 1968
    add  ebx,8
1969
    mov  ecx,5 shl 16
318 heavyiron 1970
    add  ecx,[ysi]
372 heavyiron 1971
    mov  edx,0xdd2222
31 halyavin 1972
    int  0x40
372 heavyiron 1973
 
31 halyavin 1974
    pop  eax
372 heavyiron 1975
    mov  ecx,5 shl 16
1976
    add  ecx,eax
31 halyavin 1977
    mov  eax,13
372 heavyiron 1978
    mov  edx,0x44aa44
31 halyavin 1979
    int  0x40
1980
 
318 heavyiron 1981
    popad
31 halyavin 1982
    ret
1983
 
601 Rus 1984
include 'detect.asm'
1985
include 'ctx_menu.asm'
1986
 
31 halyavin 1987
; DATA
1988
 
1989
stripe:
601 Rus 1990
    dd	-0x010101
1991
    dd	-0x010101
1992
    dd	-0x020202
1993
    dd	-0x010101
1994
    dd	-0x000000
31 halyavin 1995
 
601 Rus 1996
    dd	 0x000000
1997
    dd	 0x010101
1998
    dd	 0x020202
1999
    dd	 0x010101
2000
    dd	 0x010101
31 halyavin 2001
 
2002
m_icon:
601 Rus 2003
    dd	0x0
2004
    dd	0x808080
2005
    dd	0x000000
2006
    dd	0x000000
2007
    dd	0xffffff
31 halyavin 2008
 
2009
 
2010
lsz m_text,\
2011
  ru, "МЕНЮ",\
275 kaitz 2012
  en, "MENU",\
2013
  et, "MEN▄▄"
31 halyavin 2014
 
2015
mi_text   db   'WAVETETRBGRDGPL '
2016
 
275 kaitz 2017
flag_text db 'EnFiGeRuFrEt'
31 halyavin 2018
 
2019
type_lang db 0
2020
;music_type db 1
2021
sound_flag db 0
2022
button_frames  dd  0x0
2023
 
601 Rus 2024
checks	  dd -1
31 halyavin 2025
hidetext  db 0x11,0x10,0x1e
2026
 
2027
turn_text db  '><'
601 Rus 2028
gpl	  db  'GPL'
31 halyavin 2029
 
2030
chlang db 'LANG',0
304 diamond 2031
;syslang db 'SLAN',0
31 halyavin 2032
 
2033
contrast  db 0
2034
 
2035
running_applications  dd  0x100
2036
max_applications      dd  11
2037
 
601 Rus 2038
current_alt_tab_app	dd	-1
443 diamond 2039
 
51 mikedld 2040
page_list  dd 0
2041
draw_start_position dd 0
2042
draw_window_1 db 0
2043
 
31 halyavin 2044
b_size_y:  dd  0x0
2045
ysi  dd  0
2046
small_draw dd 0x0
2047
 
601 Rus 2048
ptime	dd 0x0
2049
maxx	dd 0x0
2050
text	db '0123456789'
51 mikedld 2051
page_a1 db '<  >'
601 Rus 2052
bte	dd 0xccddee
31 halyavin 2053
 
601 Rus 2054
wcolor	dd 0x506070
31 halyavin 2055
 
601 Rus 2056
sec	db ': '
2057
pros	db '                                                  '
2058
	db '                                                  '
31 halyavin 2059
 
601 Rus 2060
screenxy    dd	0x0
2061
stcount     dd	0x0
31 halyavin 2062
 
93 diamond 2063
setup_exec:
601 Rus 2064
	dd	7
2065
	dd	0
2066
.cmdline dd	?
2067
	dd	0
2068
	dd	0
2069
	db	'/sys/'
2070
file_sys db	'SETUP',0
93 diamond 2071
 
2072
exec_fileinfo:
601 Rus 2073
	dd	7
2074
	dd	0
2075
	dd	0
2076
	dd	0
2077
	dd	0
2078
	db	0
2079
.name	dd	?
93 diamond 2080
 
601 Rus 2081
end_name	db	'/sys/END',0
2082
menu_name	db	'/sys/@MENU',0
2083
calendar_name	db	'/sys/CALENDAR',0
2084
sysmeter_name	db	'/sys/GMON',0
93 diamond 2085
 
2086
dat_fileinfo:
601 Rus 2087
	dd	0
2088
	dd	0
2089
	dd	0
2090
	dd	1024
2091
	dd	I_END
2092
	db	'/sys/PANEL.DAT',0
93 diamond 2093
 
2094
m_bmp_fileinfo:
601 Rus 2095
	dd	0
2096
	dd	0
2097
	dd	0
2098
	dd	8192
2099
	dd	image
2100
	db	'/sys/MENUET.BMP',0
93 diamond 2101
 
2102
iconf_fileinfo:
601 Rus 2103
	dd	0
2104
	dd	0
2105
	dd	0
2106
	dd	8192
2107
	dd	image
2108
	db	'/sys/'
2109
iconf	db	'MBAR_IX.BMP',0
93 diamond 2110
 
31 halyavin 2111
I_END:
51 mikedld 2112
 
2113
screen_size:
2114
  .height dw ?
2115
  .width  dw ?
2116
 
31 halyavin 2117
system_colours rd 10
2118
app_list rd 50
601 Rus 2119
alt_tab_list	rd	256*2
2120
alt_tab_list_size dd	?
494 spraid 2121
process_info_buffer  rb 1024
31 halyavin 2122
tictable:
2123
  rd 256
601 Rus 2124
 
2125
	rb	256
2126
detect_stack:
2127
	rb	256
2128
ctx_menu_stack:
2129
 
2130
panel_x_pos	rd	1
2131
panel_y_pos	rd	1
31 halyavin 2132
image: