Skip to content

Commit 3f9d349

Browse files
committed
Part 1
1 parent 27676d4 commit 3f9d349

23 files changed

+431
-443
lines changed

src/Files.App/Actions/Display/LayoutAction.cs

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -57,58 +57,22 @@ public override HotKey HotKey
5757
=> new(Keys.Number3, KeyModifiers.CtrlShift);
5858
}
5959

60-
internal class LayoutGridSmallAction : ToggleLayoutAction
60+
internal class LayoutGridAction : ToggleLayoutAction
6161
{
6262
protected override LayoutTypes LayoutType
63-
=> LayoutTypes.GridSmall;
63+
=> LayoutTypes.Grid;
6464

6565
public override string Label
66-
=> "SmallIcons".GetLocalizedResource();
66+
=> "Grid".GetLocalizedResource();
6767

6868
public override string Description
69-
=> "LayoutGridSmallDescription".GetLocalizedResource();
70-
71-
public override RichGlyph Glyph
72-
=> new(opacityStyle: "ColorIconGridSmallLayout");
73-
74-
public override HotKey HotKey
75-
=> new(Keys.Number4, KeyModifiers.CtrlShift);
76-
}
77-
78-
internal class LayoutGridMediumAction : ToggleLayoutAction
79-
{
80-
protected override LayoutTypes LayoutType
81-
=> LayoutTypes.GridMedium;
82-
83-
public override string Label
84-
=> "MediumIcons".GetLocalizedResource();
85-
86-
public override string Description
87-
=> "LayoutGridMediumDescription".GetLocalizedResource();
88-
89-
public override RichGlyph Glyph
90-
=> new(opacityStyle: "ColorIconGridMediumLayout");
91-
92-
public override HotKey HotKey
93-
=> new(Keys.Number5, KeyModifiers.CtrlShift);
94-
}
95-
96-
internal class LayoutGridLargeAction : ToggleLayoutAction
97-
{
98-
protected override LayoutTypes LayoutType
99-
=> LayoutTypes.GridLarge;
100-
101-
public override string Label
102-
=> "LargeIcons".GetLocalizedResource();
103-
104-
public override string Description
105-
=> "LayoutGridLargeDescription".GetLocalizedResource();
69+
=> "LayoutGridescription".GetLocalizedResource();
10670

10771
public override RichGlyph Glyph
10872
=> new(opacityStyle: "ColorIconGridLargeLayout");
10973

11074
public override HotKey HotKey
111-
=> new(Keys.Number6, KeyModifiers.CtrlShift);
75+
=> new(Keys.Number4, KeyModifiers.CtrlShift);
11276
}
11377

11478
internal class LayoutColumnsAction : ToggleLayoutAction
@@ -126,7 +90,7 @@ public override RichGlyph Glyph
12690
=> new(opacityStyle: "ColorIconColumnsLayout");
12791

12892
public override HotKey HotKey
129-
=> new(Keys.Number7, KeyModifiers.CtrlShift);
93+
=> new(Keys.Number5, KeyModifiers.CtrlShift);
13094
}
13195

13296
internal class LayoutAdaptiveAction : ToggleLayoutAction

src/Files.App/Constants.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,41 @@ public static class TilesView
143143

144144
public static class ListView
145145
{
146+
public const int Increment = 4;
147+
148+
public const int Minimum = 24;
149+
150+
public const int Small = 28;
151+
146152
public const int Regular = 32;
153+
154+
public const int Maximum = 36;
147155
}
148156

149157
public static class DetailsView
150158
{
151-
public const int Regular = 32;
159+
public const int Increment = 4;
160+
161+
public const int Minimum = 28;
162+
163+
public const int Small = 32;
164+
165+
public const int Regular = 36;
166+
167+
public const int Maximum = 40;
152168
}
153169

154170
public static class ColumnsView
155171
{
172+
public const int Increment = 4;
173+
174+
public const int Minimum = 24;
175+
176+
public const int Small = 28;
177+
156178
public const int Regular = 32;
179+
180+
public const int Maximum = 36;
157181
}
158182
}
159183

src/Files.App/Data/Commands/CommandCodes.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ public enum CommandCodes
113113
LayoutDetails,
114114
LayoutList,
115115
LayoutTiles,
116-
LayoutGridSmall,
117-
LayoutGridMedium,
118-
LayoutGridLarge,
116+
LayoutGrid,
119117
LayoutColumns,
120118
LayoutAdaptive,
121119

src/Files.App/Data/Commands/Manager/CommandManager.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ public IRichCommand this[HotKey hotKey]
113113
public IRichCommand LayoutDetails => commands[CommandCodes.LayoutDetails];
114114
public IRichCommand LayoutList => commands[CommandCodes.LayoutList];
115115
public IRichCommand LayoutTiles => commands[CommandCodes.LayoutTiles];
116-
public IRichCommand LayoutGridSmall => commands[CommandCodes.LayoutGridSmall];
117-
public IRichCommand LayoutGridMedium => commands[CommandCodes.LayoutGridMedium];
118-
public IRichCommand LayoutGridLarge => commands[CommandCodes.LayoutGridLarge];
116+
public IRichCommand LayoutGrid => commands[CommandCodes.LayoutGrid];
119117
public IRichCommand LayoutColumns => commands[CommandCodes.LayoutColumns];
120118
public IRichCommand LayoutAdaptive => commands[CommandCodes.LayoutAdaptive];
121119
public IRichCommand SortByName => commands[CommandCodes.SortByName];
@@ -284,9 +282,7 @@ public CommandManager()
284282
[CommandCodes.LayoutDetails] = new LayoutDetailsAction(),
285283
[CommandCodes.LayoutList] = new LayoutListAction(),
286284
[CommandCodes.LayoutTiles] = new LayoutTilesAction(),
287-
[CommandCodes.LayoutGridSmall] = new LayoutGridSmallAction(),
288-
[CommandCodes.LayoutGridMedium] = new LayoutGridMediumAction(),
289-
[CommandCodes.LayoutGridLarge] = new LayoutGridLargeAction(),
285+
[CommandCodes.LayoutGrid] = new LayoutGridAction(),
290286
[CommandCodes.LayoutColumns] = new LayoutColumnsAction(),
291287
[CommandCodes.LayoutAdaptive] = new LayoutAdaptiveAction(),
292288
[CommandCodes.SortByName] = new SortByNameAction(),

src/Files.App/Data/Commands/Manager/ICommandManager.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ public interface ICommandManager : IEnumerable<IRichCommand>
9999
IRichCommand LayoutDetails { get; }
100100
IRichCommand LayoutList { get; }
101101
IRichCommand LayoutTiles { get; }
102-
IRichCommand LayoutGridSmall { get; }
103-
IRichCommand LayoutGridMedium { get; }
104-
IRichCommand LayoutGridLarge { get; }
102+
IRichCommand LayoutGrid { get; }
105103
IRichCommand LayoutColumns { get; }
106104
IRichCommand LayoutAdaptive { get; }
107105

src/Files.App/Data/Contexts/DisplayPage/DisplayPageContext.cs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,8 @@ public LayoutTypes LayoutType
3333
case LayoutTypes.Tiles:
3434
viewModel.ToggleLayoutModeTiles(true);
3535
break;
36-
case LayoutTypes.GridSmall:
37-
viewModel.ToggleLayoutModeGridView(IconHeights.GridView.Small, true);
38-
break;
39-
case LayoutTypes.GridMedium:
40-
viewModel.ToggleLayoutModeGridView(IconHeights.GridView.Medium, true);
41-
break;
42-
case LayoutTypes.GridLarge:
43-
viewModel.ToggleLayoutModeGridView(IconHeights.GridView.Large, true);
36+
case LayoutTypes.Grid:
37+
viewModel.ToggleLayoutModeGridView(true);
4438
break;
4539
case LayoutTypes.Columns:
4640
viewModel.ToggleLayoutModeColumnView(true);
@@ -251,12 +245,7 @@ private LayoutTypes GetLayoutType()
251245
FolderLayoutModes.DetailsView => LayoutTypes.Details,
252246
FolderLayoutModes.ListView => LayoutTypes.List,
253247
FolderLayoutModes.TilesView => LayoutTypes.Tiles,
254-
FolderLayoutModes.GridView => viewModel.IconHeight switch
255-
{
256-
< IconHeights.GridView.Medium => LayoutTypes.GridSmall,
257-
< IconHeights.GridView.Large => LayoutTypes.GridMedium,
258-
_ => LayoutTypes.GridLarge,
259-
},
248+
FolderLayoutModes.GridView => LayoutTypes.Grid,
260249
FolderLayoutModes.ColumnView => LayoutTypes.Columns,
261250
_ => throw new InvalidEnumArgumentException(),
262251
};

src/Files.App/Data/Contexts/DisplayPage/LayoutTypes.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ public enum LayoutTypes : ushort
99
Details,
1010
List,
1111
Tiles,
12-
GridSmall,
13-
GridMedium,
14-
GridLarge,
12+
Grid,
1513
Columns,
1614
Adaptive,
1715
}

src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,7 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
120120
{
121121
IsToggle = true
122122
}.Build(),
123-
new ContextMenuFlyoutItemViewModelBuilder(Commands.LayoutGridSmall)
124-
{
125-
IsToggle = true
126-
}.Build(),
127-
new ContextMenuFlyoutItemViewModelBuilder(Commands.LayoutGridMedium)
128-
{
129-
IsToggle = true
130-
}.Build(),
131-
new ContextMenuFlyoutItemViewModelBuilder(Commands.LayoutGridLarge)
123+
new ContextMenuFlyoutItemViewModelBuilder(Commands.LayoutGrid)
132124
{
133125
IsToggle = true
134126
}.Build(),

src/Files.App/Data/Models/ItemViewModel.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,11 @@ await dispatcherQueue.EnqueueOrInvokeAsync(() =>
613613
case nameof(UserSettingsService.FoldersSettingsService.SyncFolderPreferencesAcrossDirectories):
614614
case nameof(UserSettingsService.FoldersSettingsService.DefaultGroupByDateUnit):
615615
case nameof(UserSettingsService.FoldersSettingsService.DefaultLayoutMode):
616-
case nameof(UserSettingsService.LayoutSettingsService.DefaultIconHeightDetailsView):
617-
case nameof(UserSettingsService.LayoutSettingsService.DefaultIconHeightListView):
618-
case nameof(UserSettingsService.LayoutSettingsService.DefaulIconHeightTilesView):
619-
case nameof(UserSettingsService.LayoutSettingsService.DefaulIconHeightGridView):
620-
case nameof(UserSettingsService.LayoutSettingsService.DefaultIconHeightColumnsView):
616+
case nameof(UserSettingsService.LayoutSettingsService.IconHeightDetailsView):
617+
case nameof(UserSettingsService.LayoutSettingsService.IconHeightListView):
618+
case nameof(UserSettingsService.LayoutSettingsService.IconHeightTilesView):
619+
case nameof(UserSettingsService.LayoutSettingsService.IconHeightGridView):
620+
case nameof(UserSettingsService.LayoutSettingsService.IconHeightColumnsView):
621621
await dispatcherQueue.EnqueueOrInvokeAsync(() =>
622622
{
623623
folderSettings.OnDefaultPreferencesChanged(WorkingDirectory, e.SettingName);

src/Files.App/Helpers/Layout/AdaptiveLayoutHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static void ApplyAdaptativeLayout(LayoutPreferencesManager folderSettings
3030
folderSettings.ToggleLayoutModeDetailsView(false);
3131
break;
3232
case Layouts.Grid:
33-
folderSettings.ToggleLayoutModeGridView(Constants.IconHeights.GridView.Medium, false);
33+
folderSettings.ToggleLayoutModeGridView(false);
3434
break;
3535
}
3636
}

src/Files.App/Helpers/Layout/LayoutPreferencesItem.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ public class LayoutPreferencesItem
2020
public bool SortFilesFirst;
2121
public bool IsAdaptiveLayoutOverridden;
2222

23-
// Icon heights
24-
public int IconHeightDetailsView;
25-
public int IconHeightListView;
26-
public int IconHeightTilesView;
27-
public int IconHeightGridView;
28-
public int IconHeightColumnsView;
29-
3023
public FolderLayoutModes LayoutMode;
3124

3225
public SortOption DirectorySortOption;
@@ -43,11 +36,6 @@ public LayoutPreferencesItem()
4336
var defaultLayout = UserSettingsService.FoldersSettingsService.DefaultLayoutMode;
4437

4538
LayoutMode = defaultLayout is FolderLayoutModes.Adaptive ? FolderLayoutModes.DetailsView : defaultLayout;
46-
IconHeightDetailsView = UserSettingsService.LayoutSettingsService.DefaultIconHeightDetailsView;
47-
IconHeightListView = UserSettingsService.LayoutSettingsService.DefaultIconHeightListView;
48-
IconHeightTilesView = UserSettingsService.LayoutSettingsService.DefaulIconHeightTilesView;
49-
IconHeightGridView = UserSettingsService.LayoutSettingsService.DefaulIconHeightGridView;
50-
IconHeightColumnsView = UserSettingsService.LayoutSettingsService.DefaultIconHeightColumnsView;
5139
DirectorySortOption = UserSettingsService.FoldersSettingsService.DefaultSortOption;
5240
DirectoryGroupOption = UserSettingsService.FoldersSettingsService.DefaultGroupOption;
5341
DirectorySortDirection = UserSettingsService.FoldersSettingsService.DefaultDirectorySortDirection;
@@ -104,11 +92,6 @@ public override bool Equals(object? obj)
10492
{
10593
return (
10694
item.LayoutMode == LayoutMode &&
107-
item.IconHeightDetailsView == IconHeightDetailsView &&
108-
item.IconHeightListView == IconHeightListView &&
109-
item.IconHeightTilesView == IconHeightTilesView &&
110-
item.IconHeightGridView == IconHeightGridView &&
111-
item.IconHeightColumnsView == IconHeightColumnsView &&
11295
item.DirectoryGroupOption == DirectoryGroupOption &&
11396
item.DirectorySortOption == DirectorySortOption &&
11497
item.DirectorySortDirection == DirectorySortDirection &&
@@ -127,11 +110,6 @@ public override int GetHashCode()
127110
HashCode hash = new();
128111

129112
hash.Add(LayoutMode);
130-
hash.Add(IconHeightDetailsView);
131-
hash.Add(IconHeightListView);
132-
hash.Add(IconHeightTilesView);
133-
hash.Add(IconHeightGridView);
134-
hash.Add(IconHeightColumnsView);
135113
hash.Add(DirectoryGroupOption);
136114
hash.Add(DirectorySortOption);
137115
hash.Add(DirectorySortDirection);

0 commit comments

Comments
 (0)