Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
824 mikedld 1
diff16 'tp-draw.asm',0,$
2
 
178 heavyiron 3
;-----------------------------------------------------------------------------
617 mikedld 4
proc drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
178 heavyiron 5
;-----------------------------------------------------------------------------
6
 
7
	cmp	[just_from_popup],1
8
	jne	@f
9
	ret
10
    @@:
11
 
12
	mcall	48,3,sc,sizeof.system_colors
13
	call	calc_3d_colors
14
 
617 mikedld 15
	;mcall   12,1
16
	invoke	gfx.open,TRUE
17
	mov	[ctx],eax
178 heavyiron 18
 
617 mikedld 19
	;m2m     [sc.work],dword[color_tbl.back]
178 heavyiron 20
 
21
	mov	edx,[sc.work]
303 mikedld 22
	add	edx,0x73000000
178 heavyiron 23
	mov	ebx,[mainwnd_pos.x-2]
24
	mov	bx,word[mainwnd_pos.w]
25
	mov	ecx,[mainwnd_pos.y-2]
26
	mov	cx,word[mainwnd_pos.h]
27
	mcall	0,,,,,s_title
28
 
29
	mcall	9,p_info,-1
2065 mario79 30
 
31
	mov	eax,[p_info+70] ;status of window
32
	test	eax,100b
33
	jne	.exit.2
34
 
178 heavyiron 35
	mov	esi,p_info.box.left
36
	mov	edi,mainwnd_pos
37
	mov	ecx,4
38
	cld
39
	rep	movsd
40
 
41
	cmp	[p_info.client_box.height],LINEH
42
	jl	.exit.2
43
 
259 mikedld 44
	mov	[tab_bar.Bounds.Left],0
45
	mov	[tab_bar.Bounds.Top],ATOPH
46
	mov	eax,[p_info.client_box.width]
47
	mov	[tab_bar.Bounds.Right],eax
48
	mov	eax,[p_info.client_box.height]
49
	sub	eax,[bot_dlg_height]
50
	add	eax,-STATH-1
51
	mov	[tab_bar.Bounds.Bottom],eax
52
 
53
	call	align_editor_in_tab
54
 
178 heavyiron 55
	mov	[top_ofs],ATOPH;+1
56
 
259 mikedld 57
	mov	eax,[p_info.client_box.height]
58
	add	eax,-STATH+1;*3-2-2
178 heavyiron 59
	sub	eax,[bot_dlg_height]
60
	mov	[bot_ofs],eax
61
 
62
	call	draw_bottom_dialog
63
 
259 mikedld 64
;        mov     [do_not_draw],1 ; do_not_draw = true
178 heavyiron 65
 
259 mikedld 66
;        mov     ebx,eax
67
;        sub     ebx,[top_ofs]
68
;        sub     ebx,SCRLW*3+AMINS+5
69
;        js      .no_draw
178 heavyiron 70
 
259 mikedld 71
;        dec     [do_not_draw]    ; do_not_draw = false
72
;        sub     eax,SCRLW+3
73
;        sub     eax,[top_ofs]
74
;        cdq
75
;        mov     ebx,LINEH
76
;        div     ebx
77
;        mov     [lines.scr],eax
178 heavyiron 78
 
79
	inc	[top_ofs]
80
 
81
	call	draw_main_menu
82
 
83
	jmp	.exit
84
 
85
  .no_draw:
86
	mov	[top_ofs],2
87
	mov	eax,[p_info.client_box.height]
88
	inc	eax
89
	mov	[bot_ofs],eax
90
	sub	eax,2
91
	push	eax
92
	add	eax,-2-SCRLW
93
	cdq
94
	mov	ebx,LINEH
95
	idiv	ebx
96
	mov	[lines.scr],eax
97
	pop	eax
98
 
99
	mov	ebx,[p_info.client_box.height]
100
	sub	ebx,SCRLW*3+AMINS+2
101
	jns	@f
102
 
103
	inc	[do_not_draw]
104
 
105
	dec	eax
106
	cdq
107
	mov	ebx,LINEH
108
	idiv	ebx
109
	mov	[lines.scr],eax
110
 
111
	mov	eax,[p_info.client_box.width]
112
	cdq
113
	mov	ebx,6
114
	idiv	ebx
115
	mov	[columns.scr],eax
116
    @@:
117
 
118
  .exit:
259 mikedld 119
	call	draw_editor
120
	call	draw_tabctl
178 heavyiron 121
  .exit.2:
617 mikedld 122
	;mcall   12,2
123
	invoke	gfx.close,[ctx]
178 heavyiron 124
	ret
617 mikedld 125
endp
178 heavyiron 126
 
127
;-----------------------------------------------------------------------------
617 mikedld 128
proc draw_bottom_dialog ;/////////////////////////////////////////////////////
178 heavyiron 129
;-----------------------------------------------------------------------------
130
	cmp	[bot_dlg_height],0
131
	je	.exit
132
	pushad
617 mikedld 133
	invoke	gfx.pen.color,[ctx],[cl_3d_inset]
178 heavyiron 134
	mov	ecx,[bot_ofs]
135
	dec	ecx
617 mikedld 136
	invoke	gfx.line,[ctx],0,ecx,[p_info.client_box.width],ecx
137
	invoke	gfx.brush.color,[ctx],[cl_3d_normal]
138
	inc	ecx
139
	mov	eax,ecx
140
	add	eax,[bot_dlg_height]
141
	invoke	gfx.fillrect,[ctx],0,ecx,[p_info.client_box.width],eax
142
	;mov     ebx,[p_info.client_box.width]
143
	;mov     ecx,[bot_ofs]
144
	;dec     ecx
145
	;push    cx
146
	;shl     ecx,16
147
	;pop     cx
148
	;mcall   38,,,[cl_3d_inset]
149
	;mov     ecx,[bot_ofs-2]
150
	;mov     cx,word[bot_dlg_height]
151
	;dec     ecx
152
	;mov     ebx,[p_info.client_box.width]
153
	;inc     ebx
154
	;mcall   13,,,[cl_3d_normal]
178 heavyiron 155
	mov	al,1
156
	call	[bot_dlg_handler]
157
	popad
158
 
159
  .exit:
160
	ret
617 mikedld 161
endp
178 heavyiron 162
 
163
mi_sel	 dd ?
164
mi_cur	 dd -1
165
 
166
;-----------------------------------------------------------------------------
617 mikedld 167
proc draw_main_menu ;/////////////////////////////////////////////////////////
178 heavyiron 168
;-----------------------------------------------------------------------------
169
	mov	ebx,[p_info.client_box.width]
170
	inc	ebx
171
	mcall	13,,ATOPH-1,[cl_3d_normal]
172
 
280 mikedld 173
	mcall	38,[p_info.client_box.width],,[cl_3d_inset]
259 mikedld 174
 
178 heavyiron 175
	mov	edx,main_menu
280 mikedld 176
	mov	ebx,9*65536+ATOPH/2-3;4
178 heavyiron 177
	mov	[mi_sel],0
178
	mov	edi,[mi_cur]
179
    @@: inc	[mi_sel]
180
	cmp	[mi_sel],main_menu.cnt_item
181
	ja	.exit
280 mikedld 182
	mov	ecx,[sc.work_text]
178 heavyiron 183
	cmp	edi,[mi_sel]
184
	jne	.lp1
185
	pushad
186
	push	edx
280 mikedld 187
	mov	ecx,[edx+4]
188
	add	ecx,2*65536-2
297 mikedld 189
	mcall	13,[edx+0],,[sc.work]
178 heavyiron 190
	mov	edx,[esp]
280 mikedld 191
	mov	cx,[edx+6]
192
	add	ecx,-1*65536+1
193
	add	bx,[edx+2]
194
	mcall	38,,,[cl_3d_inset]
195
 
196
	mov	edx,[esp]
197
	add	cx,[edx+4]
198
	add	cx,-2
178 heavyiron 199
	mov	bx,[edx+2]
297 mikedld 200
	mcall	,,,[cl_3d_inset]
178 heavyiron 201
	pop	edx
202
	movzx	eax,word[edx]
203
	add	ebx,eax
204
	shl	eax,16
205
	add	ebx,eax
206
	mcall	38,,,[cl_3d_inset]
207
	popad
297 mikedld 208
	mov	ecx,[color_tbl.text]
178 heavyiron 209
  .lp1: add	edx,8+1
210
	movzx	esi,byte[edx-1]
211
	mcall	4
212
	add	edx,esi
213
	add	esi,2
214
	imul	esi,6*65536
215
	add	ebx,esi
216
	jmp	@b
217
 
218
  .exit:
629 mikedld 219
	mov	ebx,[mainwnd_pos.w]
220
	add	ebx,-10-(ATOPH-6)-3
221
	push	ebx 2 (ATOPH-6) (ATOPH-6)
222
	call	draw_3d_panel
223
	shl	ebx,16
224
	add	ebx,ATOPH-6
225
	mcall	8,,<2,ATOPH-6>,<0x4000,2>
226
	and	ebx,0xFFFF0000
227
	add	ebx,(ATOPH-8)/2*65536+(ATOPH-8)/2
228
	mcall	4,,[sc.work_text],.cross,1
595 Rus 229
 
178 heavyiron 230
	ret
595 Rus 231
 
629 mikedld 232
.cross db 'x'
617 mikedld 233
endp
178 heavyiron 234
 
235
;-----------------------------------------------------------------------------
617 mikedld 236
proc draw_statusbar ;///// DRAW POSITION, MODIFIED STATE, HINT ///////////////
178 heavyiron 237
;-----------------------------------------------------------------------------
238
	cmp	[do_not_draw],1  ; return if drawing is not permitted
239
	jae	.exit
240
	pusha
241
 
2065 mario79 242
       mcall   9,p_info,-1
243
 
244
	mov	eax,[p_info+70] ;status of window
245
	test	eax,100b
246
	jne	.exit_1
247
 
259 mikedld 248
	mov	ecx,[p_info.client_box.height-2]
249
	mov	cx,word[p_info.client_box.height]
250
	sub	ecx,STATH*65536+STATH
280 mikedld 251
	mcall	38,[p_info.client_box.width],,[cl_3d_inset]
259 mikedld 252
 
178 heavyiron 253
;       mcall   9,p_info,-1
254
 
255
	mov	ecx,[p_info.client_box.height-2]
256
	mov	cx,word[p_info.client_box.height]
257
	sub	ecx,STATH*65536
258
	mcall	38,<6*13,6*13>,,[cl_3d_inset]
259
 
260
	pushad
259 mikedld 261
	add	ecx,1*65536
262
	mov	cx,STATH
178 heavyiron 263
	mcall	13,<0,6*13>,,[cl_3d_normal]
264
	mcall	,<6*13+1,6*(s_modified.size+2)-1>
265
	mov	ebx,(6*(s_modified.size+15)+1)*65536
266
	mov	bx,word[p_info.client_box.width]
267
	sub	bx,6*(s_modified.size+15)
268
	mcall
269
	popad
270
 
271
	add	ebx,6*(s_modified.size+2)*65536+6*(s_modified.size+2)
272
	mcall
273
 
274
	and	ecx,0x0000FFFF
275
	push	ecx
276
 
297 mikedld 277
	mov	eax,[cur_editor.Caret.Y]
178 heavyiron 278
	inc	eax
279
	mov	ecx,10
297 mikedld 280
	mov	edi,p_info+0x100
178 heavyiron 281
	cld
282
	call	uint2str
283
	mov	al,','
284
	stosb
297 mikedld 285
	mov	eax,[cur_editor.Caret.X]
178 heavyiron 286
	inc	eax
287
	call	uint2str
288
 
289
	pop	ebx
290
 
291
	lea	esi,[edi-p_info-0x100]
292
	lea	edi,[esi*3]
293
	shl	edi,16
294
 
295
	add	ebx,(1+6*6+3)*65536-STATH/2-3
296
	sub	ebx,edi
297
	mcall	4,,[sc.work_text],p_info+0x100
298
 
297 mikedld 299
	cmp	[cur_editor.Modified],0
178 heavyiron 300
	je	@f
301
	and	ebx,0x0000FFFF
302
	add	ebx,(1+12*6+12+1)*65536
303
	mcall	,,,s_modified,s_modified.size
304
 
305
    @@: cmp	[s_status],0
306
	je	@f
307
	and	ebx,0x0000FFFF
308
	add	ebx,6*(s_modified.size+16)*65536
309
	or	ecx, 80000000h
310
	mcall	,,,[s_status]
2065 mario79 311
.exit_1:
178 heavyiron 312
    @@: popa
313
 
314
  .exit:
315
	ret
617 mikedld 316
endp
178 heavyiron 317
 
617 mikedld 318
proc draw_fillrect ; ebx,ecx,edx
297 mikedld 319
	; ebx = 
320
	; ecx = 
321
	push	ebx ecx edx
322
	call	draw_framerect
323
	add	ebx,1*65536-2
324
	add	ecx,1*65536-2
325
	mcall	13,,,esi
326
	pop	edx ecx ebx
327
	ret
617 mikedld 328
endp
297 mikedld 329
 
617 mikedld 330
proc draw_framerect ; ebx,ecx,edx
297 mikedld 331
	; ebx = 
332
	; ecx = 
178 heavyiron 333
	push	ebx ecx
334
 
297 mikedld 335
	add	bx,[esp+6]	 ; ebx = 
336
	mov	cx,[esp+2]	 ; ecx = 
178 heavyiron 337
	dec	ebx
259 mikedld 338
	mcall	38
297 mikedld 339
	add	cx,[esp]	 ; ecx = 
178 heavyiron 340
	rol	ecx,16
297 mikedld 341
	add	cx,[esp]	 ; ecx = 
178 heavyiron 342
	sub	ecx,0x00010001
343
	mcall
344
 
297 mikedld 345
	mov	ebx,[esp+4]	 ; ebx = 
346
	mov	ecx,[esp]	 ; ecx = 
347
	mov	bx,[esp+6]	 ; ebx = 
178 heavyiron 348
	add	cx,[esp+2]
349
	dec	ecx
350
	mcall
351
	add	bx,[esp+4]
352
	rol	ebx,16
353
	add	bx,[esp+4]
354
	sub	ebx,0x00010001
355
	mcall
356
 
259 mikedld 357
	pop	ecx ebx
178 heavyiron 358
	ret
617 mikedld 359
endp
267 mikedld 360
 
617 mikedld 361
proc draw_check
280 mikedld 362
	push	bx
363
	shl	ebx,16
364
	pop	bx
365
	add	ebx,0x00010000
366
	push	cx
367
	shl	ecx,16
368
	pop	cx
369
	add	ecx,0x00020001
370
	mcall	38
371
	add	ecx,0x00010001
372
	mcall
373
	add	ebx,4
374
	sub	ecx,2
375
	mcall
376
	sub	ecx,0x00010001
377
	mcall
378
	ret
617 mikedld 379
endp
280 mikedld 380
 
617 mikedld 381
proc calc_middle
267 mikedld 382
	shr	eax,1
383
	shr	ebx,1
384
	and	eax,0x007F7F7F
385
	and	ebx,0x007F7F7F
386
	add	eax,ebx
387
	ret
617 mikedld 388
endp
267 mikedld 389
 
617 mikedld 390
proc calc_3d_colors
267 mikedld 391
	pushad
392
	m2m	[cl_3d_normal],[sc.work]
393
	m2m	[cl_3d_inset],[sc.work_graph]
394
	push	[cl_3d_normal]
395
	add	byte[esp],48
396
	jnc	@f
397
	mov	byte[esp],255
398
    @@: add	byte[esp+1],48
399
	jnc	@f
400
	mov	byte[esp+1],255
401
    @@: add	byte[esp+2],48
402
	jnc	@f
403
	mov	byte[esp+2],255
404
    @@: pop	[cl_3d_outset]
405
	mov	eax,[cl_3d_inset]
406
	mov	ebx,[cl_3d_outset]
407
	call	calc_middle
280 mikedld 408
	mov	ebx,[cl_3d_normal]
409
	call	calc_middle
267 mikedld 410
	mov	[cl_3d_pushed],eax
411
	mov	eax,[cl_3d_normal]
412
	mov	ebx,[sc.work_text]
413
	call	calc_middle
414
	mov	[cl_3d_grayed],eax
415
	popad
416
	ret
617 mikedld 417
endp
267 mikedld 418
 
617 mikedld 419
proc draw_3d_panel ; x,y,w,h
267 mikedld 420
	push	eax ebx ecx edx
421
	cmp	dword[esp+16+8],4
422
	jl	.exit
423
	cmp	dword[esp+16+4],4
424
	jl	.exit
425
	mov	ebx,[esp+16+16-2]
426
	mov	bx,[esp+16+8]
427
	inc	ebx
428
	mov	ecx,[esp+16+12-2]
429
	mov	cx,[esp+16+4]
430
	inc	ecx
431
	mcall	13,,,[cl_3d_normal]
432
	dec	ebx
433
	add	bx,[esp+16+16]
434
	mov	cx,[esp+16+12]
435
	mcall	38,,,[cl_3d_inset]
436
	add	ecx,[esp+16+4-2]
437
	add	cx,[esp+16+4]
438
	mcall
439
	mov	bx,[esp+16+16]
440
	mov	ecx,[esp+16+12-2]
441
	mov	cx,[esp+16+4]
442
	add	cx,[esp+16+12]
443
	mcall
444
	add	ebx,[esp+16+8-2]
445
	add	bx,[esp+16+8]
446
	mcall
447
	mov	ebx,[esp+16+16-2]
448
	mov	bx,[esp+16+8]
449
	add	bx,[esp+16+16]
450
	add	ebx,1*65536-1
451
	mov	ecx,[esp+16+12-2]
452
	mov	cx,[esp+16+12]
453
	add	ecx,0x00010001
454
	mcall	,,,[cl_3d_outset]
455
	mov	bx,[esp+16+16]
456
	inc	ebx
457
	mov	ecx,[esp+16+12-2]
458
	mov	cx,[esp+16+4]
459
	add	cx,[esp+16+12]
460
	add	ecx,2*65536-1
461
	mcall
462
  .exit:
463
	pop	edx ecx ebx eax
464
	ret	4*4
617 mikedld 465
endp