diff --git a/NAPS2.Lib/Config/ConfigSerializer.cs b/NAPS2.Lib/Config/ConfigSerializer.cs index a6a8c844d2..314d89bf87 100644 --- a/NAPS2.Lib/Config/ConfigSerializer.cs +++ b/NAPS2.Lib/Config/ConfigSerializer.cs @@ -188,6 +188,7 @@ private ToolbarButtons GetHiddenButtonFlags(AppConfigV0 c) if (c.HidePrintButton) flags |= ToolbarButtons.Print; if (c.HideSettingsButton) flags |= ToolbarButtons.Settings; if (c.HideDonateButton) flags |= ToolbarButtons.Donate; + if (c.HideSidebar) flags |= ToolbarButtons.Sidebar; return flags; } diff --git a/NAPS2.Lib/Config/ObsoleteTypes/AppConfigV0.cs b/NAPS2.Lib/Config/ObsoleteTypes/AppConfigV0.cs index fadbf335c5..74543c076a 100644 --- a/NAPS2.Lib/Config/ObsoleteTypes/AppConfigV0.cs +++ b/NAPS2.Lib/Config/ObsoleteTypes/AppConfigV0.cs @@ -53,6 +53,8 @@ public class AppConfigV0 public bool HideDonateButton { get; set; } + public bool HideSidebar { get; set; } + public bool DisableAutoSave { get; set; } public bool LockSystemProfiles { get; set; } diff --git a/NAPS2.Lib/Config/ToolbarButtons.cs b/NAPS2.Lib/Config/ToolbarButtons.cs index 560fa71587..9e833218be 100644 --- a/NAPS2.Lib/Config/ToolbarButtons.cs +++ b/NAPS2.Lib/Config/ToolbarButtons.cs @@ -22,5 +22,6 @@ public enum ToolbarButtons Language = 1 << 15, Settings = 1 << 16, About = 1 << 17, - Donate = 1 << 18 + Donate = 1 << 18, + Sidebar = 1 << 19 } \ No newline at end of file diff --git a/NAPS2.Lib/EtoForms/Layout/SkipLayoutElement.cs b/NAPS2.Lib/EtoForms/Layout/SkipLayoutElement.cs index f358922fe4..6edf41cd0f 100644 --- a/NAPS2.Lib/EtoForms/Layout/SkipLayoutElement.cs +++ b/NAPS2.Lib/EtoForms/Layout/SkipLayoutElement.cs @@ -6,5 +6,5 @@ public class SkipLayoutElement : LayoutElement { public override void Materialize(LayoutContext context) => throw new NotSupportedException(); public override void DoLayout(LayoutContext context, RectangleF bounds) => throw new NotSupportedException(); - protected override SizeF GetPreferredSizeCore(LayoutContext context, RectangleF parentBounds) => throw new NotSupportedException(); + protected override SizeF GetPreferredSizeCore(LayoutContext context, RectangleF parentBounds) => SizeF.Empty; } \ No newline at end of file diff --git a/NAPS2.Lib/EtoForms/Ui/DesktopForm.cs b/NAPS2.Lib/EtoForms/Ui/DesktopForm.cs index a184040e00..461fd5ea8b 100644 --- a/NAPS2.Lib/EtoForms/Ui/DesktopForm.cs +++ b/NAPS2.Lib/EtoForms/Ui/DesktopForm.cs @@ -124,7 +124,9 @@ protected override void BuildLayout() LayoutController.RootPadding = 0; LayoutController.Content = L.LeftPanel( - _sidebar.CreateView(this), + Config.Get(c => c.HiddenButtons).HasFlag(ToolbarButtons.Sidebar) + ? C.None() + : _sidebar.CreateView(this), L.Overlay( // For WinForms, we add 1px of top padding to give us room to draw a border above the listview _listView.Control.Padding(top: EtoPlatform.Current.IsWinForms ? 1 : 0), @@ -435,6 +437,10 @@ protected virtual LayoutElement GetControlButtons() protected LayoutElement GetSidebarButton() { + if (Config.Get(c => c.HiddenButtons).HasFlag(ToolbarButtons.Sidebar)) + { + return C.None(); + } var toggleSidebar = C.ImageButton(Commands.ToggleSidebar); EtoPlatform.Current.ConfigureZoomButton(toggleSidebar, "application_side_list_small"); return toggleSidebar.AlignTrailing(); diff --git a/NAPS2.Setup/appsettings.xml b/NAPS2.Setup/appsettings.xml index 802855af08..f350d21341 100644 --- a/NAPS2.Setup/appsettings.xml +++ b/NAPS2.Setup/appsettings.xml @@ -21,6 +21,7 @@ false false false + true false false false