Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
259 mikedld 1
 
2
func draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
267 mikedld 3
;-----------------------------------------------------------------------------
259 mikedld 4
5
 
267 mikedld 6
	mov	bx,word[cur_editor.Bounds.Right]
7
	sub	bx,word[cur_editor.Bounds.Left]
8
	inc	ebx
259 mikedld 9
	mov	ecx,[cur_editor.Bounds.Top-2]
267 mikedld 10
	mov	cx,word[cur_editor.Bounds.Bottom]
11
	sub	cx,word[cur_editor.Bounds.Top]
12
	inc	ecx
259 mikedld 13
	mov	edx,[cl_3d_inset]
14
	call	draw_framerect
15
280 mikedld 16
 
267 mikedld 17
	test	[options],OPTS_LINENUMS
259 mikedld 18
	jnz	@f
19
	xor	eax,eax ;! mov eax,2+LCHGW
20
	jmp	.lp1
21
    @@: inc	[cur_editor.Gutter.Visible]
267 mikedld 22
	mov	edi,p_info+100
259 mikedld 23
	mov	eax,[cur_editor.Lines.Count] ;! eax,[lines]
267 mikedld 24
	mov	ecx,10
259 mikedld 25
	call	uint2str
26
	lea	eax,[edi-p_info-100]
27
	cmp	eax,3
28
	jae	@f
29
	mov	eax,3
30
    @@: imul	eax,6
31
	add	eax,8
32
  .lp1: mov	[cur_editor.Gutter.Width],eax ;! [left_ofs],eax
267 mikedld 33
	mov	[left_ofs],eax
259 mikedld 34
35
 
280 mikedld 36
	sub	eax,[cur_editor.Bounds.Left]
37
	sub	eax,[cur_editor.Gutter.Width]
38
	sub	eax,SCRLW+LCHGW+4
39
	js	.exit
40
	cdq
41
	mov	ebx,6
42
	div	ebx
43
	mov	[columns.scr],eax
44
45
 
46
	sub	eax,[cur_editor.Bounds.Top]
47
48
 
49
	js	.exit
50
	cdq
51
	mov	ebx,LINEH
52
	div	ebx
53
	mov	[lines.scr],eax
54
55
 
259 mikedld 56
	call	draw_editor_vscroll
57
	call	draw_editor_hscroll
58
	call	draw_editor_text
59
	call	draw_editor_caret
60
61
 
280 mikedld 62
	ret
259 mikedld 63
endf
64
65
 
66
func draw_editor_gutter ;///// DRAW EDITOR GUTTER (LEFT PANEL) ///////////////
267 mikedld 67
;-----------------------------------------------------------------------------
259 mikedld 68
	cmp	[cur_editor.Gutter.Visible],0
267 mikedld 69
	je	.exit
259 mikedld 70
71
 
72
73
 
267 mikedld 74
	mov	bx,word[cur_editor.Gutter.Width]
75
	add	ebx,0x00010000
259 mikedld 76
	mov	ecx,[cur_editor.Bounds.Top-2]
267 mikedld 77
	mov	cx,word[cur_editor.Bounds.Bottom]
78
	sub	cx,word[cur_editor.Bounds.Top]
79
	add	cx,-SCRLW
259 mikedld 80
	add	ecx,0x00010000
81
	dec	cx
82
	mcall	13,,,[cl_3d_normal]
83
84
 
267 mikedld 85
	push	bx
259 mikedld 86
	shl	ebx,16
87
	pop	bx
88
	add	ecx,[cur_editor.Bounds.Top]
267 mikedld 89
	mcall	38,,,[cl_3d_inset]
259 mikedld 90
91
 
92
	mov	bx,word[cur_editor.Bounds.Top]
267 mikedld 93
	add	bx,3
259 mikedld 94
	mov	edi,[sc.work_text]
95
	mov	ecx,[cur_editor.TopLeft.Y]
267 mikedld 96
	inc	ecx
259 mikedld 97
	mov	edx,p_info+100
98
    @@: pushad
99
	push	eax edx edi
100
	mov	eax,ecx
101
	mov	ecx,10
102
	mov	edi,edx
103
	call	uint2str
104
	mov	esi,edi
105
	pop	edi edx eax
106
	sub	esi,edx
107
	imul	eax,esi,6*65536
108
	sub	ebx,eax
109
	mcall	4,,edi
110
	popad
111
	add	ebx,LINEH
112
	inc	ecx
113
	cmp	ecx,[cur_editor.Lines.Count]
267 mikedld 114
	jg	@f
259 mikedld 115
	mov	esi,ecx
116
	sub	esi,[cur_editor.TopLeft.Y]
267 mikedld 117
	cmp	esi,[lines.scr]
259 mikedld 118
	jbe	@b
119
    @@: add	esp,4*8*2
120
121
 
122
	ret
123
endf
124
125
 
126
func draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR //////////////
267 mikedld 127
;-----------------------------------------------------------------------------
259 mikedld 128
	mov	ebx,[cur_editor.Bounds.Right]
267 mikedld 129
	shl	ebx,16
259 mikedld 130
	add	ebx,(-SCRLW)*65536+SCRLW
131
	mov	ecx,[cur_editor.Bounds.Top-2]
267 mikedld 132
	mov	cx,SCRLW
259 mikedld 133
	mcall	8,,,'VSL' or 0x40000000
267 mikedld 134
	pushad
259 mikedld 135
	sar	ebx,16
136
	sar	ecx,16
137
	push	ebx ecx SCRLW SCRLW
138
	call	draw_3d_panel
139
	popad
140
	mov	eax,8
141
142
 
143
	push	0x18
144
	shr	ecx,16
145
	mov	bx,cx
146
	add	ebx,(SCRLW/2-2)*65536+SCRLW/2-3
147
	mcall	4,,[sc.work_text],esp,1
148
	add	esp,4
149
	popad
150
151
 
267 mikedld 152
	shl	ecx,16
259 mikedld 153
	add	ecx,(-SCRLW*2)*65536+SCRLW
154
	mcall	,,,'VSG' or 0x40000000
267 mikedld 155
	pushad
259 mikedld 156
	sar	ebx,16
157
	sar	ecx,16
158
	push	ebx ecx SCRLW SCRLW
159
	call	draw_3d_panel
160
	popad
161
	mov	eax,8
162
163
 
164
	push	0x19
165
	shr	ecx,16
166
	mov	bx,cx
167
	add	ebx,(SCRLW/2-2)*65536+SCRLW/2-3
168
	mcall	4,,[sc.work_text],esp,1
169
	add	esp,4
170
	popad
171
172
 
173
	mov	eax,[cur_editor.Lines.Count]
267 mikedld 174
	mov	ebx,[lines.scr]
259 mikedld 175
	mov	ecx,[cur_editor.TopLeft.Y]
267 mikedld 176
	mov	edx,[cur_editor.Bounds.Bottom]
177
	sub	edx,[cur_editor.Bounds.Top]
178
	add	edx,-SCRLW*3;+1
280 mikedld 179
	call	get_scroll_vars
259 mikedld 180
	mov	[cur_editor.VScroll.Top],eax
267 mikedld 181
	mov	[cur_editor.VScroll.Size],ebx
182
	pop	ebx
259 mikedld 183
184
 
185
	add	ecx,[cur_editor.Bounds.Top]
267 mikedld 186
	add	ecx,SCRLW+1
259 mikedld 187
188
 
189
	sar	ebx,16
190
	push	ebx ecx SCRLW [cur_editor.VScroll.Size]
267 mikedld 191
	dec	dword[esp]
259 mikedld 192
	call	draw_3d_panel
193
	popad
194
	mov	eax,13
195
	add	ebx,1*65536-1
196
197
 
267 mikedld 198
	mov	cx,word[cur_editor.VScroll.Top]
199
	add	ecx,(SCRLW+1)*65536
259 mikedld 200
	mov	edx,[sc.work]
201
	or	cx,cx
202
	jle	@f
203
	mcall	13
204
    @@:
205
	mov	ecx,[cur_editor.Bounds.Top]
267 mikedld 206
	add	ecx,[cur_editor.VScroll.Top]
207
	add	ecx,[cur_editor.VScroll.Size]
208
	add	ecx,SCRLW+1
259 mikedld 209
	mov	di,cx
210
	shl	ecx,16
211
	mov	cx,word[cur_editor.Bounds.Bottom]
267 mikedld 212
	sub	cx,di
259 mikedld 213
	sub	cx,SCRLW*2;+1
214
	jle	@f
215
	mcall
216
    @@:
217
	rol	ebx,16
218
	dec	bx
219
	push	bx
220
	rol	ebx,16
221
	pop	bx
222
	mov	ecx,[cur_editor.Bounds.Top-2]
267 mikedld 223
	mov	cx,word[cur_editor.Bounds.Bottom]
224
	add	ecx,(SCRLW)*65536-SCRLW*2-1
259 mikedld 225
	mcall	38,,,[cl_3d_inset]
226
227
 
228
endf
229
230
 
231
func draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR ////////////
267 mikedld 232
;-----------------------------------------------------------------------------
259 mikedld 233
	mov	ebx,[cur_editor.Bounds.Left-2]
267 mikedld 234
	mov	bx,SCRLW
259 mikedld 235
	mov	ecx,[cur_editor.Bounds.Bottom]
267 mikedld 236
	shl	ecx,16
259 mikedld 237
	add	ecx,(-SCRLW)*65536+SCRLW
238
	mcall	8,,,'HSL' or 0x40000000
267 mikedld 239
	pushad
259 mikedld 240
	sar	ebx,16
241
	sar	ecx,16
242
	push	ebx ecx SCRLW SCRLW
243
	call	draw_3d_panel
244
	popad
245
246
 
247
	push	0x1B
248
	shr	ecx,16
249
	mov	bx,cx
250
	add	ebx,(SCRLW/2-2)*65536+SCRLW/2-3
251
	mcall	4,,[sc.work_text],esp,1
252
	add	esp,4
253
	popad
254
255
 
267 mikedld 256
	shl	ebx,16
259 mikedld 257
	add	ebx,(-SCRLW*2)*65536+SCRLW
258
	mcall	8,,,'HSG' or 0x40000000
267 mikedld 259
	pushad
259 mikedld 260
	sar	ebx,16
261
	sar	ecx,16
262
	push	ebx ecx SCRLW SCRLW
263
	call	draw_3d_panel
264
	popad
265
266
 
267
	push	0x1A
268
	shr	ecx,16
269
	mov	bx,cx
270
	add	ebx,(SCRLW/2-2)*65536+SCRLW/2-3
271
	mcall	4,,[sc.work_text],esp,1
272
	add	esp,4
273
	popad
274
275
 
276
	mov	eax,[cur_editor.Columns.Count]
267 mikedld 277
	mov	ebx,[columns.scr]
259 mikedld 278
	mov	ecx,[cur_editor.TopLeft.X]
267 mikedld 279
	mov	edx,[cur_editor.Bounds.Right]
280
	sub	edx,[cur_editor.Bounds.Left]
280 mikedld 281
	add	edx,-(SCRLW*3)
259 mikedld 282
	call	get_scroll_vars
283
	mov	[cur_editor.HScroll.Top],eax
267 mikedld 284
	mov	[cur_editor.HScroll.Size],ebx
285
	pop	ecx
259 mikedld 286
287
 
288
	add	ebx,[cur_editor.Bounds.Left]
267 mikedld 289
	add	ebx,SCRLW+1
259 mikedld 290
	shl	ebx,16
291
	mov	bx,word[cur_editor.HScroll.Size]
267 mikedld 292
259 mikedld 293
 
294
	sar	ecx,16
295
	rol	ebx,16
296
	movsx	eax,bx
297
	sar	ebx,16
298
	dec	ebx
299
	push	eax ecx ebx SCRLW
300
	call	draw_3d_panel
301
	popad
302
	add	ecx,1*65536-1
303
304
 
267 mikedld 305
	mov	bx,word[cur_editor.Bounds.Left]
306
	mov	bx,word[cur_editor.HScroll.Top]
307
	add	ebx,(1+SCRLW)*65536
259 mikedld 308
	mcall	13,,,[sc.work]
309
	mov	ebx,[cur_editor.Bounds.Left]
267 mikedld 310
	add	ebx,1+SCRLW
259 mikedld 311
	add	ebx,[cur_editor.HScroll.Top]
267 mikedld 312
	add	ebx,[cur_editor.HScroll.Size]
313
	mov	di,bx
259 mikedld 314
	shl	ebx,16
315
	mov	bx,word[cur_editor.Bounds.Right]
267 mikedld 316
	sub	bx,di
259 mikedld 317
	sub	bx,SCRLW*2
318
	jle	@f
319
	mcall
320
    @@:
321
	mov	ebx,[cur_editor.Bounds.Left-2]
267 mikedld 322
	mov	bx,word[cur_editor.Bounds.Right]
323
	add	ebx,(SCRLW)*65536-SCRLW*2-1
259 mikedld 324
	rol	ecx,16
325
	dec	cx
326
	push	cx
327
	rol	ecx,16
328
	pop	cx
329
	mcall	38,,,[cl_3d_inset]
330
331
 
332
endf
333
334
 
335
func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
267 mikedld 336
;-----------------------------------------------------------------------------
259 mikedld 337
	cmp	[cur_editor.Lines],0
280 mikedld 338
	jne	@f
339
	ret
340
    @@: mov	eax,[cur_editor.Bounds.Bottom]
341
	sub	eax,[cur_editor.Bounds.Top]
267 mikedld 342
	cmp	eax,LINEH
259 mikedld 343
	jge	@f
344
	ret
345
    @@:
346
	call	init_sel_vars
347
	call	check_bottom_right
348
349
 
350
351
 
267 mikedld 352
	add	eax,[cur_editor.Gutter.Width]
353
	add	eax,LCHGW+3
259 mikedld 354
	mov	[left_ofs],eax
355
	mov	eax,[cur_editor.Bounds.Top]
267 mikedld 356
	add	eax,3
259 mikedld 357
	mov	[top_ofs],eax
358
359
 
360
	add	ebx,[left_ofs-2]
361
362
 
267 mikedld 363
	push	ecx
259 mikedld 364
	call	get_line_offset
365
366
 
367
	add	esp,4
368
	mov	ecx,[lines.scr]
369
	or	ecx,ecx
370
	jle	.exit
371
	add	esp,-4
372
373
 
267 mikedld 374
259 mikedld 375
 
376
377
 
378
379
 
380
	shl	ecx,16
381
	mov	cl,LINEH
382
	mov	ebx,[cur_editor.Bounds.Right]
267 mikedld 383
	;sub     ebx,[cur_editor.Bounds.Left]
384
	add	ebx,-SCRLW
259 mikedld 385
	add	ebx,[left_ofs-2]
386
	sub	ebx,[left_ofs]
387
	add	ebx,-2*65536+2
388
389
 
390
	mov	[in_sel],0
391
	mov	edx,[color_tbl+4*5]
392
	mov	eax,[esp+4*2]
393
	cmp	eax,[sel.begin.y]
394
	jl	.lp6
395
	je	.lp1
396
	cmp	eax,[sel.end.y]
397
	jg	.lp6
398
	je	.lp3
399
	jmp	.lp6.2
400
  .lp1: mov	eax,[sel.begin.y]
401
	cmp	eax,[sel.end.y]
402
	je	.lp5
403
  .lp2: mov	eax,[sel.begin.x]
404
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
267 mikedld 405
	jle	.lp6.2
259 mikedld 406
	cmp	eax,[columns.scr]
407
	jge	.lp6
408
	imul	eax,6
409
	pushad
410
	sub	bx,ax
411
	rol	ebx,16
412
	mov	bx,ax
413
	add	ebx,[left_ofs]
414
	add	ebx,-2
415
	rol	ebx,16
416
	mov	edx,[color_tbl+4*7]
417
	mcall	13
418
	popad
419
	mov	bx,ax
420
	mov	[in_sel],2
421
	jmp	.lp6
422
  .lp3: mov	eax,[sel.begin.y]
423
	cmp	eax,[sel.end.y]
424
	je	.lp5
425
  .lp4: mov	eax,[sel.end.x]
426
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
267 mikedld 427
	jle	.lp6
259 mikedld 428
	cmp	eax,[columns.scr]
429
	jg	.lp6.2
430
	imul	eax,6
431
	pushad
432
	sub	bx,ax
433
	rol	ebx,16
434
	add	eax,[left_ofs];OLEFT-1
435
	add	eax,-2
436
	mov	bx,ax
437
	rol	ebx,16
438
	mcall	13
439
	popad
440
	inc	eax
441
	mov	edx,[color_tbl+4*7]
442
	mov	bx,ax
443
	mov	[in_sel],3
444
	jmp	.lp6
445
  .lp5: mov	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
267 mikedld 446
	cmp	eax,[sel.begin.x]
259 mikedld 447
	jge	.lp4
448
	add	eax,[columns.scr]
449
	cmp	eax,[sel.end.x]
450
	jl	.lp2
451
	mov	eax,[sel.begin.x]
452
	cmp	eax,[sel.end.x]
453
	je	.lp6
454
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
267 mikedld 455
	imul	eax,6
259 mikedld 456
	pushad
457
	mov	ebx,[sel.end.x]
458
	sub	ebx,[sel.begin.x]
459
	imul	ebx,6
460
	sal	ebx,16
461
	dec	eax
462
	add	eax,[left_ofs]
463
	mov	bx,ax
464
	rol	ebx,16
465
	mov	edx,[color_tbl+4*7]
466
	mcall	13
467
	movzx	eax,bx
468
	sar	ebx,16
469
	add	eax,ebx
470
	mov	ebx,eax
471
	sal	ebx,16
472
	sub	ax,[esp+4*4]
473
	neg	ax
474
	add	ax,word[left_ofs]
475
	add	ax,-2
476
	mov	bx,ax
477
	mov	edx,[color_tbl+4*5]
478
	mcall	13
479
	popad
480
	mov	bx,ax
481
	mov	[in_sel],4
482
	jmp	.lp6
483
484
 
485
	mov	edx,[color_tbl+4*7]
486
	inc	[in_sel]
487
  .lp6:
488
	mcall	13
489
490
 
491
492
 
493
	mov	edx,[color_tbl+4*5]
494
	test	eax,0x00010000
495
	jz	@f
496
	mov	edx,[color_tbl+4*8]
497
	test	eax,0x00020000
498
	jz	@f
499
	mov	edx,[color_tbl+4*9]
500
    @@: mov	ebx,[left_ofs]
501
267 mikedld 502
 
259 mikedld 503
	shl	ebx,16
504
	mov	bx,LCHGW
505
	mcall	13
506
	popad
507
508
 
509
	and	eax,0x0000FFFF
510
	mov	[cur_line_len],eax
511
512
 
513
	ja	.next_block
514
	add	esp,4*2
515
	jmp	.exit ; .draw_cursor
516
517
 
518
519
 
520
	call	get_next_part
521
	pop	ebx
522
523
 
524
	mov	ecx,eax
525
526
 
527
	mov	eax,ebx
528
	sub	ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
267 mikedld 529
	cmp	ebx,[columns.scr]
259 mikedld 530
	jge	.skip_t
531
	add	ebx,esi
532
	jle	.skip_t
533
	mov	ebx,[esp+8+4*2] ;// 4*2=esi+ebx
534
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
267 mikedld 535
	jge	.qqq
259 mikedld 536
	sub	edx,eax
537
	add	esi,eax
538
;       mov     eax,OLEFT*65536
539
	xor	eax,eax
540
	jmp	.qqq2
541
  .qqq:
542
;       inc     eax
543
	imul	eax,6*65536
544
  .qqq2:
545
	and	ebx,0x0000FFFF
546
	add	eax,[left_ofs-2];OLEFT*65536
547
	add	ebx,eax
548
549
 
550
	add	eax,[esp+4] ; esi
551
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
267 mikedld 552
	sub	eax,[columns.scr]
259 mikedld 553
	jle	.qweqwe
554
	sub	esi,eax
555
  .qweqwe:
556
557
 
558
	cmp	al,0
559
	je	.draw_t
560
	dec	al
561
	jz	.ya4
562
  .nt1: dec	al
563
	jnz	.nt2
564
	mov	eax,[esp]
565
	cmp	eax,[sel.begin.x]
566
	jge	.ya4
567
	add	eax,[esp+4]
568
	cmp	eax,[sel.begin.x]
569
	jl	.draw_t
570
;---[ selection crosses block from the right ]-(-
571
  .ya1: mov	eax,esi
572
	mov	esi,[sel.begin.x]
573
	sub	esi,[esp]
574
	pushad
575
	mov	ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col]
267 mikedld 576
	sub	ecx,[esp+4*8]
259 mikedld 577
	jle	@f
578
	sub	esi,ecx
579
	sub	[esp+4],ecx
580
    @@: sub	eax,esi
581
	add	edx,esi
582
	imul	esi,6
583
	rol	ebx,16
584
	add	bx,si
585
	rol	ebx,16
586
	mov	esi,eax
587
	mov	ecx,[color_tbl+4*6]
588
	mcall	4
589
	popad
590
	jmp	.draw_t
591
;----------------------------------------------)-
592
  .nt2: dec	al
593
	jnz	.nt3
594
	mov	eax,[esp]
595
	cmp	eax,[sel.end.x]
596
	jge	.draw_t
597
	add	eax,[esp+4]
598
	cmp	eax,[sel.end.x]
599
	jl	.ya4
600
;---[ selection crosses block from the left ]--(-
601
  .ya2: mov	eax,[sel.end.x]
602
	sub	eax,[esp]
603
	push	ebx
604
	mov	ebx,[esp+4]
605
	sub	ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
267 mikedld 606
	jge	.ya2.1
259 mikedld 607
	add	eax,ebx
608
  .ya2.1:
609
	pop	ebx
610
	pushad
611
	mov	esi,eax
612
	mov	ecx,[color_tbl+4*6]
613
	mcall	4
614
	popad
615
	sub	esi,eax
616
	add	edx,eax
617
	imul	eax,6*65536
618
	add	ebx,eax
619
	jmp	.draw_t
620
;----------------------------------------------)-
621
  .nt3: mov	eax,[esp]
622
	cmp	eax,[sel.end.x]
623
	jge	.draw_t
624
	cmp	eax,[sel.begin.x]
625
	jge	@f
626
	add	eax,[esp+4]
627
	cmp	eax,[sel.begin.x]
628
	jl	.draw_t
629
	cmp	eax,[sel.end.x]
630
	jl	.ya1
631
;---[ selection inside block ]-----------------(-
632
	mov	eax,esi
633
	mov	esi,[sel.begin.x]
634
	sub	esi,[esp]
635
	push	eax
636
	mov	eax,[esp+4]
637
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
267 mikedld 638
	jge	.nt3.1
259 mikedld 639
	add	esi,eax
640
  .nt3.1:
641
	pop	eax
642
	sub	eax,esi
643
	pushad
644
	add	edx,esi
645
	imul	esi,6*65536
646
	add	ebx,esi
647
	mov	esi,[sel.end.x]
648
	sub	esi,[sel.begin.x]
649
	mov	ecx,[color_tbl+4*6]
650
	sub	eax,esi
651
	push	eax
652
	mcall	4
653
	add	edx,esi
654
	imul	esi,6*65536
655
	add	ebx,esi
656
	pop	esi
657
	mov	ecx,[esp+4*6]
658
	mcall	4
659
	popad
660
	jmp	.draw_t
661
;----------------------------------------------)-
662
    @@: add	eax,esi
663
	dec	eax
664
	cmp	eax,[sel.end.x]
665
	jge	.ya2
666
;---[ block inside selection ]-----------------(-
667
  .ya4: mov	ecx,[color_tbl+4*6]
668
;----------------------------------------------)-
669
670
 
671
	mcall	4;[esp+8]
672
  .skip_t:
673
	pop	eax eax ; ebx esi
674
	imul	eax,6
675
	add	[esp+4*2+2],ax
676
	pop	ecx esi
677
	cmp	ecx,[cur_line_len];LINE_WIDTH
678
	jl	.next_block
679
680
 
681
	and	ebx,0x0000FFFF
682
	add	ebx,[left_ofs-2]
683
	add	ebx,LINEH
684
	add	esi,[cur_line_len];LINE_WIDTH
685
	inc	dword[esp]
686
	dec	ecx
687
	jg	.next_line
688
689
 
690
691
 
267 mikedld 692
	add	eax,[cur_editor.Gutter.Width]
693
	inc	eax
259 mikedld 694
	mov	ebx,eax
695
	shl	ebx,16
696
	mov	bx,word[cur_editor.Bounds.Right]
267 mikedld 697
	sub	bx,ax
259 mikedld 698
	add	ebx,-SCRLW
699
	mov	edx,[color_tbl+4*5]
280 mikedld 700
	mov	eax,13
701
	mov	ecx,[esp-8]
702
	add	ecx,LINEH
703
	shl	ecx,16
704
	mov	cx,word[cur_editor.Bounds.Bottom]
705
	sub	cx,[esp-8]
706
	add	cx,-SCRLW-LINEH
707
	jle	@f
708
	mcall
709
    @@: mov	ecx,[cur_editor.Bounds.Top-2]
710
	mov	cx,2
711
	add	ecx,0x00010000
712
	mcall
713
	mov	ebx,[cur_editor.Bounds.Right]
714
	mov	ecx,[cur_editor.Bounds.Bottom]
715
	shl	ebx,16
716
	shl	ecx,16
717
	add	ebx,-(SCRLW-1)*65536+SCRLW-1
718
	add	ecx,-(SCRLW-1)*65536+SCRLW-1
719
	mcall
720
259 mikedld 721
 
722
	add	esp,4
723
	ret
724
endf
725
726
 
727
func draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
267 mikedld 728
;-----------------------------------------------------------------------------
259 mikedld 729
	cmp	[bot_mode],0
730
	jne	@f
731
	mov	ebx,[cur_editor.Caret.X]
267 mikedld 732
	sub	ebx,[cur_editor.TopLeft.X]
733
	js	@f
259 mikedld 734
	cmp	ebx,[columns.scr]
735
	ja	@f
736
	imul	ebx,6
737
	add	ebx,[left_ofs]
738
	dec	ebx
739
	push	bx
740
	shl	ebx,16
741
	pop	bx
742
	mov	eax,[cur_editor.Caret.Y]
267 mikedld 743
	sub	eax,[cur_editor.TopLeft.Y]
744
	js	@f
259 mikedld 745
	cmp	eax,[lines.scr]
746
	jge	@f
747
	imul	eax,LINEH
748
	add	eax,[top_ofs]
749
	mov	esi,eax
750
	shl	esi,16
751
	add	eax,LINEH-2
752
	mov	si,ax
753
	mov	ecx,2
754
	cmp	[ins_mode],0
755
	jne	.lp8
756
	add	cl,4
757
  .lp8: push	ecx
758
	mcall	38,,esi,0x01000000
759
	add	ebx,0x00010001
760
	pop	ecx
761
	loop	.lp8
762
    @@:
763
	ret
764
endf
280 mikedld 765
766
 
767
func editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE ///////////////////
768
;-----------------------------------------------------------------------------
769
; EAX = delta
770
;-----------------------------------------------------------------------------
771
	push	ebx ecx
772
	mov	ebx,[cur_editor.Lines.Size]
773
	add	ebx,eax
774
	mov	eax,[cur_editor.Lines]
775
	mov	[cur_editor.Lines.Size],ebx
776
	mov	ecx,eax
777
	call	mem.ReAlloc
778
	mov	[cur_editor.Lines],eax
779
	sub	eax,ecx
780
	pop	ecx ebx
781
	ret
782
endf
783