FIX: Make FlatView independent between tabs

This commit is contained in:
Alexander Koblov 2014-04-03 16:40:44 +00:00
commit 4562b6949e
9 changed files with 23 additions and 34 deletions

View file

@ -65,7 +65,7 @@ var
begin
FFiles.Clear;
if FileSource.FlatView then
if FFlatView then
begin
FlatView(Path);
Exit;

View file

@ -36,9 +36,6 @@ type
function GetClassName: String;
function GetRefCount: Integer;
function GetFlatView: Boolean;
procedure SetFlatView(AValue: Boolean);
function GetCurrentAddress: String;
function GetCurrentWorkingDirectory: String;
function SetCurrentWorkingDirectory(NewDir: String): Boolean;
@ -103,7 +100,6 @@ type
property URI: TURI read GetURI;
property ClassName: String read GetClassName;
property CurrentAddress: String read GetCurrentAddress;
property FlatView: Boolean read GetFlatView write SetFlatView;
property ParentFileSource: IFileSource read GetParentFileSource write SetParentFileSource;
property Properties: TFileSourceProperties read GetProperties;
property SupportedFileProperties: TFilePropertiesTypes read GetSupportedFileProperties;
@ -115,7 +111,6 @@ type
TFileSource = class(TInterfacedObject, IFileSource)
private
FFlatView: Boolean;
FReloadEventListeners: TMethodList;
{en
File source on which this file source is dependent on
@ -129,8 +124,6 @@ type
}
procedure OperationFinishedCallback(Operation: TFileSourceOperation;
State: TFileSourceOperationState);
function GetFlatView: Boolean;
procedure SetFlatView(AValue: Boolean);
protected
FURI: TURI;
@ -289,7 +282,6 @@ type
procedure RemoveReloadEventListener(FunctionToCall: TFileSourceReloadEventNotify);
property CurrentAddress: String read GetCurrentAddress;
property FlatView: Boolean read GetFlatView write SetFlatView;
property ParentFileSource: IFileSource read GetParentFileSource write SetParentFileSource;
property Properties: TFileSourceProperties read GetProperties;
property SupportedFileProperties: TFilePropertiesTypes read GetSupportedFileProperties;
@ -747,16 +739,6 @@ begin
end;
end;
function TFileSource.GetFlatView: Boolean;
begin
Result:= FFlatView;
end;
procedure TFileSource.SetFlatView(AValue: Boolean);
begin
FFlatView:= AValue;
end;
procedure TFileSource.OperationFinished(Operation: TFileSourceOperation);
begin
// Nothing by default.

View file

@ -23,6 +23,7 @@ type
protected
FFiles: TFiles;
FFlatView: Boolean;
function GetFiles: TFiles;
function GetID: TFileSourceOperationType; override;
@ -43,6 +44,7 @@ type
property Files: TFiles read GetFiles;
property Path: String read FPath;
property FlatView: Boolean write FFlatView;
end;

View file

@ -186,6 +186,7 @@ type
procedure WatcherEvent(const EventData: TFSWatcherEventData);
protected
FFlatView: Boolean;
FFileFilter: String;
FAllDisplayFiles: TDisplayFiles; //<en List of all files that can be displayed
FFiles: TDisplayFiles; //<en List of displayed files (filtered)
@ -468,6 +469,7 @@ type
property FileSources[Index: Integer]: IFileSource read GetFileSource;
property FileSourcesCount: Integer read GetFileSourcesCount;
property Flags: TFileViewFlags read FFlags write SetFlags;
property FlatView: Boolean read FFlatView write FFlatView;
property Path[FileSourceIndex, PathIndex: Integer]: UTF8String read GetPath;
property PathsCount[FileSourceIndex: Integer]: Integer read GetPathsCount;
@ -707,6 +709,7 @@ begin
if Assigned(AFileView) then
begin
AFileView.FFlags := FFlags;
AFileView.FFlatView := FFlatView;
AFileView.FLastLoadedFileSource := FLastLoadedFileSource;
AFileView.FLastLoadedPath := FLastLoadedPath;
AFileView.FLastMark := FLastMark;
@ -1432,6 +1435,7 @@ procedure TFileView.SetCurrentPath(NewPath: String);
begin
if (NewPath <> CurrentPath) and BeforeChangePath(FileSource, NewPath) then
begin
FFlatView:= False;
EnableWatcher(False);
FHistory.AddPath(NewPath); // Sets CurrentPath.
AfterChangePath;
@ -1439,7 +1443,6 @@ begin
{$IFDEF DEBUG_HISTORY}
FHistory.DebugShow;
{$ENDIF}
FileSource.FlatView:= False;
end;
end;
@ -1839,6 +1842,7 @@ begin
FilterOptions,
CurrentPath,
SortingForSorter,
FlatView,
AThread,
FilePropertiesNeeded,
@SetFileList,

View file

@ -643,7 +643,7 @@ begin
AFileName:= AFileName + #32#32 + FormatFileFunction('DC().GETFILEATTR{}', AFile, FileSource);
lblDetails.Caption:= AFileName;
// Get file name
if not FileSource.FlatView then
if not FlatView then
begin
AFileName:= FormatFileFunction('DC().GETFILENAMENOEXT{}', AFile, FileSource);
lblInfo.Caption:= FitFileName(AFileName, lblInfo.Canvas, AFile, lblInfo.ClientWidth);

View file

@ -229,7 +229,7 @@ begin
FSelectedCount := FilesSelected + FolderSelected;
if FileSource.FlatView and (FSelectedCount = 0) then
if FlatView and (FSelectedCount = 0) then
UpdateFlatFileName
else
lblInfo.Caption := Format(rsMsgSelectedInfo,

View file

@ -91,6 +91,7 @@ type
FFileFilter: String;
FFilterOptions: TQuickSearchOptions;
FCurrentPath: String;
FFlatView: Boolean;
FSortings: TFileSortings;
FFilePropertiesNeeded: TFilePropertiesTypes;
@ -123,6 +124,7 @@ type
const AFilterOptions: TQuickSearchOptions;
const ACurrentPath: String;
const ASorting: TFileSortings;
AFlatView: Boolean;
AThread: TThread;
AFilePropertiesNeeded: TFilePropertiesTypes;
ASetFileListMethod: TSetFileListMethod;
@ -348,16 +350,13 @@ end;
{ TFileListBuilder }
constructor TFileListBuilder.Create(AFileSource: IFileSource;
AFileSourceIndex: Integer;
const AFileFilter: String;
const AFilterOptions: TQuickSearchOptions;
const ACurrentPath: String;
const ASorting: TFileSortings;
AThread: TThread;
AFilePropertiesNeeded: TFilePropertiesTypes;
ASetFileListMethod: TSetFileListMethod;
var ExistingDisplayFiles: TDisplayFiles;
var ExistingDisplayFilesHashed: TStringHashList);
AFileSourceIndex: Integer; const AFileFilter: String;
const AFilterOptions: TQuickSearchOptions; const ACurrentPath: String;
const ASorting: TFileSortings; AFlatView: Boolean; AThread: TThread;
AFilePropertiesNeeded: TFilePropertiesTypes;
ASetFileListMethod: TSetFileListMethod;
var ExistingDisplayFiles: TDisplayFiles;
var ExistingDisplayFilesHashed: TStringHashList);
begin
inherited Create(AThread);
@ -372,6 +371,7 @@ begin
FFileSource := AFileSource;
FFileSourceIndex := AFileSourceIndex;
FFlatView := AFlatView;
FFileFilter := AFileFilter;
FFilterOptions := AFilterOptions;
FCurrentPath := ACurrentPath;
@ -424,6 +424,7 @@ begin
if Assigned(FListOperation) then
try
FListOperation.FlatView := FFlatView;
FListOperation.AssignThread(Thread);
FListOperation.Execute;
if FListOperation.Result = fsorFinished then

View file

@ -228,7 +228,7 @@ begin
if Assigned(OnChangeActiveFile) then
OnChangeActiveFile(Self, FFiles[NewFileIndex].FSFile);
end;
if FileSource.FlatView and (FSelectedCount = 0) then UpdateFlatFileName;
if FlatView and (FSelectedCount = 0) then UpdateFlatFileName;
end;
end;

View file

@ -770,7 +770,7 @@ begin
if not (fspListFlatView in FileSource.GetProperties) then
msgWarning(rsMsgErrNotSupported)
else begin
FileSource.FlatView:= not FileSource.FlatView;
FlatView:= not FlatView;
Reload;
end;
end;