Subversion Repositories Kolibri OS

Rev

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

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