-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwin2.pas
1336 lines (1189 loc) · 33.6 KB
/
win2.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
{ $Id$
OpenXP window handling and file chooser unit
Copyright (C) 1991-2001 Peter Mandrella
Copyright (C) 2000-2002 OpenXP team (www.openxp.de)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}
{$I xpdefine.inc }
{ OpenXP window handling and file chooser unit }
unit win2;
interface
uses
inout,typeform;
var fsb_shadow : boolean = false; { fsbox: Schatten }
fsb_info : boolean = false; { fsbox: Dategroesse/Datum anzeigen }
fsb_rcolor : byte = 0; { fsbox: eigene Rahmenfarbe }
type diskstat = record
dateien,bytes : longint;
end;
xproc = procedure(path:string);
stproc = procedure(stat:diskstat);
perrproc = procedure;
procedure setwinselcursor(cur:curtype);
procedure fslct(x,y1,y2: Integer; const txt:string; sla:string; errdisp:boolean;
var fi:string; var brk:boolean);
function fsbox(y: Integer; path,pathx:string; vorgabe: String; xdir,invers,
vert:boolean):string;
// not used
procedure pslct(x1,x2,y1,y2: Integer; drive:char; fenster,pvorg,modify:boolean;
crproc:xproc; sproc:stproc; errproc:perrproc;
var path:string; mark:boolean; var brk:boolean);
procedure pdummyproc;
function pname(p: Integer):string;
function pslcted(p: Integer):boolean;
function pnum: Integer;
procedure punselect;
procedure pdel;
procedure psave; { Path-Liste sichern (1 x moeglich!) }
procedure prest; { Path-Liste wiederherstellen }
{ ========================= Implementation-Teil ========================= }
implementation
uses
{$IFDEF Win32 }
windows, //must come before SysUtils!
{$ENDIF }
sysutils,
Classes, //TStringList
{$IFDEF DOS32 }
xpdos32,
{$ENDIF }
{$IFDEF Win32 }
xpwin32,
{$ENDIF }
{$IFDEF OS2 }
xpos2,
{$ENDIF }
{$ifdef NCRT}
xpcurses,
{$endif}
osdepend,maus2, mouse,
keys, FileIO, xp1,winxp,
xpglobal;
const maxpath = 2000;
markchar = #16;
var pdrive : char = ' ';
mdrive : char = ' ';
oldpn : integer = 0;
wcursor : boolean = false;
type parr = array[1..maxpath] of String;
var pa,mpa : ^parr;
pn,mpn : integer;
procedure fslct(x,y1,y2: Integer; const txt:string; sla:string; errdisp:boolean;
var fi:string; var brk:boolean);
const maxs = 5;
var pntl : pntslcta;
sr : tsearchrec;
rc : integer;
n : xpWord; //var parameter!
lnum : Integer;
handle : TxpHandle; //Integer;
p : Integer;
s : string[20];
slas : array[1..maxs] of string;
slan,i : Integer;
begin
cursor(curoff);
new(pntl);
lnum:=0;
p:=cPos(';',sla);
if p=0 then begin
sla:=sla+';';
p:=length(sla);
end;
slan:=0;
while p>0 do begin
inc(slan);
slas[slan]:=LeftStr(sla,p-1);
delete(sla,1,p);
p:=cPos(';',sla);
end;
for i:=1 to slan do begin
rc:= findfirst(slas[i],faArchive,sr);
while rc=0 do begin
if lnum<500 then begin
inc(lnum);
n:=lnum;
s:=' '+sr.name;
p:=cPos('.',s);
if p=0 then
s:=forms(s,9)+'.'
else
s:=forms(copy(s,1,p-1),9)+'.'+forms(copy(s,p+1,3),3);
while (n>1) and (pntl^[n-1].el>s) do
dec(n);
Move(pntl^[n],pntl^[n+1],sizeof(slcttyp)*(lnum-n));
with pntl^[n] do begin
el:=s;
zu:=true;
nu:=n;
end;
end;
rc:= findnext(sr);
end; { while }
findclose(sr);
end; { for }
if lnum=0 then
if errdisp then begin
wpull(25,55,10,14,'Fehler',handle);
mwrt(28,12,'Datei existiert nicht');
SysDelay(1500);
wrest(handle);
brk:=true;
fi:='*brk*';
end
else begin
brk:=true; fi:='*err*';
end
else begin
wpull(x,x+18,y1,y2,txt,handle);
wslct(lnum,pntl,handle,1,txt<>'',n,brk);
if not brk then begin
fi:=copy(pntl^[n].el,2,12);
for i:=length(fi) downto 1 do
if fi[i]=' ' then
delete(fi,i,1);
end;
wrest(handle);
end;
dispose(pntl);
end;
{ y : Y-Position Bildschirm
path : z.B. C:\TURBO4\*.PAS oder *.EXE
pathx : '' oder mehrere Extensions, z.B. *.EXE;*.COM;*.SYS
vorgabe : Vorgabe-Dateiname; wird automatisch selektiert
xdir : mit Unterverzeichnissen
invers : inverse Anzeige
vert : vertikale Anzeige }
{$IFDEF VP }
function OwnStringListCompare(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := CompareText(List[Index1], List[Index2]);
end;
{$ENDIF }
function fsbox(y: Integer; path,pathx:string; vorgabe: String; xdir,invers,vert:boolean):string;
const
maxs = 5;
type
txst = string[70];
var fb : string;
f : TStringList;
sr : tsearchrec;
s: String;
rc : integer;
CposY,i,ma,
add,x : integer;
disp : boolean;
t : taste;
dir, name, ext: string;
paths : array[1..maxs] of string;
pathn : Integer;
dpath : string; { Display-Path }
chgdrive : boolean;
wpushed : boolean;
height : shortint;
na,ia : Integer;
drives : string[80];
doppelpunkt : boolean; { bei Novell liefert FF/FN kein ".." ... }
mausscroll : boolean;
aue,ade,au,ad,ab :boolean;
procedure iit;
begin
if invers then invtxt else normtxt;
end;
procedure rahmen1(li,re,ob,un: Integer; const txt: String);
var i : Integer;
begin
moff;
Wrt(li, ob, 'Ú'+ dup(re-li-1,'Ä') + '¿');
if txt<>'' then begin
gotoxy((re+li+1)div 2-length(txt)div 2-1,ob);
if not invers and (fsb_rcolor=0) then hightxt;
Wrt2(' ' + txt + ' ');
iit;
end;
for i:=ob+1 to un-1 do
begin
Wrt(li, i, '³');
Wrt(re, i, '³');
end;
gotoxy(li,un); Wrt2('À' + dup(re-li-1,'Ä') + 'Ù');
mon;
end;
function fname(n:integer):string;
begin
fsplit(path,dir,name,ext);
fname:=dir+f[n];
end;
procedure clfswin;
begin
clwin(10,70,y+1,y+9);
if fsb_info then wrt(10,y+11,sp(61));
end;
procedure dispfile(n:integer);
var s : string;
begin
moff;
if not vert then
gotoxy((n mod 4)*19+3,(n div 4)+y+1)
else
gotoxy((n div 9)*19+3,n mod 9+y+1);
if n+add>f.Count-1 then
Wrt2(sp(18))
else begin
s:=f[n+add];
Wrt2(' ' + forms(ConvertFileName(s), 16) + ' ');
end;
mon;
end;
procedure display;
var i : integer;
begin
for i:=0 to 35 do
dispfile(i);
end;
procedure disp_p;
var s,s2 : string;
sr : TSearchRec;
xx,yy : Integer;
begin
if invers then normtxt else invtxt;
dispfile(CposY);
xx:=wherex; yy:=wherey; { fr Cursor-Anzeige }
iit;
FWrt(2,y+1,iifc(cposy+add>4,#30,'³'));
FWrt(78,y+1,iifc(cposy+add>4,#30,'³'));
FWrt(2,y-iif(fsb_info,3,1)+height,iifc(cposy+add<=pathn-4,#31,'³'));
FWrt(78,y-iif(fsb_info,3,1)+height,iifc(cposy+add<=pathn-4,#31,'³'));
if fsb_info then begin
s:=f[add+CposY];
gotoxy(3,y+height-1);
moff;
{$IFNDEF UnixFS }
if s[1]='[' then
case SysGetDriveType(s[2]) of
2 : Wrt2(forms(' RAM-Disk',74));
3 : Wrt2(forms(' Subst-Laufwerk',74));
4 : Wrt2(forms(' device driven',74));
5 : Wrt2(forms(' Netz-Laufwerk',74));
6 : Wrt2(forms(' CD-ROM Laufwerk',74));
else
Wrt2(sp(74));
end
else
{$ENDIF }
if LastChar(s)=DirSepa then
Wrt2(' ' + Forms(ConvertFilename(s), 74))
else begin
if (findfirst(AddDirSepa(ExtractFilePath(path))+s,faanyfile,sr)<>0) then
Wrt2(sp(69)+'#')
else begin
s2 := Trim(strsrnp(sr.size,12,0));
Wrt2(' ' +forms(ConvertFileName(s),60 - Length(s2)) + ' ' + s2 + ' ' +
DateToStr(FileDateToDateTime(sr.time)) + ' ');
{formi(day,2) + '.' + formi(month,2) + '.' + formi(year mod 100,2)}
end;
findclose(sr);
end;
mon;
end;
if wcursor then gotoxy(xx-14,yy);
end;
procedure binseek(ab:char);
var i : integer;
begin
i:=CposY+add+1;
while (i<f.Count) and (UpCase(f[i][1])<>ab) do inc(i);
if i>=f.Count then
begin
i:=1;
while (i<=CposY+add) and (UpCase(f[i][1])<>ab) do inc(i);
end;
if (i<f.count) and (f[i] <> '') and (UpCase(f[i][1])=ab) then begin
if not vert then begin
while i-add<1 do add:=max(0,add-4);
while i-add>36 do inc(add,4);
end
else begin
while i-add<1 do add:=max(0,add-9);
while i-add>36 do inc(add,9);
end;
CposY:=i-add;
end;
end;
procedure maus_bearbeiten(var t:taste);
var xx,yy : integer;
inside : boolean;
mausbut : byte;
down : boolean;
begin
maus_gettext(xx,yy);
inside:=(xx>10) and (xx<71) and (yy>y) and (yy<y+height-2);
down:=yy>=y+height div 2;
if inside then begin
if (t=mausleft) or (t=mauslmoved) then
if vert then
CposY:=((xx-11)div 15)*9+1 + (yy-y)
else
CposY:=(xx-11)div 15+1 + ((yy-y-1)*4);
if t=mausldouble then
t:=keycr;
end
else if (t=mausleft) and not mausscroll
then begin
mausscroll:=true;
aue:=autoupenable;
ade:=autodownenable;
au:=autoup;
ad:=autodown;
ab:=autobremse;
autobremse:=true;
if down then begin
autodownenable:=true;
autodown:=true;
end
else begin
autoupenable:=true;
autoup:=true;
end;
end;
if mausscroll then begin
{ Beim Scrollen Maustaste abfragen }
mausbut := maust; //todo: check compatibility of the undocumented bit settings
// if mausswapped then mausbut:=mausbut shr 1;
if (mausbut and 1) = 0 then begin { Rechte Taste nicht gedrueckt: Scrollen aus }
autoupenable:=aue;
autodownenable:=ade;
autoup:=au;
autodown:=ad;
autobremse:=ab;
mausscroll:=false;
end else if inside then
t:=''
else if down then
t:=keydown { Rechte Taste gedrueckt gehalten: scrollen }
else t:=keyup;
end;
if not mausscroll and (t=mausunright) then t:=keyesc;
CPosY:=min(CposY,PathN);
end;
begin
mausscroll:=false;
f := TStringList.Create;
path:=trim(path); pathx:=trim(pathx);
if path='' then path:=WildCard;
path:=ExpandFileName(path);
if pathx='' then begin
pathn:=1;
paths[1]:=path;
end
else begin
pathn:=0;
CposY:=cPos(';',pathx);
path := ExtractFilePath(path);
dpath:=pathx; { dpath wird hier als Temp genutzt! }
while CposY>0 do begin
inc(pathn);
paths[pathn]:=path+LeftStr(dpath,CposY-1);
delete(dpath,1,CposY);
CposY:=cPos(';',dpath);
end;
end;
vorgabe:=FileUpperCase(vorgabe);
t:=#0#0;
wpushed:=false;
height:=iif(fsb_info,12,10);
{$IFDEF UnixFS }
drives:= '';
{$ELSE }
drives:=alldrives;
{$ENDIF }
maus_pushinside(10,70,y+1,y+height-3);
repeat
f.Clear;
fsplit(path,dir,name,ext);
if xdir then begin
doppelpunkt:=false;
{$IFDEF UnixFS}
rc:= findfirst(dir+WildCard,faAnyFile,sr);
{$ELSE}
rc:= findfirst(dir+WildCard,faDirectory+faArchive,sr);
{$ENDIF}
while rc=0 do
begin
if (sr.name<>'.') and ((sr.attr and faDirectory)<>0) then
begin
s := #125+sr.name;
if s[2]='.' then
begin
s[1]:=#127; doppelpunkt:=true;
end;
f.Add(s);
end;
rc:= findnext(sr);
end; { while }
findclose(sr);
if not doppelpunkt and (length(dir)>3) then
f.Add(#127+'..');
for i:=1 to length(drives) do
f.Add(#126'['+drives[i]+':]');
end; { if xdir }
for x:=1 to pathn do begin
rc:= findfirst(paths[x],faReadOnly+faArchive,sr);
while rc=0 do
begin
if sr.name<>'.' then
f.Add(sr.name);
rc:= findnext(sr);
end; { while }
findclose(sr);
end;
if not wpushed then begin
setrahmen(0);
if fsb_shadow then wpushs(2,78,y,y+height,'')
else wpush(2,78,y,y+height,'');
setrahmen(1);
wpushed:=true;
end;
dpath:=path;
if pathx<>'' then dpath := ExtractFilePath(dpath);
dpath:=fitpath(dpath,71);
na:=normattr; ia:=invattr;
if fsb_rcolor<>0 then begin
if invers then invattr:=fsb_rcolor
else normattr:=fsb_rcolor;
end;
iit;
rahmen1(2,78,y,y+height,ConvertFileName(dpath));
if fsb_info then
mwrt(2,y+height-2,'Ã'+dup(75,'Ä')+'´');
normattr:=na; invattr:=ia;
iit;
clfswin;
if F.Count = 0 then
begin
fb:='';
iit;
clfswin;
mwrt(4,y+1,'keine Dateien');
get(t,curoff);
chgdrive:=xdir and (t>=^A) and (t<=^Z) and
(cpos(chr(ord(t[1])+64),drives)>0);
end
else begin
F.Sort;
for i:=0 to F.Count - 1 do
if f[i][1]>=#125 then
begin
f[i] := Mid(f[i],2);
if FirstChar(f[i])<>'[' then
f[i]:=f[i]+DirSepa;
end;
CposY:=0; add:=0;
while (CposY<f.count) and (FileUpperCase(f[CposY])<>vorgabe) do inc(CposY);
if CposY=f.count then CposY:=0
else add:=max(CposY-36,add);
CposY:=CposY-add;
disp:=true;
repeat
if disp then begin
display;
disp:=false;
end;
disp_p;
mauszul:=true; mauszur:=true;
mauszuo:=true; mauszuu:=true;
if wcursor then
get(t,curon)
else
get(t,curoff);
iit;
dispfile(CposY);
ma:=add;
if (t>=mausfirstkey) and (t<=mauslastkey) then
maus_bearbeiten(t);
if not vert then
begin
if t=keyup then
begin
if CposY>=4 then
dec(CposY,4)
else
if add>0 then dec(add,4);
end;
if t=keydown then
begin
if CposY+add<f.count-4 then
if CposY<31 then
inc(CposY,4)
else
inc(add,4);
end;
if t=keyleft then begin
if CposY>0 then
dec(CposY,1)
else
if add>0 then
begin
dec(add,4); CposY:=3;
end;
end;
if t=keyrght then begin
if CposY+add<f.count-1 then
if CposY<35 then inc(CposY,1)
else
begin
inc(add,4); CposY:=32;
end;
end;
if t=keyhome then
begin
CposY:=0; add:=0;
end;
if t=keyend then
begin
if f.count-add<=36 then
CposY:=f.count-add-1
else begin
CposY:=f.count-1; add:=0;
while CposY>=36 do
begin
dec(CposY,4); inc(add,4);
end;
end;
end;
if t=keypgup then begin
if add>=36 then dec(add,36)
else begin
add:=0; CposY:=CposY mod 4;
end;
end;
if t=keypgdn then
begin
if f.count-1-add>=36 then
begin
inc(add,36);
if CposY+add>f.count-1 then
if f.count-add>=4 then
repeat dec(CposY,4) until CposY+add < f.count
else
begin
repeat dec(CposY) until CposY+add < f.count;
end
end
else
while CposY+add<f.count-4 do inc(CposY,4);
end;
end
else begin { vertikal }
if t=keyup then begin
if CposY>1 then dec(CposY)
else if add>0 then dec(add);
end;
if t=keydown then begin
if CposY+add<f.count then
if CposY<36 then inc(CposY)
else inc(add);
end;
if t=keyleft then begin
if CposY>9 then dec(CposY,9)
else
if add>0 then
add:=max(0,add-9);
end;
if t=keyrght then begin
if CposY+add<f.count then
if CposY<28 then CposY:=iif(CposY+9<=f.count-add,CposY+9,CposY)
else
if add+9+CposY<=f.count then
inc(add,9);
end;
if t=keyhome then begin
CposY:=1; add:=0;
end;
if t=keyend then begin
if f.count<=36 then begin
add:=0; CposY:=f.count;
end
else begin
add:=f.count-36; CposY:=36;
end;
end;
if t=keypgup then begin
dec(CposY,35);
if CposY<1 then begin
add:=max(0,add-(1-CposY));
CposY:=1;
end;
end;
if t=keypgdn then begin
if f.count-add<=36 then CposY:=f.count-add
else begin
inc(CposY,35);
if CposY>36 then begin
add:=min(f.count-36,add+(CposY-36));
CposY:=36;
end;
end;
end;
end;
if (t[1]>' ') then binseek(UpCase(t[1]));
if add<>ma then disp:=true;
if (t=keycr) and (f[CPosY+add][1]='[') then
t:=chr(ord(f[CPosY+add][2])-64)+'+';
chgdrive:=false;
if xdir and (t[1]>=^A) and (t[1]<=^Z) and (kb_ctrl or (t<>keycr))
then
if (cpos(chr(ord(t[1])+64),drives)>0) then chgdrive:=true
else errsound;
if chgdrive then begin { Balken auf [LW:] positionieren }
i:= 0;
while (i<f.count) and (f[i]<>'['+chr(ord(t[1])+64)+':]') do inc(i);
if (i<=f.count) and (i<>CposY+add) then begin
while i-add<1 do dec(add,iif(vert,9,4));
while i-add>36 do inc(add,iif(vert,9,4));
CposY:=i-add;
display;
disp_p;
end;
end;
if (t=keycr) and kb_ctrl then t:='';
until (t=keyesc) or (t=keycr) or chgdrive;
end;
if ((f.count>0) and (t=keycr) and (LastChar(f[CposY+add])=DirSepa)) or chgdrive then
begin
for i:=1 to pathn do begin
fsplit(paths[i],dir,name,ext);
if t=keycr then { Pfadwechsel }
if f[CposY+add]='..'+DirSepa then begin
delete(dir,length(dir),1);
while LastChar(dir)<>DirSepa do
delete(dir,length(dir),1);
if dir<>'' then path:=dir+name+ext;
end
else
path:=dir+f[CposY+add]+name+ext
else
begin { Laufwerkswechsel }
GetDir(Ord(t[1]), Path);
path:=IncludeTrailingPathDelimiter(Path)+name+ext;
end;
paths[i]:=path;
end;
t:=#0#0;
end;
until (t=keyesc) or (t=keycr);
maus_popinside;
if wpushed then begin
normtxt;
wpop;
end;
if t=keycr then fb:=fname(CposY+add)
else fb:='';
F.Free;
fsbox:=fb;
end;
function pname(p: Integer):string;
var x : Integer;
path : string;
begin
path:='';
while p>1 do begin
x:=cPos('Ã',pa^[p]);
if x=0 then x:=cPos('À',pa^[p]);
path:=copy(pa^[p],x+3,80)+PathDelim+path;
while pa^[p][x] in ['³','Ã','À'] do dec(p);
end;
pname:=PathDelim+trim(path);
end;
function pnum: Integer;
begin
pnum:=pn;
end;
procedure punselect;
var i : integer;
begin
for i:=1 to pn do
pa^[i][1]:=' ';
end;
function pslcted(p: Integer):boolean;
begin
pslcted:=(pa^[p][1]=markchar);
end;
var dsfiles : longint = 0;
dsb : longint = 0;
procedure pslct(x1,x2,y1,y2: Integer; drive:char; fenster,pvorg,modify:boolean;
crproc:xproc; sproc:stproc; errproc:perrproc;
var path:string; mark:boolean; var brk:boolean);
var i,j : integer;
IORes : Integer;
econt : set of byte;
glc : char;
sn : string;
gl,wdt : Integer;
t,t2 : taste;
p,a,am : integer;
xp : integer;
vn : string;
s,s2 : string;
stat : diskstat;
procedure pmsg(s:string);
begin
moff;
if s<>'' then begin
hightxt;
wrt(x1+2,y2,' '+s+' ');
normtxt;
Wrt2(dup(wdt-length(s)-1,'Ä'));
end
else wrt(x1+2,y2,dup(wdt+2,'Ä'));
mon;
end;
procedure wrp(p:integer);
begin
if (lastattr=normattr) and (pa^[p+a][1]=markchar) then hightxt;
mwrt(x1+2,y1+p,forms(pa^[p+a],wdt+1));
normtxt;
end;
procedure papp(p:string);
var i : Integer;
begin
inc(pn);
if pvorg and (trim(p)=path) then xp:=pn;
i:=2;
while i<length(p) do begin
if (p[i]=' ') and (i in econt) then p[i]:='³';
inc(i,3);
end;
if pn<=gl then wrt(x1+2,y1+pn,LeftStr(p,wdt));
pa^[pn] :=p;
end;
procedure dstat;
begin
if dsb<0 then dsb:=0;
stat.dateien:=dsfiles; stat.bytes:=dsb;
sproc(stat);
end;
procedure psearch(const p:string; ebene: Integer);
var sr : tsearchrec;
{ n1 : word; MK 14.02.2000 Variable wird nicht benutzt }
de : integer;
begin
de:= findfirst(AddDirSepa(p)+WildCard,faDirectory+faHidden+faReadOnly+faSysFile,sr);
while (de=0) and (((sr.attr and faDirectory)=0) {or (sr.name[1]='.')}) do begin
testbrk(brk);
if brk then begin
findclose(sr);
exit;
end;
de:= findnext(sr);
if (de=0) and (sr.attr and (faDirectory+faVolumeID)=0) then begin
inc(dsfiles);
inc(dsb,sr.size);
end;
end; { while }
{ n1:=pn; }
while de=0 do begin
sn:=sr.name;
multi2;
dstat;
repeat
testbrk(brk);
if brk then begin
findclose(sr);
exit;
end;
de:= findnext(sr);
if (de=0) and (sr.attr and (faDirectory+faVolumeID)=0) then begin
inc(dsfiles);
inc(dsb,sr.size);
end;
until (de<>0) or (((sr.attr and faDirectory)<>0) {and (name[1]<>'.')});
if de=0 then econt:=econt+[succ(ebene)]
else econt:=econt-[succ(ebene)];
if trim(p+sn)=path then xp:=pn+1;
glc:=iifc(de=0,'Ã','À');
papp(sp(ebene)+glc+'ÄÄ'+sn);
{ n1:=pn; }
psearch(p+sn+DirSepa,ebene+3);
if brk then begin
findclose(sr);
exit;
end;
end;
findclose(sr);
end;
procedure display;
var i : integer;
begin
for i:=1 to gl do
if i+a<=pn then
wrp(i)
else
mwrt(x1+2,y1+i,sp(wdt));
end;
begin
brk:=false;
drive:=UpCase(drive);
if pdrive<>drive then
begin
if pdrive<>' ' then pdel;
new(pa);
end;
if pa=nil then path:='*mem*'
else begin
econt:=[];
if fenster then wpush(x1,x2,y1,y2,'Laufwerk '+drive);
gl:=y2-y1-1; wdt:=x2-x1-4; xp:=1;
if pdrive<>drive then begin
pn:=0;
dsfiles:=0; dsb:=0;
pmsg('einen Moment bitte ...');
papp(' \');
psearch(drive+_MPMask,1);
if ioresult = 0 then ;
if not brk then pdrive:=drive
else pdel;
end
else if pvorg then begin
i:=1;
while (i<=pn) and (pname(i)<>UpperCase(mid(path,3))+DirSepa) do inc(i);
if i<=pn then xp:=i;
end;
if not brk then begin
p:=xp;
if p>gl then begin
a:=p-gl;
while (a-(p-gl)<3) and (a<pn-gl) do
inc(a);
dec(p,a);
end
else a:=0;
am:=-1;
pmsg('');
brk:=true;
repeat
dstat;
if am<>a then begin
display;
am:=a;
end;
invtxt;
wrp(p);
normtxt;
get(t,curoff);
wrp(p);
if t=keyup then
if p=1 then
if a>0 then dec(a)
else
else dec(p);
if t=keydown then
if a+p<pn then
if p=gl then inc(a)
else inc(p);
if t=keyhome then begin
p:=1; a:=0; end;
if t=keyend then begin
a:=max(0,pn-gl);
p:=pn-a;
end;
if t=keypgup then begin
dec(p,gl-1);
if p<1 then begin
dec(a,1-p); p:=1;
a:=max(0,a);
end;
end;
if t=keypgdn then
for i:=1 to gl-1 do
if a+p<pn then
if p=gl then inc(a)
else inc(p);
if modify and (t=keyins) then begin
pmsg('Name:'+sp(13));
vn:='';
bd(x1+9,y2,'',vn,12,1,brk);
if not brk then begin
path:=AddDirSepa(pname(a+p));
DeleteFirstChar(Path); // fuehrenden Separator loeschen
mkdir(drive+_MPMask+path+vn);
IORes := IOResult;
if IORes <>0 then
begin
if IORes =3 then
pmsg('ungltiger Name - Taste')