-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEDITOR.PAS
2282 lines (1944 loc) · 54 KB
/
EDITOR.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Unit Editor;
{$O+}
Interface
Uses
Crt,
Dos,
Video, { CGA5.OBJ + DISPLAY.OBJ Assembly rutinok }
BGI,
WindowM,
MenuErr,
InputCdw,InputOVR,
{$IFNDEF CDVIEW}
{$IFNDEF VER3}
Publicat,
{$ENDIF}
StartNyo,
Nyomtat,
Szotag,
SetCdw,
{$ENDIF}
HeapCdw,
FileCdw,
EmsCdw,
CalcCdw,
{$IFDEF PROBA}
PRINTER,
{$ENDIF}
{$IFNDEF DPMI}
Overlay,
{$ENDIF}
{$IFDEF HELYESKE}
Strings,
PlusMem,
Elemez,
{$ENDIF}
Speakcdw;
{ Ems kezelo }
Procedure Edit;
Implementation
Procedure Edit;
{$IFNDEF CDVIEW}
Procedure CallGib(Par : Byte; Var X1,X2: Byte); Forward;
{$ENDIF}
{$I ELEJE.CDW}
Var
Lastpos,Fkeycount,kc,bc,Lastsc : BYTE;
Cikl : Integer;
Function FullOfComplex(Hp:Integer):Integer;
Begin
FullOfComplex := UpInd(HP) + DownInd(Hp) + 1
End;
Procedure LapvegKi(Li:Integer);
Begin
If LapVegeI(Li) Then
Begin
Dec(Pcount);
Lcount := PopLapveg
End
Else
If Lcount = 0 Then
Begin
Dec(Pcount);
Lcount := PageLen-1;
End
Else
Dec(Lcount);
End;
{$I SCROLL.CDW}
Procedure SeekToMain;
Begin
If NOT MainLineI(Ypos) Then
Begin
If UpIndexI(Ypos) Then
While NOT MainLineI(Ypos) do
HalfLineDown
Else
While NOT MainLineI(Ypos) do
HalfLineUp
End;
End;
Procedure SeekToMain2;
Var NewY : Integer;
Cikl : Integer;
Procedure Felfele;
Begin
If NewY = Ypos Then
Begin
Cikl := Ypos -1;
While (Cikl > FirstLine) And (NewY=Ypos) Do
If MainLineI(Cikl) Then
NewY := Cikl
Else
Dec(Cikl);
End
End;
Procedure Lefele;
Begin
If NewY = Ypos Then
Begin
Cikl := Ypos +1;
While (Cikl < LastLine) And (Cikl <= TrueLast) And (NewY=Ypos) Do
If MainLineI(Cikl) Then
NewY := Cikl
Else
Inc(Cikl);
End
End;
Begin
If NOT MainLineI(Ypos) Then
Begin
NewY := Ypos;
If Ypos < (TrueLast Div 2) Then
Begin
Felfele;
Lefele
End
Else
Begin
Lefele;
Felfele
End;
If Ypos <> NewY Then
If Ypos < NewY Then
While Ypos <> NewY do
HalfLineDown
Else
While Ypos <> NewY do
HalfLineUp
End;
End;
Procedure PosOfPrevPage(Var Hp,Sor,Nemkell : Integer;Hanyat : Integer);
Var f : Integer;
Begin
If Sor > Hanyat Then
Begin
Nemkell := Sor - Hanyat;
Sor := Hanyat
End;
While (Sor < Hanyat) And Not(FirstMain(Hp)) Do
Begin
Hp := PrevMain(Hp);
F := FullOfComplex(Hp);
If F + Sor > Hanyat Then
Begin
NemKell := F + Sor - Hanyat;
Sor := Hanyat;
End
Else
Begin
Inc(Sor,F);
NemKell := 0;
End
End
End; { PosOfPrevPage }
Procedure FreshPage;
Var Cik : Integer;
Begin
Disp_Page(0,0,0,FontOffs,SortabOffs,ImageOffs);
Page_Stat(0,TrueLast+2,0,FontOffs,SortabOffs,ImageOffs);
PageEndCount; { Lapvegek bejelolese az image- en }
PageEndFresh(FirstLine);
New_Header;
Fresh_Header;
Fejtab(1);
If TrueLast = FirstLine Then
Begin
HalfScrollUp;
TrueLast := FirstLine + 1;
Ypos := TrueLast;
End;
{$IFNDEF CDVIEW}
If BlockMode Then
Begin
Block_End;
For Cik := Byte(LegFelso) To TrueLast Do
InvertLine(Cik,True);
End;
{$ENDIF}
SorCurBe;
End;
Procedure FreshPage2(Mettol,Meddig:Word);
Var Cik : Integer;
CCS : Array[FirstLine..MLastLine] Of Char;
Begin
Arr^.Disp78 := Meddig-Mettol+1;
Disp_Page(Mettol,0,0,FontOffs,SortabOffs,ImageOffs);
Arr^.Disp78 := 78;
Fejtab(1);
If TrueLast = FirstLine Then
Begin
HalfScrollUp;
TrueLast := FirstLine + 1;
Ypos := TrueLast;
End;
{$IFNDEF CDVIEW}
If BlockMode Then
Begin
For Cik := Byte(LegFelso) To TrueLast Do
Begin
CCS[Cik] := Image[Cik]^.Chars[C80+c79];
Image[Cik]^.Chars[C80+c79] := #0;
End;
For Cik := Byte(LegFelso) To TrueLast Do
InvertLine2(Cik,True,Mettol,Meddig);
For Cik := Byte(LegFelso) To TrueLast Do
Image[Cik]^.Chars[C80+c79] := CCS[Cik];
End;
{$ENDIF}
End;
Procedure RangeCheck(Var Uj: Integer; Top: Byte);
Begin
If Uj > (Top-1) Then Uj := Uj Mod Top;
If Uj < 0 Then Inc(Uj,Top);
End;
Procedure Next_Color(Mennyit : Integer);
Var Uj : Integer;
Begin
Uj := Color[EditNum];
Inc(Uj,Mennyit);
Case GrMode Of
CGAMode : Begin
RangeCheck(Uj,16);
Port[$3d9] := Uj;
End;
EGAMode,
VgaMode: Begin
RangeCheck(Uj,64);
Set_EGA_Color(Uj);
End
End;
Color[EditNum] := Uj
End;
Procedure Next_Background(Mennyit : Integer);
Var Uj : Integer;
Begin
Uj := BackG[EditNum];
Inc(Uj,Mennyit);
RangeCheck(Uj,64);
If (GrMode = EGAMode) Or (GrMode = VgaMode) Then EGA_Hatter(Uj);
BackG[EditNum] := Uj
End;
Procedure CheckXpos(KellFr:Boolean);
Var OldXo : Word;
Kul : Word;
Begin
OldXo := Xoffset;
If Xpos-Xoffset > 77 Then
Begin { az Xoffset no }
SetXoffset(scstep*(((Xpos-77)+(ScStep-1)) Div ScStep));
If KellFr Then
Begin
Kul := Xoffset-OldXo;
GlobLeszedes;
If Kul > 77 Then
Begin
FreshPage2(0,77);
Page_Stat(0,TrueLast+2,0,FontOffs,SortabOffs,ImageOffs);
SorCurBe
End
Else
Begin
ScrollL(Kul);
FreshPage2(78-Kul,77);
End;
GlobFelrakas;
End;
End
Else
If Xoffset > Xpos Then
Begin { az xoffset csokken }
SetXoffset(Xoffset-ScStep*(((Xoffset-Xpos)+(ScStep-1)) Div ScStep));
If KellFr Then
Begin
Kul := OldXo-Xoffset;
GlobLeszedes;
If Kul > 77 Then
Begin
FreshPage2(0,77);
Page_Stat(0,TrueLast+2,0,FontOffs,SortabOffs,ImageOffs);
SorCurBe;
End
Else
Begin
ScrollR(Kul);
FreshPage2(0,Kul-1);
End;
GlobFelrakas;
End;
End;
End;
Procedure Top_text;
Begin
scount := 0; { Hanyadik felsor a file-ban }
Lcount := 0; { Hanyadik felsor a lapon }
Pcount := 0; { Hanyadik lap }
PageHeapToImage(StartLine[EditNum],0);
Xpos := LeftMar[EditNum];
CheckXpos(False);
Ypos := FirstLine +1;
New_Header;
Fresh_Header;
FejTab(1);
Disp_Page(0,0,0,FontOffs,SortabOffs,ImageOffs);
{$IFNDEF CDVIEW}
If BlockMode Then
Begin
Block_End;
For Cik := Byte(LegFelso) To TrueLast Do
InvertLine(Cik,True);
End;
{$ENDIF}
Page_Stat(0,TrueLast+2,0,FontOffs,SortabOffs,ImageOffs);
PageEndCount;
PageEndFresh(FirstLine);
SorCurBe;
SeekToMain2;
Fresh_Header;
End;
Procedure End_text;
Var MainP,NemKell,Sor,D : Integer;
Begin
MainP := EndLine[EditNum]; { Utolso sor }
While Not MainLine(Mainp) Do
Dec(MainP); { Az utolso fosor }
NemKell := 0;
Sor := FullOfComplex(MainP);
PosOfPrevPage(MainP,Sor,NemKell,37); { 37- et menjunk vissza }
PageHeapToImage(MainP,Nemkell);
D := 0;
CountScount(MainP,NemKell,D,0); { Lap- es sorszamlalas }
Ypos := TrueLast;
FreshPage;
SeekToMain2; { Csak akkor hatasos, ha titkarnoi verzio }
Fresh_Header
End;
Procedure SeekToLastp;
Var Mp : Integer;
D : Integer;
Begin
Mp := StartLine[EditNum] + MainPs[EditNum]-1;
Scount := Scounts[EditNum];
PageHeapToImage(MP,Nemkells[EditNum]);
Ypos := Yps[EditNum];
Xpos := Xps[EditNum];
SetXoffset(Xel[EditNum]);
Pcount := Pcounts[EditNum];
Lcount := Lcounts[EditNum];
CheckXpos(False);
D := 0;
CountScount(Mp,NemKells[EditNum],D,0);
FreshPage;
End;
Procedure SaveLastp;
Begin
If LegFelso Then
Begin
MainPs[EditNum] := MainOfIndex[FirstLine+1]-StartLine[EditNum]+1;
Xps[EditNum] := Xpos;
Yps[EditNum] := Ypos;
Xel[EditNum] := Xoffset;
Scounts[EditNum] := Scount + 1;
Pcounts[EditNum] := Pcount;
Lcounts[EditNum] := Lcount;
NemKells[EditNum] := 0;
If Ypos <> FirstLine + 1 Then
Dec(Yps[EditNum])
End
Else
Begin
MainPs[EditNum] := MainOfIndex[FirstLine]-StartLine[EditNum]+1;
Xps[EditNum] := Xpos;
Yps[EditNum] := Ypos;
Scounts[EditNum] := Scount;
Pcounts[EditNum] := Pcount;
Lcounts[EditNum] := Lcount;
If MainLineI(FirstLine) Then
NemKells[EditNum] := UpIndI(FirstLine)
Else
If UpIndexI(FirstLine) Then
NemKells[EditNum] := UpInd(MainOfIndex[FirstLine])
-UpIndI(FirstLine)
Else
NemKells[EditNum] := UpInd(MainOfIndex[FirstLine]) + 1
+UpIndI(FirstLine)-1
End;
End;
Procedure PosToPos(MainP,Xp : Integer;
Mindenkepp : Boolean);
Var
Sc : Integer;
Megvagy : Integer;
Sor,Nemkell : Integer;
Teteje : Integer;
D : Integer;
Procedure SeekToMegvan;
Begin
SorCurKi;
If Megvagy < Ypos Then
While ImageToHeap[Ypos] <> MainP Do
HalfLineUp;
If Megvagy > Ypos Then
While ImageToHeap[Ypos] <> MainP Do
HalfLineDown;
Xpos := Xp;
SorCurBe;
End;
Procedure SearchMegvan;
Begin
Megvagy := -1;
Sc := FirstLine;
If LegFelso Then Inc(Sc);
Repeat
If ImageToHeap[Sc] = MainP Then
Megvagy := Sc;
Inc(Sc)
Until (Megvagy <> -1) Or (Sc= TrueLast+1);
End;
Begin {PosToPos}
Megvagy := -1;
If Not Mindenkepp Then
SearchMegvan;
If Megvagy <> - 1 Then
Begin
SeekToMegvan;
CheckXpos(True);
End
Else
Begin
Sor := 0;
NemKell := 0;
Teteje := MainP;
PosOfPrevPage(Teteje,Sor,NemKell,18); { 18- at menjunk vissza }
D := 0;
CountScount(Teteje,NemKell,D,0);
PageHeapToImage(Teteje,Nemkell);
Ypos := 1;
SearchMegvan;
SeekToMegvan;
CheckXpos(False);
FreshPage
End
End;
Procedure PosToPage(Pszam,Xp : Integer);
Var
Sc : Integer;
Megvagy : Integer;
Sor,Nemkell : Integer;
Teteje : Integer;
MainP : Integer;
TOUT : Word;
Cur : Byte;
Scbuf : Array [1..6*69*8] Of Byte;
Procedure SeekToMegvan;
Begin
SorCurKi;
If Megvagy < Ypos Then
While ImageToHeap[Ypos] <> MainP Do
HalfLineUp;
If Megvagy > Ypos Then
While ImageToHeap[Ypos] <> MainP Do
HalfLineDown;
Xpos := Xp;
SorCurBe;
End;
Procedure SearchMegvan;
Begin
Megvagy := -1;
Sc := FirstLine;
If LegFelso Then Inc(Sc);
Repeat
If ImageToHeap[Sc] = MainP Then
Megvagy := Sc;
Inc(Sc)
Until (Megvagy <> -1) Or (Sc= TrueLast+1);
End;
Begin {PosToPage}
If Pszam = 0 Then
Begin
TOUT := OutJel;
Set_Nem_lehet;
Cur := Gcur;
FelSor_IdeOdaW(6,69,6,14,Ofs(ScBuf),Seg(ScBuf),SortabOffs,0);
GrWindow(20,14,61,17,GoPageSt);
SaveXY;
GlobalFont := 2;
MezoFont := 1;
MaxStringLen := 64;
GotoX(22,14);
PuffiRekurzio := True;
Input_Integer(Enterpage,Pszam,24);
PuffiRekurzio := False;
FelSor_IdeOdaW(6,69,6,14,Ofs(ScBuf),Seg(ScBuf),SortabOffs,1);
RestoreXY;
RestoreCur(Cur);
OutJel := TOUT;
End;
If Not ESC Then
Begin
Sor := 0;
NemKell := 0;
MainP := 0;
If Pszam < 1 Then
Pszam := 1;
CountScount(Teteje,NemKell,MainP,Pszam);
If MainP = 0 Then
Begin
Beepel(660);
Beepel(330);
PosToPos(MainOfIndex[Ypos],Xpos,True)
End
Else
Begin
PageHeapToImage(MainP,Nemkell);
Ypos := 1;
SearchMegvan;
SeekToMegvan;
Xpos := LeftMar[EditNum];
CheckXpos(False);
FreshPage
End;
End
End;
Procedure Create_Szo(Var XX: Integer; Len: Byte);
Begin
While NOT(NemBetuHeap(XX)) AND (XX <= Len) Do
Begin
Szo := Szo + Heapline^.Chars[C80+XX];
SzoAtt := SzoAtt + Char(Heapline^.Attribs[XX] AND 15);
Inc(XX);
End;
End;
{$IFNDEF CDVIEW}
{$I BLOKK.CDW }
Procedure Change_Tab;
Begin
If InInt(Xpos,LeftMar[EditNum],RightMar[EditNum]) Then
Begin
Tabs[Xpos] := NOT(Tabs[Xpos]);
Make_Tabulators;
FejTab(1);
End
End;
Procedure HelyreTomorit;
Var OldJust : Boolean;
Begin
OldJust := LegyenJust;
LegyenJust := False;
Just2(MainOfIndex[Ypos]);
CheckXpos(True);
ComplexToScreen(0,Ypos);
LegyenJust := OldJust;
End;
Procedure HelyreIgazit;
Var OldJust : Boolean;
Begin
OldJust := LegyenJust;
LegyenJust := True;
Just2(MainOfIndex[Ypos]);
CheckXpos(True);
ComplexToScreen(0,Ypos);
LegyenJust := OldJust;
End;
Procedure InvertSorVeg;
Var MainI,MainP : Integer;
Begin
MainI := CompMainI(Ypos);
MainP := MainOfIndex[Ypos];
Heap_Pos(HeapLine,PointerTomb^[MainP]);
HeapLine^.Attribs[0] :=
HeapLine^.Attribs[0] Xor KemenySor;
FreeEms1(PointerTomb^[MainP]);
If InInt(MainI,FirstLine,LastLine) Then
Begin
Image[MainI]^.Attribs[0] := Image[MainI]^.Attribs[0] Xor KemenySor;
Fresh_Stat(MainI,MainI,True);
End;
End;
{$IFDEF PROTECT}
Procedure ProtectLine(Protect: Boolean);
Var MainI,MainP : Integer;
Begin
MainI := CompMainI(Ypos);
MainP := MainOfIndex[Ypos];
Heap_Pos(HeapLine,PointerTomb^[MainP]);
If Protect Then
Begin
Beepel(600); Beepel(800); Beepel(1000);
HeapLine^.Attribs[c77] := HeapLine^.Attribs[c77] OR Protected;
End
Else
Begin
Beepel(1000); Beepel(800); Beepel(600);
HeapLine^.Attribs[c77] := HeapLine^.Attribs[c77] AND 255-Protected;
End;
If InInt(MainI,FirstLine,LastLine) Then
Begin
If Protect Then
Image[MainI]^.Attribs[c77] := Image[MainI]^.Attribs[c77] OR Protected
Else
Image[MainI]^.Attribs[c77] := Image[MainI]^.Attribs[c77] AND 255-Protected;
Line_Stat(0,MainI+2,0,FontOffs,SortabOffs,ImageOffs);
End;
FreeEms1(PointerTomb^[MainP]);
End;
{$ENDIF}
{$IFNDEF TITKAR}
Procedure Ins_Indexline(Yp : Integer);
Var Cikl : Integer;
Eredeti,
ElsoHp,
UtolsoHp,
ElsoIp,
UtolsoIp,
FoIp,
NewInd,
Ide,
Typ : Integer;
Begin
Eredeti := MainOfIndex[Yp];
If NOT( (UpLineI(Yp) And (UpInd(Eredeti) = MaxIndex)) Or
((DownLineI(Yp) Or MainLineI(Yp))
And (DownInd(Eredeti) = MaxIndex))) Then
Begin
GlobLeszedes;
Inc(All_Lines[EditNum]);
SorCurKi;
FirstAndLast(Eredeti,ElsoHp,UtolsoHp);
If UpLineI(Yp) Then
Begin { Felso index sor }
NewInd := UpIndI(Yp);
Ide := Yp + 1;
FoIp := Yp + UpIndI(Yp);
Typ := 1;
ElsoIp := FoIp - UpInd(Eredeti);
UtolsoIp := FoIp + DownInd(Eredeti);
For Cikl := ElsoHp To Eredeti - 1 Do
If UpInd(Cikl) >= NewInd Then { Atszamozas a HEAP - en }
Set_Ind(Cikl,UpInd(Cikl) + 1);
Set_Ind(Eredeti,UpInd(Eredeti)+1); { Felsoindexek szama no }
For Cikl := ElsoIp To FoIp - 1 Do
If InInt(Cikl,FirstLine,LastLine) Then
If UpIndI(Cikl) >= NewInd Then { Atszamozas az IMAGE - en }
Set_IndI(Cikl,UpIndI(Cikl) + 1);
If InInt(FoIp,FirstLine,LastLine) Then
Set_IndI(FoIp,UpIndI(FoIp)+1); { Felsoindexek szama no }
End
Else
Begin { Fosor vagy also index sor }
If MainLineI(Yp) Then
Begin
NewInd := 1;
FoIp := Yp;
End
Else
Begin
NewInd := UpIndI(YP) + 1;
FoIp := Yp - UpIndI(Yp);
End;
Ide := Yp + 1;
Typ := 0;
ElsoIp := FoIp - UpInd(Eredeti);
UtolsoIp := FoIp + DownInd(Eredeti);
For Cikl := Eredeti + 1 To UtolsoHp Do
If UpInd(Cikl) >= NewInd Then { Atszamozas a HEAP - en }
Set_Ind(Cikl,UpInd(Cikl) + 1);
Set_Und(Eredeti,DownInd(Eredeti)+1); { Alsoindexek szama no }
For Cikl := FoIp + 1 To UtolsoIp Do
If InInt(Cikl,FirstLine,LastLine) Then
If UpIndI(Cikl) >= NewInd Then { Atszamozas az IMAGE - en }
Set_IndI(Cikl,UpIndI(Cikl) + 1);
If InInt(FoIp,FirstLine,LastLine) Then
Set_UndI(FoIp,DownIndI(FoIp)+1); { Alsoindexek szama no }
End; { Fosor vagy also index }
If Ide < LastLine Then
Begin { Ha kell scrollozas }
For Cikl := LastLine -1 DownTo Ide Do
Begin { Tombok scrollozasa }
MainOfIndex[Cikl+1] := MainOfIndex[Cikl];
ImageToHeap[Cikl+1] := ImageToHeap[Cikl]
End;
Sc_dn(LastLine+2,Ide+2,0,0,SorTabOffs,ImageOffs);
End; { Ha kell scrollozas }
TrueLast := GoodLast(TrueLast+1);
LegAlso := False;
FillImageLine(Ide);
Set_IndI(Ide,NewInd);
Set_BitsI(Ide,0,Typ*128+32);
Disp_Li(Xoffset,Ide);
Line_Stat(0,Ide+2,0,FontOffs,SortabOffs,ImageOffs);
Set_BitsI(Ide,0,Typ*128); { Visszaall kitoltetlenre }
If Ide - 1 >= FirstLine Then
Line_Stat(0,Ide-1+2,0,FontOffs,SortabOffs,ImageOffs);
MainOfIndex[Ide] := Eredeti;
ImageToHeap[Ide] := 0;
LegAlso := False;
HalfLineDown;
SorCurBe;
GlobFelrakas
End
End; { Ins_IndexLine }
Procedure Del_Indexline(Yp : Integer);
Var Nemkell,
Fline,
Mainp,
ElsoInd,UtolsoInd,
Cikl,wrk,
ElsoP,UtolsoP,
Inum : Integer;
Uheap : Boolean; {True = A heap utolso sora ebben a komplexben van }
vbit : Byte;
Fp,Lp : Integer;
Begin
Inum := UpIndI(Yp); { Hanyadik indexsor amin allunk }
MainP := MainOfIndex[Yp];
If (Not MainLineI(Yp)) And {}
NOT( UplineI(Yp) And (UpInd(MainP) = 1)) Then
Begin
GlobLeszedes;
Dec(All_Lines[EditNum]);
SorCurKi;
If UpLineI(Yp) Then
Begin { Ha felso index }
ElsoInd := GoodLast(Yp - (Upind(MainP)-Inum)); { elso az image-en}
UtolsoInd := GoodLast(Yp + Inum); { Utolso az image - en }
FirstAndLast(MainP,ElsoP,UtolsoP); { Elso es utolso a heap-en }
For Cikl := ElsoInd To UtolsoInd Do { Atszamozas az Image - en }
If UpIndI(Cikl) > Inum Then
Set_IndI(Cikl,UpIndI(Cikl)-1);
For Cikl := ElsoP To MainP - 1 Do { Atszamozas a Heap - en }
If UpInd(Cikl) > Inum Then
Set_Ind(Cikl,UpInd(Cikl)-1);
Set_Ind(MainP,UpInd(MainP) - 1); { Korrigalas a Heap - en }
If Yp + Inum <= LastLine Then
Set_IndI(Yp+Inum,UpIndI(Yp+Inum)-1);{ Korrigalas az Image - en }
If ImageToHeap[Yp] <> 0 Then
Begin { Ha kitoltott indexsor volt }
DelHeapLine(ImageToHeap[Yp]); { Torles a heap - rol }
For Cikl := Yp + 1 To TrueLast Do
If ImageToHeap[Cikl] <> 0 Then { Tombok korrigalasa }
Dec(ImageToHeap[Cikl]);
For Cikl := ElsoInd To TrueLast Do
Dec(MainOfIndex[Cikl]);
End { Ha kitoltott }
End { Ha felso indexsor }
Else
Begin { Ha also indexsor }
ElsoInd := GoodLast(Yp - DownInd(MainP)-Inum);
UtolsoInd := GoodLast(Yp + DownInd(MainP)-Inum);
FirstAndLast(MainP,ElsoP,UtolsoP);
For Cikl := Yp+1 To UtolsoInd Do { Atszamozas az Image - en }
Set_IndI(Cikl,UpIndI(Cikl)-1);
For Cikl := MainP + 1 To UtolsoP Do { Atszamozas a Heap - en }
If UpInd(Cikl) > Inum Then
Set_Ind(Cikl,UpInd(Cikl)-1);
Set_Und(MainP,DownInd(MainP) - 1); { Korrigalas a Heap - en }
If Yp - Inum >= FirstLine Then
Set_UndI(Yp-Inum,DownIndI(Yp-Inum)-1);{ Korrigalas az Image - en }
If ImageToHeap[Yp] <> 0 Then
Begin { Ha kitoltott indexsor volt }
DelHeapLine(ImageToHeap[Yp]);
For Cikl := Yp + 1 To TrueLast Do
If ImageToHeap[Cikl] <> 0 Then { Tombok korrigalasa }
Dec(ImageToHeap[Cikl]);
For Cikl := UtolsoInd + 1 To TrueLast Do
Dec(MainOfIndex[Cikl]);
End { Ha kitoltott }
End; { Ha also index sor volt }
If Yp < TrueLast Then { Scrollozas }
Begin
Sc_up(Yp + 2,TrueLast+2,0,0,SorTabOffs,ImageOffs);
ScrollPlusU(Yp);
WriteImageLine(Yp,True);
End;
If Yp - 1 >= FirstLine Then
Line_Stat(0,Yp-1+2,0,FontOffs,SortabOffs,ImageOffs);
{ Most kell TrueLast - ra kerulni az uj soroknak,ha vannak.
Az Image TrueLast sora bizonytalan, ide jon az uj sor }
MainP := MainOfIndex[TrueLast-1]; { Maradek kiirasa, regi TrueLast }
FirstAndLast(MainP,Fp,Lp);
Uheap := Lp = EndLine[EditNum];
Fline := FullOfComplex(MainP); { Also sorok+Felso sorok+Fosor }
If MainLineI(TrueLast-1) Then
NemKell := UpInd(MainP)+1 { Felso sorok+Fosor }
Else
If UpIndexI(TrueLast-1) Then { Felso indexek az image-en }
Nemkell := UpInd(MainP)-UpIndI(TrueLast-1)+1
Else { Felso indexek + fosor + Alsok }
Nemkell := UpInd(MainP)+UpIndI(TrueLast-1)+1;
If Not((Nemkell = Fline) And Uheap) Then
Begin
HalfToImage(MainP,LastLine,Nemkell,2);
WriteImageLine(LastLine,True);
Fresh_Stat(LastLine-1,LastLine-1,True);
End
Else
Begin
FillImageLine(TrueLast);
WriteImageLine(TrueLast,False);
Dec(TrueLast);
WriteImageLine(TrueLast,True);
End;
HalfLineUp; { Az indexsor torlese utan egyet felfele megyunk }
SorCurBe;
GlobFelrakas;
End
End;
{$ENDIF}
{$ENDIF}
Procedure NextPos(Limes1,Limes2:Integer);
Var NewM : Integer;
Begin
Inc(Xpos);
If (Xpos > Limes2) Then
If (BlockMode AND OszlopMode) OR FrameMode Then
Dec(Xpos)
Else
Begin
Xpos := Limes1;
If Not LastMain(MainOfIndex[Ypos]) Then
Begin
SorCurKi;
NewM := NextMain(MainOfIndex[Ypos]);
While ImageToHeap[Ypos] <> NewM Do
HalfLineDown;
SorCurBe
End
End;
CheckXpos(True);
End;
Procedure NextP2(Limes1,Limes2:Integer);
Var NewM : Integer;
Begin
If (Xpos >= Limes2) Then
Begin
Xpos := Limes1;
If Not LastMain(MainOfIndex[Ypos]) Then
Begin
SorCurKi;
NewM := NextMain(MainOfIndex[Ypos]);
While ImageToHeap[Ypos] <> NewM Do
HalfLineDown;
{$IFNDEF CDVIEW}
Block_End;
{$ENDIF}
MegisKell := True;
SorCurBe
End
End
Else
Inc(Xpos);
CheckXPos(True);
End;
Procedure PrevPos(Limes1,Limes2:Integer);
Var NewM : Integer;
Begin
Dec(Xpos);
If (Xpos < Limes1) Then If (BlockMode AND OszlopMode) OR FrameMode Then Inc(Xpos) Else
Begin
Xpos := Limes2;
If Not FirstMain(MainOfIndex[Ypos]) Then
Begin
SorCurKi;
NewM := PrevMain(MainOfIndex[Ypos]);
While ImageToHeap[Ypos] <> NewM Do
HalfLineUp;