Merge pull request #2879 from jlewin/design_tools

Revise and increase use of default font size
This commit is contained in:
johnlewin 2018-01-12 12:54:19 -08:00 committed by GitHub
commit b67916b83d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 38 additions and 45 deletions

View file

@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl
public int FontSize12 { get; } = 12;
public int FontSize14 { get; } = 14;
public int DefaultFontSize { get; } = 12;
public int DefaultFontSize { get; } = 11;
internal int shortButtonHeight = 25;
private int sideBarButtonWidth;
@ -172,7 +172,7 @@ namespace MatterHackers.MatterControl
commonOptions.PressedTextColor = theme.PrimaryTextColor;
commonOptions.DisabledTextColor = theme.TertiaryBackgroundColor;
commonOptions.Margin = new BorderDouble(14, 0);
commonOptions.FontSize = 11;
commonOptions.FontSize = this.DefaultFontSize;
commonOptions.ImageSpacing = 8;
commonOptions.BorderWidth = 0;
commonOptions.FixedHeight = 32;

View file

@ -36,6 +36,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
public SettingsItem (string text, Color textColor, GuiWidget settingsControls, GuiWidget optionalControls = null, ImageBuffer imageBuffer = null, bool enforceGutter = true)
: base (FlowDirection.LeftToRight)
{
var theme = ApplicationController.Instance.Theme;
this.SettingsControl = settingsControls;
this.HAnchor = HAnchor.Stretch;
this.MinimumSize = new Vector2(0, 40);
@ -59,7 +60,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
});
}
this.AddChild(new TextWidget(text, textColor: textColor)
this.AddChild(new TextWidget(text, textColor: textColor, pointSize: theme.DefaultFontSize)
{
AutoExpandBoundsToText = true,
VAnchor = VAnchor.Center,

View file

@ -136,18 +136,12 @@ namespace MatterHackers.MatterControl
public Button Generate(string label, double fixedWidth = -1)
{
// Create button based on view container widget
var buttonViewWidget = new ButtonViewStates(
new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight, imageSpacing: ImageSpacing),
new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight, imageSpacing: ImageSpacing),
new TextImageWidget(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight, imageSpacing: ImageSpacing),
new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight, imageSpacing: ImageSpacing)
);
var theme = ApplicationController.Instance.Theme;
var textImageButton = new Button(0, 0, buttonViewWidget)
var button = new TextButton(label, theme)
{
Margin = new BorderDouble(0),
Padding = new BorderDouble(0),
BackgroundColor = theme.MinimalShade,
VAnchor = VAnchor.Absolute
};
// Allow fixedWidth parameter to override local .FixedWith property
@ -155,17 +149,17 @@ namespace MatterHackers.MatterControl
{
if (fixedWidth > 0)
{
buttonViewWidget.Width = fixedWidth;
textImageButton.Width = fixedWidth;
button.HAnchor = HAnchor.Absolute;
button.Width = fixedWidth;
}
}
else if (this.FixedWidth != 0)
{
//Override the width if requested
buttonViewWidget.Width = this.FixedWidth;
textImageButton.Width = this.FixedWidth;
button.HAnchor = HAnchor.Absolute;
button.Width = this.FixedWidth;
}
return textImageButton;
return button;
}
private ButtonViewStates getButtonView(string label, ImageBuffer normalImage = null, ImageBuffer hoverImage = null, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null)

View file

@ -53,7 +53,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
private PrinterConfig printer;
private ThemeConfig theme;
private ResizeContainer resizePage;
public DockingTabControl(GuiWidget widgetTodockTo, DockSide dockSide, PrinterConfig printer)
: base (FlowDirection.TopToBottom)
@ -62,6 +61,8 @@ namespace MatterHackers.MatterControl.CustomWidgets
this.printer = printer;
this.widgetTodockTo = widgetTodockTo;
this.DockSide = dockSide;
this.BorderColor = theme.MinimalShade;
this.Border = new BorderDouble(left: 1);
// Add dummy widget to ensure OnLoad fires
this.AddChild(new GuiWidget(10, 10));
@ -275,7 +276,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
});
settingsButtons.Add(settingsButton);
settingsButton.DebugShowBounds = true;
settingsButton.PopupContent = resizeContainer;
settingsButton.Click += (s, e) =>

View file

@ -244,7 +244,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
this.Padding = theme.ButtonFactory.Options.Margin;
this.TextColor = textColor;
this.AddChild(textWidget = new TextWidget(text, pointSize: theme.ButtonFactory.Options.FontSize, textColor: textColor)
this.AddChild(textWidget = new TextWidget(text, pointSize: theme.DefaultFontSize, textColor: textColor)
{
HAnchor = HAnchor.Center,
VAnchor = VAnchor.Center

View file

@ -62,7 +62,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
this.AddChild(row);
var radioButton = new RadioButton(string.Format("{0} {1}", "Material".Localize(), extruderIndex + 1), textColor: theme.Colors.PrimaryTextColor);
var radioButton = new RadioButton(string.Format("{0} {1}", "Material".Localize(), extruderIndex + 1), textColor: theme.Colors.PrimaryTextColor, fontSize: theme.DefaultFontSize);
materialButtons.Add(radioButton);
radioButton.SiblingRadioButtonList = materialButtons;
row.AddChild(radioButton);

View file

@ -38,8 +38,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class PopupMenu : FlowLayoutWidget
{
public static double PointSize { get; set; } = 12;
public static int GutterWidth { get; set; } = 35;
private ThemeConfig theme;
@ -70,9 +68,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public MenuItem CreateMenuItem(string name, ImageBuffer icon = null)
{
var textWidget = new TextWidget(name)
var textWidget = new TextWidget(name, pointSize: theme.DefaultFontSize)
{
PointSize = PopupMenu.PointSize,
Padding = MenuPadding,
};
@ -91,9 +88,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public MenuItem CreateBoolMenuItem(string name, Func<bool> getter, Action<bool> setter)
{
var textWidget = new TextWidget(name)
var textWidget = new TextWidget(name, pointSize: theme.DefaultFontSize)
{
PointSize = PopupMenu.PointSize,
Padding = MenuPadding,
};

View file

@ -23,7 +23,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
if (!string.IsNullOrEmpty(sectionTitle))
{
// Add heading
var pointSize = (headingPointSize) == -1 ? theme.H1PointSize : headingPointSize;
var pointSize = (headingPointSize) == -1 ? theme.DefaultFontSize : headingPointSize;
GuiWidget heading;

View file

@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
this.AddChild(firstPanel);
firstPanel.AddChild(itemName = new TextWidget("", textColor: ActiveTheme.Instance.PrimaryTextColor)
firstPanel.AddChild(itemName = new TextWidget("", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: theme.DefaultFontSize)
{
AutoExpandBoundsToText = true,
EllipsisIfClipped = true,

View file

@ -56,7 +56,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.AddChild(new ScaleOptionsPanel(this, theme));
// Going to use this in the scaling controls, create it early.
usePercents = new CheckBox("Use Percents".Localize(), textColor: theme.Colors.PrimaryTextColor);
usePercents = new CheckBox("Use Percents".Localize(), textColor: theme.Colors.PrimaryTextColor, textSize: theme.DefaultFontSize);
// add in the dimensions
this.AddChild(CreateAxisScalingControl("x".ToUpper(), 0));
@ -64,7 +64,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.AddChild(CreateAxisScalingControl("z".ToUpper(), 2));
// lock ratio checkbox
uniformScale = new CheckBox("Lock Ratio".Localize(), textColor: theme.Colors.PrimaryTextColor);
uniformScale = new CheckBox("Lock Ratio".Localize(), textColor: theme.Colors.PrimaryTextColor, textSize: theme.DefaultFontSize);
uniformScale.Margin = new BorderDouble(5, 3);
uniformScale.Checked = true;
uniformScale.CheckedStateChanged += (s, e) =>
@ -134,7 +134,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Padding = new BorderDouble(5, 3)
};
var sizeDescription = new TextWidget("{0}:".FormatWith(axis), textColor: theme.Colors.PrimaryTextColor)
var sizeDescription = new TextWidget("{0}:".FormatWith(axis), textColor: theme.Colors.PrimaryTextColor, pointSize: theme.DefaultFontSize)
{
VAnchor = VAnchor.Center
};
@ -159,7 +159,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
leftToRight.AddChild(sizeDisplay[axisIndex]);
var units = new TextWidget("mm".FormatWith(axis), textColor: theme.Colors.PrimaryTextColor)
var units = new TextWidget("mm".FormatWith(axis), textColor: theme.Colors.PrimaryTextColor, pointSize: theme.DefaultFontSize)
{
VAnchor = VAnchor.Center
};

View file

@ -67,7 +67,7 @@ namespace MatterHackers.MatterControl.PrinterControls
VAnchor = VAnchor.Fit
};
var feedRateDescription = new TextWidget("Speed Multiplier".Localize())
var feedRateDescription = new TextWidget("Speed Multiplier".Localize(), pointSize: theme.DefaultFontSize)
{
MinimumSize = new Vector2(140, 0) * GuiWidget.DeviceScale,
TextColor = ActiveTheme.Instance.PrimaryTextColor,
@ -132,7 +132,7 @@ namespace MatterHackers.MatterControl.PrinterControls
VAnchor = VAnchor.Fit
};
var extrusionDescription = new TextWidget("Extrusion Multiplier".Localize())
var extrusionDescription = new TextWidget("Extrusion Multiplier".Localize(), pointSize: theme.DefaultFontSize)
{
MinimumSize = new Vector2(140, 0) * GuiWidget.DeviceScale,
TextColor = ActiveTheme.Instance.PrimaryTextColor,

View file

@ -212,14 +212,16 @@ namespace MatterHackers.MatterControl.PrinterControls
private FlowLayoutWidget GetHWDestinationBar()
{
FlowLayoutWidget hwDestinationBar = new FlowLayoutWidget();
hwDestinationBar.HAnchor = HAnchor.Stretch;
hwDestinationBar.Margin = new BorderDouble(top: 8);
hwDestinationBar.Padding = 0;
var hwDestinationBar = new FlowLayoutWidget
{
HAnchor = HAnchor.Stretch,
Margin = new BorderDouble(top: 8),
Padding = 0
};
TextWidget xPosition = new TextWidget("X: 0.0 ", pointSize: 12, textColor: ActiveTheme.Instance.PrimaryTextColor);
TextWidget yPosition = new TextWidget("Y: 0.0 ", pointSize: 12, textColor: ActiveTheme.Instance.PrimaryTextColor);
TextWidget zPosition = new TextWidget("Z: 0.0 ", pointSize: 12, textColor: ActiveTheme.Instance.PrimaryTextColor);
var xPosition = new TextWidget("X: 0.0 ", pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor);
var yPosition = new TextWidget("Y: 0.0 ", pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor);
var zPosition = new TextWidget("Z: 0.0 ", pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor);
hwDestinationBar.AddChild(xPosition);
hwDestinationBar.AddChild(yPosition);
@ -301,7 +303,7 @@ namespace MatterHackers.MatterControl.PrinterControls
this.AddChild(zOffsetStreamContainer);
double zoffset = printerSettings.GetValue<double>(SettingsKey.baby_step_z_offset);
zOffsetStreamDisplay = new TextWidget(zoffset.ToString("0.##"))
zOffsetStreamDisplay = new TextWidget(zoffset.ToString("0.##"), pointSize: theme.DefaultFontSize)
{
AutoExpandBoundsToText = true,
TextColor = ActiveTheme.Instance.PrimaryTextColor,

@ -1 +1 @@
Subproject commit e7daeeaccf8e8257bc4e6ef7623805df965e232a
Subproject commit 20e512ecddb0612aa1ca9bbfe512a13401093f85