ADD: Option that specifies where to put updated files in the file list, similar as the option for new files.

This commit is contained in:
cobines 2012-03-17 20:44:58 +00:00
commit d3bd4b6fc4
6 changed files with 109 additions and 37 deletions

View file

@ -9,7 +9,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 166
Height = 200
Top = 6
Width = 622
Anchors = [akTop, akLeft, akRight]
@ -21,7 +21,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 12
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 144
ClientHeight = 178
ClientWidth = 618
TabOrder = 0
object lblSortMethod: TLabel
@ -29,7 +29,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
Left = 12
Height = 22
Top = 8
Width = 127
Width = 130
Caption = 'Sort &method:'
ParentColor = False
end
@ -40,10 +40,10 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = gbSorting
AnchorSideRight.Side = asrBottom
Left = 149
Left = 152
Height = 29
Top = 5
Width = 457
Width = 454
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
ItemHeight = 21
@ -58,7 +58,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
Left = 12
Height = 22
Top = 42
Width = 127
Width = 130
Caption = 'Case sensitivity:'
ParentColor = False
end
@ -69,10 +69,10 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = gbSorting
AnchorSideRight.Side = asrBottom
Left = 149
Left = 152
Height = 29
Top = 39
Width = 457
Width = 454
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
ItemHeight = 21
@ -88,7 +88,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
Left = 12
Height = 22
Top = 76
Width = 127
Width = 130
Caption = 'Sorting directories:'
ParentColor = False
end
@ -99,10 +99,10 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = gbSorting
AnchorSideRight.Side = asrBottom
Left = 149
Left = 152
Height = 29
Top = 73
Width = 457
Width = 454
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
ItemHeight = 21
@ -118,7 +118,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
Left = 12
Height = 22
Top = 110
Width = 127
Width = 130
Caption = 'Insert new files'
ParentColor = False
end
@ -129,16 +129,41 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = gbSorting
AnchorSideRight.Side = asrBottom
Left = 149
Left = 152
Height = 29
Top = 107
Width = 457
Width = 454
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
ItemHeight = 21
Style = csDropDownList
TabOrder = 3
end
object lblUpdatedFilesPosition: TLabel
Left = 12
Height = 22
Top = 144
Width = 130
Caption = 'Move updated files'
ParentColor = False
end
object cbUpdatedFilesPosition: TComboBox
AnchorSideLeft.Control = lblUpdatedFilesPosition
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblUpdatedFilesPosition
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = gbSorting
AnchorSideRight.Side = asrBottom
Left = 152
Height = 29
Top = 141
Width = 454
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
ItemHeight = 21
Style = csDropDownList
TabOrder = 4
end
end
object gbMisc: TGroupBox[1]
AnchorSideLeft.Control = Owner
@ -148,7 +173,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
AnchorSideRight.Side = asrBottom
Left = 6
Height = 216
Top = 283
Top = 317
Width = 622
Anchors = [akTop, akLeft, akRight]
AutoSize = True
@ -218,7 +243,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
AnchorSideRight.Side = asrBottom
Left = 6
Height = 99
Top = 178
Top = 212
Width = 622
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6

View file

@ -3,6 +3,7 @@ TFRMOPTIONSFILESVIEWS.LBLSORTMETHOD.CAPTION=Sort &method:
TFRMOPTIONSFILESVIEWS.LBLCASESENSITIVITY.CAPTION=Case sensitivity:
TFRMOPTIONSFILESVIEWS.LBLSORTFOLDERMODE.CAPTION=Sorting directories:
TFRMOPTIONSFILESVIEWS.LBLNEWFILESPOSITION.CAPTION=Insert new files
TFRMOPTIONSFILESVIEWS.LBLUPDATEDFILESPOSITION.CAPTION=Move updated files
TFRMOPTIONSFILESVIEWS.CBSPACEMOVESDOWN.CAPTION=When selecting files with <SPACEBAR>, move down to next file (as with <INSERT>)
TFRMOPTIONSFILESVIEWS.CBDIRBRACKETS.CAPTION=Show square brackets around directories
TFRMOPTIONSFILESVIEWS.CBSHOWSYSTEMFILES.CAPTION=Show system and hidden files

View file

@ -40,6 +40,7 @@ type
cbListFilesInThread: TCheckBox;
cbLoadIconsSeparately: TCheckBox;
cbDelayLoadingTabs: TCheckBox;
cbUpdatedFilesPosition: TComboBox;
cbShortFileSizeFormat: TCheckBox;
cbShowSystemFiles: TCheckBox;
cbNewFilesPosition: TComboBox;
@ -50,6 +51,7 @@ type
gbFormatting: TGroupBox;
gbSorting: TGroupBox;
gbMisc: TGroupBox;
lblUpdatedFilesPosition: TLabel;
lblSortFolderMode: TLabel;
lblCaseSensitivity: TLabel;
lblDateTimeExample: TLabel;
@ -86,6 +88,7 @@ begin
ParseLineToList(rsOptSortCaseSens, cbCaseSensitivity.Items);
ParseLineToList(rsOptSortFolderMode, cbSortFolderMode.Items);
ParseLineToList(rsOptNewFilesPosition, cbNewFilesPosition.Items);
ParseLineToList(rsOptUpdatedFilesPosition, cbUpdatedFilesPosition.Items);
end;
procedure TfrmOptionsFilesViews.Load;
@ -110,6 +113,11 @@ begin
nfpSortedPosition: cbNewFilesPosition.ItemIndex := 2;
nfpBottom: cbNewFilesPosition.ItemIndex := 3;
end;
case gUpdatedFilesPosition of
ufpNoChange: cbUpdatedFilesPosition.ItemIndex := 0;
ufpSameAsNewFiles: cbUpdatedFilesPosition.ItemIndex := 1;
ufpSortedPosition: cbUpdatedFilesPosition.ItemIndex := 2;
end;
cbShortFileSizeFormat.Checked :=gShortFileSizeFormat;
cbDateTimeFormat.Text := gDateTimeFormat;
lblDateTimeExample.Caption:= FormatDateTime(cbDateTimeFormat.Text, Now);
@ -140,6 +148,11 @@ begin
2: gNewFilesPosition := nfpSortedPosition;
3: gNewFilesPosition := nfpBottom;
end;
case cbUpdatedFilesPosition.ItemIndex of
0: gUpdatedFilesPosition := ufpNoChange;
1: gUpdatedFilesPosition := ufpSameAsNewFiles;
2: gUpdatedFilesPosition := ufpSortedPosition;
end;
gShortFileSizeFormat := cbShortFileSizeFormat.Checked;
gDateTimeFormat := cbDateTimeFormat.Text;
gSpaceMovesDown := cbSpaceMovesDown.Checked;

View file

@ -112,7 +112,7 @@ type
FOnActivate : TOnActivate;
FOnFileListChanged : TOnFileListChanged;
procedure AddFile(const FileName, APath: String; NewFilesPosition: TNewFilesPosition);
procedure AddFile(const FileName, APath: String; NewFilesPosition: TNewFilesPosition; UpdatedFilesPosition: TUpdatedFilesPosition);
procedure AddEventToPendingFilesChanges(const EventData: TFSWatcherEventData);
procedure ApplyPendingFilesChanges;
procedure ClearPendingFilesChanges;
@ -140,11 +140,11 @@ type
procedure Notify(NewNotifications: TFileViewNotifications);
procedure RemoveFile(ADisplayFile: TDisplayFile);
procedure RemoveFile(const FileName: String);
procedure RenameFile(const NewFileName, OldFileName, APath: String; NewFilesPosition: TNewFilesPosition);
procedure RenameFile(const NewFileName, OldFileName, APath: String; NewFilesPosition: TNewFilesPosition; UpdatedFilesPosition: TUpdatedFilesPosition);
procedure Request(NewRequests: TFileViewRequests);
procedure ResortFile(ADisplayFile: TDisplayFile; AFileList: TDisplayFiles);
procedure SetFlags(AValue: TFileViewFlags);
procedure UpdateFile(const FileName, APath: String; NewFilesPosition: TNewFilesPosition);
procedure UpdateFile(const FileName, APath: String; NewFilesPosition: TNewFilesPosition; UpdatedFilesPosition: TUpdatedFilesPosition);
procedure UpdatePath(UpdateAddressToo: Boolean);
{en
Assigns the built lists to the file view and displays new the file list.
@ -156,7 +156,9 @@ type
procedure ActivateEvent(Sender: TObject);
function CheckIfDelayReload: Boolean;
procedure DoReload;
procedure HandleFSWatcherEvent(const EventData: TFSWatcherEventData; NewFilesPosition: TNewFilesPosition);
procedure HandleFSWatcherEvent(const EventData: TFSWatcherEventData;
NewFilesPosition: TNewFilesPosition;
UpdatedFilesPosition: TUpdatedFilesPosition);
procedure ReloadEvent(const aFileSource: IFileSource; const ReloadedPaths: TPathsArray);
procedure ReloadTimerEvent(Sender: TObject);
procedure WatcherEvent(const EventData: TFSWatcherEventData);
@ -713,7 +715,7 @@ begin
pEvent := PFSWatcherEventData(FPendingFilesChanges[i]);
// Insert new files at sorted position since the filelist hasn't been
// shown to the user yet, so no need to use user setting.
HandleFSWatcherEvent(pEvent^, nfpSortedPosition);
HandleFSWatcherEvent(pEvent^, nfpSortedPosition, ufpSortedPosition);
end;
end;
ClearPendingFilesChanges;
@ -752,7 +754,7 @@ begin
Result := nil;
end;
procedure TFileView.AddFile(const FileName, APath: String; NewFilesPosition: TNewFilesPosition);
procedure TFileView.AddFile(const FileName, APath: String; NewFilesPosition: TNewFilesPosition; UpdatedFilesPosition: TUpdatedFilesPosition);
var
ADisplayFile: TDisplayFile;
AFile: TFile;
@ -785,7 +787,7 @@ begin
Notify([fvnFileSourceFileListChanged]);
end
else
UpdateFile(FileName, APath, NewFilesPosition);
UpdateFile(FileName, APath, NewFilesPosition, UpdatedFilesPosition);
end;
procedure TFileView.RemoveFile(const FileName: String);
@ -808,7 +810,7 @@ begin
Notify([fvnFileSourceFileListChanged, fvnDisplayFileListChanged]);
end;
procedure TFileView.RenameFile(const NewFileName, OldFileName, APath: String; NewFilesPosition: TNewFilesPosition);
procedure TFileView.RenameFile(const NewFileName, OldFileName, APath: String; NewFilesPosition: TNewFilesPosition; UpdatedFilesPosition: TUpdatedFilesPosition);
var
ADisplayFile: TDisplayFile;
OldIndex, NewIndex, FilteredFilesIndex: Integer;
@ -844,15 +846,15 @@ begin
else
begin
RemoveFile(ADisplayFile);
UpdateFile(NewFileName, APath, NewFilesPosition);
UpdateFile(NewFileName, APath, NewFilesPosition, UpdatedFilesPosition);
end;
end
else
begin
if NewIndex < 0 then
AddFile(NewFileName, APath, NewFilesPosition)
AddFile(NewFileName, APath, NewFilesPosition, UpdatedFilesPosition)
else
UpdateFile(NewFileName, APath, NewFilesPosition);
UpdateFile(NewFileName, APath, NewFilesPosition, UpdatedFilesPosition);
end;
end;
@ -872,11 +874,18 @@ begin
TDisplayFileSorter.ResortSingle(I, AFileList, SortingForSorter);
end;
procedure TFileView.UpdateFile(const FileName, APath: String; NewFilesPosition: TNewFilesPosition);
procedure TFileView.UpdateFile(const FileName, APath: String; NewFilesPosition: TNewFilesPosition; UpdatedFilesPosition: TUpdatedFilesPosition);
var
AFile: TFile;
ADisplayFile: TDisplayFile;
I: Integer;
procedure Resort;
begin
ResortFile(ADisplayFile, FAllDisplayFiles);
ResortFile(ADisplayFile, FFiles);
end;
begin
I := FHashedNames.Find(FileName);
if I >= 0 then
@ -898,12 +907,30 @@ begin
end;
end;
ADisplayFile.DisplayStrings.Clear;
ResortFile(ADisplayFile, FAllDisplayFiles);
ResortFile(ADisplayFile, FFiles);
case UpdatedFilesPosition of
ufpNoChange: ; // Do nothing
ufpSameAsNewFiles:
if NewFilesPosition = nfpSortedPosition then
Resort
else
begin
FAllDisplayFiles.OwnsObjects := False;
FAllDisplayFiles.Remove(ADisplayFile); // Remove only temporarily
FAllDisplayFiles.OwnsObjects := True;
InsertFile(ADisplayFile, FAllDisplayFiles, NewFilesPosition);
FFiles.Remove(ADisplayFile);
InsertFile(ADisplayFile, FFiles, NewFilesPosition);
end;
ufpSortedPosition:
Resort;
else
raise Exception.Create('Unsupported UpdatedFilesPosition setting.');
end;
Notify([fvnFileSourceFileListChanged, fvnDisplayFileListChanged]);
end
else
AddFile(FileName, APath, NewFilesPosition);
AddFile(FileName, APath, NewFilesPosition, UpdatedFilesPosition);
end;
procedure TFileView.UpdatePath(UpdateAddressToo: Boolean);
@ -2145,17 +2172,17 @@ begin
MakeFileSourceFileList;
end;
procedure TFileView.HandleFSWatcherEvent(const EventData: TFSWatcherEventData; NewFilesPosition: TNewFilesPosition);
procedure TFileView.HandleFSWatcherEvent(const EventData: TFSWatcherEventData; NewFilesPosition: TNewFilesPosition; UpdatedFilesPosition: TUpdatedFilesPosition);
begin
case EventData.EventType of
fswFileCreated:
Self.AddFile(EventData.FileName, EventData.Path, NewFilesPosition);
Self.AddFile(EventData.FileName, EventData.Path, NewFilesPosition, UpdatedFilesPosition);
fswFileChanged:
Self.UpdateFile(EventData.FileName, EventData.Path, NewFilesPosition);
Self.UpdateFile(EventData.FileName, EventData.Path, NewFilesPosition, UpdatedFilesPosition);
fswFileDeleted:
Self.RemoveFile(EventData.FileName);
fswFileRenamed:
Self.RenameFile(EventData.NewFileName, EventData.FileName, EventData.Path, NewFilesPosition);
Self.RenameFile(EventData.NewFileName, EventData.FileName, EventData.Path, NewFilesPosition, UpdatedFilesPosition);
else
Reload(EventData.Path);
end;
@ -2190,7 +2217,7 @@ begin
else
begin
if FileListLoaded then
HandleFSWatcherEvent(EventData, gNewFilesPosition)
HandleFSWatcherEvent(EventData, gNewFilesPosition, gUpdatedFilesPosition)
else
Reload(EventData.Path);
end;

View file

@ -54,6 +54,7 @@ type
TSortFolderMode = (sfmSortNameShowFirst, sfmSortLikeFileShowFirst, sfmSortLikeFile);
{ Where to insert new files in the filelist }
TNewFilesPosition = (nfpTop, nfpTopAfterDirectories, nfpSortedPosition, nfpBottom);
TUpdatedFilesPosition = (ufpSameAsNewFiles, ufpSortedPosition, ufpNoChange);
TExternalTool = (etViewer, etEditor, etDiffer);
TExternalToolOptions = record
@ -162,6 +163,7 @@ var
gSortNatural: Boolean;
gSortFolderMode: TSortFolderMode;
gNewFilesPosition: TNewFilesPosition;
gUpdatedFilesPosition: TUpdatedFilesPosition;
gLynxLike:Boolean;
gFirstTextSearch: Boolean;
@ -708,6 +710,7 @@ begin
gSortNatural := False;
gSortFolderMode := sfmSortNameShowFirst;
gNewFilesPosition := nfpSortedPosition;
gUpdatedFilesPosition := ufpNoChange;
gShortFileSizeFormat := True;
gMinimizeToTray := False;
gAlwaysShowTrayIcon := False;
@ -1674,7 +1677,8 @@ begin
gSortCaseSensitivity := TCaseSensitivity(GetValue(SubNode, 'CaseSensitivity', Integer(gSortCaseSensitivity)));
gSortNatural := GetValue(SubNode, 'NaturalSorting', gSortNatural);
gSortFolderMode:= TSortFolderMode(GetValue(SubNode, 'SortFolderMode', Integer(gSortFolderMode)));
gNewFilesPosition :=TNewFilesPosition(GetValue(SubNode, 'NewFilesPosition', Integer(gNewFilesPosition)));
gNewFilesPosition := TNewFilesPosition(GetValue(SubNode, 'NewFilesPosition', Integer(gNewFilesPosition)));
gUpdatedFilesPosition := TUpdatedFilesPosition(GetValue(SubNode, 'UpdatedFilesPosition', Integer(gUpdatedFilesPosition)));
end;
end;
@ -1998,6 +2002,7 @@ begin
SetValue(SubNode, 'NaturalSorting', gSortNatural);
SetValue(SubNode, 'SortFolderMode', Integer(gSortFolderMode));
SetValue(SubNode, 'NewFilesPosition', Integer(gNewFilesPosition));
SetValue(SubNode, 'UpdatedFilesPosition', Integer(gUpdatedFilesPosition));
{ Keys page }
Node := FindNode(Root, 'Keyboard', True);

View file

@ -443,6 +443,7 @@ resourcestring
rsOptSortCaseSens = 'not case sensitive;according to locale settings (aAbBcC);first upper then lower case (ABCabc)';
rsOptSortFolderMode = 'sort by name and show first;sort like files and show first;sort like files';
rsOptNewFilesPosition = 'at the top of the file list;after directories (if directories are sorted before files);at sorted position;at the bottom of the file list';
rsOptUpdatedFilesPosition = 'don''t change position;use the same setting as for new files;to sorted position';
//Columns Menu
rsMenuConfigureCustomColumns= 'Configure custom columns';