Subversion Repositories Kolibri OS

Rev

Rev 280 | Rev 311 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 280 Rev 297
Line 15... Line 15...
15
 
15
 
Line 16... Line 16...
16
	mov	[cur_editor.Gutter.Visible],0
16
	mov	[cur_editor.Gutter.Visible],0
17
	test	[options],OPTS_LINENUMS
17
	test	[options],OPTS_LINENUMS
18
	jnz	@f
18
	jnz	@f
19
	xor	eax,eax ;! mov eax,2+LCHGW
19
	xor	eax,eax
20
	jmp	.lp1
20
	jmp	.lp1
21
    @@: inc	[cur_editor.Gutter.Visible]
21
    @@: inc	[cur_editor.Gutter.Visible]
22
	mov	edi,p_info+100
22
	mov	edi,p_info+100
23
	mov	eax,[cur_editor.Lines.Count] ;! eax,[lines]
23
	mov	eax,[cur_editor.Lines.Count]
24
	mov	ecx,10
24
	mov	ecx,10
25
	call	uint2str
25
	call	uint2str
26
	lea	eax,[edi-p_info-100]
26
	lea	eax,[edi-p_info-100]
27
	cmp	eax,3
27
	cmp	eax,3
28
	jae	@f
28
	jae	@f
29
	mov	eax,3
29
	mov	eax,3
30
    @@: imul	eax,6
30
    @@: imul	eax,6
31
	add	eax,8
31
	add	eax,8
32
  .lp1: mov	[cur_editor.Gutter.Width],eax ;! [left_ofs],eax
32
  .lp1: mov	[cur_editor.Gutter.Width],eax
33
	mov	[left_ofs],eax
33
	mov	[left_ofs],eax
Line 34... Line 34...
34
 
34
 
35
	mov	eax,[cur_editor.Bounds.Right]
35
	mov	eax,[cur_editor.Bounds.Right]
36
	sub	eax,[cur_editor.Bounds.Left]
36
	sub	eax,[cur_editor.Bounds.Left]
Line 129... Line 129...
129
	shl	ebx,16
129
	shl	ebx,16
130
	add	ebx,(-SCRLW)*65536+SCRLW
130
	add	ebx,(-SCRLW)*65536+SCRLW
131
	mov	ecx,[cur_editor.Bounds.Top-2]
131
	mov	ecx,[cur_editor.Bounds.Top-2]
132
	mov	cx,SCRLW
132
	mov	cx,SCRLW
133
	mcall	8,,,'VSL' or 0x40000000
133
	cmp	[bot_mode],0
-
 
134
	jne	@f
-
 
135
	mcall	8,,,'VSL' or 0x40000000
134
	pushad
136
    @@: pushad
135
	sar	ebx,16
137
	sar	ebx,16
136
	sar	ecx,16
138
	sar	ecx,16
137
	push	ebx ecx SCRLW SCRLW
139
	push	ebx ecx SCRLW SCRLW
138
	call	draw_3d_panel
140
	call	draw_3d_panel
139
	popad
141
	popad
140
	mov	eax,8
142
	mov	eax,8
Line 150... Line 152...
150
 
152
 
Line 151... Line 153...
151
	mov	ecx,[cur_editor.Bounds.Bottom]
153
	mov	ecx,[cur_editor.Bounds.Bottom]
152
	shl	ecx,16
154
	shl	ecx,16
153
	add	ecx,(-SCRLW*2)*65536+SCRLW
155
	add	ecx,(-SCRLW*2)*65536+SCRLW
-
 
156
	cmp	[bot_mode],0
-
 
157
	jne	@f
154
	mcall	,,,'VSG' or 0x40000000
158
	mcall	,,,'VSG' or 0x40000000
155
	pushad
159
    @@: pushad
156
	sar	ebx,16
160
	sar	ebx,16
157
	sar	ecx,16
161
	sar	ecx,16
158
	push	ebx ecx SCRLW SCRLW
162
	push	ebx ecx SCRLW SCRLW
159
	call	draw_3d_panel
163
	call	draw_3d_panel
160
	popad
164
	popad
Line 234... Line 238...
234
	mov	bx,SCRLW
238
	mov	bx,SCRLW
235
	mov	ecx,[cur_editor.Bounds.Bottom]
239
	mov	ecx,[cur_editor.Bounds.Bottom]
236
	shl	ecx,16
240
	shl	ecx,16
237
	add	ecx,(-SCRLW)*65536+SCRLW
241
	add	ecx,(-SCRLW)*65536+SCRLW
238
	mcall	8,,,'HSL' or 0x40000000
242
	cmp	[bot_mode],0
-
 
243
	jne	@f
-
 
244
	mcall	8,,,'HSL' or 0x40000000
239
	pushad
245
    @@: pushad
240
	sar	ebx,16
246
	sar	ebx,16
241
	sar	ecx,16
247
	sar	ecx,16
242
	push	ebx ecx SCRLW SCRLW
248
	push	ebx ecx SCRLW SCRLW
243
	call	draw_3d_panel
249
	call	draw_3d_panel
244
	popad
250
	popad
245
 
251
 
Line 254... Line 260...
254
 
260
 
Line 255... Line 261...
255
	mov	ebx,[cur_editor.Bounds.Right]
261
	mov	ebx,[cur_editor.Bounds.Right]
256
	shl	ebx,16
262
	shl	ebx,16
257
	add	ebx,(-SCRLW*2)*65536+SCRLW
263
	add	ebx,(-SCRLW*2)*65536+SCRLW
-
 
264
	cmp	[bot_mode],0
-
 
265
	jne	@f
258
	mcall	8,,,'HSG' or 0x40000000
266
	mcall	8,,,'HSG' or 0x40000000
259
	pushad
267
    @@: pushad
260
	sar	ebx,16
268
	sar	ebx,16
261
	sar	ecx,16
269
	sar	ecx,16
262
	push	ebx ecx SCRLW SCRLW
270
	push	ebx ecx SCRLW SCRLW
263
	call	draw_3d_panel
271
	call	draw_3d_panel
264
	popad
272
	popad
Line 331... Line 339...
331
	ret
339
	ret
332
endf
340
endf
Line 333... Line 341...
333
 
341
 
-
 
342
;-----------------------------------------------------------------------------
-
 
343
func draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) //////////////////
-
 
344
;-----------------------------------------------------------------------------
-
 
345
; EAX = start line
-
 
346
; EBX = end line
-
 
347
;-----------------------------------------------------------------------------
-
 
348
	cmp	[cur_editor.Lines],0
-
 
349
	jne	@f
-
 
350
	ret
-
 
351
    @@: push	eax
-
 
352
	mov	eax,[cur_editor.Bounds.Bottom]
-
 
353
	sub	eax,[cur_editor.Bounds.Top]
-
 
354
	cmp	eax,LINEH
-
 
355
	pop	eax
-
 
356
	jge	@f
-
 
357
	ret
-
 
358
    @@:
-
 
359
	mov	ebp,cur_editor
-
 
360
	call	init_sel_vars
-
 
361
	call	check_bottom_right
-
 
362
 
-
 
363
	pushad
-
 
364
 
-
 
365
	push	eax
-
 
366
	mov	eax,[cur_editor.Bounds.Left]
-
 
367
	add	eax,[cur_editor.Gutter.Width]
-
 
368
	add	eax,LCHGW+3
-
 
369
	mov	[left_ofs],eax
-
 
370
	mov	eax,[cur_editor.Bounds.Top]
-
 
371
	add	eax,3
-
 
372
	mov	[top_ofs],eax
-
 
373
	pop	eax
-
 
374
 
-
 
375
	cmp	[lines.scr],0
-
 
376
	jle	.exit
-
 
377
 
-
 
378
	cmp	eax,ebx
-
 
379
	jle	@f
-
 
380
	xchg	eax,ebx
-
 
381
    @@: cmp	eax,[cur_editor.TopLeft.Y]
-
 
382
	jge	@f
-
 
383
	mov	eax,[cur_editor.TopLeft.Y]
-
 
384
    @@: mov	ecx,[cur_editor.TopLeft.Y]
-
 
385
	add	ecx,[lines.scr]
-
 
386
	cmp	ebx,ecx
-
 
387
	jl	@f
-
 
388
	dec	ecx
-
 
389
	mov	ebx,ecx
-
 
390
    @@: cmp	eax,ebx
-
 
391
	jg	.exit
-
 
392
 
-
 
393
	mov	ecx,eax
-
 
394
	push	eax
-
 
395
	call	get_line_offset
-
 
396
 
-
 
397
  .start:
-
 
398
	mov	ecx,ebx
-
 
399
	sub	ecx,eax
-
 
400
	inc	ecx
-
 
401
 
-
 
402
	mov	ebx,[top_ofs]
-
 
403
	add	ebx,[left_ofs-2]
-
 
404
	sub	eax,[cur_editor.TopLeft.Y]
-
 
405
	imul	eax,LINEH
-
 
406
	add	ebx,eax
-
 
407
 
-
 
408
	imul	ebp,[cur_editor.TopLeft.X],6*65536
-
 
409
	mov	[draw_blines],0
-
 
410
 
-
 
411
	jmp	draw_editor_text.next_line
-
 
412
 
-
 
413
  .exit:
-
 
414
	popad
-
 
415
	ret
-
 
416
endf
-
 
417
 
334
;-----------------------------------------------------------------------------
418
;-----------------------------------------------------------------------------
335
func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
419
func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
336
;-----------------------------------------------------------------------------
420
;-----------------------------------------------------------------------------
337
	cmp	[cur_editor.Lines],0
421
	cmp	[cur_editor.Lines],0
338
	jne	@f
422
	jne	@f
Line 342... Line 426...
342
	cmp	eax,LINEH
426
	cmp	eax,LINEH
343
	jge	@f
427
	jge	@f
344
	ret
428
	ret
345
    @@:
429
    @@:
346
	call	init_sel_vars
430
	mov	ebp,cur_editor
-
 
431
	call	init_sel_vars
347
	call	check_bottom_right
432
	call	check_bottom_right
348
 
433
 
Line 349... Line 434...
349
	pushad
434
	pushad
Line 358... Line 443...
358
 
443
 
Line 359... Line 444...
359
	mov	ebx,[top_ofs]
444
	mov	ebx,[top_ofs]
360
	add	ebx,[left_ofs-2]
445
	add	ebx,[left_ofs-2]
Line 361... Line 446...
361
 
446
 
362
	mov	ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
447
	mov	ecx,[cur_editor.TopLeft.Y]
363
	push	ecx
448
	push	ecx
Line 364... Line 449...
364
	call	get_line_offset
449
	call	get_line_offset
365
 
450
 
366
  .start:
451
  .start:
367
	add	esp,4
452
	add	esp,4
368
	mov	ecx,[lines.scr]
453
	mov	ecx,[lines.scr]
369
	or	ecx,ecx
454
	or	ecx,ecx
Line 370... Line 455...
370
	jle	.exit
455
	jle	.exit
-
 
456
	add	esp,-4
Line 371... Line 457...
371
	add	esp,-4
457
 
Line 372... Line 458...
372
 
458
	imul	ebp,[cur_editor.TopLeft.X],6*65536
Line 373... Line 459...
373
	imul	ebp,[cur_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
459
	mov	[draw_blines],1
374
 
460
 
375
  .next_line:
461
  .next_line:
376
 
462
 
377
	push	ecx ebx
-
 
378
 
463
	push	ecx ebx
379
	mov	ecx,ebx
464
 
380
	shl	ecx,16
465
	mov	ecx,ebx
381
	mov	cl,LINEH
466
	shl	ecx,16
Line 382... Line 467...
382
	mov	ebx,[cur_editor.Bounds.Right]
467
	mov	cl,LINEH
383
	;sub     ebx,[cur_editor.Bounds.Left]
468
	mov	ebx,[cur_editor.Bounds.Right]
384
	add	ebx,-SCRLW
469
	add	ebx,-SCRLW
385
	add	ebx,[left_ofs-2]
470
	add	ebx,[left_ofs-2]
386
	sub	ebx,[left_ofs]
471
	sub	ebx,[left_ofs]
387
	add	ebx,-2*65536+2
472
	add	ebx,-2*65536+2
388
 
473
 
389
  ; selection (text background)
474
  ; selection (text background)
Line 400... Line 485...
400
  .lp1: mov	eax,[sel.begin.y]
485
  .lp1: mov	eax,[sel.begin.y]
401
	cmp	eax,[sel.end.y]
486
	cmp	eax,[sel.end.y]
402
	je	.lp5
487
	je	.lp5
403
  .lp2: mov	eax,[sel.begin.x]
488
  .lp2: mov	eax,[sel.begin.x]
404
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
489
	sub	eax,[cur_editor.TopLeft.X]
405
	jle	.lp6.2
490
	jle	.lp6.2
406
	cmp	eax,[columns.scr]
491
	cmp	eax,[columns.scr]
407
	jge	.lp6
492
	jge	.lp6
408
	imul	eax,6
493
	imul	eax,6
409
	pushad
494
	pushad
410
	sub	bx,ax
495
	sub	bx,ax
Line 412... Line 497...
412
	mov	bx,ax
497
	mov	bx,ax
413
	add	ebx,[left_ofs]
498
	add	ebx,[left_ofs]
414
	add	ebx,-2
499
	add	ebx,-2
415
	rol	ebx,16
500
	rol	ebx,16
416
	mov	edx,[color_tbl+4*7]
501
	mov	edx,[color_tbl.back.sel]
417
	mcall	13
502
	mcall	13
418
	popad
503
	popad
419
	mov	bx,ax
504
	mov	bx,ax
420
	mov	[in_sel],2
505
	mov	[in_sel],2
421
	jmp	.lp6
506
	jmp	.lp6
422
  .lp3: mov	eax,[sel.begin.y]
507
  .lp3: mov	eax,[sel.begin.y]
423
	cmp	eax,[sel.end.y]
508
	cmp	eax,[sel.end.y]
424
	je	.lp5
509
	je	.lp5
425
  .lp4: mov	eax,[sel.end.x]
510
  .lp4: mov	eax,[sel.end.x]
426
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
511
	sub	eax,[cur_editor.TopLeft.X]
427
	jle	.lp6
512
	jle	.lp6
428
	cmp	eax,[columns.scr]
513
	cmp	eax,[columns.scr]
429
	jg	.lp6.2
514
	jg	.lp6.2
430
	imul	eax,6
515
	imul	eax,6
431
	pushad
516
	pushad
432
	sub	bx,ax
517
	sub	bx,ax
433
	rol	ebx,16
518
	rol	ebx,16
434
	add	eax,[left_ofs];OLEFT-1
519
	add	eax,[left_ofs]
435
	add	eax,-2
520
	add	eax,-2
436
	mov	bx,ax
521
	mov	bx,ax
437
	rol	ebx,16
522
	rol	ebx,16
438
	mcall	13
523
	mcall	13
439
	popad
524
	popad
440
	inc	eax
525
	inc	eax
441
	mov	edx,[color_tbl+4*7]
526
	mov	edx,[color_tbl.back.sel]
442
	mov	bx,ax
527
	mov	bx,ax
443
	mov	[in_sel],3
528
	mov	[in_sel],3
444
	jmp	.lp6
529
	jmp	.lp6
445
  .lp5: mov	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
530
  .lp5: mov	eax,[cur_editor.TopLeft.X]
446
	cmp	eax,[sel.begin.x]
531
	cmp	eax,[sel.begin.x]
447
	jge	.lp4
532
	jge	.lp4
448
	add	eax,[columns.scr]
533
	add	eax,[columns.scr]
449
	cmp	eax,[sel.end.x]
534
	cmp	eax,[sel.end.x]
450
	jl	.lp2
535
	jl	.lp2
451
	mov	eax,[sel.begin.x]
536
	mov	eax,[sel.begin.x]
452
	cmp	eax,[sel.end.x]
537
	cmp	eax,[sel.end.x]
453
	je	.lp6
538
	je	.lp6
454
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
539
	sub	eax,[cur_editor.TopLeft.X]
455
	imul	eax,6
540
	imul	eax,6
456
	pushad
541
	pushad
457
	mov	ebx,[sel.end.x]
542
	mov	ebx,[sel.end.x]
458
	sub	ebx,[sel.begin.x]
543
	sub	ebx,[sel.begin.x]
459
	imul	ebx,6
544
	imul	ebx,6
460
	sal	ebx,16
545
	sal	ebx,16
461
	dec	eax
546
	dec	eax
462
	add	eax,[left_ofs]
547
	add	eax,[left_ofs]
463
	mov	bx,ax
548
	mov	bx,ax
464
	rol	ebx,16
549
	rol	ebx,16
465
	mov	edx,[color_tbl+4*7]
550
	mov	edx,[color_tbl.back.sel]
466
	mcall	13
551
	mcall	13
467
	movzx	eax,bx
552
	movzx	eax,bx
468
	sar	ebx,16
553
	sar	ebx,16
469
	add	eax,ebx
554
	add	eax,ebx
470
	mov	ebx,eax
555
	mov	ebx,eax
471
	sal	ebx,16
556
	sal	ebx,16
Line 473... Line 558...
473
	neg	ax
558
	neg	ax
474
	add	ax,word[left_ofs]
559
	add	ax,word[left_ofs]
475
	add	ax,-2
560
	add	ax,-2
476
	mov	bx,ax
561
	mov	bx,ax
477
	mov	edx,[color_tbl+4*5]
562
	mov	edx,[color_tbl.back]
478
	mcall	13
563
	mcall	13
479
	popad
564
	popad
480
	mov	bx,ax
565
	mov	bx,ax
481
	mov	[in_sel],4
566
	mov	[in_sel],4
482
	jmp	.lp6
567
	jmp	.lp6
483
 
568
 
Line 484... Line 569...
484
  .lp6.2:
569
  .lp6.2:
485
	mov	edx,[color_tbl+4*7]
570
	mov	edx,[color_tbl.back.sel]
486
	inc	[in_sel]
571
	inc	[in_sel]
487
  .lp6:
572
  .lp6:
488
	mcall	13
573
	mcall	13
Line 489... Line 574...
489
 
574
 
Line 490... Line 575...
490
	lodsd
575
	lodsd
491
 
576
 
492
	pushad
577
	pushad
493
	mov	edx,[color_tbl+4*5]
578
	mov	edx,[color_tbl.back]
494
	test	eax,0x00010000
579
	test	eax,0x00010000
495
	jz	@f
580
	jz	@f
496
	mov	edx,[color_tbl+4*8]
581
	mov	edx,[color_tbl.line.moded]
497
	test	eax,0x00020000
582
	test	eax,0x00020000
498
	jz	@f
583
	jz	@f
Line 499... Line 584...
499
	mov	edx,[color_tbl+4*9]
584
	mov	edx,[color_tbl.line.saved]
500
    @@: mov	ebx,[left_ofs]
585
    @@: mov	ebx,[left_ofs]
501
 
586
 
Line 511... Line 596...
511
 
596
 
Line 512... Line 597...
512
	or	eax,eax
597
	or	eax,eax
513
	ja	.next_block
598
	ja	.next_block
514
	add	esp,4*2
599
	add	esp,4*2
515
	jmp	.exit ; .draw_cursor
600
	jmp	.exit
Line 516... Line 601...
516
 
601
 
Line 517... Line 602...
517
  .next_block:
602
  .next_block:
518
 
603
 
519
	push	esi ecx
604
	push	esi ecx
Line 520... Line 605...
520
	call	get_next_part
605
	call	.get_next_part
521
	pop	ebx
606
	pop	ebx
Line 522... Line 607...
522
 
607
 
523
	push	ecx
608
	push	ecx
524
	mov	ecx,eax
609
	mov	ecx,eax
525
 
610
 
526
	push	esi ebx
611
	push	esi ebx
527
	mov	eax,ebx
612
	mov	eax,ebx
528
	sub	ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
613
	sub	ebx,[cur_editor.TopLeft.X]
529
	cmp	ebx,[columns.scr]
614
	cmp	ebx,[columns.scr]
530
	jge	.skip_t
615
	jge	.skip_t
531
	add	ebx,esi
616
	add	ebx,esi
532
	jle	.skip_t
617
	jle	.skip_t
533
	mov	ebx,[esp+8+4*2] ;// 4*2=esi+ebx
618
	mov	ebx,[esp+8+4*2] ;// 4*2=esi+ebx
534
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
-
 
535
	jge	.qqq
619
	sub	eax,[cur_editor.TopLeft.X]
536
	sub	edx,eax
620
	jge	.qqq
537
	add	esi,eax
621
	sub	edx,eax
538
;       mov     eax,OLEFT*65536
-
 
539
	xor	eax,eax
622
	add	esi,eax
540
	jmp	.qqq2
623
	xor	eax,eax
541
  .qqq:
624
	jmp	.qqq2
542
;       inc     eax
625
  .qqq:
543
	imul	eax,6*65536
626
	imul	eax,6*65536
Line 544... Line 627...
544
  .qqq2:
627
  .qqq2:
545
	and	ebx,0x0000FFFF
628
	and	ebx,0x0000FFFF
546
	add	eax,[left_ofs-2];OLEFT*65536
629
	add	eax,[left_ofs-2]
547
	add	ebx,eax
630
	add	ebx,eax
548
 
631
 
549
	mov	eax,[esp]   ; ebx
632
	mov	eax,[esp]   ; ebx
550
	add	eax,[esp+4] ; esi
633
	add	eax,[esp+4] ; esi
Line 571... Line 654...
571
  .ya1: mov	eax,esi
654
  .ya1: mov	eax,esi
572
	mov	esi,[sel.begin.x]
655
	mov	esi,[sel.begin.x]
573
	sub	esi,[esp]
656
	sub	esi,[esp]
574
	pushad
657
	pushad
575
	mov	ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col]
658
	mov	ecx,[cur_editor.TopLeft.X]
576
	sub	ecx,[esp+4*8]
659
	sub	ecx,[esp+4*8]
577
	jle	@f
660
	jle	@f
578
	sub	esi,ecx
661
	sub	esi,ecx
579
	sub	[esp+4],ecx
662
	sub	[esp+4],ecx
580
    @@: sub	eax,esi
663
    @@: sub	eax,esi
581
	add	edx,esi
664
	add	edx,esi
Line 583... Line 666...
583
	rol	ebx,16
666
	rol	ebx,16
584
	add	bx,si
667
	add	bx,si
585
	rol	ebx,16
668
	rol	ebx,16
586
	mov	esi,eax
669
	mov	esi,eax
587
	mov	ecx,[color_tbl+4*6]
670
	mov	ecx,[color_tbl.text.sel]
588
	mcall	4
671
	mcall	4
589
	popad
672
	popad
590
	jmp	.draw_t
673
	jmp	.draw_t
591
;----------------------------------------------)-
674
;----------------------------------------------)-
592
  .nt2: dec	al
675
  .nt2: dec	al
593
	jnz	.nt3
676
	jnz	.nt3
Line 601... Line 684...
601
  .ya2: mov	eax,[sel.end.x]
684
  .ya2: mov	eax,[sel.end.x]
602
	sub	eax,[esp]
685
	sub	eax,[esp]
603
	push	ebx
686
	push	ebx
604
	mov	ebx,[esp+4]
687
	mov	ebx,[esp+4]
605
	sub	ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
688
	sub	ebx,[cur_editor.TopLeft.X]
606
	jge	.ya2.1
689
	jge	.ya2.1
607
	add	eax,ebx
690
	add	eax,ebx
608
  .ya2.1:
691
  .ya2.1:
609
	pop	ebx
692
	pop	ebx
610
	pushad
693
	pushad
611
	mov	esi,eax
694
	mov	esi,eax
612
	mov	ecx,[color_tbl+4*6]
695
	mov	ecx,[color_tbl.text.sel]
613
	mcall	4
696
	mcall	4
614
	popad
697
	popad
615
	sub	esi,eax
698
	sub	esi,eax
616
	add	edx,eax
699
	add	edx,eax
617
	imul	eax,6*65536
700
	imul	eax,6*65536
618
	add	ebx,eax
701
	add	ebx,eax
Line 633... Line 716...
633
	mov	esi,[sel.begin.x]
716
	mov	esi,[sel.begin.x]
634
	sub	esi,[esp]
717
	sub	esi,[esp]
635
	push	eax
718
	push	eax
636
	mov	eax,[esp+4]
719
	mov	eax,[esp+4]
637
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
720
	sub	eax,[cur_editor.TopLeft.X]
638
	jge	.nt3.1
721
	jge	.nt3.1
639
	add	esi,eax
722
	add	esi,eax
640
  .nt3.1:
723
  .nt3.1:
641
	pop	eax
724
	pop	eax
642
	sub	eax,esi
725
	sub	eax,esi
643
	pushad
726
	pushad
Line 645... Line 728...
645
	imul	esi,6*65536
728
	imul	esi,6*65536
646
	add	ebx,esi
729
	add	ebx,esi
647
	mov	esi,[sel.end.x]
730
	mov	esi,[sel.end.x]
648
	sub	esi,[sel.begin.x]
731
	sub	esi,[sel.begin.x]
649
	mov	ecx,[color_tbl+4*6]
732
	mov	ecx,[color_tbl.text.sel]
650
	sub	eax,esi
733
	sub	eax,esi
651
	push	eax
734
	push	eax
652
	mcall	4
735
	mcall	4
653
	add	edx,esi
736
	add	edx,esi
654
	imul	esi,6*65536
737
	imul	esi,6*65536
655
	add	ebx,esi
738
	add	ebx,esi
Line 663... Line 746...
663
	dec	eax
746
	dec	eax
664
	cmp	eax,[sel.end.x]
747
	cmp	eax,[sel.end.x]
665
	jge	.ya2
748
	jge	.ya2
666
;---[ block inside selection ]-----------------(-
749
;---[ block inside selection ]-----------------(-
667
  .ya4: mov	ecx,[color_tbl+4*6]
750
  .ya4: mov	ecx,[color_tbl.text.sel]
668
;----------------------------------------------)-
751
;----------------------------------------------)-
669
 
752
 
Line 670... Line 753...
670
  .draw_t:
753
  .draw_t:
671
	mcall	4;[esp+8]
754
	mcall	4
672
  .skip_t:
755
  .skip_t:
673
	pop	eax eax ; ebx esi
756
	pop	eax eax ; ebx esi
674
	imul	eax,6
757
	imul	eax,6
675
	add	[esp+4*2+2],ax
758
	add	[esp+4*2+2],ax
676
	pop	ecx esi
759
	pop	ecx esi
677
	cmp	ecx,[cur_line_len];LINE_WIDTH
760
	cmp	ecx,[cur_line_len]
678
	jl	.next_block
761
	jl	.next_block
Line 679... Line 762...
679
 
762
 
680
	pop	ebx ecx
763
	pop	ebx ecx
681
	and	ebx,0x0000FFFF
764
	and	ebx,0x0000FFFF
682
	add	ebx,[left_ofs-2]
765
	add	ebx,[left_ofs-2]
683
	add	ebx,LINEH
766
	add	ebx,LINEH
684
	add	esi,[cur_line_len];LINE_WIDTH
767
	add	esi,[cur_line_len]
685
	inc	dword[esp]
768
	inc	dword[esp]
686
	dec	ecx
769
	dec	ecx
Line 687... Line 770...
687
	jg	.next_line
770
	jg	.next_line
Line -... Line 771...
-
 
771
 
-
 
772
  .exit:
688
 
773
 
689
  .exit:
774
	cmp	[draw_blines],0
690
 
775
	je	.exit.2
691
	mov	eax,[cur_editor.Bounds.Left]
776
	mov	eax,[cur_editor.Bounds.Left]
692
	add	eax,[cur_editor.Gutter.Width]
777
	add	eax,[cur_editor.Gutter.Width]
693
	inc	eax
778
	inc	eax
694
	mov	ebx,eax
779
	mov	ebx,eax
695
	shl	ebx,16
780
	shl	ebx,16
696
	mov	bx,word[cur_editor.Bounds.Right]
781
	mov	bx,word[cur_editor.Bounds.Right]
697
	sub	bx,ax
782
	sub	bx,ax
698
	add	ebx,-SCRLW
783
	add	ebx,-SCRLW
699
	mov	edx,[color_tbl+4*5]
784
	mov	edx,[color_tbl.back]
700
	mov	eax,13
785
	mov	eax,13
701
	mov	ecx,[esp-8]
786
	mov	ecx,[esp-8]
Line 717... Line 802...
717
	add	ebx,-(SCRLW-1)*65536+SCRLW-1
802
	add	ebx,-(SCRLW-1)*65536+SCRLW-1
718
	add	ecx,-(SCRLW-1)*65536+SCRLW-1
803
	add	ecx,-(SCRLW-1)*65536+SCRLW-1
719
	mcall
804
	mcall
720
 
805
 
Line -... Line 806...
-
 
806
  .exit.2:
721
	popad
807
	popad
722
	add	esp,4
808
	add	esp,4
723
	ret
809
	ret
724
endf
810
endf
Line 725... Line 811...
725
 
811
 
-
 
812
;-----------------------------------------------------------------------------
-
 
813
func draw_editor_text.get_next_part ;/////////////////////////////////////////
-
 
814
;-----------------------------------------------------------------------------
-
 
815
; Input:
-
 
816
;  ECX = current letter
-
 
817
;  ESI = string
-
 
818
; Output:
-
 
819
;  ECX = color
-
 
820
;  EDX = string
-
 
821
;  ESI = length
-
 
822
;-----------------------------------------------------------------------------
-
 
823
	cmp	[cur_editor.AsmMode],0
-
 
824
	je	.plain.text
-
 
825
	xor	ebx,ebx
-
 
826
	mov	edx,ecx
-
 
827
	add	esi,ecx
-
 
828
	mov	edi,symbols
-
 
829
	mov	al,[esi]
-
 
830
	cmp	al,';'
-
 
831
	je	.comment
-
 
832
	mov	ecx,symbols.size
-
 
833
	repne	scasb
-
 
834
	je	.symbol
-
 
835
	cmp	al,'$'
-
 
836
	jne	@f
-
 
837
	mov	edi,symbols
-
 
838
	mov	al,[esi+1]
-
 
839
	mov	ecx,symbols.size
-
 
840
	repne	scasb
-
 
841
	je	.not_symbol
-
 
842
	jmp	.number
-
 
843
    @@: cmp	al,'0'
-
 
844
	jb	@f
-
 
845
	cmp	al,'9'
-
 
846
	jbe	.number
-
 
847
    @@: cmp	al,"'"
-
 
848
	je	.string
-
 
849
	cmp	al,'"'
-
 
850
	je	.string
-
 
851
  .not_symbol:
-
 
852
	inc	ebx
-
 
853
	inc	edx
-
 
854
	cmp	edx,[cur_line_len]
-
 
855
	jge	@f
-
 
856
	mov	edi,symbols
-
 
857
	mov	al,[esi+ebx]
-
 
858
	cmp	al,';'
-
 
859
	je	@f
-
 
860
	mov	ecx,symbols.size
-
 
861
	repne	scasb
-
 
862
	jne	.not_symbol
-
 
863
    @@: mov	ecx,edx
-
 
864
	mov	edx,esi
-
 
865
	mov	esi,ebx
-
 
866
	mov	eax,[color_tbl.text]
-
 
867
	ret
-
 
868
  .symbol:
-
 
869
	inc	ebx
-
 
870
	inc	edx
-
 
871
	cmp	edx,[cur_line_len]
-
 
872
	jge	@f
-
 
873
	mov	edi,symbols
-
 
874
	mov	al,[esi+ebx]
-
 
875
	mov	ecx,symbols.size
-
 
876
	repne	scasb
-
 
877
	je	.symbol
-
 
878
    @@: mov	ecx,edx
-
 
879
	mov	edx,esi
-
 
880
	mov	esi,ebx
-
 
881
	mov	eax,[color_tbl.symbol]
-
 
882
	ret
-
 
883
  .comment:
-
 
884
	neg	edx
-
 
885
	add	edx,[cur_line_len]
-
 
886
	xchg	edx,esi
-
 
887
	mov	ecx,[cur_line_len]
-
 
888
	mov	eax,[color_tbl.comment]
-
 
889
	ret
-
 
890
  .number:
-
 
891
	inc	ebx
-
 
892
	inc	edx
-
 
893
	cmp	edx,[cur_line_len]
-
 
894
	jge	@f
-
 
895
	mov	edi,symbols
-
 
896
	mov	al,[esi+ebx]
-
 
897
	cmp	al,';'
-
 
898
	je	@f
-
 
899
	mov	ecx,symbols.size
-
 
900
	repne	scasb
-
 
901
	jne	.number
-
 
902
    @@: mov	ecx,edx
-
 
903
	mov	edx,esi
-
 
904
	mov	esi,ebx
-
 
905
	mov	eax,[color_tbl.number]
-
 
906
	ret
-
 
907
  .string:
-
 
908
	inc	ebx
-
 
909
	inc	edx
-
 
910
	cmp	edx,[cur_line_len]
-
 
911
	jge	@f
-
 
912
	cmp	[esi+ebx],al
-
 
913
	jne	.string
-
 
914
	inc	ebx
-
 
915
	inc	edx
-
 
916
    @@:
-
 
917
	mov	ecx,edx
-
 
918
	mov	edx,esi
-
 
919
	mov	esi,ebx
-
 
920
	mov	eax,[color_tbl.string]
-
 
921
	ret
-
 
922
  .plain.text:
-
 
923
	mov	edx,[cur_line_len]
-
 
924
	xchg	edx,esi
-
 
925
	mov	ecx,[cur_line_len]
-
 
926
	mov	eax,[color_tbl.text]
-
 
927
	ret
-
 
928
endf
-
 
929
 
726
;-----------------------------------------------------------------------------
930
;-----------------------------------------------------------------------------
727
func draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
931
func draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
728
;-----------------------------------------------------------------------------
932
;-----------------------------------------------------------------------------
729
	cmp	[bot_mode],0
933
	cmp	[bot_mode],0
730
	jne	@f
934
	jne	@f
Line 779... Line 983...
779
	sub	eax,ecx
983
	sub	eax,ecx
780
	pop	ecx ebx
984
	pop	ecx ebx
781
	ret
985
	ret
782
endf
986
endf
783
987
 
-
 
988
REDRAW_TEXT	 = 00000001b
-
 
989
REDRAW_HSCROLL	 = 00000010b
-
 
990
REDRAW_VSCROLL	 = 00000100b
-
 
991
REDRAW_ONELINE	 = 00001000b
-
 
992
REDRAW_TWOLINES  = 00010000b
-
 
993
 
-
 
994
;-----------------------------------------------------------------------------
-
 
995
func editor_check_for_changes ;///// EDITOR CHANGES CHECKER //////////////////
-
 
996
;-----------------------------------------------------------------------------
-
 
997
	call	.check_cursor_visibility
-
 
998
 
-
 
999
	xor	edx,edx
-
 
1000
 
-
 
1001
	mov	eax,[cur_editor.TopLeft.Y]
-
 
1002
	cmp	eax,[checker_ed.TopLeft.Y]
-
 
1003
	je	@f
-
 
1004
	or	dl,REDRAW_TEXT+REDRAW_VSCROLL
-
 
1005
    @@: mov	eax,[cur_editor.TopLeft.X]
-
 
1006
	cmp	eax,[checker_ed.TopLeft.X]
-
 
1007
	je	@f
-
 
1008
	or	dl,REDRAW_TEXT+REDRAW_HSCROLL
-
 
1009
    @@: or	dl,dl
-
 
1010
	jnz	.redraw
-
 
1011
 
-
 
1012
	mov	eax,[cur_editor.Caret.Y]
-
 
1013
	cmp	eax,[checker_ed.Caret.Y]
-
 
1014
	je	@f
-
 
1015
	or	dl,REDRAW_TWOLINES
-
 
1016
    @@: mov	eax,[cur_editor.Caret.X]
-
 
1017
	cmp	eax,[checker_ed.Caret.X]
-
 
1018
	je	@f
-
 
1019
	or	dl,REDRAW_ONELINE
-
 
1020
    @@: mov	ebp,cur_editor
-
 
1021
	call	init_sel_vars
-
 
1022
	mov	al,[sel.selected]
-
 
1023
	mov	ebp,checker_ed
-
 
1024
	call	init_sel_vars
-
 
1025
	cmp	al,[sel.selected]
-
 
1026
	je	@f
-
 
1027
	cmp	al,0
-
 
1028
	je	.clear_sel
-
 
1029
	jmp	.draw_sel
-
 
1030
    @@: cmp	al,0
-
 
1031
	jne	.redraw_sel
-
 
1032
 
-
 
1033
	or	dl,dl
-
 
1034
	jz	.exit
-
 
1035
	test	dl,REDRAW_TWOLINES
-
 
1036
	jz	.one_line
-
 
1037
	push	edx
-
 
1038
	mov	eax,[checker_ed.Caret.Y]
-
 
1039
	mov	ebx,eax
-
 
1040
	call	draw_editor_text.part
-
 
1041
	pop	edx
-
 
1042
  .one_line:
-
 
1043
	mov	eax,[cur_editor.Caret.Y]
-
 
1044
	mov	ebx,eax
-
 
1045
	call	draw_editor_text.part
-
 
1046
	call	draw_editor_caret
-
 
1047
	jmp	.exit
-
 
1048
 
-
 
1049
  .clear_sel:
-
 
1050
	;// use checker_ed
-
 
1051
	mov	eax,[sel.begin.y]
-
 
1052
	mov	ebx,[sel.end.y]
-
 
1053
	push	eax ebx
-
 
1054
	call	draw_editor_text.part
-
 
1055
	pop	edx ecx
-
 
1056
	mov	eax,[cur_editor.Caret.Y]
-
 
1057
	cmp	eax,ecx
-
 
1058
	jb	@f
-
 
1059
	cmp	eax,edx
-
 
1060
	jbe	.lp1
-
 
1061
    @@: mov	ebx,eax
-
 
1062
	call	draw_editor_text.part
-
 
1063
  .lp1: call	draw_editor_caret
-
 
1064
	jmp	.exit
-
 
1065
 
-
 
1066
  .draw_sel:
-
 
1067
	;// use cur_editor
-
 
1068
	mov	ebp,cur_editor
-
 
1069
	call	init_sel_vars
-
 
1070
	mov	eax,[sel.begin.y]
-
 
1071
	mov	ebx,[sel.end.y]
-
 
1072
	push	eax ebx
-
 
1073
	call	draw_editor_text.part
-
 
1074
	pop	edx ecx
-
 
1075
	mov	eax,[checker_ed.Caret.Y]
-
 
1076
	cmp	eax,ecx
-
 
1077
	jb	@f
-
 
1078
	cmp	eax,edx
-
 
1079
	jbe	.lp2
-
 
1080
    @@: mov	ebx,eax
-
 
1081
	call	draw_editor_text.part
-
 
1082
  .lp2: call	draw_editor_caret
-
 
1083
	jmp	.exit
-
 
1084
 
-
 
1085
  .redraw_sel:
-
 
1086
	;// use checker_ed and cur_editor
-
 
1087
	mov	eax,[checker_ed.Caret.Y]
-
 
1088
	mov	ebx,[cur_editor.Caret.Y]
-
 
1089
	cmp	eax,ebx
-
 
1090
	jb	@f
-
 
1091
	xchg	eax,ebx
-
 
1092
    @@: call	draw_editor_text.part
-
 
1093
	call	draw_editor_caret
-
 
1094
	jmp	.exit
-
 
1095
 
-
 
1096
  .redraw:
-
 
1097
	push	edx
-
 
1098
	call	draw_editor_gutter
-
 
1099
	call	draw_editor_text
-
 
1100
	call	draw_editor_caret
-
 
1101
	test	byte[esp],REDRAW_VSCROLL
-
 
1102
	jz	@f
-
 
1103
	call	draw_editor_vscroll
-
 
1104
    @@: pop	edx
-
 
1105
	test	dl,REDRAW_HSCROLL
-
 
1106
	jz	@f
-
 
1107
	call	draw_editor_hscroll
-
 
1108
    @@: jmp	.exit
-
 
1109
 
-
 
1110
  .exit:
-
 
1111
	mov	esi,cur_editor
-
 
1112
	mov	edi,checker_ed
-
 
1113
	mov	ecx,sizeof.EDITOR/4
-
 
1114
	cld
-
 
1115
	rep	movsd
-
 
1116
	ret
-
 
1117
 
-
 
1118
  .check_cursor_visibility:
-
 
1119
	push	eax ebx
-
 
1120
    .chk_y:
-
 
1121
	mov	eax,[cur_editor.Caret.Y]
-
 
1122
	or	eax,eax
-
 
1123
	jge	@f
-
 
1124
	mov	[cur_editor.Caret.Y],0
-
 
1125
	jmp	.chk_dy
-
 
1126
    @@: cmp	eax,[cur_editor.Lines.Count]
-
 
1127
	jl	.chk_dy
-
 
1128
	mov	eax,[cur_editor.Lines.Count]
-
 
1129
	dec	eax
-
 
1130
	mov	[cur_editor.Caret.Y],eax
-
 
1131
    .chk_dy:
-
 
1132
	mov	eax,[cur_editor.TopLeft.Y]
-
 
1133
	cmp	eax,[cur_editor.Caret.Y]
-
 
1134
	jle	@f
-
 
1135
	m2m	[cur_editor.TopLeft.Y],[cur_editor.Caret.Y]
-
 
1136
    @@: add	eax,[lines.scr]
-
 
1137
	cmp	eax,[cur_editor.Caret.Y]
-
 
1138
	jg	.chk_x
-
 
1139
	mov	eax,[cur_editor.Caret.Y]
-
 
1140
	sub	eax,[lines.scr]
-
 
1141
	inc	eax
-
 
1142
	mov	[cur_editor.TopLeft.Y],eax
-
 
1143
    .chk_x:
-
 
1144
	mov	eax,[cur_editor.Caret.X]
-
 
1145
	or	eax,eax
-
 
1146
	jge	@f
-
 
1147
	mov	[cur_editor.Caret.X],0
-
 
1148
	jmp	.chk_dx
-
 
1149
    @@: cmp	eax,[cur_editor.Columns.Count]
-
 
1150
	jl	.chk_dx
-
 
1151
	mov	eax,[cur_editor.Columns.Count]
-
 
1152
	mov	[cur_editor.Caret.X],eax
-
 
1153
    .chk_dx:
-
 
1154
	mov	eax,[cur_editor.TopLeft.X]
-
 
1155
	cmp	eax,[cur_editor.Caret.X]
-
 
1156
	jle	@f
-
 
1157
	m2m	[cur_editor.TopLeft.X],[cur_editor.Caret.X]
-
 
1158
    @@: add	eax,[columns.scr]
-
 
1159
	cmp	eax,[cur_editor.Caret.X]
-
 
1160
	jg	@f
-
 
1161
	mov	eax,[cur_editor.Caret.X]
-
 
1162
	sub	eax,[columns.scr]
-
 
1163
	inc	eax
-
 
1164
	mov	[cur_editor.TopLeft.X],eax
-
 
1165
    @@: cmp	[mev],MEV_LDOWN
-
 
1166
	jne	@f
-
 
1167
	push	[cur_editor.Caret.X] [cur_editor.Caret.Y]
-
 
1168
	pop	[cur_editor.SelStart.Y] [cur_editor.SelStart.X]
-
 
1169
    @@: pop	ebx eax
-
 
1170
	ret
-
 
1171
endf
-
 
1172