From 9967e14328310b811da8477ec5eb431023ca4e4e Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 17 May 2018 12:41:00 -0700 Subject: [PATCH] Switch to constant padding with right margin on buttons - Previously layout was using variable padding with left margin --- ApplicationView/WidescreenPanel.cs | 15 ++++----------- CustomWidgets/InlineTitleEdit.cs | 2 +- .../LibrarySelector/FolderBreadCrumbWidget.cs | 1 - DesignTools/Operations/PinchEditor.cs | 7 ------- Library/Widgets/PrintLibraryWidget.cs | 1 + PartPreviewWindow/PartPreviewContent.cs | 19 ++++++++++++++----- PartPreviewWindow/SelectedObjectPanel.cs | 4 ++-- PartPreviewWindow/Tabs.cs | 2 +- PartPreviewWindow/Toolbar.cs | 4 +++- .../View3D/PrinterBar/OverflowBar.cs | 2 +- SetupWizard/DialogPage.cs | 2 +- 11 files changed, 28 insertions(+), 31 deletions(-) diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index 7ca56b2b3..baf7e9ee1 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -76,22 +76,15 @@ namespace MatterHackers.MatterControl var leftNav = new FlowLayoutWidget(FlowDirection.TopToBottom); leftNav.AnchorAll(); - var toolbar = new Toolbar() + leftNav.AddChild(new BrandMenuButton(theme) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit, BackgroundColor = theme.TabBarBackground, - BorderColor = theme.ActiveTabColor, - Border = 0 //new BorderDouble(bottom: 2), - }; - toolbar.ActionArea.AddChild(new BrandMenuButton(theme) - { - HAnchor = HAnchor.Stretch, - VAnchor = VAnchor.Fit, Border = new BorderDouble(right: 1), - BorderColor = theme.MinimalShade + BorderColor = theme.MinimalShade, + Padding = theme.ToolbarPadding.Clone(right: 0) }); - leftNav.AddChild(toolbar); var partPreviewContent = new PartPreviewContent() { @@ -137,7 +130,7 @@ namespace MatterHackers.MatterControl row.AddChild(new IconButton(AggContext.StaticData.LoadIcon("mh-app-logo.png", theme.InvertIcons), theme) { VAnchor = VAnchor.Center, - Margin = new BorderDouble(right: 4), + Margin = theme.ButtonSpacing, Selectable = false }); diff --git a/CustomWidgets/InlineTitleEdit.cs b/CustomWidgets/InlineTitleEdit.cs index 514ddbdde..b9f94843c 100644 --- a/CustomWidgets/InlineTitleEdit.cs +++ b/CustomWidgets/InlineTitleEdit.cs @@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.CustomWidgets private SearchInputBox searchPanel; public InlineTitleEdit(string title, ThemeConfig theme, string automationName, bool boldFont = false) - : base(null) + : base(theme) { this.Padding = theme.ToolbarPadding; this.HAnchor = HAnchor.Stretch; diff --git a/CustomWidgets/LibrarySelector/FolderBreadCrumbWidget.cs b/CustomWidgets/LibrarySelector/FolderBreadCrumbWidget.cs index f0e70eec6..12816dd67 100644 --- a/CustomWidgets/LibrarySelector/FolderBreadCrumbWidget.cs +++ b/CustomWidgets/LibrarySelector/FolderBreadCrumbWidget.cs @@ -52,7 +52,6 @@ namespace MatterHackers.MatterControl.CustomWidgets this.HAnchor = HAnchor.Stretch; this.VAnchor = VAnchor.Fit | VAnchor.Center; this.MinimumSize = new VectorMath.Vector2(0, 1); // Force some minimum bounds to ensure draw and thus onload (and our local init) are called on startup - this.Padding = new BorderDouble(left: 2); } public static IEnumerable ItemAndParents(ILibraryContainer item) diff --git a/DesignTools/Operations/PinchEditor.cs b/DesignTools/Operations/PinchEditor.cs index afaf27408..339383484 100644 --- a/DesignTools/Operations/PinchEditor.cs +++ b/DesignTools/Operations/PinchEditor.cs @@ -27,18 +27,11 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ -using System; -using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Threading; -using System.Threading.Tasks; -using MatterHackers.Agg; -using MatterHackers.Agg.Font; using MatterHackers.Agg.UI; using MatterHackers.DataConverters3D; -using MatterHackers.Localizations; -using MatterHackers.MatterControl.PartPreviewWindow; using MatterHackers.MatterControl.PartPreviewWindow.View3D; using MatterHackers.PolygonMesh; using MatterHackers.VectorMath; diff --git a/Library/Widgets/PrintLibraryWidget.cs b/Library/Widgets/PrintLibraryWidget.cs index 5583aca4e..1d882ee5f 100644 --- a/Library/Widgets/PrintLibraryWidget.cs +++ b/Library/Widgets/PrintLibraryWidget.cs @@ -164,6 +164,7 @@ namespace MatterHackers.MatterControl.PrintLibrary { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit | VAnchor.Center, + Margin = theme.ButtonSpacing, Name = "Show Folders Toggle", Checked = UserSettings.Instance.get(UserSettingsKey.ShowContainers) == "1", }; diff --git a/PartPreviewWindow/PartPreviewContent.cs b/PartPreviewWindow/PartPreviewContent.cs index ef3384479..bbc952f86 100644 --- a/PartPreviewWindow/PartPreviewContent.cs +++ b/PartPreviewWindow/PartPreviewContent.cs @@ -56,7 +56,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow var extensionArea = new LeftClipFlowLayoutWidget() { BackgroundColor = theme.TabBarBackground, - Padding = new BorderDouble(left: 8, top: 6) + VAnchor = VAnchor.Stretch, + Padding = new BorderDouble(left: 8) }; tabControl = new ChromeTabs(extensionArea, theme) @@ -71,8 +72,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow return new PlusTabPage(this, theme); } }; - tabControl.TabBar.BackgroundColor = theme.TabBarBackground; - tabControl.ActiveTabChanged += (s, e) => { if (this.tabControl.ActiveTab?.TabContent is PartTabPage tabPage) @@ -85,9 +84,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } }; + + // Force the ActionArea to be as high as ButtonHeight + tabControl.TabBar.ActionArea.MinimumSize = new Vector2(0, theme.ButtonHeight); + tabControl.TabBar.BackgroundColor = theme.TabBarBackground; tabControl.TabBar.BorderColor = theme.ActiveTabColor; - tabControl.TabBar.Padding = new BorderDouble(top: 4); - //tabControl.TabBar.Border = new BorderDouble(bottom: 2); + + // Force common padding into top region + var padding = tabControl.TabBar.Padding; + tabControl.TabBar.Padding = padding.Clone(top: padding.Top * 2, bottom: 0); + + //tabControl.TabBar.Padding = 0; + //tabControl.TabBar.ActionArea.Padding = padding.Clone(top: padding.Top * 2, bottom: 0); + Color selectedTabColor = ActiveTheme.Instance.TabLabelSelected; diff --git a/PartPreviewWindow/SelectedObjectPanel.cs b/PartPreviewWindow/SelectedObjectPanel.cs index 8bd04fa72..ca4921147 100644 --- a/PartPreviewWindow/SelectedObjectPanel.cs +++ b/PartPreviewWindow/SelectedObjectPanel.cs @@ -107,7 +107,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow VAnchor = VAnchor.Fit }; - var toolbar = new Toolbar() + var toolbar = new Toolbar(theme) { Padding = theme.ToolbarPadding, HAnchor = HAnchor.Stretch, @@ -375,7 +375,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (buttons.Any()) { - var toolbar = new Toolbar() + var toolbar = new Toolbar(theme) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit, diff --git a/PartPreviewWindow/Tabs.cs b/PartPreviewWindow/Tabs.cs index 44cac9fdf..4a9eff895 100644 --- a/PartPreviewWindow/Tabs.cs +++ b/PartPreviewWindow/Tabs.cs @@ -64,7 +64,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } else { - TabBar = new Toolbar(rightAnchorItem) + TabBar = new Toolbar(theme, rightAnchorItem) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit diff --git a/PartPreviewWindow/Toolbar.cs b/PartPreviewWindow/Toolbar.cs index 8bf05f5c4..7c1ac316e 100644 --- a/PartPreviewWindow/Toolbar.cs +++ b/PartPreviewWindow/Toolbar.cs @@ -36,8 +36,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow /// public class Toolbar : GuiWidget { - public Toolbar(GuiWidget rightAnchorItem = null) + public Toolbar(ThemeConfig theme, GuiWidget rightAnchorItem = null) { + this.Padding = theme.ToolbarPadding; + this.ActionArea = new FlowLayoutWidget() { HAnchor = HAnchor.Stretch, diff --git a/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs b/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs index 778677cf0..aec3579ef 100644 --- a/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs +++ b/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs @@ -46,8 +46,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private static HashSet ignoredInMenuTypes = new HashSet { typeof(VerticalLine), typeof(HorizontalLine), typeof(SearchInputBox), typeof(HorizontalSpacer) }; public OverflowBar(ThemeConfig theme) + : base (theme) { - this.Padding = theme.ToolbarPadding.Clone(left: 0); this.theme = theme; this.OverflowButton = new OverflowMenuButton(this, theme) diff --git a/SetupWizard/DialogPage.cs b/SetupWizard/DialogPage.cs index 38e660713..b8f74234d 100644 --- a/SetupWizard/DialogPage.cs +++ b/SetupWizard/DialogPage.cs @@ -137,7 +137,7 @@ namespace MatterHackers.MatterControl public void AddPageAction(GuiWidget button) { - button.Margin = new BorderDouble(right: theme.ButtonSpacing.Left); + button.Margin = theme.ButtonSpacing; footerRow.AddChild(button); }