Subversion Repositories Kolibri OS

Rev

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