Subversion Repositories Kolibri OS

Rev

Rev 2630 | 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
218
	mov	bx,9
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
291
	mcall	4,,,m_text,4
2619 mario79 292
;--------------------------------------
293
align 4
294
no_menu:
295
; check draw for clean desktop button
296
	cmp	[clean_desktop_enable],dword 0
297
	je	.exit
298
; calculate and draw clean desktop button
299
	mov	ebx, (0 shl 16) + CLD_SIZE-5
300
; check for left minimize button enabled
301
	cmp	[minimize_left],dword 0
302
	je	@f
303
 
304
	add	ebx, ML_SIZE shl 16
305
;--------------------------------------
306
align 4
307
@@:
308
; check for menu button enabled
309
	cmp	[menu_enable],dword 0
310
	je	@f
311
 
312
	add	ebx, MENU_SIZE shl 16
313
;--------------------------------------
314
align 4
315
@@:
316
; Inserted code for drawing buttons 103, 104, 105 (Clean, Restore, Exchange windows)
317
	mov	esi, dword [system_colours+24]    ; drawing buttons
318
	and	esi, 0x00ffffff
319
	mov	edx, 0x40000000 + 103
320
	call	calculate_button_y_coordinate_and_size
321
	mcall	8	;,,<3,13>
322
 
323
	mov	edx,[CleanDesktopButton_color]	;time_bgr_color
324
	mov	esi,[wcolor]
325
	call	draw_appl_button
326
 
327
;	mov	ecx, dword [system_colours+28]
328
;	and	ecx, 0x00ffffff
2626 mario79 329
	mov	ecx,[PanelText_color]
2619 mario79 330
	add	ebx,5 shl 16
331
;	mov	bx,6
332
	mov	bx,[height]
333
	shr	bx,1
334
	sub	bx,2
335
	mcall	4,,,page_clean_but,1
336
	sub	bx,2
337
	mcall	,,,page_clean_but+1
338
;--------------------------------------
339
align 4
340
.exit:
341
	popa
342
	ret
343
;------------------------------------------------------------------------------
344
align 4
345
draw_application_buttons:
346
	pusha
347
 
348
	cmp	[run_appl],dword 0	; do not draw application buttons
349
	je	.exit
350
 
351
	call	calculate_offset_X
352
 
353
;	mcall	14
354
	mov	eax,[screenxy]
355
	shr	eax,16
356
 
357
	sub	eax,[offset_X]
358
; check for left minimize button enabled
359
	cmp	[minimize_right],dword 0
360
	je	@f
361
 
362
	sub	eax, MR_SIZE
363
;--------------------------------------
364
align 4
365
@@:
366
	cmp	[clock_enable],dword 0
367
	je	@f
368
 
369
	sub	eax,CLOCK_SIZE
370
;--------------------------------------
371
align 4
372
@@:
373
	cmp	[cpu_usage_enable],dword 0
374
	je	@f
375
 
376
	sub	eax,CPU_USAGE_SIZE
377
;--------------------------------------
378
align 4
379
@@:
380
	cmp	[chlang_enable],dword 0
381
	je	@f
382
 
383
	sub	eax,CHLANG_SIZE
384
;--------------------------------------
385
align 4
386
@@:
387
	cmp	[page_list_enable],dword 0
388
	je	@f
389
 
390
	sub	eax,PAGE_LIST_SIZE
391
;--------------------------------------
392
align 4
393
@@:
394
	mov	ebx, TAB_SIZE
395
	xor	edx,edx
396
	div	ebx
397
	mov	[max_applications], eax
398
	xor	edi,edi
399
;--------------------------------------
400
align 4
401
.nb:
402
	mov	ebx,edi
403
	imul	ebx,TAB_SIZE
404
	add	ebx,[offset_X]
405
	shl	ebx,16
406
	mov	bx, TAB_SIZE-1
407
	mov	edx,edi
408
	add	edx,52
409
	or	edx,0x60000000
410
	mov	ecx, 1*65536
411
	add	ecx, [height]
412
	sub	ecx,3
413
	mcall	8,,,,[wcolor]
414
 
415
	inc	edi
416
	cmp	edi,[max_applications]
417
	jb	.nb
418
;--------------------------------------
419
align 4
420
.exit:
421
	popa
422
	ret
423
;------------------------------------------------------------------------------
424
align 4
425
calculate_offset_X:
426
	push	eax
427
	xor	eax,eax
428
; check for left minimize button enabled
429
	cmp	[minimize_left],dword 0
430
	je	@f
431
 
432
	add	eax, ML_SIZE
433
;--------------------------------------
434
align 4
435
@@:
436
; check for menu button enabled
437
	cmp	[menu_enable],dword 0
438
	je	@f
439
 
440
	add	eax, MENU_SIZE
441
;--------------------------------------
442
align 4
443
@@:
444
; check for clean desktop button enabled
445
	cmp	[clean_desktop_enable],dword 0
446
	je	@f
447
 
448
	add	eax, CLD_SIZE
449
;--------------------------------------
450
align 4
451
@@:
452
	mov	[offset_X],eax
453
	pop	eax
454
	ret
455
;------------------------------------------------------------------------------