Switch to constant padding with right margin on buttons

- Previously layout was using variable padding with left margin
This commit is contained in:
John Lewin 2018-05-17 12:41:00 -07:00
parent 4f96518a9b
commit 9967e14328
11 changed files with 28 additions and 31 deletions

View file

@ -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
});

View file

@ -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;

View file

@ -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<ILibraryContainer> ItemAndParents(ILibraryContainer item)

View file

@ -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;

View file

@ -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",
};

View file

@ -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;

View file

@ -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,

View file

@ -64,7 +64,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
else
{
TabBar = new Toolbar(rightAnchorItem)
TabBar = new Toolbar(theme, rightAnchorItem)
{
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Fit

View file

@ -36,8 +36,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
/// </summary>
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,

View file

@ -46,8 +46,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private static HashSet<Type> ignoredInMenuTypes = new HashSet<Type> { 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)

View file

@ -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);
}