mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Feature [0000196] Sorting folders differently (patch by Holger Segler with modifications)
This commit is contained in:
parent
a78fbfba7f
commit
8d5686cca0
6 changed files with 102 additions and 51 deletions
|
|
@ -9,7 +9,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 98
|
||||
Height = 104
|
||||
Top = 6
|
||||
Width = 604
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
|
|
@ -21,15 +21,15 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
ChildSizing.HorizontalSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 12
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ClientHeight = 76
|
||||
ClientHeight = 86
|
||||
ClientWidth = 600
|
||||
TabOrder = 0
|
||||
object lblSortMethod: TLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 22
|
||||
Height = 14
|
||||
Top = 8
|
||||
Width = 108
|
||||
Width = 92
|
||||
Caption = 'Sort &method:'
|
||||
ParentColor = False
|
||||
end
|
||||
|
|
@ -40,13 +40,13 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = gbSorting
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 130
|
||||
Height = 29
|
||||
Left = 114
|
||||
Height = 21
|
||||
Top = 5
|
||||
Width = 458
|
||||
Width = 474
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 10
|
||||
ItemHeight = 21
|
||||
ItemHeight = 13
|
||||
Items.Strings = (
|
||||
'Alphabetical, considering accents'
|
||||
'Natural sorting: alphabetical and numbers'
|
||||
|
|
@ -56,9 +56,9 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
end
|
||||
object lblCaseSensitivity: TLabel
|
||||
Left = 12
|
||||
Height = 22
|
||||
Top = 42
|
||||
Width = 108
|
||||
Height = 14
|
||||
Top = 34
|
||||
Width = 92
|
||||
Caption = 'Case sensitivity:'
|
||||
ParentColor = False
|
||||
end
|
||||
|
|
@ -69,13 +69,13 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = gbSorting
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 130
|
||||
Height = 29
|
||||
Top = 39
|
||||
Width = 458
|
||||
Left = 114
|
||||
Height = 21
|
||||
Top = 31
|
||||
Width = 474
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 10
|
||||
ItemHeight = 21
|
||||
ItemHeight = 13
|
||||
Items.Strings = (
|
||||
'not case sensitive'
|
||||
'according to locale settings (aAbBcC)'
|
||||
|
|
@ -84,6 +84,36 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
end
|
||||
object lblSortFolderMode: TLabel
|
||||
Left = 12
|
||||
Height = 14
|
||||
Top = 60
|
||||
Width = 92
|
||||
Caption = 'Sorting directories:'
|
||||
ParentColor = False
|
||||
end
|
||||
object cbSortFolderMode: TComboBox
|
||||
AnchorSideLeft.Control = lblSortFolderMode
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = lblSortFolderMode
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = gbSorting
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 114
|
||||
Height = 21
|
||||
Top = 57
|
||||
Width = 474
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 10
|
||||
ItemHeight = 13
|
||||
Items.Strings = (
|
||||
'sort by name and show first'
|
||||
'sort like files and show first'
|
||||
'sort like files'
|
||||
)
|
||||
Style = csDropDownList
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
object gbMisc: TGroupBox[1]
|
||||
AnchorSideLeft.Control = Owner
|
||||
|
|
@ -92,8 +122,8 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 185
|
||||
Top = 215
|
||||
Height = 131
|
||||
Top = 221
|
||||
Width = 604
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
|
|
@ -103,46 +133,46 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
ChildSizing.VerticalSpacing = 4
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 163
|
||||
ClientHeight = 113
|
||||
ClientWidth = 600
|
||||
TabOrder = 1
|
||||
object cbSpaceMovesDown: TCheckBox
|
||||
Left = 6
|
||||
Height = 27
|
||||
Height = 17
|
||||
Top = 6
|
||||
Width = 589
|
||||
Width = 424
|
||||
Caption = 'When selecting files with <SPACEBAR>, move down to next file (as with <INSERT>)'
|
||||
TabOrder = 0
|
||||
end
|
||||
object cbDirBrackets: TCheckBox
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 37
|
||||
Width = 589
|
||||
Height = 17
|
||||
Top = 27
|
||||
Width = 424
|
||||
Caption = 'Show square brackets around directories'
|
||||
TabOrder = 1
|
||||
end
|
||||
object cbShowSystemFiles: TCheckBox
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 68
|
||||
Width = 589
|
||||
Height = 17
|
||||
Top = 48
|
||||
Width = 424
|
||||
Caption = 'Show system and hidden files'
|
||||
TabOrder = 2
|
||||
end
|
||||
object cbListFilesInThread: TCheckBox
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 99
|
||||
Width = 589
|
||||
Height = 17
|
||||
Top = 69
|
||||
Width = 424
|
||||
Caption = 'Load file list in separate thread'
|
||||
TabOrder = 3
|
||||
end
|
||||
object cbLoadIconsSeparately: TCheckBox
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 130
|
||||
Width = 589
|
||||
Height = 17
|
||||
Top = 90
|
||||
Width = 424
|
||||
Caption = 'Load icons after file list'
|
||||
TabOrder = 4
|
||||
end
|
||||
|
|
@ -155,14 +185,14 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 99
|
||||
Top = 110
|
||||
Top = 116
|
||||
Width = 604
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Formatting'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ClientHeight = 77
|
||||
ClientHeight = 81
|
||||
ClientWidth = 600
|
||||
TabOrder = 2
|
||||
object lblDateTimeFormat: TLabel
|
||||
|
|
@ -170,9 +200,9 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideTop.Control = cbDateTimeFormat
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 22
|
||||
Height = 14
|
||||
Top = 9
|
||||
Width = 148
|
||||
Width = 107
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Date and time format:'
|
||||
ParentColor = False
|
||||
|
|
@ -184,7 +214,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideRight.Side = asrBottom
|
||||
Left = 593
|
||||
Height = 1
|
||||
Top = 20
|
||||
Top = 16
|
||||
Width = 1
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
|
|
@ -198,15 +228,15 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = gbFormatting
|
||||
AnchorSideRight.Control = lblDateTimeExample
|
||||
Left = 164
|
||||
Height = 29
|
||||
Left = 123
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 421
|
||||
Width = 462
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 8
|
||||
ItemHeight = 21
|
||||
ItemHeight = 13
|
||||
Items.Strings = (
|
||||
'yyyy.mm.dd hh:mm:ss'
|
||||
'yyyy.mm.dd hh:mm'
|
||||
|
|
@ -225,9 +255,9 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideTop.Control = cbDateTimeFormat
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 41
|
||||
Width = 169
|
||||
Height = 17
|
||||
Top = 33
|
||||
Width = 117
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Short file size format'
|
||||
TabOrder = 1
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
TFRMOPTIONSFILESVIEWS.GBSORTING.CAPTION=Sorting
|
||||
TFRMOPTIONSFILESVIEWS.LBLSORTMETHOD.CAPTION=Sort &method:
|
||||
TFRMOPTIONSFILESVIEWS.LBLCASESENSITIVITY.CAPTION=Case sensitivity:
|
||||
TFRMOPTIONSFILESVIEWS.LBLSORTFOLDERMODE.CAPTION=Sorting directories:
|
||||
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
|
||||
|
|
|
|||
|
|
@ -44,9 +44,11 @@ type
|
|||
cbSortMethod: TComboBox;
|
||||
cbSpaceMovesDown: TCheckBox;
|
||||
cbCaseSensitivity: TComboBox;
|
||||
cbSortFolderMode: TComboBox;
|
||||
gbFormatting: TGroupBox;
|
||||
gbSorting: TGroupBox;
|
||||
gbMisc: TGroupBox;
|
||||
lblSortFolderMode: TLabel;
|
||||
lblCaseSensitivity: TLabel;
|
||||
lblDateTimeExample: TLabel;
|
||||
lblDateTimeFormat: TLabel;
|
||||
|
|
@ -79,6 +81,7 @@ procedure TfrmOptionsFilesViews.Init;
|
|||
begin
|
||||
ParseLineToList(rsOptSortMethod, cbSortMethod.Items);
|
||||
ParseLineToList(rsOptSortCaseSens, cbCaseSensitivity.Items);
|
||||
ParseLineToList(rsOptSortFolderMode, cbSortFolderMode.Items);
|
||||
end;
|
||||
|
||||
procedure TfrmOptionsFilesViews.Load;
|
||||
|
|
@ -92,6 +95,11 @@ begin
|
|||
cbSortMethod.ItemIndex:= 0
|
||||
else
|
||||
cbSortMethod.ItemIndex:= 1;
|
||||
case gSortFolderMode of
|
||||
sfmSortNameShowFirst: cbSortFolderMode.ItemIndex := 0;
|
||||
sfmSortLikeFileShowFirst: cbSortFolderMode.ItemIndex := 1;
|
||||
sfmSortLikeFile: cbSortFolderMode.ItemIndex := 2;
|
||||
end;
|
||||
cbShortFileSizeFormat.Checked :=gShortFileSizeFormat;
|
||||
cbDateTimeFormat.Text := gDateTimeFormat;
|
||||
lblDateTimeExample.Caption:= FormatDateTime(cbDateTimeFormat.Text, Now);
|
||||
|
|
@ -110,6 +118,11 @@ begin
|
|||
2: gSortCaseSensitivity := cstCharValue;
|
||||
end;
|
||||
gSortNatural := (cbSortMethod.ItemIndex = 1);
|
||||
case cbSortFolderMode.ItemIndex of
|
||||
0: gSortFolderMode := sfmSortNameShowFirst;
|
||||
1: gSortFolderMode := sfmSortLikeFileShowFirst;
|
||||
2: gSortFolderMode := sfmSortLikeFile;
|
||||
end;
|
||||
gShortFileSizeFormat := cbShortFileSizeFormat.Checked;
|
||||
gDateTimeFormat := cbDateTimeFormat.Text;
|
||||
gSpaceMovesDown := cbSpaceMovesDown.Checked;
|
||||
|
|
|
|||
|
|
@ -256,8 +256,10 @@ begin
|
|||
Result := -1
|
||||
else if item2.Name = '..' then
|
||||
Result := 1
|
||||
else if (gSortFolderMode <> sfmSortNameShowFirst) then
|
||||
Result := 0
|
||||
else
|
||||
Result := 0;
|
||||
Result := CompareStrings(item1.Name, item2.Name, gSortNatural, gSortCaseSensitivity);
|
||||
end;
|
||||
|
||||
function ICompareByName(item1, item2: TFile; bSortNegative: Boolean):Integer;
|
||||
|
|
@ -470,7 +472,7 @@ begin
|
|||
if item1 = item2 then Exit;
|
||||
|
||||
// Put directories first.
|
||||
if gDirSortFirst then
|
||||
if (gSortFolderMode <> sfmSortLikeFile) then
|
||||
begin
|
||||
Result := ICompareByDirectory(TFile(item1), TFile(item2), False); // Ascending
|
||||
if Result <> 0 then Exit;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ type
|
|||
{ Show tooltip mode }
|
||||
TShowToolTipMode = set of (stm_show_for_all, stm_only_large_name);
|
||||
TScrollMode = (smLineByLineCursor, smLineByLine, smPageByPage);
|
||||
{ Sorting directories mode }
|
||||
TSortFolderMode = (sfmSortNameShowFirst, sfmSortLikeFileShowFirst, sfmSortLikeFile);
|
||||
|
||||
TExternalTool = (etViewer, etEditor, etDiffer);
|
||||
TExternalToolOptions = record
|
||||
|
|
@ -148,14 +150,14 @@ var
|
|||
gToolBarButtonSize,
|
||||
gToolBarIconSize: Integer;
|
||||
|
||||
gDirSortFirst:Boolean; // if directories are shown as first in panels
|
||||
gRepeatPassword:Boolean; // repeat password when packing files
|
||||
gDirHistoryCount:Integer; // how many history we remember
|
||||
gShowSystemFiles:Boolean;
|
||||
gRunInTerm: String;
|
||||
gRunTerm: String;
|
||||
gSortCaseSensitivity: TCaseSensitivity;
|
||||
gSortNatural:Boolean;
|
||||
gSortNatural: Boolean;
|
||||
gSortFolderMode: TSortFolderMode;
|
||||
gLynxLike:Boolean;
|
||||
gFirstTextSearch: Boolean;
|
||||
|
||||
|
|
@ -690,6 +692,7 @@ begin
|
|||
gLynxLike := True;
|
||||
gSortCaseSensitivity := cstNotSensitive;
|
||||
gSortNatural := False;
|
||||
gSortFolderMode := sfmSortNameShowFirst;
|
||||
gShortFileSizeFormat := True;
|
||||
gMinimizeToTray := False;
|
||||
gAlwaysShowTrayIcon := False;
|
||||
|
|
@ -887,7 +890,6 @@ procedure SetDefaultNonConfigGlobs;
|
|||
begin
|
||||
{ - Not in config - }
|
||||
gHelpLang := '';
|
||||
gDirSortFirst := True;
|
||||
gRepeatPassword := True;
|
||||
gDirHistoryCount := 30;
|
||||
gFirstTextSearch := True;
|
||||
|
|
@ -1641,6 +1643,7 @@ begin
|
|||
begin
|
||||
gSortCaseSensitivity := TCaseSensitivity(GetValue(SubNode, 'CaseSensitivity', Integer(gSortCaseSensitivity)));
|
||||
gSortNatural := GetValue(SubNode, 'NaturalSorting', gSortNatural);
|
||||
gSortFolderMode:= TSortFolderMode(GetValue(SubNode, 'SortFolderMode', Integer(gSortFolderMode)));
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
@ -1956,6 +1959,7 @@ begin
|
|||
SubNode := FindNode(Node, 'Sorting', True);
|
||||
SetValue(SubNode, 'CaseSensitivity', Integer(gSortCaseSensitivity));
|
||||
SetValue(SubNode, 'NaturalSorting', gSortNatural);
|
||||
SetValue(SubNode, 'SortFolderMode', Integer(gSortFolderMode));
|
||||
|
||||
{ Keys page }
|
||||
Node := FindNode(Root, 'Keyboard', True);
|
||||
|
|
@ -2128,4 +2132,4 @@ initialization
|
|||
|
||||
finalization
|
||||
DestroyGlobs;
|
||||
end.
|
||||
end.
|
||||
|
|
@ -433,6 +433,7 @@ resourcestring
|
|||
//-------------------------------
|
||||
rsOptSortMethod = 'Alphabetical, considering accents;Natural sorting: alphabetical and numbers';
|
||||
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';
|
||||
|
||||
//Columns Menu
|
||||
rsMenuConfigureCustomColumns= 'Configure custom columns';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue