Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
2619 mario79 1
;------------------------------------------------------------------------------
2
; ***************************************************
3
; ********* WINDOW DEFINITIONS AND DRAW *************
4
; ***************************************************
5
align 4
6
draw_window:
7
	pusha
8
	mov	[running_applications],-1
9
	mcall	12,1
10
 
11
	mcall	48,3,system_colours,10*4
12
 
13
	mov	eax, [system_colours+4*6]
14
	sub	eax, 0x101010
15
	mov	[wcolor], eax
16
 
17
	mcall	14	; get screen max x & max y
18
 
19
	cmp	[width],dword 0
20
	je	no_def_width
21
 
22
	and	eax,0xffff
23
	mov	ebx,[width]
24
	shl	ebx,16
25
	add	eax,ebx
26
;--------------------------------------
27
align 4
28
no_def_width:
29
	mov	ebx,eax
30
	mov	[screenxy],ebx
31
	shr	ebx,16
32
	mov	ecx,eax
33
 
34
	cmp	[place_attachment],1
35
	je	@f
36
 
37
	xor	ecx,ecx
38
	mov	cx,[height]
39
	dec	cx
40
	jmp	.attachment_selected
41
;--------------------------------------
42
align 4
43
@@:
44
	sub	ecx,[height]
45
	inc	ecx
46
	shl	ecx,16
47
	mov	cx,[height]
48
	dec	cx
49
;--------------------------------------
50
align 4
51
.attachment_selected:
52
	xor	eax,eax 		    ; DEFINE AND DRAW WINDOW
53
	mov 	edx, [wcolor]
54
	or	edx, 0x01000000 ; do not draw the window
55
	mov	esi, [wcolor]
56
	or	esi, 0x01000000 ; unmovable window
57
	mov 	edi, [wcolor]
58
	mov	[panel_x_pos], ebx
59
	mov	[panel_y_pos], ecx	 ; Пока что так.
60
	mcall
61
 
62
	movzx	eax,word [screenxy+2]
63
	mov	[max_x],eax
64
 
65
	call	fill_window
66
	call	minimize_left_button
67
	call	minimize_right_button
68
	call	draw_menu_and_clean_desktop
69
	mov	[ptime],0
70
	call	draw_tray
71
	call	draw_application_buttons
72
 
2626 mario79 73
	mov	[redraw_window_flag],0
2619 mario79 74
	mcall	12,2
75
	popa
76
	ret
77
;------------------------------------------------------------------------------
78
align 4
79
fill_window:
80
	movzx	ebx,word [screenxy+2]
81
	xor	ecx,ecx
82
	mov	edx,[wcolor]
83
;	add	edx,0x161616
84
	mov	eax,COLOR_CHANGE_MAGNITUDE_0
85
	imul	eax,dword [soften_height]
86
	call	subtract_color_change_magnitude
87
	cmp	[soften_up],dword 0
88
	je	no_su
89
;--------------------------------------
90
align 4
91
@@:			; debug.inc has macros with the same name
92
;	sub	edx,0x040404
93
	mov	eax,COLOR_CHANGE_MAGNITUDE_0
94
	call	add_color_change_magnitude
95
; draw soften_up - the width of 5 pixels
96
	and	edx,0x00FFFFFF
97
	mcall	38
98
 
99
	add	ecx,1*65536+1
100
	cmp	cx,[soften_height]	;5
101
	jb	@r
102
;--------------------------------------
103
align 4
104
no_su:
105
	cmp	[soften_down],dword 0
106
	je	no_sd
107
; draw soften_down - the width of 5 pixels
108
	pusha
109
	mov	esi,[soften_height]
110
	mov	ecx,[height]
111
	dec	ecx
112
	shl	ecx,16
113
	add	ecx,[height]
114
	dec	ecx
115
	mov	edx,[wcolor]
116
	mov	eax,COLOR_CHANGE_MAGNITUDE_0
117
	imul	eax,dword [soften_height]
118
	call	subtract_color_change_magnitude
119
@@:
120
	mov	eax,COLOR_CHANGE_MAGNITUDE_0
121
	call	add_color_change_magnitude
122
	and	edx,0x00FFFFFF
123
	mcall	38
124
	sub	ecx,1*65536+1
125
	dec	esi
126
	jnz	@r
127
	popa
128
;--------------------------------------
129
align 4
130
no_sd:
131
	movzx	ebx,word [screenxy+2]
132
	xor	ecx,ecx
133
	cmp	[soften_up],dword 0
134
	je	@f
135
 
136
	add	ecx,[soften_height]
137
	rol	ecx,16
138
	add	ecx,[soften_height]
139
;--------------------------------------
140
align 4
141
@@:
142
;	mov	esi,stripe
143
	mov	edx,[wcolor]
144
;--------------------------------------
145
align 4
146
newline3:
147
	and	edx,0x00FFFFFF
148
	mov	eax,[height]
149
	cmp	[soften_up],dword 0
150
	je	@f
151
 
152
	sub	eax,[soften_height]
153
;--------------------------------------
154
align 4
155
@@:
156
	cmp	[soften_down],dword 0
157
	je	@f
158
 
159
	sub	eax,[soften_height]
160
;--------------------------------------
161
align 4
162
@@:
163
	mov	cx,ax
164
	inc	ebx
165
	mcall	13
166
	ret
167
;------------------------------------------------------------------------------
168
align 4
169
minimize_left_button:
170
	cmp	[minimize_left],dword 0
171
	je	.exit
172
 
173
	mov	ecx,1 *65536
174
	add	ecx,[height]
175
	dec	ecx
176
	mov	edx,101
177
;	add	edx,[button_frames]
178
	or	edx,0x40000000
179
	mcall	8,<0,9>,,,[wcolor]	; ABS LEFT
180
 
181
	mov	ebx,2*65536	;+6
182
	mov	bx,[height]
183
	shr	bx,1
184
	sub	bx,3
2626 mario79 185
;	mov	ecx,[wcolor]
186
;	add	ecx,0x303030
187
	mov	edx,[wcolor]
188
	mov	eax,COLOR_CHANGE_MAGNITUDE_2
189
	call	add_color_change_magnitude
190
	mov	ecx,edx
2619 mario79 191
	mcall	4,,,hidetext,1	; HIDE TEXT
192
;--------------------------------------
193
align 4
194
.exit:
195
	ret
196
;------------------------------------------------------------------------------
197
align 4
198
minimize_right_button:
199
	cmp	[minimize_right],dword 0
200
	je	.exit
201
	mov	eax,[max_x]
202
	sub	eax,77
203
	shl	eax,16
204
	mov	ebx,eax
205
	add	ebx,67
206
 
207
	mov	ecx,1 *65536
208
	add	ecx,[height]
209
	dec	ecx
210
	add	ebx,68*65536
211
	mov	bx,9
212
	mov	edx,102
213
;	add	edx,[button_frames]
214
	or	edx,0x40000000
215
	mcall	8,,,,[wcolor]	; ABS RIGHT
216
 
217
	mov	ebx,[max_x]
218
	sub	ebx,6
219
	shl	ebx,16
220
	mov	bx,[height]
221
	shr	bx,1
222
	sub	bx,3
2626 mario79 223
;	mov	ecx,[wcolor]
224
;	add	ecx,0x303030
225
	mov	edx,[wcolor]
226
	mov	eax,COLOR_CHANGE_MAGNITUDE_2
227
	call	add_color_change_magnitude
228
	mov	ecx,edx
2619 mario79 229
	mov	esi,1
230
	mcall	4,,,hidetext+1
231
;--------------------------------------
232
align 4
233
.exit:
234
	ret
235
;------------------------------------------------------------------------------
236
align 4
237
draw_menu_and_clean_desktop:
238
	pusha
239
; check draw for menu
240
	cmp	[menu_enable],dword  0
241
	je	no_menu
242
; calculate and draw menu
243
	mov	ebx, (0 shl 16) + MENU_SIZE-3
244
; check for left minimize button enabled
245
	cmp	[minimize_left],dword 0
246
	je	@f
247
 
248
	add	ebx, ML_SIZE shl 16
249
;--------------------------------------
250
align 4
251
@@:
252
	call	calculate_button_y_coordinate_and_size
253
	mov	edx, 0x40d1ff01
254
;	mov	edx, 0xd1ff01
255
;	add	edx, [button_frames]
256
	mcall	8,,,,[wcolor]	; MENU BUTTON
257
 
258
	mov	eax,ebx
259
	shr	eax,16
260
	mov	[menu_button_x.start],eax
261
 
262
	mov	eax,ebx
263
	and	eax,0xffff
264
	mov	[menu_button_x.size],eax
265
 
266
	mov	eax,ecx
267
	shr	eax,16
268
	mov	[menu_button_y.start],eax
269
 
270
	mov	eax,ecx
271
	and	eax,0xffff
272
	mov	[menu_button_y.size],eax
273
 
274
	mov	edx,[MenuButton_color]	;0x44aa44
275
	mov	esi,[wcolor]
276
	call	draw_appl_button
277
 
278
	add	ebx, 8*65536
279
	mov	bx,[height]
280
	shr	bx,1
281
	sub	bx,3
2626 mario79 282
	mov	ecx,[PanelText_color]
283
	or	ecx,0x10000000
284
	mcall	4,,,m_text,4
2619 mario79 285
;--------------------------------------
286
align 4
287
no_menu:
288
; check draw for clean desktop button
289
	cmp	[clean_desktop_enable],dword 0
290
	je	.exit
291
; calculate and draw clean desktop button
292
	mov	ebx, (0 shl 16) + CLD_SIZE-5
293
; check for left minimize button enabled
294
	cmp	[minimize_left],dword 0
295
	je	@f
296
 
297
	add	ebx, ML_SIZE shl 16
298
;--------------------------------------
299
align 4
300
@@:
301
; check for menu button enabled
302
	cmp	[menu_enable],dword 0
303
	je	@f
304
 
305
	add	ebx, MENU_SIZE shl 16
306
;--------------------------------------
307
align 4
308
@@:
309
; Inserted code for drawing buttons 103, 104, 105 (Clean, Restore, Exchange windows)
310
	mov	esi, dword [system_colours+24]    ; drawing buttons
311
	and	esi, 0x00ffffff
312
	mov	edx, 0x40000000 + 103
313
	call	calculate_button_y_coordinate_and_size
314
	mcall	8	;,,<3,13>
315
 
316
	mov	edx,[CleanDesktopButton_color]	;time_bgr_color
317
	mov	esi,[wcolor]
318
	call	draw_appl_button
319
 
320
;	mov	ecx, dword [system_colours+28]
321
;	and	ecx, 0x00ffffff
2626 mario79 322
	mov	ecx,[PanelText_color]
2619 mario79 323
	add	ebx,5 shl 16
324
;	mov	bx,6
325
	mov	bx,[height]
326
	shr	bx,1
327
	sub	bx,2
328
	mcall	4,,,page_clean_but,1
329
	sub	bx,2
330
	mcall	,,,page_clean_but+1
331
;--------------------------------------
332
align 4
333
.exit:
334
	popa
335
	ret
336
;------------------------------------------------------------------------------
337
align 4
338
draw_application_buttons:
339
	pusha
340
 
341
	cmp	[run_appl],dword 0	; do not draw application buttons
342
	je	.exit
343
 
344
	call	calculate_offset_X
345
 
346
;	mcall	14
347
	mov	eax,[screenxy]
348
	shr	eax,16
349
 
350
	sub	eax,[offset_X]
351
; check for tray enabled
352
;	cmp	[tray_enable],dword 0
353
;	je	@f
354
 
355
;	sub	eax, TRAY_SIZE
356
;--------------------------------------
357
;align 4
358
;@@:
359
; check for left minimize button enabled
360
	cmp	[minimize_right],dword 0
361
	je	@f
362
 
363
	sub	eax, MR_SIZE
364
;--------------------------------------
365
align 4
366
@@:
367
	cmp	[clock_enable],dword 0
368
	je	@f
369
 
370
	sub	eax,CLOCK_SIZE
371
;--------------------------------------
372
align 4
373
@@:
374
	cmp	[cpu_usage_enable],dword 0
375
	je	@f
376
 
377
	sub	eax,CPU_USAGE_SIZE
378
;--------------------------------------
379
align 4
380
@@:
381
	cmp	[chlang_enable],dword 0
382
	je	@f
383
 
384
	sub	eax,CHLANG_SIZE
385
;--------------------------------------
386
align 4
387
@@:
388
	cmp	[page_list_enable],dword 0
389
	je	@f
390
 
391
	sub	eax,PAGE_LIST_SIZE
392
;--------------------------------------
393
align 4
394
@@:
395
	mov	ebx, TAB_SIZE
396
	xor	edx,edx
397
	div	ebx
398
	mov	[max_applications], eax
399
	xor	edi,edi
400
;--------------------------------------
401
align 4
402
.nb:
403
	mov	ebx,edi
404
	imul	ebx,TAB_SIZE
405
	add	ebx,[offset_X]
406
	shl	ebx,16
407
	mov	bx, TAB_SIZE-1
408
	mov	edx,edi
409
	add	edx,52
410
	or	edx,0x60000000
411
	mov	ecx, 1*65536
412
	add	ecx, [height]
413
	sub	ecx,3
414
	mcall	8,,,,[wcolor]
415
 
416
	inc	edi
417
	cmp	edi,[max_applications]
418
	jb	.nb
419
;--------------------------------------
420
align 4
421
.exit:
422
	popa
423
	ret
424
;------------------------------------------------------------------------------
425
align 4
426
calculate_offset_X:
427
	push	eax
428
	xor	eax,eax
429
; check for left minimize button enabled
430
	cmp	[minimize_left],dword 0
431
	je	@f
432
 
433
	add	eax, ML_SIZE
434
;--------------------------------------
435
align 4
436
@@:
437
; check for menu button enabled
438
	cmp	[menu_enable],dword 0
439
	je	@f
440
 
441
	add	eax, MENU_SIZE
442
;--------------------------------------
443
align 4
444
@@:
445
; check for clean desktop button enabled
446
	cmp	[clean_desktop_enable],dword 0
447
	je	@f
448
 
449
	add	eax, CLD_SIZE
450
;--------------------------------------
451
align 4
452
@@:
453
	mov	[offset_X],eax
454
	pop	eax
455
	ret
456
;------------------------------------------------------------------------------