Subversion Repositories Kolibri OS

Rev

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