-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathflpanel.pas
2239 lines (2137 loc) · 63 KB
/
flpanel.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
{/////////////////////////////////////////////////////////////////////////
//
// Dos Navigator Open Source 1.51.08
// Based on Dos Navigator (C) 1991-99 RIT Research Labs
//
// This programs is free for commercial and non-commercial use as long as
// the following conditions are aheared to.
//
// Copyright remains RIT Research Labs, and as such any Copyright notices
// in the code are not to be removed. If this package is used in a
// product, RIT Research Labs should be given attribution as the RIT Research
// Labs of the parts of the library used. This can be in the form of a textual
// message at program startup or in documentation (online or textual)
// provided with the package.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. All advertising materials mentioning features or use of this software
// must display the following acknowledgement:
// "Based on Dos Navigator by RIT Research Labs."
//
// THIS SOFTWARE IS PROVIDED BY RIT RESEARCH LABS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The licence and distribution terms for any publically available
// version or derivative of this code cannot be changed. i.e. this code
// cannot simply be copied and put under another distribution licence
// (including the GNU Public Licence).
//
//////////////////////////////////////////////////////////////////////////}
{$I STDEFINE.INC}
{Cat = Aleksej Kozlov, 2:5030/1326.13@fidonet}
{&Delphi+}
unit FlPanel;
interface
uses
Defines, Streams, Views, Drivers, FilesCol,
FlPanelX, Objects, TopView
;
type
PFilePanel = ^TFilePanel;
TFilePanel = object(TFilePanelRoot)
procedure Draw; virtual;
procedure SetState(AState: Word; Enable: Boolean); virtual;
procedure HandleEvent(var Event: TEvent); virtual;
function GetPalette: PPalette; virtual;
procedure DrawTop(var B); virtual;
end;
TPanelBottomDnD = record
TotalY, SelectedY, CurrentY1, CurrentY2: Byte;
end;
const
MaxFooterHeight = 4;
type
PInfoView = ^TInfoView;
TFooterProc = function(IV: PInfoView): Boolean;
{ à®æ¥¤ãà ä®à¬¨à®¢ ¨ï (ç áâ¨) áâப¨ ¯®¤¢ « . „«ï ª ¦¤®©
áâப¨ â ª¨å ¯à®æ¥¤ãà ¬®¦¥â ¡ëâì § ¤ ® ¥áª®«ìª®, ®¨ ¢ë§ë¢ îâáï
¯® ¯®à浪ã.
¥§ã«ìâ â True ®¡®§ ç ¥â, çâ® ä®à¬¨à®¢ ¨¥ áâப¨ § ª®ç¥® ¨
¯®á«¥¤ãî騥 ¯à®æ¥¤ãàë ¥ ¢ë§ë¢ îâáï. }
TInfoView = object(TView)
Panel: PFilePanel;
DnD: TPanelBottomDnD;
LineMaker: array[0..MaxFooterHeight] of array[0..6] of TFooterProc;
{` „«ï ª ¦¤®© áâப¨ ¯®¤¢ « , ç¨ ï á à §¤¥«¨â¥«ï,
¯®á«¥¤®¢ ⥫ì®áâì ¯à®æ¥¤ãà ä®à¬¨à®¢ ¨ï í⮩ áâப¨.
Š ¦¤ ï ¯®á«¥¤®¢ ⥫ì®áâì § ¢¥àè ¥âáï nil.`}
constructor Init(R: TRect);
procedure Compile(Value: Word;
FullProc, BriefProc: TFooterProc);
procedure CompileShowOptions;
procedure Draw; virtual;
{AK155: â®â ¬¥â®¤ £à㦥 ¤¢ã¬ï ¢ ¦ë¬¨ ¯®¡®ç묨 íä䥪⠬¨:
® ¢ ᮮ⢥âá⢨¨ á áâனª ¬¨ ãáâ ¢«¨¢ ¥â ᢮© Size.Y ¨
§ ¯®«ï¥â DnD ª®®à¤¨ â ¬¨ áâப, ¨§ ª®â®àëå ¢®§¬®¦¥ D&D.
¥à¢®¥ ¨á¯®«ì§ã¥âáï ¢ TFilePanelRoot.ChangeBounds,
¢â®à®¥ ¢ HandleEvent}
constructor Load(var S: TStream);
procedure Store(var S: TStream);
function GetPalette: PPalette; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
end;
PDirView = ^TDirView;
TDirView = object(TTopView)
procedure HandleEvent(var Event: TEvent); virtual;
function GetText(MaxWidth: Integer): String; virtual;
end;
PDriveLine = ^TDriveLine;
{`2 }
TDriveLine = object(TView)
Panel: PFilePanel;
DriveLine: String[29];
ViewLine: String[60];
CharDelta: AInt;
LogDrvMap: LongInt; {Cat}
constructor Init(var R: TRect; APanel: PFilePanel);
procedure MakeDriveLine;
function GetPalette: PPalette; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure Draw; virtual;
constructor Load(var S: TStream);
procedure Store(var S: TStream);
procedure Refresh; {Cat}
procedure Update; virtual;
{` AK155 18.03.2005 ìè¥ áâனª ¢â®®¡®¢«¥¨ï áâப¨ ¤¨áª®¢
áà ¡ âë¢ « ⮫쪮 ¯à¨ § £à㧪¥. â® ¡ë«® ¢ë§¢ ® ⥬, çâ®
¯à¨ ᬥ¥ í⮩ áâனª¨ á«®¦® "á® áâ®à®ë" ¢ª«îç¨âì ¯®«®áë ¤¨áª®¢
¢á¥å ¯ ¥«© ¢ ᯨ᮪ ¢â®®¡®¢«¥¨ï (RegisterToBackground).
‘¥©ç á ï ᤥ« « ¯à®áâ®, å®âï ¨ £®à¡ â®: RegisterToBackground
¤¥« ¥âáï ¯à¨ á®§¤ ¨¨ ¨ ¢á¥£¤ , Update ä ªâ¨çá¥áª¨ ¤¥« ¥â
®¯à®á ¨ ®¡®¢«¥¨¥ ⮫쪮 ¯à¨ ¢ª«îçñ®© áâனª¥. `}
procedure ShiftLetter(d: Integer);
{` ‘¤¢¨ãâì Panel^.DriveLetter ¢¯à ¢® (d=1) ¨«¨ ¢«¥¢® (d=-1),
横«¨ç¥áª¨. `}
end;
{`}
const
CPanel = #6#7#8#9#10#32#33#34#35#36#37#38#39#40#44#45#46#47#48; {JO}
CTopView = #11#12;
CInfoView = #25#26#27#28#29#30#31#49#50;
CDriveLine = #41#42#43;
(* AK155 16.05.05
Ÿ ¥ ¯®ï«, § 祬 ¢®®¡é¥ §¤¥áì ã¦ë í⨠®¯à¥¤¥«¥¨ï, ¯®áª®«ìªã
¢ uses ¨â¥à䥩ᮩ ç á⨠FlPanelX ¥áâì ¨ ¢á¥ í⨠¯¥à¥¬¥ë¥ ¢¨¤ë
¡¥§ ¢á直å ãå¨é२©. ˆ ¢¤¢®©¥ ï ¥ ¯®ï«, § 祬 㦮 ¡ë«® ¨å ¯®¬¥é âì
¢ ¨â¥à䥩ᮩ ç á⨠á ⨯ ¬¨, ®â«¨ç î騬¨áï ®â ®à¨£¨ «ìëå
(⨯ Pointer ¢¬¥áâ® PFilesPanelRoot), â ª ª ª ¯®á«¥ í⮣® ¢ ¯à®ç¨å
¬®¤ã«ïå ¯®«ãç ¥âáï, ç⮠⨯ íâ¨å ¯¥à®¥¬¥ëå § ¢¨á¨â ®â ¯®à浪
FlPanelX ¨ FlPanel ¢ ¨å uses. ’ ª ç⮠㡨à î íâã ᥪæ¨î 䨣.
var
ActivePanel: Pointer absolute FlPanelX.ActivePanel;
PassivePanel: Pointer absolute FlPanelX.PassivePanel;
CtrlWas: Boolean absolute FlPanelX.CtrlWas;
DirsToChange: array[0..9] of PString absolute FlPanelX.DirsToChange;
var
CurrentDirectory: String absolute FlPanelX.CurrentDirectory;
/AK155 *)
implementation
uses
Files, VpSysLow, Dos, Eraser, Drives, DNHelp, TitleSet,
Lfnvp, DNUtil, DNApp, Advance, Advance1, Advance2, Advance3, Startup,
Memory, FileCopy, Messages, Menus, DiskInfo, Dialogs, Commands,
HistList, Tree, FBB, ArcView, CmdLine, Histries, Archiver,
Gauges, Gauge, FileFind, FLTools, DnIni, XDblWnd, DblWnd, Filediz
{$IFDEF UUENCODE}
, UUCode
{$ELSE}
{$IFDEF UUDECODE}
, UUCode
{$ENDIF}
{$ENDIF} {, Crt}
, xTime
, PDSetup, VPUtils
{$IFDEF UUENCODE}
, netbrwsr
{$ENDIF}
;
var
QSLastSuccessPos: Integer;
{` ®á«¥¤ïï ãᯥè ï ¯®§¨æ¨ï ¡ëáâண® ¯®¨áª . ⮠ᮡá⢥ ï
(¤«ï ¡ëáâண® ¯®¨áª ) ª®¯¨ï LastSuccessPos, ª®â®àë© ¬®¦¥â ¨§¬¥ïâìáï
¢ १ã«ìâ ⥠¤à㣨å ᮯ®áâ ¢«¥¨© á ¬ ᪮© ( ¯à¨¬¥à, ¯à¨
¢â®®¡®¢«¥¨¨ ¯ ¥«¥©). `}
constructor TDriveLine.Init;
begin
inherited Init(R);
Panel := APanel;
EventMask := evMouse or evBroadcast;
MakeDriveLine;
CharDelta := 1;
LogDrvMap := SysGetValidDrives;
UpdTicks := 3000;
RegisterToBackground(@Self);
end;
constructor TDriveLine.Load(var S: TStream);
begin
inherited Load(S);
MakeDriveLine;
CharDelta := 1;
GetPeerViewPtr(S, Panel);
UpdTicks := 3000;
RegisterToBackground(@Self);
end;
procedure TDriveLine.MakeDriveLine;
var
C: Char;
begin
DriveLine := '';
for C := 'A' to 'Z' do
if ValidDrive(C) then
DriveLine := DriveLine + C;
DriveLine := DriveLine + chTempDrive
{$IFDEF NetBrowser}
+ chNetDrive
{$ENDIF};
end;
function TDriveLine.GetPalette;
const
S: String[Length(CDriveLine)] = CDriveLine;
begin
GetPalette := @S;
end;
procedure TDriveLine.Draw;
var
B: TDrawBuffer;
M: Byte absolute DriveLine;
I: Integer;
SDir: String;
begin
I := M*2+3;
if (Panel^.Size.X >= I) then
begin
if (Size.X <> I) then
begin
GrowTo(I, 1);
Exit;
end;
ViewLine := '';
for I := 1 to Length(DriveLine) do
ViewLine := ViewLine+' '+DriveLine[I];
ViewLine := '['+ViewLine+' ]';
end
else
begin
I := 2+M;
if Panel^.Size.X-2 >= I then
if (Size.X <> I)
then
begin
GrowTo(I, 1);
Exit;
end
else
ViewLine := '['+DriveLine+']'
else if Panel^.Size.X <> Size.X+2
then
begin
GrowTo(Panel^.Size.X-2, 1);
CharDelta := 1;
Exit;
end
else
begin
ViewLine := Copy(DriveLine, CharDelta, Size.X-2);
if Length(ViewLine) < Size.X-2 then
ViewLine := ViewLine+Copy(DriveLine, 1, Size.X-2-Length(ViewLine));
ViewLine := '{'+ViewLine+'}';
end;
end;
MoveStr(B, ViewLine, GetColor(1));
I := PosChar(Panel^.DriveLetter, ViewLine);
if I > 0 then
WordRec(B[I-1]).Hi := GetColor(3);
WordRec(B[0]).Hi := GetColor(2);
WordRec(B[Size.X-1]).Hi := GetColor(2);
WriteLine(0, 0, Size.X, 1, B);
end { TDriveLine.Draw };
procedure TDriveLine.HandleEvent;
var
P: TPoint;
{ AK155 29.01.06 }
procedure BracketClick(T: TPanelNum);
var
TargetPanel: PView;
Manager: PDoubleWindow;
const
HideCommand: array[TPanelNum] of Word =
(cmHideLeft, cmHideRight);
begin
Manager := PDoubleWindow(Panel^.Owner);
{ …᫨ ¯ ¥«ì à ᯠåãâ , â® ®¯¥à æ¨ï ¯à¨¬¥ï¥âáï ª ¥©, ¥§ ¢¨á¨¬®
®â ⮣®, ¯à ¢ ï ¨«¨ «¥¢ ï ᪮¡ª ¡ë« ¦ â . ’ ª çâ® ¯®¤£®ï¥¬
T ª ¢ãâ॥¬ã ®¬¥àã ¤ ®© ¯ ¥«¨ }
if Manager^.PanelZoomed then
T := Manager^.Panel[pRight].AnyPanel^.GetState(sfSelected);
TargetPanel := Manager^.Panel[T].AnyPanel;
if (Event.Buttons and mbLeftButton <> 0) or
not TargetPanel^.GetState(sfVisible)
then { «¥¢ ï ª®¯ª ¬ëè¨ ¨«¨ ®¯¥à æ¨ï á® áªàë⮩ ¯ ¥«ìî:
áªàë⨥/¯®ª §, ª ª Ctrl-F1/F2}
Message(Owner, evCommand, HideCommand[T], nil)
else
begin { ¯à ¢ ï ª®¯ª ¬ëè¨: ªâ¨¢¨§ æ¨ï ¨
à ᯠ娢 ¨¥/¢®ááâ ®¢«¥¨¥ (ª ª Alt-Ctrl-Z) }
TargetPanel^.Select;
Message(TargetPanel^.Owner, evCommand, cmMaxi, nil);
end;
end;
procedure Scroll(D: Integer{+1 ¨«¨ -1});
begin
repeat
CharDelta := 1 + ((CharDelta+D-1+Length(DriveLine)) mod Length(DriveLine));
DrawView;
until not MouseEvent(Event, evMouseAuto);
end;
{ /AK155 }
begin { TDriveLine.HandleEvent }
inherited HandleEvent(Event);
case Event.What of
evBroadcast:
case Event.Command of
cmDropped:
if MouseInView(PCopyRec(Event.InfoPtr)^.Where) then
begin
Event.What := evNothing;
ClrIO;
MakeLocal(PCopyRec(Event.InfoPtr)^.Where, P);
if ViewLine[P.X+1] = ' ' then
{Dec(P.X);}
begin { ¬¥¦¤ã ¡ãª¢ ¬¨ - ¨£®à¨à㥬. â® «ãçè¥, 祬 ¯à®¬ åãâìáï }
ClearEvent(Event); Exit;
end;
case ViewLine[P.X+1] of
chTempDrive:
CopyDirName := cTEMP_;
{$IFDEF NetBrowser}
chNetDrive:
begin { ¯ ¥«ìªã á¥â¨ ¨ç¥£® ¥ ª®¯¨à㥬 }
ClearEvent(Event); Exit;
end;
{$ENDIF}
'A'..'Z':
CopyDirName := ViewLine[P.X+1]+':';
else {case}
Exit;
end {case};
SkipCopyDialog := Confirms and cfMouseConfirm = 0;
if ReflectCopyDirection
then
RevertBar := (Message(Desktop, evBroadcast,
cmIsRightPanel, Panel) <> nil)
else
RevertBar := False;
Message(PCopyRec(Event.InfoPtr)^.Owner,
evBroadcast, cmCopyCollection,
PCopyRec(Event.InfoPtr)^.FC);
SkipCopyDialog := False;
end;
end {case};
evMouseDown:
begin
ClrIO;
MakeLocal(Event.Where, P);
if ViewLine[P.X+1] = ' ' then
{Dec(P.X);}
begin { ¬¥¦¤ã ¡ãª¢ ¬¨ - ¨£®à¨à㥬. â® «ãçè¥, 祬 ¯à®¬ åãâìáï }
ClearEvent(Event); Exit;
end;
if Event.Double then
begin
case ViewLine[P.X+1] of
'A'..'Z':
Panel^.ChDir(ViewLine[P.X+1]+':\');
'}':
Scroll(+1); // ¡¥§ í⮣® ¡ëáâàë¥ ª«¨ª¨ ᪮¡ª¥ ¥ à ¡®â îâ
'{':
Scroll(-1); // «®£¨ç®
end {case};
end
else if ViewLine[P.X+1] = Panel^.DirectoryName[1]
then
Message(Panel, evCommand, cmRereadDir, @Panel^.DirectoryName)
else
case ViewLine[P.X+1] of
chTempDrive:
begin
FreeStr := cTEMP_;
Message(Panel, evCommand, cmChangeDrv, @FreeStr);
end;
{$IFDEF NetBrowser}
chNetDrive:
begin
FreeStr := cNET_;
Message(Panel, evCommand, cmChangeDrv, @FreeStr);
end;
{$ENDIF}
'A'..'Z':
begin
FreeStr := ViewLine[P.X+1]+':';
Message(Panel, evCommand, cmChangeDrv, @FreeStr);
end;
'[':
BracketClick(pLeft);
']':
BracketClick(pRight);
'}':
Scroll(+1);
'{':
Scroll(-1);
end {case};
ClearEvent(Event);
end;
end {case};
end { TDriveLine.HandleEvent };
procedure TDriveLine.Store(var S: TStream);
begin
inherited Store(S);
PutPeerViewPtr(S, Panel);
end;
procedure TDriveLine.Refresh;
var
newLogDrvMap: LongInt;
begin
newLogDrvMap := SysGetValidDrives;
if newLogDrvMap <> LogDrvMap then
begin
LogDrvMap := newLogDrvMap;
MakeDriveLine;
DrawView;
end;
end;
procedure TDriveLine.Update;
begin
if (FMSetup.Options and fmoAutorefreshDriveLine) <> 0 then
Refresh;
end;
procedure TDriveLine.ShiftLetter(d: Integer);
var
i, l: Integer;
begin
Refresh;
i := PosChar(Panel^.DriveLetter, DriveLine);
l := Length(DriveLine);
if i = 0 then
begin
if d < 0 then
i := PosChar(chTempDrive, DriveLine)
else
i := l;
end;
Panel^.DriveLetter := DriveLine[1 + (i + l - 1 + d) mod l];
end;
{ TFilePanel }
{----------------------------------------------------------------------------}
function TFilePanel.GetPalette;
const
S: String[Length(CPanel)] = CPanel;
begin
GetPalette := @S;
end;
var
Idx, CurPos, i, j: LongInt;
C, C1, C2, C3, C4, C5, C6, C7, C8, C9: Byte;
C2_3, C8_9: AWord;
B: array[0..300] of AWord;
B1: array[0..200] of record
C: Char;
A: Byte;
end absolute B;
procedure TFilePanel.DrawTop;
var
S: String;
I, J: Integer;
C: Word;
begin
Drive^.MakeTop(S);
I := 0;
C := GetColor($0206);
J := CStrLen(S);
while I < Size.X do
begin
MoveCStr(TAWordArray(B)[I], S, C);
Inc(I, J);
end;
end;
{-DataCompBoy-}
procedure TFilePanel.SetState;
procedure MakeChange;
var
Event: TEvent;
{A: Boolean;}
begin
CurrentDirectory := DirectoryName;
ClrIO;
NeedAbort := True;
lChDir(CurrentDirectory);
{A := Abort;}
DriveState := dsActive;
if IOResult <> 0 then
begin
DriveState := DriveState and dsInvalid;
Exit;
end;
DriveState := dsActive;
NeedAbort := DriveState and dsInvalid <> 0;
Message(CommandLine, evCommand, cmRereadInfo, nil);
{Cat:warn £¤¥-â® ¢ ¯à®¬¥¦ã⪥ ®â b4.09 ª b4.13 ¯à®¨§®è«¨ ª ª¨¥-â® ¨§¬¥¥¨ï,
᪮॥ ¢á¥£®, á¢ï§ ë¥ á ª®¬ ¤®© áâப®©, ¢ १ã«ìâ ⥠ª®â®àëå áâ «
¢ë«¥§ âì íâ®â ªã᮪. ‚¬¥á⥠á ⥬, ®áãé¥áâ¢«ï¥¬ë¥ §¤¥áì ¤¥©áâ¢¨ï ¬®©
¢§£«ï¤ ¤®áâ â®ç® ¡¥§ã¬ë, â ª çâ® § ª®¬¬¥â¨à®¢ « ¨å}
(*
if (UpStrg(ActiveDir) <> UpStrg(DirectoryName)) or A then
begin
Drive^.lChDir(ActiveDir);
ReadDirectory;
CurrentDirectory := DirectoryName;
Event.What := evKeyDown;
Event.KeyCode := kbTab;
Event.InfoPtr := nil;
PutEvent(Event);
end;
*)
Message(Owner, evCommand, cmChangeTree, @DirectoryName);
end { MakeChange };
var
DoDraw: Boolean;
begin { TFilePanel.SetState }
inherited SetState(AState, Enable);
{ AK155 ®¤¢ « ¨ áâப㠤¨áª®¢ ¤® ¯àïâ âì á¨åà®® á ¯ ¥«ìî.
ìè¥ í⨬ § ¨¬ «áï HideView }
if (AState and sfVisible) <> 0 then
begin
if (InfoView <> nil) then
InfoView^.SetState(sfVisible, Enable);
if DriveLine <> nil then
DriveLine^.SetState(sfVisible,
Enable and (FMSetup.Show and fmsDriveLine <> 0));
end;
{/AK155 3-02-2004, 23-05-2005}
DoDraw := False;
if QuickSearch and (AState and
(sfFocused+sfActive+sfVisible+sfSelected) <> 0) and not Enable
then
begin
DoDraw := True;
StopQuickSearch;
end;
if (AState and sfActive <> 0) then
if not Enable then
begin
DisableCommands(PanelCommands);
if not GetState(sfActive+sfSelected) and
(ScrollBar <> nil) and ScrollBar^.GetState(sfVisible)
then
ScrollBar^.Hide;
DoDraw := True;
end
else
EnableCommands(PanelCommands);
if (AState and sfSelected <> 0) and Enable then
begin
ActivePanel := @Self;
if Owner <> nil then { nil ¡ë¢ ¥â ¢® ¢à¥¬ï Load }
PassivePanel := OtherFilePanel(@Self);
end;
if (AState and sfFocused and State <> 0) then
if Enable then
begin
DoDraw := True;
if ScrollBar <> nil then
begin
ScrollBar^.Show;
ScrollBar^.Options := ScrollBar^.Options or ofPostProcess;
end;
if InfoView <> nil then
InfoView^.DrawView;
if DirView <> nil then
DirView^.DrawView;
if (Drive^.DriveType = dtDisk) then
begin
AddToDirectoryHistory(DirectoryName, Integer(dtDisk));
if UpStrg(CurrentDirectory) <> UpStrg(DirectoryName)
then
MakeChange;
end
else if Drive^.DriveType = dtArc
then
Drive^.lChDir(#0);
EnableCommands(PanelCommands);
end;
if GetState(sfFocused) then
begin
if AState and sfFocused <> 0 then
DrawView;
EnableCommands(PanelCommands);
if (ScrollBar <> nil) and not ScrollBar^.GetState(sfVisible) then
begin
ScrollBar^.Show;
ScrollBar^.Options := ScrollBar^.Options or ofPostProcess;
end;
end;
if AState and (sfSelected+sfActive) <> 0 then
if GetState(sfSelected+sfActive) then
begin
if (Drive^.DriveType = dtDisk)
then
MakeChange
else if Drive^.DriveType = dtArc
then
Drive^.lChDir(#0);
DoDraw := True;
EnableCommands(PanelCommands)
end
else
begin
if ScrollBar <> nil then
begin
ScrollBar^.Hide;
ScrollBar^.Options := ScrollBar^.Options and (not ofPostProcess);
end;
DoDraw := True;
if InfoView <> nil then
InfoView^.DrawView;
if DirView <> nil then
DirView^.DrawView;
end;
if DoDraw then
begin
PosChanged := False;
DrawView;
end;
if GetState(sfFocused) then
SetTitle(DirectoryName);
end { TFilePanel.SetState };
{-DataCompBoy-}
{-DataCompBoy-}
procedure TFilePanel.Draw;
label 1;
var
P: PFileRec;
CW: AWord;
CS: AWord;
PgS: AWord;
S, S1: String;
HLC: array[0..ttUpDir] of Byte; {JO, AK155}
PB: ^Byte;
TagC: Char;
procedure DrawAtIdx;
var
P: PFileRec;
CC: Byte;
JJ: LongInt;
CursorPos: Integer;
S: String;
RLimit: Integer;
label Scroll;
begin
JJ := j*LineLength;
if (Files <> nil) and (Idx < Files^.Count) then
begin
P := Files^.At(Idx);
CC := HLC[P^.TType];
if (Idx = CurPos) then
begin
LastCurPos.X := JJ;
LastCurPos.Y := i+1
end;
if Idx = CurPos then
if P^.Selected then
begin
C := C5;
CC := C5
end
else
C := C4
else if P^.Selected then
begin
C := CC;
CC := C3
end
else
C := CC;
MoveChar(B[JJ], ' ', C, LineLength);
if (Idx = CurPos) and GetState(sfFocused) then
begin
Drive^.GetFull(B[JJ], P, C shl 8+C, Cs and $00FF+C shl 8);
end
else
Drive^.GetFull(B[JJ], P, CC shl 8+C, Cs);
if QuickSearch and (Idx = CurPos) then
begin
if LFNLonger250 then
Inc(JJ, CalcLengthWithoutName);
if (QSLastSuccessPos > flnNLength) then {ªãàá®à ¢ ¯®«¥ à áè¨à¥¨ï }
begin
CursorPos := flnDotPos + QSLastSuccessPos - flnNLength - 2;
if CursorPos >= LFNLen - Byte(flnPanelName[LFNLen] = #16) then
goto Scroll; { ªãàá®à ãèñ« ¢¯à ¢® § £à ¨æã }
end
else if QSLastSuccessPos <= flnNSize then {ªãàá®à ¢ ¯®«¥ ¨¬¥¨ }
CursorPos := QSLastSuccessPos - 1
else { ªãàá®à § ¯à¥¤¥« ¬¨ ¨¬¥¨ }
Scroll:
begin
{‘¨¬¢®«, ª®â®à®¬ ¤®«¦¥ ¡ëâì ªãàá®à, ¥ ¢¨¤¥.
‚뢮¤¨¬ ¨¬ï § ®¢® ¡¥§ â ¡ã«ï樨 ¨ á ®¡à¥§ª®©, ¥á«¨ ¤®.
…᫨ ®¡à¥§ª á¯à ¢ ¥áâì, â® ªãàá®à ¯®¬¥é ¥¬ ¥ ¯à ¢¥¥
¯®á«¥¤¥£® ᨬ¢®« ¯¥à¥¤ ®¡à¥§ª®©. …᫨ ®¡à¥§ª¨ á¯à ¢ ¥â,
â® ªãàá®à ®â¯ã᪠¥¬ ¢¯à ¢® ¦ ¤® «¨¨¨ § ª®«®ª®©. }
S := P^.FlName[uLFN];
RLimit := Max(-1, QSLastSuccessPos - Length(S));
{à ¢ë© ¯à¥¤¥« ¯®§¨æ¨¨ ªãàá®à ®â®á¨â¥«ì® LFNLen;
¬¥ï¥âáï ®â -1 ¤® +1 }
if QSLastSuccessPos > LFNLen then
begin
System.Delete(S, 2, QSLastSuccessPos - LFNLen - RLimit);
S[1] := #17;
CursorPos := LFNLen - 1 + RLimit;
end
else
CursorPos := QSLastSuccessPos-1;
S := FormatLongName(S, LFNLen, 0,
flnPadRight or flnHandleTildes, nfmNull);
MoveCStr(B[JJ], S, C);
end;
SetCursor(JJ+CursorPos, i);
ShowCursor;
NormalCursor
end;
end
else
begin
MoveChar(B[JJ], ' ', C1, LineLength);
GetEmpty(B[JJ], Cs, False);
end;
end { DrawAtIdx };
var
ColumnTitles: Boolean;
begin { TFilePanel.Draw }
if DrawDisableLvl > 0 then
Exit;
if DrawDisableLvl < 0 then
DrawDisableLvl := 0;
if Loaded then
RereadDir;
LineLength := CalcLength;
if (DriveState and dsInvalid > 0) then
begin
C1 := GetColor(1); { Normal }
for i := 0 to pred(Owner^.Size.Y) do
begin
MoveChar(B, ' ', C1, Size.X);
WriteLine(0, i, Owner^.Size.X, 1, B[0]);
end;
Exit;
end;
if Size.X > LineLength-1 then
DeltaX := 0;
if UpStrg(OldDirectory) <> UpStrg(DirectoryName) then
begin
if (UpStrg(OldDirectory[1]) <> UpStrg(DirectoryName[1]))
and (OldDirectory <> '')
then
ScrollBar^.SetValue(0);
PosChanged := False;
DecDrawDisabled;
OldDirectory := DirectoryName;
end;
C1 := GetColor(1); { Normal }
C2 := GetColor(2); { Separator }
C3 := GetColor(3); { Selected }
C4 := C1;
C5 := C3;
HLC[0] := C1;
HLC[ttUpDir] := C1;
if FMSetup.TagChar[1] <> ' ' then
TagC := FMSetup.TagChar[1]
else
TagC := #251;
if Startup.FMSetup.Show and fmsHiliteFiles <> 0 then
for i := 1 to ttCust10 do
HLC[i] := GetColor(6+i) {JO}
else
for i := 1 to ttCust10 do
HLC[i] := C1; {JO}
CS := 179+C2 shl 8;
CW := 32+C2 shl 8;
ColumnTitles := (Pansetup^.Show.MiscOptions and 2) <> 0;
PgS := (Size.Y-Byte(ColumnTitles))
*((Size.X+1) div LineLength);
if PgS = 0 then
PgS := (Size.Y-Byte(ColumnTitles));
ScrollBar^.PgStep := PgS;
if Delta < 0 then
Delta := 0;
if (Files <> nil {¡ë¢ ¥â, ¯à¨¬¥à, ¯à¨ ¢å®¤¥ ¢ ¡¨âë© zip- à娢} )
and (Files^.Count > 0)
then
begin
CurPos := ScrollBar^.Value;
if CurPos < Delta then
Delta := CurPos;
if CurPos >= Delta+PgS then
Delta := CurPos-PgS+1;
end
else
CurPos := -1;
if GetState(sfFocused) then
begin
C4 := GetColor(4); { Normal cursor }
C5 := GetColor(5); { Selected cursor }
end
else if CurPos >= 0 then
begin
P := Files^.At(CurPos);
if Startup.FMSetup.Show and fmsHiliteFiles <> 0 then
C4 := HLC[P^.TType];
end;
if not QuickSearch then
HideCursor;
if PosChanged and (OldDelta = Delta) then
begin
if CurPos <> OldPos then
begin
for i := Byte(ColumnTitles) to Size.Y-1
do
for j := 0 to Size.X div LineLength do
begin
Idx := i-Byte(ColumnTitles)+
j*(Size.Y-Byte(ColumnTitles))+Delta;
if (Idx = CurPos) or (Idx = OldPos) then
begin
MoveChar(B, ' ', C1, Size.X);
DrawAtIdx;
Idx := (j+1)*LineLength;
if Idx < Size.X then
B[Idx-1] := CS
else
B[Idx-1] := CW;
Idx := j*LineLength;
WriteLine(Idx, i, LineLength-1, 1, B[Idx+DeltaX]);
end;
end;
end
else
goto 1;
PosChanged := False;
OldDelta := Delta;
OldPos := CurPos;
Exit;
end;
1:
OldDelta := Delta;
OldPos := CurPos;
PosChanged := False;
if ColumnTitles then
begin
DrawTop(B);
if WordRec(B[Size.X-1]).Lo = 179 then
WordRec(B[Size.X-1]).Lo := 32;
WriteLine(0, 0, Size.X, 1, B[DeltaX]);
end;
for i := Byte(ColumnTitles) to Size.Y-1 do
begin
MoveChar(B, ' ', C1, Size.X);
for j := 0 to Size.X div LineLength do
begin
Idx := i-Byte(ColumnTitles)+
j*(Size.Y-Byte(ColumnTitles))+Delta;
DrawAtIdx;
Idx := (j+1)*LineLength;
if Idx < Size.X then
B[Idx-1] := CS
else
B[Idx-1] := CW;
end;
WriteLine(0, i, Size.X, 1, B[DeltaX]);
end;
if GetState(sfFocused) then
SetTitle(DirectoryName);
end { TFilePanel.Draw };
{-DataCompBoy-}
{ TInfoView }
{----------------------------------------------------------------------------}
constructor TInfoView.Init;
begin
inherited Init(R);
EventMask := evMouse;
end;
constructor TInfoView.Load;
begin
inherited Load(S);
GetPeerViewPtr(S, Panel);
end;
procedure TInfoView.Store;
begin
inherited Store(S);
PutPeerViewPtr(S, Panel);
end;
procedure TInfoView.HandleEvent;
var
P: TPoint;
Y: Integer;
Mover: PView;
S: String;
FC: PFilesCollection;
C: TCopyRec;
procedure CE;
begin
ClearEvent(Event)
end;
procedure DragCurrent;
begin
with Panel^ do
begin
S := Cut(PFileRec(Files^.At(ScrollBar^.Value))^.FlName[uLfn], 20);
{DataCompBoy}
if S = '..' then
Exit;
end;
New(FC, Init(1, 100));
FC^.Insert(CopyFileRec(Panel^.Files^.At(Panel^.ScrollBar^.Value)));
if P.X < Length(S) then
Dec(P.X);
MakeGlobal(P, P);
DragMover(@P, S, FC, @C);
CE;
end;
procedure DragSelected;
var
I: LongInt;
PF: PFileRec; {DataCompBoy}
begin
if Panel^.SelNum = 0 then
Exit;
New(FC, Init(Panel^.SelNum, 100));
for I := 1 to Panel^.Files^.Count do
begin
PF := Panel^.Files^.At(I-1); {DataCompBoy}
if PF^.Selected then
FC^.Insert(CopyFileRec(PF)); {DataCompBoy}
end;
MakeGlobal(P, P);
DragMover(@P, ItoS(Panel^.SelNum)+GetString(dlSelectedFiles), FC, @C);
CE;
end;
procedure DragTotals;
var
N, I, Start: LongInt;
begin