From 1553b16dcac77000131baf51f00de80195e82c2d Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 15:24:28 -0800 Subject: [PATCH 01/12] Use alternate mechanism to sync DockingTabControl width - Issue MatterHackers/MCCentral#2632 DockingTabControl failing to persist width --- CustomWidgets/DockingTabControl.cs | 40 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/CustomWidgets/DockingTabControl.cs b/CustomWidgets/DockingTabControl.cs index 7d3c0c16a..b354283fb 100644 --- a/CustomWidgets/DockingTabControl.cs +++ b/CustomWidgets/DockingTabControl.cs @@ -53,6 +53,8 @@ namespace MatterHackers.MatterControl.CustomWidgets private PrinterConfig printer; private ThemeConfig theme; + private ResizeContainer resizePage; + public DockingTabControl(GuiWidget widgetTodockTo, DockSide dockSide, PrinterConfig printer) : base (FlowDirection.TopToBottom) { @@ -132,23 +134,28 @@ namespace MatterHackers.MatterControl.CustomWidgets return imageWidget; } - public override double Width - { - get => this.PageWidth; - set => this.PageWidth = value; - } - // Clamped to MinDockingWidth or value - double PageWidth + private double _constrainedWidth; + private double ConstrainedWidth { get => Math.Max(MinDockingWidth, printer.ViewState.SliceSettingsWidth); - set => printer.ViewState.SliceSettingsWidth = Math.Max(MinDockingWidth, value); + set + { + if (value > MinDockingWidth + && _constrainedWidth != value) + { + _constrainedWidth = value; + printer.ViewState.SliceSettingsWidth = value; + } + } } private void Rebuild() { settingsButtons.Clear(); - Focus(); + + this.Focus(); + foreach (var nameWidget in allTabs) { nameWidget.Value.Parent?.RemoveChild(nameWidget.Value); @@ -162,11 +169,15 @@ namespace MatterHackers.MatterControl.CustomWidgets { var resizePage = new ResizeContainer(this) { - Width = PageWidth, + Width = this.ConstrainedWidth, VAnchor = VAnchor.Stretch, SpliterBarColor = theme.SplitterBackground, SplitterWidth = theme.SplitterWidth, - MinimumSize = new Vector2(this.MinDockingWidth, 200) + MinimumSize = new Vector2(this.MinDockingWidth, 0) + }; + resizePage.BoundsChanged += (s, e) => + { + this.ConstrainedWidth = resizePage.Width; }; tabControl = new SimpleTabs(this.CreatePinButton()) @@ -251,7 +262,7 @@ namespace MatterHackers.MatterControl.CustomWidgets var resizeContainer = new ResizeContainer(this) { - Width = PageWidth, + Width = this.ConstrainedWidth, VAnchor = VAnchor.Stretch, HAnchor = HAnchor.Right, SpliterBarColor = spliterColor, @@ -260,15 +271,16 @@ namespace MatterHackers.MatterControl.CustomWidgets resizeContainer.AddChild(new DockingWindowContent(this, kvp.Value, tabTitle) { BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor, - Width = PageWidth + Width = this.ConstrainedWidth }); settingsButtons.Add(settingsButton); + settingsButton.DebugShowBounds = true; settingsButton.PopupContent = resizeContainer; settingsButton.Click += (s, e) => { - resizeContainer.Width = PageWidth; + resizeContainer.Width = this.ConstrainedWidth; }; settingsButton.PopupLayoutEngine = new UnpinnedLayoutEngine(settingsButton.PopupContent, widgetTodockTo, DockSide); From 07676d327adbe6e232a95c047892df8300f66a56 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 16:12:08 -0800 Subject: [PATCH 02/12] Reuse SettingsItem for PowerControls toggle switch row --- .../ApplicationSettings/SettingsItem.cs | 26 ++++++--- .../ControlWidgets/PowerControls.cs | 53 ++++++++++++------- PrinterControls/ManualPrinterControls.cs | 6 +++ 3 files changed, 60 insertions(+), 25 deletions(-) diff --git a/ConfigurationPage/ApplicationSettings/SettingsItem.cs b/ConfigurationPage/ApplicationSettings/SettingsItem.cs index 2b5087649..552a7e0d2 100644 --- a/ConfigurationPage/ApplicationSettings/SettingsItem.cs +++ b/ConfigurationPage/ApplicationSettings/SettingsItem.cs @@ -18,14 +18,25 @@ namespace MatterHackers.MatterControl.ConfigurationPage private static Color menuTextColor = Color.Black; - public SettingsItem(string text, ToggleSwitchConfig toggleSwitchConfig = null, GuiWidget optionalControls = null, ImageBuffer iconImage = null, bool enforceGutter = true) - : this(text, CreateToggleSwitch(toggleSwitchConfig), optionalControls, iconImage, enforceGutter) + public SettingsItem(string text, Color textColor, ToggleSwitchConfig toggleSwitchConfig = null, GuiWidget optionalControls = null, ImageBuffer iconImage = null, bool enforceGutter = true) + : this(text, textColor, CreateToggleSwitch(toggleSwitchConfig, textColor), optionalControls, iconImage, enforceGutter) { } - public SettingsItem (string text, GuiWidget settingsControls, GuiWidget optionalControls = null, ImageBuffer imageBuffer = null, bool enforceGutter = true) + public SettingsItem(string text, ToggleSwitchConfig toggleSwitchConfig = null, GuiWidget optionalControls = null, ImageBuffer iconImage = null, bool enforceGutter = true) + : this(text, CreateToggleSwitch(toggleSwitchConfig, menuTextColor), optionalControls, iconImage, enforceGutter) + { + } + + public SettingsItem(string text, GuiWidget settingsControls, GuiWidget optionalControls = null, ImageBuffer imageBuffer = null, bool enforceGutter = true) + : this(text, menuTextColor, settingsControls, optionalControls, imageBuffer, enforceGutter) + { + } + + public SettingsItem (string text, Color textColor, GuiWidget settingsControls, GuiWidget optionalControls = null, ImageBuffer imageBuffer = null, bool enforceGutter = true) : base (FlowDirection.LeftToRight) { + this.SettingsControl = settingsControls; this.HAnchor = HAnchor.Stretch; this.MinimumSize = new Vector2(0, 40); @@ -48,10 +59,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage }); } - this.AddChild(new TextWidget(text) + this.AddChild(new TextWidget(text, textColor: textColor) { AutoExpandBoundsToText = true, - TextColor = menuTextColor, VAnchor = VAnchor.Center, }); @@ -68,14 +78,16 @@ namespace MatterHackers.MatterControl.ConfigurationPage } } - private static CheckBox CreateToggleSwitch(ToggleSwitchConfig toggleSwitchConfig) + public GuiWidget SettingsControl { get; } + + private static CheckBox CreateToggleSwitch(ToggleSwitchConfig toggleSwitchConfig, Color textColor) { if (toggleSwitchConfig == null) { return null; } - var toggleSwitch = ImageButtonFactory.CreateToggleSwitch(toggleSwitchConfig.Checked, menuTextColor); + var toggleSwitch = ImageButtonFactory.CreateToggleSwitch(toggleSwitchConfig.Checked, textColor); toggleSwitch.VAnchor = VAnchor.Center; toggleSwitch.Margin = new BorderDouble(left: 16); toggleSwitch.CheckedStateChanged += (sender, e) => diff --git a/PrinterControls/ControlWidgets/PowerControls.cs b/PrinterControls/ControlWidgets/PowerControls.cs index af4ebca97..c1ec9abd5 100644 --- a/PrinterControls/ControlWidgets/PowerControls.cs +++ b/PrinterControls/ControlWidgets/PowerControls.cs @@ -31,6 +31,7 @@ using System; using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.Localizations; +using MatterHackers.MatterControl.ConfigurationPage; using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.SlicerConfiguration; @@ -39,44 +40,60 @@ namespace MatterHackers.MatterControl.PrinterControls public class PowerControls : FlowLayoutWidget { private EventHandler unregisterEvents; - private CheckBox atxPowertoggleSwitch; private PrinterConfig printer; + private SettingsItem settingsItem; - private PowerControls(PrinterConfig printer) + private PowerControls(PrinterConfig printer, ThemeConfig theme) : base(FlowDirection.TopToBottom) { this.printer = printer; - this.HAnchor = HAnchor.Stretch; - this.VAnchor = VAnchor.Stretch; - this.Visible = printer.Settings.GetValue(SettingsKey.has_power_control); this.Enabled = printer.Connection.PrinterIsConnected; - atxPowertoggleSwitch = ImageButtonFactory.CreateToggleSwitch(false); - atxPowertoggleSwitch.HAnchor = HAnchor.Left; - atxPowertoggleSwitch.Margin = new BorderDouble(6, 0, 6, 6); - atxPowertoggleSwitch.CheckedStateChanged += (sender, e) => - { - printer.Connection.AtxPowerEnabled = atxPowertoggleSwitch.Checked; - }; - this.AddChild(atxPowertoggleSwitch); + this.AddChild( + settingsItem = new SettingsItem( + "ATX Power Control".Localize(), + theme.Colors.PrimaryTextColor, + new SettingsItem.ToggleSwitchConfig() + { + Checked = printer.Connection.AtxPowerEnabled, + ToggleAction = (itemChecked) => + { + if (printer.Connection.AtxPowerEnabled != itemChecked) + { + printer.Connection.AtxPowerEnabled = itemChecked; + } + } + }, + enforceGutter: false)); printer.Connection.CommunicationStateChanged.RegisterEvent((s, e) => { - this.Visible = printer.Settings.GetValue(SettingsKey.has_power_control); - this.Enabled = printer.Connection.PrinterIsConnected; + this.Enabled = printer.Connection.PrinterIsConnected + && printer.Settings.GetValue(SettingsKey.has_power_control); }, ref unregisterEvents); printer.Connection.AtxPowerStateChanged.RegisterEvent((s, e) => { - this.atxPowertoggleSwitch.Checked = printer.Connection.AtxPowerEnabled; + if (settingsItem.SettingsControl is ICheckbox toggleSwitch) + { + if (toggleSwitch.Checked != printer.Connection.AtxPowerEnabled) + { + toggleSwitch.Checked = printer.Connection.AtxPowerEnabled; + } + } }, ref unregisterEvents); } public static SectionWidget CreateSection(PrinterConfig printer, ThemeConfig theme) { + if (!printer.Settings.GetValue(SettingsKey.has_power_control)) + { + return null; + } + return new SectionWidget( - "ATX Power Control".Localize(), - new PowerControls(printer), + "Power Control".Localize(), + new PowerControls(printer, theme), theme); } diff --git a/PrinterControls/ManualPrinterControls.cs b/PrinterControls/ManualPrinterControls.cs index 10fb97927..5200db205 100644 --- a/PrinterControls/ManualPrinterControls.cs +++ b/PrinterControls/ManualPrinterControls.cs @@ -116,6 +116,12 @@ namespace MatterHackers.MatterControl public GuiWidget RegisterSection(SectionWidget sectionWidget) { + // Section not active due to constraints + if (sectionWidget == null) + { + return null; + } + ApplicationController.Instance.Theme.BoxStyleSectionWidget(sectionWidget); column.AddChild(sectionWidget); From 04e01f464ca02bbd016cfbaaec076dcd4daadabe Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 16:30:50 -0800 Subject: [PATCH 03/12] Use standard button --- PrinterControls/ControlWidgets/MacroControls.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PrinterControls/ControlWidgets/MacroControls.cs b/PrinterControls/ControlWidgets/MacroControls.cs index 1370d2fde..d17eb3e4c 100644 --- a/PrinterControls/ControlWidgets/MacroControls.cs +++ b/PrinterControls/ControlWidgets/MacroControls.cs @@ -56,8 +56,11 @@ namespace MatterHackers.MatterControl.PrinterControls foreach (GCodeMacro macro in printer.Settings.GetMacros(MacroUiLocation.Controls)) { - Button macroButton = theme.HomingButtons.Generate(GCodeMacro.FixMacroName(macro.Name)); - macroButton.Margin = new BorderDouble(right: 5); + var macroButton = new TextButton(GCodeMacro.FixMacroName(macro.Name), theme) + { + BackgroundColor = theme.MinimalShade, + Margin = new BorderDouble(right: 5) + }; macroButton.Click += (s, e) => macro.Run(printer.Connection); this.AddChild(macroButton); From 5676067eb2bd8e782f171c14fdc4ea2d78728301 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 18:03:10 -0800 Subject: [PATCH 04/12] Revise contrast levels in DialogPage --- SetupWizard/DialogPage.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SetupWizard/DialogPage.cs b/SetupWizard/DialogPage.cs index c2549a678..7efb157f1 100644 --- a/SetupWizard/DialogPage.cs +++ b/SetupWizard/DialogPage.cs @@ -58,6 +58,7 @@ namespace MatterHackers.MatterControl public DialogPage(string cancelButtonText = null) { + var theme = ApplicationController.Instance.Theme; if (cancelButtonText == null) { cancelButtonText = "Cancel".Localize(); @@ -77,7 +78,7 @@ namespace MatterHackers.MatterControl mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom) { Padding = new BorderDouble(12, 12, 12, 0), - BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor + BackgroundColor = theme.Colors.PrimaryBackgroundColor }; mainContainer.AnchorAll(); @@ -90,7 +91,7 @@ namespace MatterHackers.MatterControl HAnchor = HAnchor.Stretch }; - headerLabel = new WrappedTextWidget("Setup Wizard".Localize(), pointSize: 24, textColor: ActiveTheme.Instance.SecondaryAccentColor) + headerLabel = new WrappedTextWidget("Setup Wizard".Localize(), pointSize: 24, textColor: theme.Colors.SecondaryAccentColor) { HAnchor = HAnchor.Stretch }; @@ -100,7 +101,7 @@ namespace MatterHackers.MatterControl contentRow = new FlowLayoutWidget(FlowDirection.TopToBottom) { Padding = new BorderDouble(10), - BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor, + BackgroundColor = theme.MinimalShade, HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Stretch }; @@ -125,7 +126,7 @@ namespace MatterHackers.MatterControl headerRow.Padding = new BorderDouble(0, 3, 0, 3); headerLabel.TextWidget.PointSize = 14; - headerLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; + headerLabel.TextColor = theme.Colors.PrimaryTextColor; contentRow.Padding = new BorderDouble(5); footerRow.Margin = new BorderDouble(0, 3); } From 12c65499dd40f9c9ffb515d58754d382ef7def60 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 18:03:35 -0800 Subject: [PATCH 05/12] Use common button colors --- PrinterControls/ControlWidgets/MovementControls.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PrinterControls/ControlWidgets/MovementControls.cs b/PrinterControls/ControlWidgets/MovementControls.cs index ca705020f..775c0b0a8 100644 --- a/PrinterControls/ControlWidgets/MovementControls.cs +++ b/PrinterControls/ControlWidgets/MovementControls.cs @@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.PrinterControls var homeIcon = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", IconColor.Theme), theme) { ToolTipText = ToolTipText = "Home X, Y and Z".Localize(), - BackgroundColor = theme.ActiveTabColor, + BackgroundColor = theme.MinimalShade, Margin = theme.ButtonSpacing }; homeIcon.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.XYZ); @@ -157,7 +157,7 @@ namespace MatterHackers.MatterControl.PrinterControls var homeXButton = new TextButton("X", theme) { ToolTipText = "Home X".Localize(), - BackgroundColor = theme.ActiveTabColor, + BackgroundColor = theme.MinimalShade, Margin = theme.ButtonSpacing }; homeXButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.X); @@ -166,7 +166,7 @@ namespace MatterHackers.MatterControl.PrinterControls var homeYButton = new TextButton("Y", theme) { ToolTipText = "Home Y".Localize(), - BackgroundColor = theme.ActiveTabColor, + BackgroundColor = theme.MinimalShade, Margin = theme.ButtonSpacing }; homeYButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.Y); @@ -175,7 +175,7 @@ namespace MatterHackers.MatterControl.PrinterControls var homeZButton = new TextButton("Z", theme) { ToolTipText = "Home Z".Localize(), - BackgroundColor = theme.ActiveTabColor, + BackgroundColor = theme.MinimalShade, Margin = theme.ButtonSpacing }; homeZButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.Z); @@ -199,7 +199,7 @@ namespace MatterHackers.MatterControl.PrinterControls // Create 'Release' button var disableMotors = new TextButton("Release".Localize(), theme) { - BackgroundColor = theme.ActiveTabColor, + BackgroundColor = theme.MinimalShade, }; disableMotors.Click += (s, e) => { From 1f8d5614e08d5169f824e332ed874f70303bd972 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 18:04:54 -0800 Subject: [PATCH 06/12] Remove unused button factories --- ApplicationView/ThemeConfig.cs | 115 ---------------------------- PartPreviewWindow/ViewControls3D.cs | 2 - 2 files changed, 117 deletions(-) diff --git a/ApplicationView/ThemeConfig.cs b/ApplicationView/ThemeConfig.cs index 91b54c10a..283c42866 100644 --- a/ApplicationView/ThemeConfig.cs +++ b/ApplicationView/ThemeConfig.cs @@ -69,12 +69,10 @@ namespace MatterHackers.MatterControl public LinkButtonFactory LinkButtonFactory { get; private set; } public LinkButtonFactory HelpLinkFactory { get; private set; } - public TextImageButtonFactory ExpandMenuOptionFactory; public TextImageButtonFactory WhiteButtonFactory; public TextImageButtonFactory ButtonFactory { get; private set; } public TextImageButtonFactory SmallMarginButtonFactory { get; private set; } - public TextImageButtonFactory RadioButtons { get; private set; } public TextImageButtonFactory WizardButtons { get; private set; } /// @@ -87,15 +85,8 @@ namespace MatterHackers.MatterControl /// public TextImageButtonFactory GrayButtonFactory { get; private set; } - public TextImageButtonFactory imageConverterExpandMenuOptionFactory; - - public TextImageButtonFactory imageConverterButtonFactory; - public TextImageButtonFactory imageConverterUnlockButtonFactory; - public Color TabBodyBackground { get; private set; } - public TextImageButtonFactory ViewControlsButtonFactory { get; private set; } - public Color SplitterBackground { get; private set; } = new Color(0, 0, 0, 60); public int SplitterWidth => (int)(6 * (GuiWidget.DeviceScale <= 1 ? GuiWidget.DeviceScale : GuiWidget.DeviceScale * 1.4)); @@ -124,12 +115,10 @@ namespace MatterHackers.MatterControl sectionWidget.BackgroundColor = this.MinimalShade; } - public TextImageButtonFactory HomingButtons { get; private set; } public TextImageButtonFactory MicroButton { get; private set; } public TextImageButtonFactory MicroButtonMenu { get; private set; } public BorderDouble ButtonSpacing { get; set; } = new BorderDouble(3, 0, 0, 0); - public TextImageButtonFactory NoMarginWhite { get; private set; } public BorderDouble ToolbarPadding { get; set; } = 3; public double ButtonHeight { get; internal set; } = 32; @@ -208,12 +197,6 @@ namespace MatterHackers.MatterControl this.ButtonFactory = new TextImageButtonFactory(commonOptions); - this.NoMarginWhite = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions) - { - Margin = 0, - AllowThemeToAdjustImage = false - }); - this.SmallMarginButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions) { Margin = new BorderDouble(8, 0), @@ -229,13 +212,6 @@ namespace MatterHackers.MatterControl #endif }); - this.RadioButtons = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions) - { - BorderWidth = 1, - CheckedBorderColor = Color.White, - AllowThemeToAdjustImage = false - }); - var commonGray = new ButtonFactoryOptions(commonOptions) { NormalTextColor = Color.Black, @@ -256,15 +232,6 @@ namespace MatterHackers.MatterControl NormalFillColor = Color.Gray }); - this.ViewControlsButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions) - { - DisabledTextColor = theme.PrimaryTextColor, - FixedHeight = 0, - FixedWidth = 0, - AllowThemeToAdjustImage = false, - CheckedBorderColor = Color.White - }); - this.MicroButton = new TextImageButtonFactory(new ButtonFactoryOptions() { FixedHeight = 20 * GuiWidget.DeviceScale, @@ -304,71 +271,9 @@ namespace MatterHackers.MatterControl BorderWidth = 1, }); - - ExpandMenuOptionFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions) - { - HoverTextColor = theme.PrimaryTextColor, - HoverFillColor = new Color(255, 255, 255, 50), - - PressedTextColor = theme.PrimaryTextColor, - PressedFillColor = new Color(255, 255, 255, 50), - - DisabledTextColor = theme.PrimaryTextColor, - DisabledFillColor = new Color(255, 255, 255, 50), - FixedWidth = sideBarButtonWidth, - }); - #endregion #region ImageConverter - imageConverterButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions) - { - FixedWidth = 185, - FixedHeight = 30, - - NormalFillColor = Color.White, - NormalTextColor = Color.Black, - NormalBorderColor = new Color(theme.PrimaryTextColor, 200), - - HoverFillColor = new Color(255, 255, 255, 200), - HoverTextColor = Color.Black, - HoverBorderColor = new Color(theme.PrimaryTextColor, 200), - - BorderWidth = 1, - }); - - imageConverterUnlockButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions) - { - FixedWidth = 185, - FixedHeight = 30, - - NormalFillColor = theme.PrimaryAccentColor.SetLightness(.8).ToColor(), - NormalTextColor = Color.Black, - NormalBorderColor = new Color(theme.PrimaryAccentColor.SetLightness(.8).ToColor(), 200), - - HoverFillColor = theme.PrimaryAccentColor.SetLightness(.9).ToColor(), - HoverTextColor = Color.Black, - HoverBorderColor = new Color(theme.PrimaryAccentColor.SetLightness(.9).ToColor(), 200), - - BorderWidth = 1, - }); - - imageConverterExpandMenuOptionFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions) - { - FixedWidth = 200, - - NormalTextColor = theme.PrimaryTextColor, - - HoverTextColor = theme.PrimaryTextColor, - HoverFillColor = new Color(255, 255, 255, 50), - - DisabledTextColor = theme.PrimaryTextColor, - DisabledFillColor = new Color(255, 255, 255, 50), - - PressedTextColor = theme.PrimaryTextColor, - PressedFillColor = new Color(255, 255, 255, 50), - }); - // TODO: Need to remain based default ButtonFactionOptions constructor until reviewed for styling issues var disableableControlOptions = new ButtonFactoryOptions() { @@ -383,14 +288,6 @@ namespace MatterHackers.MatterControl }; this.DisableableControlBase = new TextImageButtonFactory(disableableControlOptions); - this.HomingButtons = new TextImageButtonFactory(new ButtonFactoryOptions(disableableControlOptions) - { - BorderWidth = 1, - NormalBorderColor = new Color(theme.PrimaryTextColor, 200), - HoverBorderColor = new Color(theme.PrimaryTextColor, 200), - NormalFillColor = new Color(180, 180, 180), - }); - #endregion this.LinkButtonFactory = new LinkButtonFactory() @@ -461,18 +358,6 @@ namespace MatterHackers.MatterControl return popupMenu; } - - internal TabControl CreateTabControl(int height = 1) - { - var tabControl = new TabControl(separator: new HorizontalLine(alpha: 50, height: height)); - tabControl.TabBar.BorderColor = Color.Transparent; // theme.SecondaryTextColor; - tabControl.TabBar.Margin = 0; - tabControl.TabBar.Padding = 0; - tabControl.TextPointSize = FontSize12; - - return tabControl; - } - private static ImageBuffer ColorCircle(int size, Color color) { ImageBuffer imageBuffer = new ImageBuffer(size, size); diff --git a/PartPreviewWindow/ViewControls3D.cs b/PartPreviewWindow/ViewControls3D.cs index becef8477..71de61715 100644 --- a/PartPreviewWindow/ViewControls3D.cs +++ b/PartPreviewWindow/ViewControls3D.cs @@ -161,8 +161,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow var commonMargin = theme.ButtonSpacing; - var buttonFactory = theme.RadioButtons; - double height = theme.ButtonFactory.Options.FixedHeight; var homeButton = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", IconColor.Theme), theme) From 78ad78647af4fdfd0bdd24f83b2d541ac730dc74 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 21:21:22 -0800 Subject: [PATCH 07/12] New view icons --- StaticData/Icons/ViewTransformControls/2d.png | Bin 618 -> 1042 bytes StaticData/Icons/ViewTransformControls/3d.png | Bin 614 -> 1289 bytes .../Icons/ViewTransformControls/model.png | Bin 590 -> 1267 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/StaticData/Icons/ViewTransformControls/2d.png b/StaticData/Icons/ViewTransformControls/2d.png index 5a98c63b6536247a8d789b22a5f6c7e506e37716..964e530ad7d11e561fc1859b1ab7617fa97fa062 100644 GIT binary patch literal 1042 zcmeAS@N?(olHy`uVBq!ia0y~yU=RUe4mJh`hTcwDUIqq6>CBLbk_cZPtK|G#y~LFK zq*T3%+yVv=u(7WwNKDR7Em25HP0!4;ReHaBzmh^`img((sjq==fpcm`rbks#YH*cb zNODznvSo^ry&acLg;hmvL2hbEqC!P(PF}H9g{>0UT&uidE0D0hk^)#sNw%$0gl~X? zbAC~(f~lUVo`I4bmx4`EN}5%WiyKsPQA(PvQbtKhft9{~d3m{Bxv^e;QM$gNrKP35 zfswwEk#12+nr?ArUP)qwZeFo6$OwoTE~&-IMVSR9nfZANATtw_@=Hr>m6Y^Bmgs{- zf?V9}xNP*njsZE$jtk-A)Vvg1r6MJJJ1MW#uNW8@n=+l91B!#(ofJG>oy`m_&CGO- z^b8poG$xi#-0jWmD9~=dcu|ImqpprllZ&>pq0@z9N{)*ch#5AmSKGO#MMbV$T_}e& z+R<^#$Iut?3)Uv+a&#$mv`*c+sJE?Hk5i>%W@`HWzi-cMu;$+8;db&BZ`_GzJi0Pm zJD!P)#rm$ll6c(B`rL{|t1oYUESPocdb3OS-O4plTOa@1dac4Ke8IZNijY84=L)Ba zth)ia_e9@?T)Md9!_I>JYT_dMwttD}yszUo^~dofT_L`vvzl+bLJQY)P2Dn0blUXC z=hCiC`Bb}R`VHZoJ0l~jQ_2<#tGO_UPwo*sa$Z6C(cg*>h6>hMPpZ3r8n5wMrxd5! ze~e4>lEjzpU20c_H>tV$pExmL`>+4o*H;yt2w#=Q@9?-gv+j%2Wj>K@zMp^JFyU4Y z_|Fr*)9c?WL7w`qeX$qsv_H7f(*3$i>~`~M-4|6si=(z^Ts^%-b@GQgwp{KDh1|N{ zOXp2JZ&}-NqOImC?;ClC`A4j$)iZwEo4#4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b`t?U&HYnWn)T;%U*N%6Vd3ttD!ccP?0^ zt@Me_!j#d9$A&rX==D4NIt=$2U0i-WEvh^xu~~2R<(C312Nzt-kXVqpwpQeD*8$rH ziUNKj+2>jQT}&`g;Aqm|Xfn-yYx=y651DgV|9UL`t((b7#aj%lvweGgASog%| zl@nKOd%S~vPfz0VpWUgOfZq}-GO!^J$52z;mx_+yrOfq>|h-u1}lI`j< a>zPB2PP4rD;#VlBtnzgAb6Mw<&;$VHISYRP literal 590 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}jKx9jP7LeL$-HD>U|>mi z^mSxl*x1kgCy|wbfq}EYBeIx*f$uN~Gak=hk;1^hAX(xXQ4*Y=R#Ki=l*&+$n3-3i zmzP?iV4`QBXK3bb@+cF_gk;h}9k3^1H(!`?; zy+>0f_)2b&;5qd`S2%IA$C8eS87`jpPFZVK{`_|(*+TZX?e}|&ul&54zN37{`TsWO z|NogU{o(O*dv&gr9zTA4X}@^Lb;dEiYZv-bDyBtDS->3iMKoICxRBq+mc%QH%!%q! zni)sT^gi?mPEqE)#Vb0!mrdq@oV$dx+@pt9o-YonzBAyqt+kr7Xwm5fb8j4xo)*X& zzVZmSSOCX%|Alh{H{RMS{bEIuK*_3)jB~fn%3(NqLHM7TX)?E30o&hmA|)Y?$3+tM zI9o4@%W%?rl(6XfMkcK}RZh0t>D4tN->ITWTanN z@i}1eP2ESCj7H4M?|s^)1yh3=rR=26Pc8^`uq!!uLpS4VFyk!V z=86LXO_E9XFKS$UyPbL;DV^Afo({9S)uTf^1k`~KTc5=6oy+Vkwg rW92$uhz1|7{1tzpU%p?MqlPJ@ci(Tx<5_hK3=9mOu6{1-oD!M<`pxs3 From 7bccbe558711e6b54172b7d48be822c5515a6e45 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 22:11:43 -0800 Subject: [PATCH 08/12] Revise update widgets - Issue MatterHackers/MCCentral#2330 update page has bad margin --- AboutPage/CheckForUpdatesPage.cs | 185 ++++++++++-------- AboutPage/UpdateControlView.cs | 72 ++++--- CustomWidgets/SimpleButton.cs | 3 + .../TerminalWindow/TextScrollWidget.cs | 5 +- 4 files changed, 145 insertions(+), 120 deletions(-) diff --git a/AboutPage/CheckForUpdatesPage.cs b/AboutPage/CheckForUpdatesPage.cs index 6375a457a..721b0a4bb 100644 --- a/AboutPage/CheckForUpdatesPage.cs +++ b/AboutPage/CheckForUpdatesPage.cs @@ -12,94 +12,51 @@ namespace MatterHackers.MatterControl.AboutPage public CheckForUpdatesPage() : base("Close".Localize()) { - AnchorAll(); - - this.WindowTitle = this.HeaderText = "Check for Update".Localize(); - var theme = ApplicationController.Instance.Theme; - FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); - topToBottom.AnchorAll(); - topToBottom.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; - Padding = 0; + this.WindowTitle = this.HeaderText = "Check for Update".Localize(); + this.Padding = 0; + this.AnchorAll(); - FlowLayoutWidget currentFeedAndDropDownContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); - currentFeedAndDropDownContainer.VAnchor = VAnchor.Fit; - currentFeedAndDropDownContainer.HAnchor = HAnchor.Stretch; - currentFeedAndDropDownContainer.Margin = new BorderDouble(0, 5, 0, 0); - currentFeedAndDropDownContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; - - UpdateControlView updateStatusWidget = new UpdateControlView(ApplicationController.Instance.Theme); + // Clear padding so UpdateControlView toolbar appears like toolbar + contentRow.Padding = 0; - TextWidget feedLabel = new TextWidget("Update Channel".Localize(), pointSize: 12); - feedLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; - feedLabel.VAnchor = VAnchor.Center; - feedLabel.Margin = new BorderDouble(left: 5); + // Update Status Widget + contentRow.AddChild( + new UpdateControlView(ApplicationController.Instance.Theme)); - var releaseOptionsDropList = new DropDownList("Development", ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200); - releaseOptionsDropList.HAnchor = HAnchor.Stretch; - - releaseOptionsDropList.AddItem("Stable".Localize(), "release"); - releaseOptionsDropList.AddItem("Beta".Localize(), "pre-release"); - releaseOptionsDropList.AddItem("Alpha".Localize(), "development"); - - var acceptableUpdateFeedTypeValues = new List() { "release", "pre-release", "development" }; - - string currentUpdateFeedType = UserSettings.Instance.get(UserSettingsKey.UpdateFeedType); - if (acceptableUpdateFeedTypeValues.IndexOf(currentUpdateFeedType) == -1) + var contentPanel = new FlowLayoutWidget(FlowDirection.TopToBottom) { - UserSettings.Instance.set(UserSettingsKey.UpdateFeedType, "release"); - } - - releaseOptionsDropList.SelectedValue = currentUpdateFeedType; - releaseOptionsDropList.SelectionChanged += (s, e) => - { - string releaseCode = releaseOptionsDropList.SelectedValue; - if (releaseCode != UserSettings.Instance.get(UserSettingsKey.UpdateFeedType)) - { - UserSettings.Instance.set(UserSettingsKey.UpdateFeedType, releaseCode); - } - - UpdateControlData.Instance.CheckForUpdateUserRequested(); + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Stretch, + Padding = 8 }; + contentRow.AddChild(contentPanel); - var currentBuildInfo = new TextWidget("Current Build".Localize() + $" : {VersionInfo.Instance.BuildVersion}"); - currentBuildInfo.HAnchor = HAnchor.Stretch; - currentBuildInfo.Margin = new BorderDouble(left: 5, bottom: 15, top: 20); - currentBuildInfo.TextColor = ActiveTheme.Instance.PrimaryTextColor; + var currentBuildInfo = new TextWidget("Current Build".Localize() + $" : {VersionInfo.Instance.BuildVersion}") + { + HAnchor = HAnchor.Stretch, + Margin = new BorderDouble(left: 5, bottom: 15, top: 20), + TextColor = theme.Colors.PrimaryTextColor + }; + contentPanel.AddChild(currentBuildInfo); - FlowLayoutWidget additionalInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); - additionalInfoContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; - additionalInfoContainer.HAnchor = HAnchor.Stretch; - additionalInfoContainer.Padding = new BorderDouble(left: 6, top: 6); + var currentFeedAndDropDownContainer = new FlowLayoutWidget(FlowDirection.LeftToRight) + { + VAnchor = VAnchor.Fit, + HAnchor = HAnchor.Stretch, + }; + contentPanel.AddChild(currentFeedAndDropDownContainer); - string aboutUpdateChannel = "Changing your update channel will change the version of MatterControl that you receive when updating".Localize() + ":"; - var updateChannelLabel = new WrappedTextWidget(aboutUpdateChannel); - updateChannelLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; - updateChannelLabel.HAnchor = HAnchor.Stretch; - updateChannelLabel.Margin = new BorderDouble(bottom: 20); - additionalInfoContainer.AddChild(updateChannelLabel); + var feedLabel = new TextWidget("Update Channel".Localize(), pointSize: 12) + { + TextColor = theme.Colors.PrimaryTextColor, + VAnchor = VAnchor.Center, + Margin = new BorderDouble(left: 5) + }; + currentFeedAndDropDownContainer.AddChild(feedLabel); - string stableFeedInfoText = "Stable: The current release version of MatterControl (recommended).".Localize(); - var stableInfoLabel = new WrappedTextWidget(stableFeedInfoText); - stableInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; - stableInfoLabel.HAnchor = HAnchor.Stretch; - stableInfoLabel.Margin = new BorderDouble(bottom: 10); - additionalInfoContainer.AddChild(stableInfoLabel); - - string betaFeedInfoText = "Beta: The release candidate version of MatterControl.".Localize(); - var betaInfoLabel = new WrappedTextWidget(betaFeedInfoText); - betaInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; - betaInfoLabel.HAnchor = HAnchor.Stretch; - betaInfoLabel.Margin = new BorderDouble(bottom: 10); - additionalInfoContainer.AddChild(betaInfoLabel); - - string alphaFeedInfoText = "Alpha: The in development version of MatterControl.".Localize(); - var alphaInfoLabel = new WrappedTextWidget(alphaFeedInfoText); - alphaInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; - alphaInfoLabel.HAnchor = HAnchor.Stretch; - alphaInfoLabel.Margin = new BorderDouble(bottom: 10); - additionalInfoContainer.AddChild(alphaInfoLabel); + FlowLayoutWidget additionalInfoContainer = null; Button whatsThisLink = theme.HelpLinkFactory.Generate("What's this?".Localize()); whatsThisLink.VAnchor = VAnchor.Center; @@ -118,22 +75,78 @@ namespace MatterHackers.MatterControl.AboutPage } }); }; - - topToBottom.AddChild(updateStatusWidget); - topToBottom.AddChild(currentBuildInfo); - currentFeedAndDropDownContainer.AddChild(feedLabel); currentFeedAndDropDownContainer.AddChild(whatsThisLink); + currentFeedAndDropDownContainer.AddChild(new HorizontalSpacer()); + + + var acceptableUpdateFeedTypeValues = new List() { "release", "pre-release", "development" }; + + string currentUpdateFeedType = UserSettings.Instance.get(UserSettingsKey.UpdateFeedType); + if (acceptableUpdateFeedTypeValues.IndexOf(currentUpdateFeedType) == -1) + { + UserSettings.Instance.set(UserSettingsKey.UpdateFeedType, "release"); + } + + var releaseOptionsDropList = new DropDownList("Development", theme.Colors.PrimaryTextColor, maxHeight: 200) + { + HAnchor = HAnchor.Fit + }; + releaseOptionsDropList.AddItem("Stable".Localize(), "release"); + releaseOptionsDropList.AddItem("Beta".Localize(), "pre-release"); + releaseOptionsDropList.AddItem("Alpha".Localize(), "development"); + releaseOptionsDropList.SelectedValue = currentUpdateFeedType; + releaseOptionsDropList.SelectionChanged += (s, e) => + { + string releaseCode = releaseOptionsDropList.SelectedValue; + if (releaseCode != UserSettings.Instance.get(UserSettingsKey.UpdateFeedType)) + { + UserSettings.Instance.set(UserSettingsKey.UpdateFeedType, releaseCode); + } + + UpdateControlData.Instance.CheckForUpdateUserRequested(); + }; currentFeedAndDropDownContainer.AddChild(releaseOptionsDropList); - topToBottom.AddChild(currentFeedAndDropDownContainer); - topToBottom.AddChild(additionalInfoContainer); + additionalInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom) + { + BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor, + HAnchor = HAnchor.Stretch, + Padding = new BorderDouble(left: 6, top: 6), + Visible = false + }; + additionalInfoContainer.AddChild( + new WrappedTextWidget("Changing your update channel will change the version of MatterControl that you receive when updating".Localize() + ":") + { + TextColor = theme.Colors.PrimaryTextColor, + HAnchor = HAnchor.Stretch, + Margin = new BorderDouble(bottom: 20) + }); - contentRow.AddChild(topToBottom); + additionalInfoContainer.AddChild( + new WrappedTextWidget("Stable: The current release version of MatterControl (recommended)".Localize()) + { + TextColor = theme.Colors.PrimaryTextColor, + HAnchor = HAnchor.Stretch, + Margin = new BorderDouble(bottom: 10) + }); - additionalInfoContainer.Visible = false; + additionalInfoContainer.AddChild( + new WrappedTextWidget("Beta: The release candidate version of MatterControl".Localize()) + { + TextColor = theme.Colors.PrimaryTextColor, + HAnchor = HAnchor.Stretch, + Margin = new BorderDouble(bottom: 10) + }); - this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; + additionalInfoContainer.AddChild( + new WrappedTextWidget("Alpha: The in development version of MatterControl".Localize()) + { + TextColor = theme.Colors.PrimaryTextColor, + HAnchor = HAnchor.Stretch, + Margin = new BorderDouble(bottom: 10) + }); + contentPanel.AddChild(additionalInfoContainer); } } } diff --git a/AboutPage/UpdateControlView.cs b/AboutPage/UpdateControlView.cs index 466701b9a..d4d9b2814 100644 --- a/AboutPage/UpdateControlView.cs +++ b/AboutPage/UpdateControlView.cs @@ -29,9 +29,11 @@ either expressed or implied, of the FreeBSD Project. using System; using MatterHackers.Agg; +using MatterHackers.Agg.Platform; using MatterHackers.Agg.UI; using MatterHackers.Localizations; using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.VectorMath; namespace MatterHackers.MatterControl { @@ -47,40 +49,51 @@ namespace MatterHackers.MatterControl public UpdateControlView(ThemeConfig theme) { this.HAnchor = HAnchor.Stretch; - this.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; - this.Padding = new BorderDouble(6, 5); + this.BackgroundColor = theme.MinimalShade; + this.Padding = theme.ToolbarPadding.Clone(left: 8); - updateStatusText = new TextWidget(string.Format(""), textColor: ActiveTheme.Instance.PrimaryTextColor); - updateStatusText.AutoExpandBoundsToText = true; - updateStatusText.VAnchor = VAnchor.Center; - this.AddChild(updateStatusText); + this.AddChild(updateStatusText = new TextWidget(string.Format(""), textColor: ActiveTheme.Instance.PrimaryTextColor) + { + AutoExpandBoundsToText = true, + VAnchor = VAnchor.Center + }); this.AddChild(new HorizontalSpacer()); - checkUpdateLink = theme.GrayButtonFactory.Generate("Check for Update".Localize()); - checkUpdateLink.VAnchor = VAnchor.Center; + checkUpdateLink = new IconButton(AggContext.StaticData.LoadIcon("fa-refresh_14.png", IconColor.Theme), ApplicationController.Instance.Theme) + { + ToolTipText = "Check for Update".Localize(), + BackgroundColor = theme.MinimalShade, + Cursor = Cursors.Hand, + Visible = false + }; checkUpdateLink.Click += (s, e) => { UpdateControlData.Instance.CheckForUpdateUserRequested(); }; - checkUpdateLink.Visible = false; this.AddChild(checkUpdateLink); - downloadUpdateLink = theme.GrayButtonFactory.Generate("Download Update".Localize()); - downloadUpdateLink.Visible = false; - downloadUpdateLink.VAnchor = VAnchor.Center; + this.MinimumSize = new Vector2(0, checkUpdateLink.Height); + + downloadUpdateLink = new TextButton("Download Update".Localize(), theme) + { + BackgroundColor = theme.MinimalShade, + Visible = false + }; downloadUpdateLink.Click += (s, e) => { downloadUpdateLink.Visible = false; - updateStatusText.Text = string.Format("Retrieving download info...".Localize()); + updateStatusText.Text = "Retrieving download info...".Localize(); UpdateControlData.Instance.InitiateUpdateDownload(); }; this.AddChild(downloadUpdateLink); - installUpdateLink = theme.GrayButtonFactory.Generate("Install Update".Localize()); - installUpdateLink.Visible = false; - installUpdateLink.VAnchor = VAnchor.Center; + installUpdateLink = new TextButton("Install Update".Localize(), theme) + { + BackgroundColor = theme.MinimalShade, + Visible = false + }; installUpdateLink.Click += (s, e) => { try @@ -88,22 +101,20 @@ namespace MatterHackers.MatterControl if (!UpdateControlData.Instance.InstallUpdate()) { installUpdateLink.Visible = false; - updateStatusText.Text = string.Format("Oops! Unable to install update.".Localize()); + updateStatusText.Text = "Oops! Unable to install update.".Localize(); } } catch { GuiWidget.BreakInDebugger(); installUpdateLink.Visible = false; - updateStatusText.Text = string.Format("Oops! Unable to install update.".Localize()); + updateStatusText.Text = "Oops! Unable to install update.".Localize(); } }; this.AddChild(installUpdateLink); UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(UpdateStatusChanged, ref unregisterEvents); - this.MinimumSize = new VectorMath.Vector2(0, 50); - this.UpdateStatusChanged(null, null); } @@ -113,25 +124,25 @@ namespace MatterHackers.MatterControl base.OnClosed(e); } - string recommendedUpdateAvailable = "There is a recommended update available.".Localize(); - string requiredUpdateAvailable = "There is a required update available.".Localize(); + string recommendedUpdateAvailable = "There is a recommended update available".Localize(); + string requiredUpdateAvailable = "There is a required update available".Localize(); private void UpdateStatusChanged(object sender, EventArgs e) { switch (UpdateControlData.Instance.UpdateStatus) { case UpdateControlData.UpdateStatusStates.MayBeAvailable: - updateStatusText.Text = string.Format("New updates may be available.".Localize()); + updateStatusText.Text = "New updates may be available".Localize(); checkUpdateLink.Visible = true; break; case UpdateControlData.UpdateStatusStates.CheckingForUpdate: updateStatusText.Text = "Checking for updates...".Localize(); - checkUpdateLink.Visible = false; + //checkUpdateLink.Visible = false; break; case UpdateControlData.UpdateStatusStates.UnableToConnectToServer: - updateStatusText.Text = "Oops! Unable to connect to server.".Localize(); + updateStatusText.Text = "Oops! Unable to connect to server".Localize(); downloadUpdateLink.Visible = false; installUpdateLink.Visible = false; checkUpdateLink.Visible = true; @@ -152,20 +163,21 @@ namespace MatterHackers.MatterControl break; case UpdateControlData.UpdateStatusStates.UpdateDownloading: - string newText = "Downloading updates...".Localize(); - newText = "{0} {1}%".FormatWith(newText, UpdateControlData.Instance.DownloadPercent); - updateStatusText.Text = newText; + updateStatusText.Text = string.Format( + "{0} {1}%", + "Downloading updates...".Localize(), + UpdateControlData.Instance.DownloadPercent); break; case UpdateControlData.UpdateStatusStates.ReadyToInstall: - updateStatusText.Text = string.Format("New updates are ready to install.".Localize()); + updateStatusText.Text = "New updates are ready to install".Localize(); downloadUpdateLink.Visible = false; installUpdateLink.Visible = true; checkUpdateLink.Visible = false; break; case UpdateControlData.UpdateStatusStates.UpToDate: - updateStatusText.Text = string.Format("Your application is up-to-date.".Localize()); + updateStatusText.Text = "Your application is up-to-date".Localize(); downloadUpdateLink.Visible = false; installUpdateLink.Visible = false; checkUpdateLink.Visible = true; diff --git a/CustomWidgets/SimpleButton.cs b/CustomWidgets/SimpleButton.cs index 2098c0894..006cbbe61 100644 --- a/CustomWidgets/SimpleButton.cs +++ b/CustomWidgets/SimpleButton.cs @@ -242,6 +242,7 @@ namespace MatterHackers.MatterControl.CustomWidgets this.VAnchor = VAnchor.Absolute | VAnchor.Center; this.Height = theme.ButtonFactory.Options.FixedHeight; this.Padding = theme.ButtonFactory.Options.Margin; + this.TextColor = textColor; this.AddChild(textWidget = new TextWidget(text, pointSize: theme.ButtonFactory.Options.FontSize, textColor: textColor) { @@ -250,6 +251,8 @@ namespace MatterHackers.MatterControl.CustomWidgets }); } + public Color TextColor { get; } + public override string Text { get => base.Text; diff --git a/PrinterControls/TerminalWindow/TextScrollWidget.cs b/PrinterControls/TerminalWindow/TextScrollWidget.cs index 04e851954..263c184a8 100644 --- a/PrinterControls/TerminalWindow/TextScrollWidget.cs +++ b/PrinterControls/TerminalWindow/TextScrollWidget.cs @@ -176,10 +176,7 @@ namespace MatterHackers.MatterControl public override void OnClosed(ClosedEventArgs e) { - if (unregisterEvents != null) - { - unregisterEvents(this, null); - } + unregisterEvents?.Invoke(this, null); base.OnClosed(e); } From 4168f1dfe66f4f7cd6df2d788df26ccb07b7623e Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 22:25:36 -0800 Subject: [PATCH 09/12] Move bed menu, extract creation to helper function --- PartPreviewWindow/PartTabPage.cs | 3 +- PartPreviewWindow/ViewControls3D.cs | 73 +++++++++++++++-------------- 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/PartPreviewWindow/PartTabPage.cs b/PartPreviewWindow/PartTabPage.cs index 028656661..c36e39312 100644 --- a/PartPreviewWindow/PartTabPage.cs +++ b/PartPreviewWindow/PartTabPage.cs @@ -57,13 +57,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow bool isPrinterType = this is PrinterTabPage; - viewControls3D = new ViewControls3D(sceneContext, theme, sceneContext.Scene.UndoBuffer) + viewControls3D = new ViewControls3D(sceneContext, theme, sceneContext.Scene.UndoBuffer, isPrinterType) { //BackgroundColor = new Color(0, 0, 0, theme.OverlayAlpha), VAnchor = VAnchor.Top | VAnchor.Fit, HAnchor = HAnchor.Left | HAnchor.Stretch, Visible = true, - IsPrinterMode = isPrinterType }; viewControls3D.ResetView += (sender, e) => { diff --git a/PartPreviewWindow/ViewControls3D.cs b/PartPreviewWindow/ViewControls3D.cs index 71de61715..aa022dd1d 100644 --- a/PartPreviewWindow/ViewControls3D.cs +++ b/PartPreviewWindow/ViewControls3D.cs @@ -163,6 +163,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow double height = theme.ButtonFactory.Options.FixedHeight; + this.AddChild(CreateBedMenu(sceneContext, theme)); + var homeButton = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", IconColor.Theme), theme) { ToolTipText = "Reset View".Localize(), @@ -370,41 +372,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow this.AddChild(button); } - var buttonView = new FlowLayoutWidget(); - buttonView.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon((IsPrinterMode) ? "bed.png" : "cube.png", IconColor.Theme)) - { - VAnchor = VAnchor.Center, - Margin = theme.ButtonSpacing, - }); - - var buttonText = (IsPrinterMode) ? "Bed".Localize() : "Part".Localize(); - buttonView.AddChild(new TextButton(buttonText, theme) - { - Padding = new BorderDouble(8, 4, 0, 4) - }); - - this.AddChild(new HorizontalSpacer()); - - var overflowMenu = new OverflowMenu(buttonView) - { - Name = "Bed Options Menu", - DynamicPopupContent = () => theme.CreatePopupMenu(this.BedMenuActions(sceneContext)), - DrawArrow = true, - AlignToRightEdge = true, - Margin = new BorderDouble(right: theme.ButtonSpacing.Left), - }; - - // HACK: Fix left padding to improve style. Ideally fix this in the underlying button - var firstChild = overflowMenu.Children.First(); - firstChild.Margin = firstChild.Margin.Clone(left: 8); - - overflowMenu.Load += (s, e) => - { - var firstBackgroundColor = this.Parents().Where(p => p.BackgroundColor.Alpha0To1 == 1).FirstOrDefault()?.BackgroundColor; - overflowMenu.BackgroundColor = firstBackgroundColor ?? Color.Transparent; - }; - this.AddChild(overflowMenu); - if (printer != null) { printer.Bed.Scene.SelectionChanged += Scene_SelectionChanged; @@ -439,6 +406,42 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } } + private OverflowMenu CreateBedMenu(BedConfig sceneContext, ThemeConfig theme) + { + var buttonView = new FlowLayoutWidget(); + buttonView.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon((IsPrinterMode) ? "bed.png" : "cube.png", IconColor.Theme)) + { + VAnchor = VAnchor.Center, + Margin = theme.ButtonSpacing, + }); + + var buttonText = (IsPrinterMode) ? "Bed".Localize() : "Part".Localize(); + buttonView.AddChild(new TextButton(buttonText, theme) + { + Padding = new BorderDouble(8, 4, 0, 4) + }); + + var overflowMenu = new OverflowMenu(buttonView) + { + Name = "Bed Options Menu", + DynamicPopupContent = () => theme.CreatePopupMenu(this.BedMenuActions(sceneContext)), + DrawArrow = true, + AlignToRightEdge = true, + Margin = new BorderDouble(right: theme.ButtonSpacing.Left), + }; + + // HACK: Fix left padding to improve style. Ideally fix this in the underlying button + var firstChild = overflowMenu.Children.First(); + firstChild.Margin = firstChild.Margin.Clone(left: 8); + + overflowMenu.Load += (s, e) => + { + var firstBackgroundColor = this.Parents().Where(p => p.BackgroundColor.Alpha0To1 == 1).FirstOrDefault()?.BackgroundColor; + overflowMenu.BackgroundColor = firstBackgroundColor ?? Color.Transparent; + }; + return overflowMenu; + } + private void SwitchModes_Click(object sender, MouseEventArgs e) { if (sender is GuiWidget widget) From 027bee90cd5d90e06fed18dc2395afd53d32ceae Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 22:26:05 -0800 Subject: [PATCH 10/12] Fix incorrect IsPrinterMode state during startup --- PartPreviewWindow/ViewControls3D.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PartPreviewWindow/ViewControls3D.cs b/PartPreviewWindow/ViewControls3D.cs index aa022dd1d..9234ba431 100644 --- a/PartPreviewWindow/ViewControls3D.cs +++ b/PartPreviewWindow/ViewControls3D.cs @@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private ViewControls3DButtons activeTransformState = ViewControls3DButtons.Rotate; private List<(GuiWidget button, SceneSelectionOperation operation)> operationButtons; - public bool IsPrinterMode { get; set; } + public bool IsPrinterMode { get; } public ViewControls3DButtons ActiveButton { @@ -152,10 +152,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow this.view3DWidget = view3DWidget; } - public ViewControls3D(BedConfig sceneContext, ThemeConfig theme, UndoBuffer undoBuffer) + public ViewControls3D(BedConfig sceneContext, ThemeConfig theme, UndoBuffer undoBuffer, bool isPrinterType) : base (theme) { this.printer = sceneContext.Printer; + this.IsPrinterMode = isPrinterType; string iconPath; From be0f2c24af191d03d22183857b3c921742a31d9a Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 22:26:24 -0800 Subject: [PATCH 11/12] Add top border to selection panel --- PartPreviewWindow/View3D/View3DWidget.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index f1a9eaf9f..4ce4ae3c9 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -164,6 +164,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow SpliterBarColor = theme.SplitterBackground, SplitterWidth = theme.SplitterWidth, Visible = false, + Border = new BorderDouble(top: 1), + BorderColor = theme.MinimalShade }; this.InteractionLayer.AddChild(selectedObjectContainer); From f32b99fc33b2e33cf0d91330f253555e2eb4e7ea Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 11 Jan 2018 22:32:29 -0800 Subject: [PATCH 12/12] Consistent SectionWidget spacing --- SlicerConfiguration/SliceSettingsWidget.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 4b211dc99..a0e4c5a31 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -203,7 +203,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { VAnchor = VAnchor.Fit, HAnchor = HAnchor.Stretch, - Padding = new BorderDouble(10, 10, 13, 6), + Padding = new BorderDouble(10, 0, 12, 10), }; bool isFirstSection = true; @@ -242,12 +242,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration string groupName = (group.Name.Contains("!hidden")) ? "" : group.Name; - var sectionWidget = new SectionWidget(groupName, groupPanel, theme, expanded: expanded) - { - Margin = new BorderDouble(bottom: 8), - }; - + var sectionWidget = new SectionWidget(groupName, groupPanel, theme, expanded: expanded); theme.BoxStyleSectionWidget(sectionWidget); + sectionWidget.Margin = new BorderDouble(bottom: 10); if (string.IsNullOrEmpty(groupName)) {