From 511da77d5160ddcf8da44b2799e7e24b1c3790ab Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 12 Jan 2018 12:21:29 -0800 Subject: [PATCH 1/5] Fix spelling --- ActionBar/TemperatureWidgetBed.cs | 6 +++--- ActionBar/TemperatureWidgetExtruder.cs | 6 +++--- PartPreviewWindow/View3D/Actions/SubtractAndReplace.cs | 2 +- PartPreviewWindow/View3D/Actions/SubtractEditor.cs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ActionBar/TemperatureWidgetBed.cs b/ActionBar/TemperatureWidgetBed.cs index 63bde8edf..bbba725fd 100644 --- a/ActionBar/TemperatureWidgetBed.cs +++ b/ActionBar/TemperatureWidgetBed.cs @@ -104,7 +104,7 @@ namespace MatterHackers.MatterControl.ActionBar }, enforceGutter: false)); - heatToggle = hotendRow.Decendants().FirstOrDefault(); + heatToggle = hotendRow.Descendants().FirstOrDefault(); heatToggle.Name = "Toggle Heater"; int tabIndex = 0; @@ -138,8 +138,8 @@ namespace MatterHackers.MatterControl.ActionBar } }; - var valueField = row.Decendants().FirstOrDefault(); - var settingsRow = row.Decendants().FirstOrDefault(); + var valueField = row.Descendants().FirstOrDefault(); + var settingsRow = row.Descendants().FirstOrDefault(); ActiveSliceSettings.SettingChanged.RegisterEvent((s, e) => { if (e is StringEventArgs stringEvent) diff --git a/ActionBar/TemperatureWidgetExtruder.cs b/ActionBar/TemperatureWidgetExtruder.cs index e3d85f447..112f92cb2 100644 --- a/ActionBar/TemperatureWidgetExtruder.cs +++ b/ActionBar/TemperatureWidgetExtruder.cs @@ -239,7 +239,7 @@ namespace MatterHackers.MatterControl.ActionBar }, enforceGutter: false)); - heatToggle = hotendRow.Decendants().FirstOrDefault(); + heatToggle = hotendRow.Descendants().FirstOrDefault(); heatToggle.Name = "Toggle Heater"; int tabIndex = 0; @@ -272,9 +272,9 @@ namespace MatterHackers.MatterControl.ActionBar } }; - var valueField = row.Decendants().FirstOrDefault(); + var valueField = row.Descendants().FirstOrDefault(); valueField.Name = "Temperature Input"; - var settingsRow = row.Decendants().FirstOrDefault(); + var settingsRow = row.Descendants().FirstOrDefault(); ActiveSliceSettings.SettingChanged.RegisterEvent((s, e) => { if (e is StringEventArgs stringEvent) diff --git a/PartPreviewWindow/View3D/Actions/SubtractAndReplace.cs b/PartPreviewWindow/View3D/Actions/SubtractAndReplace.cs index 59402e81d..6ac0c58be 100644 --- a/PartPreviewWindow/View3D/Actions/SubtractAndReplace.cs +++ b/PartPreviewWindow/View3D/Actions/SubtractAndReplace.cs @@ -173,7 +173,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D if (!opperationApplied && !selectionHasBeenMade) { // select the last item - if (tabContainer.Decendants().Where((d) => d is ICheckbox).Last() is ICheckbox firstCheckBox) + if (tabContainer.Descendants().Where((d) => d is ICheckbox).Last() is ICheckbox firstCheckBox) { firstCheckBox.Checked = true; } diff --git a/PartPreviewWindow/View3D/Actions/SubtractEditor.cs b/PartPreviewWindow/View3D/Actions/SubtractEditor.cs index c4d382920..9f80ce52f 100644 --- a/PartPreviewWindow/View3D/Actions/SubtractEditor.cs +++ b/PartPreviewWindow/View3D/Actions/SubtractEditor.cs @@ -154,7 +154,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D if (!opperationApplied && !selectionHasBeenMade) { // select the last item - if (tabContainer.Decendants().Where((d) => d is ICheckbox).Last() is ICheckbox firstCheckBox) + if (tabContainer.Descendants().Where((d) => d is ICheckbox).Last() is ICheckbox firstCheckBox) { firstCheckBox.Checked = true; } From 98aee75b267d984f2a648bdcf5e7dd2978d2760e Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 12 Jan 2018 12:22:08 -0800 Subject: [PATCH 2/5] Add runtime TextWidget size debugging to the Inspector --- Submodules/agg-sharp | 2 +- Utilities/InspectForm.Designer.cs | 48 ++++++++++++++++++++----------- Utilities/InspectForm.cs | 12 ++++++++ 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 20e512ecd..c42218762 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 20e512ecddb0612aa1ca9bbfe512a13401093f85 +Subproject commit c42218762da3a066c82049de13a496b1af5c4166 diff --git a/Utilities/InspectForm.Designer.cs b/Utilities/InspectForm.Designer.cs index b97e1a98b..055a4943c 100644 --- a/Utilities/InspectForm.Designer.cs +++ b/Utilities/InspectForm.Designer.cs @@ -35,6 +35,7 @@ this.tabPage2 = new System.Windows.Forms.TabPage(); this.sceneTreeView = new System.Windows.Forms.TreeView(); this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); + this.debugTextWidget = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -48,18 +49,19 @@ // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.splitContainer1.Margin = new System.Windows.Forms.Padding(2); this.splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.debugTextWidget); this.splitContainer1.Panel1.Controls.Add(this.tabControl1); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.propertyGrid1); - this.splitContainer1.Size = new System.Drawing.Size(831, 632); - this.splitContainer1.SplitterDistance = 554; + this.splitContainer1.Size = new System.Drawing.Size(913, 632); + this.splitContainer1.SplitterDistance = 608; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 0; // @@ -71,7 +73,7 @@ this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(554, 632); + this.tabControl1.Size = new System.Drawing.Size(608, 632); this.tabControl1.TabIndex = 1; this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged); // @@ -80,8 +82,8 @@ this.tabPage1.Controls.Add(this.aggTreeView); this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); - this.tabPage1.Size = new System.Drawing.Size(546, 606); + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(600, 606); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "SystemWindow"; this.tabPage1.UseVisualStyleBackColor = true; @@ -93,9 +95,9 @@ this.aggTreeView.FullRowSelect = true; this.aggTreeView.HideSelection = false; this.aggTreeView.Location = new System.Drawing.Point(3, 3); - this.aggTreeView.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.aggTreeView.Margin = new System.Windows.Forms.Padding(2); this.aggTreeView.Name = "aggTreeView"; - this.aggTreeView.Size = new System.Drawing.Size(540, 600); + this.aggTreeView.Size = new System.Drawing.Size(594, 600); this.aggTreeView.TabIndex = 1; this.aggTreeView.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.AggTreeView_DrawNode); this.aggTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.AggTreeView_AfterSelect); @@ -105,8 +107,8 @@ this.tabPage2.Controls.Add(this.sceneTreeView); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); - this.tabPage2.Size = new System.Drawing.Size(547, 606); + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(546, 606); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Scene"; this.tabPage2.UseVisualStyleBackColor = true; @@ -118,9 +120,9 @@ this.sceneTreeView.FullRowSelect = true; this.sceneTreeView.HideSelection = false; this.sceneTreeView.Location = new System.Drawing.Point(3, 3); - this.sceneTreeView.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.sceneTreeView.Margin = new System.Windows.Forms.Padding(2); this.sceneTreeView.Name = "sceneTreeView"; - this.sceneTreeView.Size = new System.Drawing.Size(541, 600); + this.sceneTreeView.Size = new System.Drawing.Size(540, 600); this.sceneTreeView.TabIndex = 2; this.sceneTreeView.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.SceneTreeView_DrawNode); this.sceneTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.SceneTreeView_AfterSelect); @@ -130,22 +132,35 @@ this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGrid1.LineColor = System.Drawing.SystemColors.ControlDark; this.propertyGrid1.Location = new System.Drawing.Point(0, 0); - this.propertyGrid1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.propertyGrid1.Margin = new System.Windows.Forms.Padding(2); this.propertyGrid1.Name = "propertyGrid1"; - this.propertyGrid1.Size = new System.Drawing.Size(274, 632); + this.propertyGrid1.Size = new System.Drawing.Size(302, 632); this.propertyGrid1.TabIndex = 0; this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid1_PropertyValueChanged); // + // debugTextWidget + // + this.debugTextWidget.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.debugTextWidget.AutoSize = true; + this.debugTextWidget.Location = new System.Drawing.Point(489, 3); + this.debugTextWidget.Name = "debugTextWidget"; + this.debugTextWidget.Size = new System.Drawing.Size(116, 17); + this.debugTextWidget.TabIndex = 2; + this.debugTextWidget.Text = "Debug TextWidget"; + this.debugTextWidget.UseVisualStyleBackColor = true; + this.debugTextWidget.CheckedChanged += new System.EventHandler(this.debugTextWidget_CheckedChanged); + // // InspectForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(831, 632); + this.ClientSize = new System.Drawing.Size(913, 632); this.Controls.Add(this.splitContainer1); - this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "InspectForm"; this.Text = "InspectForm"; this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); @@ -165,5 +180,6 @@ private System.Windows.Forms.TreeView aggTreeView; private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.TreeView sceneTreeView; + private System.Windows.Forms.CheckBox debugTextWidget; } } diff --git a/Utilities/InspectForm.cs b/Utilities/InspectForm.cs index 6abf293c5..9aad0e0cb 100644 --- a/Utilities/InspectForm.cs +++ b/Utilities/InspectForm.cs @@ -477,5 +477,17 @@ namespace MatterHackers.MatterControl scene.DebugItem = null; } } + + private void debugTextWidget_CheckedChanged(object sender, EventArgs e) + { + TextWidget.DebugShowSize = debugTextWidget.Checked; + + + foreach(var widget in this.inspectedSystemWindow.Descendants()) + { + widget.Invalidate(); + } + + } } } From 13cc147dfe658bdaa42216670b26ca1bf145ec0e Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 12 Jan 2018 12:57:53 -0800 Subject: [PATCH 3/5] Caller specified pointSize for DropDownLists --- AboutPage/CheckForUpdatesPage.cs | 2 +- ActionBar/PrinterSelector.cs | 3 ++- ActionBar/TemperatureWidgetBed.cs | 2 +- ActionBar/TemperatureWidgetExtruder.cs | 2 +- .../ApplicationSettingsView.cs | 2 +- CustomWidgets/ConfigurePrinterWidget.cs | 2 +- PartPreviewWindow/PlusTab/PlusTabPage.cs | 2 +- PartPreviewWindow/View3D/GridOptionsPanel.cs | 2 +- .../View3D/PrinterBar/PrintPopupMenu.cs | 2 +- .../View3D/SideBar/ScaleControl.cs | 2 +- PrinterControls/MacroDetailPage.cs | 16 ++++++++------ .../PrinterConnections/PrinterChooser.cs | 10 ++------- SlicerConfiguration/PresetSelectorWidget.cs | 22 +++++++++---------- SlicerConfiguration/SliceSettingsWidget.cs | 14 +++++++----- SlicerConfiguration/UIFields/ComPortField.cs | 7 +++--- .../UIFields/DropMenuWrappedField.cs | 2 +- SlicerConfiguration/UIFields/IpAddessField.cs | 12 +++++----- SlicerConfiguration/UIFields/ListField.cs | 3 ++- Submodules/agg-sharp | 2 +- .../MatterControl/SliceSettingsFieldTests.cs | 2 +- 20 files changed, 57 insertions(+), 54 deletions(-) diff --git a/AboutPage/CheckForUpdatesPage.cs b/AboutPage/CheckForUpdatesPage.cs index 721b0a4bb..26c550e2a 100644 --- a/AboutPage/CheckForUpdatesPage.cs +++ b/AboutPage/CheckForUpdatesPage.cs @@ -88,7 +88,7 @@ namespace MatterHackers.MatterControl.AboutPage UserSettings.Instance.set(UserSettingsKey.UpdateFeedType, "release"); } - var releaseOptionsDropList = new DropDownList("Development", theme.Colors.PrimaryTextColor, maxHeight: 200) + var releaseOptionsDropList = new DropDownList("Development", theme.Colors.PrimaryTextColor, maxHeight: 200, pointSize: theme.DefaultFontSize) { HAnchor = HAnchor.Fit }; diff --git a/ActionBar/PrinterSelector.cs b/ActionBar/PrinterSelector.cs index d8e4a2615..9343a78fd 100644 --- a/ActionBar/PrinterSelector.cs +++ b/ActionBar/PrinterSelector.cs @@ -42,7 +42,8 @@ namespace MatterHackers.MatterControl private EventHandler unregisterEvents; int lastSelectedIndex = -1; - public PrinterSelector() : base("Printers".Localize() + "... ", ActiveTheme.Instance.PrimaryTextColor) + public PrinterSelector(ThemeConfig theme) + : base("Printers".Localize() + "... ", theme.Colors.PrimaryTextColor, pointSize: theme.DefaultFontSize) { Rebuild(); diff --git a/ActionBar/TemperatureWidgetBed.cs b/ActionBar/TemperatureWidgetBed.cs index bbba725fd..60bf7e48e 100644 --- a/ActionBar/TemperatureWidgetBed.cs +++ b/ActionBar/TemperatureWidgetBed.cs @@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl.ActionBar var settingsContext = new SettingsContext(printer, null, NamedSettingsLayers.All); var settingsData = SliceSettingsOrganizer.Instance.GetSettingsData(SettingsKey.bed_temperature); - var row = SliceSettingsWidget.CreateItemRow(settingsData, settingsContext, printer, Color.Black, ref tabIndex); + var row = SliceSettingsWidget.CreateItemRow(settingsData, settingsContext, printer, Color.Black, ApplicationController.Instance.Theme, ref tabIndex); container.AddChild(row); // add in the temp graph diff --git a/ActionBar/TemperatureWidgetExtruder.cs b/ActionBar/TemperatureWidgetExtruder.cs index 112f92cb2..f516c67d7 100644 --- a/ActionBar/TemperatureWidgetExtruder.cs +++ b/ActionBar/TemperatureWidgetExtruder.cs @@ -246,7 +246,7 @@ namespace MatterHackers.MatterControl.ActionBar var settingsContext = new SettingsContext(printer, null, NamedSettingsLayers.All); // TODO: make this be for the correct extruder var settingsData = SliceSettingsOrganizer.Instance.GetSettingsData(TemperatureKey); - var row = SliceSettingsWidget.CreateItemRow(settingsData, settingsContext, printer, Color.Black, ref tabIndex); + var row = SliceSettingsWidget.CreateItemRow(settingsData, settingsContext, printer, Color.Black, ApplicationController.Instance.Theme, ref tabIndex); container.AddChild(row); diff --git a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs index 8aefdcc86..07b9f9d3a 100644 --- a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs +++ b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs @@ -161,7 +161,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage #if !__ANDROID__ { // ThumbnailRendering - var thumbnailsModeDropList = new DropDownList("", ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200) + var thumbnailsModeDropList = new DropDownList("", ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200, pointSize: ApplicationController.Instance.Theme.DefaultFontSize) { TextColor = menuTextColor, }; diff --git a/CustomWidgets/ConfigurePrinterWidget.cs b/CustomWidgets/ConfigurePrinterWidget.cs index 184bd65e6..3458f7af4 100644 --- a/CustomWidgets/ConfigurePrinterWidget.cs +++ b/CustomWidgets/ConfigurePrinterWidget.cs @@ -43,7 +43,7 @@ namespace MatterHackers.MatterControl : base(FlowDirection.TopToBottom) { int tabIndex = 0; - var rowItem = sliceSettingsWidget.CreateItemRow(SliceSettingsOrganizer.SettingsData["printer_name"], ref tabIndex); + var rowItem = sliceSettingsWidget.CreateItemRow(SliceSettingsOrganizer.SettingsData["printer_name"],ref tabIndex, theme); var firstChild = rowItem.Children.FirstOrDefault(); firstChild.HAnchor = HAnchor.Absolute; diff --git a/PartPreviewWindow/PlusTab/PlusTabPage.cs b/PartPreviewWindow/PlusTab/PlusTabPage.cs index 09c434203..f4bb77e15 100644 --- a/PartPreviewWindow/PlusTab/PlusTabPage.cs +++ b/PartPreviewWindow/PlusTab/PlusTabPage.cs @@ -134,7 +134,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab var existingPrinterSection = CreateSection(leftContent, "Open Existing".Localize() + ":"); - var printerSelector = new PrinterSelector() + var printerSelector = new PrinterSelector(theme) { Margin = new BorderDouble(left: 15) }; diff --git a/PartPreviewWindow/View3D/GridOptionsPanel.cs b/PartPreviewWindow/View3D/GridOptionsPanel.cs index 834cd00f4..4df79c5b9 100644 --- a/PartPreviewWindow/View3D/GridOptionsPanel.cs +++ b/PartPreviewWindow/View3D/GridOptionsPanel.cs @@ -57,7 +57,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { 5, "5" }, }; - var dropDownList = new DropDownList("Custom", ActiveTheme.Instance.PrimaryTextColor, Direction.Down) + var dropDownList = new DropDownList("Custom", ActiveTheme.Instance.PrimaryTextColor, Direction.Down, ApplicationController.Instance.Theme.DefaultFontSize) { TextColor = Color.Black, Margin = new BorderDouble(35, 15, 35, 5), diff --git a/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs b/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs index 0b03d2dd3..b9fa645f2 100644 --- a/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs +++ b/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs @@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow foreach (var key in new[] { "layer_height", "fill_density", "support_material", "create_raft", "spiral_vase", "layer_to_pause" }) { var settingsData = SliceSettingsOrganizer.Instance.GetSettingsData(key); - var row = SliceSettingsWidget.CreateItemRow(settingsData, settingsContext, printer, Color.Black, ref tabIndex); + var row = SliceSettingsWidget.CreateItemRow(settingsData, settingsContext, printer, Color.Black, theme, ref tabIndex); optionsPanel.AddChild(row); } diff --git a/PartPreviewWindow/View3D/SideBar/ScaleControl.cs b/PartPreviewWindow/View3D/SideBar/ScaleControl.cs index 169d7b282..52fa1e68b 100644 --- a/PartPreviewWindow/View3D/SideBar/ScaleControl.cs +++ b/PartPreviewWindow/View3D/SideBar/ScaleControl.cs @@ -207,7 +207,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { 10, "cm to mm (10)"}, }; - var dropDownList = new DropDownList("Scale".Localize(), theme.Colors.PrimaryTextColor, Direction.Down) + var dropDownList = new DropDownList("Scale".Localize(), theme.Colors.PrimaryTextColor, Direction.Down, pointSize: theme.DefaultFontSize) { HAnchor = HAnchor.Left }; diff --git a/PrinterControls/MacroDetailPage.cs b/PrinterControls/MacroDetailPage.cs index 531481be4..3ae7d28af 100644 --- a/PrinterControls/MacroDetailPage.cs +++ b/PrinterControls/MacroDetailPage.cs @@ -46,6 +46,8 @@ namespace MatterHackers.MatterControl public MacroDetailPage(GCodeMacro gcodeMacro, PrinterSettings printerSettings) { + var theme = ApplicationController.Instance.Theme; + // Form validation fields MHTextEditWidget macroNameInput; MHTextEditWidget macroCommandInput; @@ -61,7 +63,7 @@ namespace MatterHackers.MatterControl contentRow.AddChild(new TextWidget("Macro Name".Localize() + ":", 0, 0, 12) { - TextColor = ActiveTheme.Instance.PrimaryTextColor, + TextColor = theme.Colors.PrimaryTextColor, HAnchor = HAnchor.Stretch, Margin = new BorderDouble(0, 0, 0, 1) }); @@ -73,14 +75,14 @@ namespace MatterHackers.MatterControl contentRow.AddChild(macroNameError = new TextWidget("Give the macro a name".Localize() + ".", 0, 0, 10) { - TextColor = ActiveTheme.Instance.PrimaryTextColor, + TextColor = theme.Colors.PrimaryTextColor, HAnchor = HAnchor.Stretch, Margin = elementMargin }); contentRow.AddChild(new TextWidget("Macro Commands".Localize() + ":", 0, 0, 12) { - TextColor = ActiveTheme.Instance.PrimaryTextColor, + TextColor = theme.Colors.PrimaryTextColor, HAnchor = HAnchor.Stretch, Margin = new BorderDouble(0, 0, 0, 1) }); @@ -96,7 +98,7 @@ namespace MatterHackers.MatterControl contentRow.AddChild(macroCommandError = new TextWidget("This should be in 'G-Code'".Localize() + ".", 0, 0, 10) { - TextColor = ActiveTheme.Instance.PrimaryTextColor, + TextColor = theme.Colors.PrimaryTextColor, HAnchor = HAnchor.Stretch, Margin = elementMargin }); @@ -109,13 +111,13 @@ namespace MatterHackers.MatterControl container.AddChild(new TextWidget("Where to show this macro:") { - TextColor = ActiveTheme.Instance.PrimaryTextColor, + TextColor = theme.Colors.PrimaryTextColor, VAnchor = VAnchor.Center }); - var macroUiLocation = new DropDownList("Default", ActiveTheme.Instance.PrimaryTextColor, Direction.Up) + var macroUiLocation = new DropDownList("Default", theme.Colors.PrimaryTextColor, Direction.Up, pointSize: theme.DefaultFontSize) { - TextColor = ActiveTheme.Instance.PrimaryTextColor, + TextColor = theme.Colors.PrimaryTextColor, Margin = new BorderDouble(5, 0), VAnchor = VAnchor.Center }; diff --git a/PrinterControls/PrinterConnections/PrinterChooser.cs b/PrinterControls/PrinterConnections/PrinterChooser.cs index bb2d4f105..114440b92 100644 --- a/PrinterControls/PrinterConnections/PrinterChooser.cs +++ b/PrinterControls/PrinterConnections/PrinterChooser.cs @@ -27,15 +27,9 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ -using MatterHackers.Agg.Platform; -using MatterHackers.Agg.UI; -using MatterHackers.Localizations; using System.Collections.Generic; -using MatterHackers.MatterControl.SettingsManagement; -using System.IO; -using System.Linq; using MatterHackers.Agg; -using System; +using MatterHackers.Agg.UI; namespace MatterHackers.MatterControl { @@ -44,7 +38,7 @@ namespace MatterHackers.MatterControl private List> listSource; public BoundDropList(string noSelectionString, int maxHeight = 0) - : base(noSelectionString, ActiveTheme.Instance.PrimaryTextColor, maxHeight: maxHeight) + : base(noSelectionString, ActiveTheme.Instance.PrimaryTextColor, maxHeight: maxHeight, pointSize: ApplicationController.Instance.Theme.DefaultFontSize) { } diff --git a/SlicerConfiguration/PresetSelectorWidget.cs b/SlicerConfiguration/PresetSelectorWidget.cs index fe47319a0..853eea29c 100644 --- a/SlicerConfiguration/PresetSelectorWidget.cs +++ b/SlicerConfiguration/PresetSelectorWidget.cs @@ -35,7 +35,6 @@ using MatterHackers.Agg; using MatterHackers.Agg.Platform; using MatterHackers.Agg.UI; using MatterHackers.Localizations; -using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.SlicerConfiguration @@ -46,6 +45,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration private string defaultMenuItemText = "- none -".Localize(); private Button editButton; private NamedSettingsLayers layerType; + private ThemeConfig theme; private PrinterConfig printer; private GuiWidget pullDownContainer; private EventHandler unregisterEvents; @@ -55,9 +55,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public PresetSelectorWidget(PrinterConfig printer, string label, Color accentColor, NamedSettingsLayers layerType, bool whiteBackground = false) : base(FlowDirection.TopToBottom) { + theme = ApplicationController.Instance.Theme; + this.printer = printer; this.whiteBackground = whiteBackground; - Name = label; + this.Name = label; ActiveSliceSettings.MaterialPresetChanged += ActiveSliceSettings_MaterialPresetChanged; @@ -75,7 +77,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration this.HAnchor = HAnchor.Stretch; this.VAnchor = VAnchor.Fit; - this.BackgroundColor = ActiveTheme.Instance.TertiaryBackgroundColor; + this.BackgroundColor = theme.Colors.TertiaryBackgroundColor; GuiWidget accentBar = new GuiWidget(7, 3) { @@ -84,9 +86,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration }; // Section Label - this.AddChild(new TextWidget(label) + this.AddChild(new TextWidget(label, pointSize: theme.DefaultFontSize) { - TextColor = whiteBackground ? Color.Black : ActiveTheme.Instance.PrimaryTextColor, + TextColor = whiteBackground ? Color.Black : theme.Colors.PrimaryTextColor, HAnchor = HAnchor.Left, Margin = new BorderDouble(12, 3, 0, 6) }); @@ -216,10 +218,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public override void OnClosed(ClosedEventArgs e) { ActiveSliceSettings.MaterialPresetChanged -= ActiveSliceSettings_MaterialPresetChanged; - if (unregisterEvents != null) - { - unregisterEvents(this, null); - } + unregisterEvents?.Invoke(this, null); + base.OnClosed(e); } @@ -230,11 +230,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration private DropDownList CreateDropdown() { - var dropDownList = new DropDownList(defaultMenuItemText, ActiveTheme.Instance.PrimaryTextColor, maxHeight: 300, useLeftIcons: true) + var dropDownList = new DropDownList(defaultMenuItemText, theme.Colors.PrimaryTextColor, maxHeight: 300, useLeftIcons: true, pointSize: theme.DefaultFontSize) { HAnchor = HAnchor.Stretch, MenuItemsPadding = new BorderDouble(10, 7, 7, 7), - TextColor = whiteBackground ? Color.Black : ActiveTheme.Instance.PrimaryTextColor, + TextColor = whiteBackground ? Color.Black : theme.Colors.PrimaryTextColor, }; dropDownList.Name = layerType.ToString() + " DropDown List"; diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index a0e4c5a31..e78bda278 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -310,7 +310,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration && settingShouldBeShown) { topToBottomSettings.AddChild( - CreateItemRow(settingData, ref tabIndexForItem)); + CreateItemRow(settingData, ref tabIndexForItem, theme)); topToBottomSettings.AddChild(new HorizontalLine(20) { @@ -430,12 +430,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return dataArea; } - internal GuiWidget CreateItemRow(SliceSettingData settingData, ref int tabIndexForItem) + internal GuiWidget CreateItemRow(SliceSettingData settingData, ref int tabIndexForItem, ThemeConfig theme) { - return CreateItemRow(settingData, settingsContext, printer, ActiveTheme.Instance.PrimaryTextColor, ref tabIndexForItem, allUiFields); + return CreateItemRow(settingData, settingsContext, printer, theme.Colors.PrimaryTextColor, theme, ref tabIndexForItem, allUiFields); } - public static GuiWidget CreateItemRow(SliceSettingData settingData, SettingsContext settingsContext, PrinterConfig printer, Color textColor, ref int tabIndexForItem, Dictionary fieldCache = null) + public static GuiWidget CreateItemRow(SliceSettingData settingData, SettingsContext settingsContext, PrinterConfig printer, Color textColor, ThemeConfig theme, ref int tabIndexForItem, Dictionary fieldCache = null) { string sliceSettingValue = settingsContext.GetValue(settingData.SlicerConfigName); @@ -536,7 +536,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration sliceSettingValue = printer.Settings.Helpers.ComPort(); - uiField = new ComPortField(printer); + uiField = new ComPortField(printer, theme); uiField.ValueChanged += (s, e) => { if (e.UserInitiated) @@ -698,10 +698,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public static GuiWidget CreateQuickMenu(SliceSettingData settingData, SettingsContext settingsContext, GuiWidget content, InternalTextEditWidget internalTextWidget) { + var theme = ApplicationController.Instance.Theme; + string sliceSettingValue =settingsContext.GetValue(settingData.SlicerConfigName); FlowLayoutWidget totalContent = new FlowLayoutWidget(); - DropDownList selectableOptions = new DropDownList("Custom", ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200); + DropDownList selectableOptions = new DropDownList("Custom", theme.Colors.PrimaryTextColor, maxHeight: 200, pointSize: theme.DefaultFontSize); selectableOptions.Margin = new BorderDouble(0, 0, 10, 0); foreach (QuickMenuNameValue nameValue in settingData.QuickMenuSettings) diff --git a/SlicerConfiguration/UIFields/ComPortField.cs b/SlicerConfiguration/UIFields/ComPortField.cs index c7271e9ba..db3c3ada6 100644 --- a/SlicerConfiguration/UIFields/ComPortField.cs +++ b/SlicerConfiguration/UIFields/ComPortField.cs @@ -39,11 +39,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public class ComPortField : UIField { private DropDownList dropdownList; - + private ThemeConfig theme; private PrinterConfig printer; - public ComPortField(PrinterConfig printer) + public ComPortField(PrinterConfig printer, ThemeConfig theme) { + this.theme = theme; this.printer = printer; } @@ -59,7 +60,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration // bind to a context that will place it in the SliceSetting view but it binds its values to a machine // specific dictionary key that is not exposed in the UI. At runtime we lookup and store to '_com_port' // ensuring that a single printer can be shared across different devices and we'll select the correct com port in each case - dropdownList = new DropDownList("None".Localize(), ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200) + dropdownList = new DropDownList("None".Localize(), ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200, pointSize: theme.DefaultFontSize) { ToolTipText = this.HelpText, Margin = new BorderDouble(), diff --git a/SlicerConfiguration/UIFields/DropMenuWrappedField.cs b/SlicerConfiguration/UIFields/DropMenuWrappedField.cs index 2cde4a370..166609eaa 100644 --- a/SlicerConfiguration/UIFields/DropMenuWrappedField.cs +++ b/SlicerConfiguration/UIFields/DropMenuWrappedField.cs @@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { var totalContent = new FlowLayoutWidget(); - var selectableOptions = new DropDownList("Custom", textColor, maxHeight: 200); + var selectableOptions = new DropDownList("Custom", textColor, maxHeight: 200, pointSize: ApplicationController.Instance.Theme.DefaultFontSize); selectableOptions.Margin = new BorderDouble(0, 0, 10, 0); foreach (QuickMenuNameValue nameValue in settingData.QuickMenuSettings) diff --git a/SlicerConfiguration/UIFields/IpAddessField.cs b/SlicerConfiguration/UIFields/IpAddessField.cs index 31d52fc71..789db6af3 100644 --- a/SlicerConfiguration/UIFields/IpAddessField.cs +++ b/SlicerConfiguration/UIFields/IpAddessField.cs @@ -30,19 +30,21 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { EventHandler unregisterEvents = null; + var theme = ApplicationController.Instance.Theme; + base.Initialize(tabIndex); bool canChangeComPort = !printer.Connection.PrinterIsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect; //This setting defaults to Manual var selectedMachine = printer.Settings.GetValue(SettingsKey.selector_ip_address); - dropdownList = new DropDownList(selectedMachine, ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200) + dropdownList = new DropDownList(selectedMachine, theme.Colors.PrimaryTextColor, maxHeight: 200, pointSize: theme.DefaultFontSize) { ToolTipText = HelpText, Margin = new BorderDouble(), TabIndex = tabIndex, Enabled = canChangeComPort, - TextColor = canChangeComPort ? ActiveTheme.Instance.PrimaryTextColor : new Color(ActiveTheme.Instance.PrimaryTextColor, 150), - BorderColor = canChangeComPort ? ActiveTheme.Instance.SecondaryTextColor : new Color(ActiveTheme.Instance.SecondaryTextColor, 150), + TextColor = canChangeComPort ? theme.Colors.PrimaryTextColor : new Color(theme.Colors.PrimaryTextColor, 150), + BorderColor = canChangeComPort ? theme.Colors.SecondaryTextColor : new Color(theme.Colors.SecondaryTextColor, 150), }; @@ -60,8 +62,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { canChangeComPort = !printer.Connection.PrinterIsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect; dropdownList.Enabled = canChangeComPort; - dropdownList.TextColor = canChangeComPort ? ActiveTheme.Instance.PrimaryTextColor : new Color(ActiveTheme.Instance.PrimaryTextColor, 150); - dropdownList.BorderColor = canChangeComPort ? ActiveTheme.Instance.SecondaryTextColor : new Color(ActiveTheme.Instance.SecondaryTextColor, 150); + dropdownList.TextColor = canChangeComPort ? theme.Colors.PrimaryTextColor : new Color(theme.Colors.PrimaryTextColor, 150); + dropdownList.BorderColor = canChangeComPort ? theme.Colors.SecondaryTextColor : new Color(theme.Colors.SecondaryTextColor, 150); }, ref unregisterEvents); // Release event listener on close diff --git a/SlicerConfiguration/UIFields/ListField.cs b/SlicerConfiguration/UIFields/ListField.cs index 8f5657ef7..608b311f1 100644 --- a/SlicerConfiguration/UIFields/ListField.cs +++ b/SlicerConfiguration/UIFields/ListField.cs @@ -43,7 +43,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public override void Initialize(int tabIndex) { - dropdownList = new DropDownList("None".Localize(), ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200) + var theme = ApplicationController.Instance.Theme; + dropdownList = new DropDownList("None".Localize(), theme.Colors.PrimaryTextColor, maxHeight: 200, pointSize: theme.DefaultFontSize) { ToolTipText = this.HelpText, TabIndex = tabIndex, diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index c42218762..f3461d676 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit c42218762da3a066c82049de13a496b1af5c4166 +Subproject commit f3461d6760b2f460c25d6ef924d5f87f83835876 diff --git a/Tests/MatterControl.Tests/MatterControl/SliceSettingsFieldTests.cs b/Tests/MatterControl.Tests/MatterControl/SliceSettingsFieldTests.cs index 8f199222a..634a11bec 100644 --- a/Tests/MatterControl.Tests/MatterControl/SliceSettingsFieldTests.cs +++ b/Tests/MatterControl.Tests/MatterControl/SliceSettingsFieldTests.cs @@ -277,7 +277,7 @@ namespace MatterControl.Tests.MatterControl AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData")); MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4)); - var field = new ComPortField(new PrinterConfig(PrinterSettings.Empty)); + var field = new ComPortField(new PrinterConfig(PrinterSettings.Empty), new ThemeConfig()); await ValidateAgainstValueMap( field, From 1a91cbc5c8f2b25830921a8c9caaf16ce1ee8f00 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 12 Jan 2018 14:05:04 -0800 Subject: [PATCH 4/5] Use theme default font size --- .../CalibrationControls.cs | 3 +-- CustomWidgets/ConfigurePrinterWidget.cs | 3 ++- CustomWidgets/DockingTabControl.cs | 2 +- CustomWidgets/PrintingWindow/ZAxisControls.cs | 2 +- .../TerminalWindow/TerminalWidget.cs | 4 ++-- PrinterControls/XYZJogControls.cs | 19 ++++++++++++------- SlicerConfiguration/SliceSettingsWidget.cs | 5 +++-- Submodules/agg-sharp | 2 +- 8 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ConfigurationPage/CalibrationSettings/CalibrationControls.cs b/ConfigurationPage/CalibrationSettings/CalibrationControls.cs index 1a7aa471e..0b2602518 100644 --- a/ConfigurationPage/CalibrationSettings/CalibrationControls.cs +++ b/ConfigurationPage/CalibrationSettings/CalibrationControls.cs @@ -40,10 +40,9 @@ namespace MatterHackers.MatterControl.PrinterControls // label buttonRow.AddChild( - new TextWidget("") + new TextWidget("", textColor: theme.Colors.PrimaryTextColor, pointSize: theme.DefaultFontSize) { AutoExpandBoundsToText = true, - TextColor = ActiveTheme.Instance.PrimaryTextColor, VAnchor = VAnchor.Center, Text = "Software Print Leveling".Localize() }); diff --git a/CustomWidgets/ConfigurePrinterWidget.cs b/CustomWidgets/ConfigurePrinterWidget.cs index 3458f7af4..26b015304 100644 --- a/CustomWidgets/ConfigurePrinterWidget.cs +++ b/CustomWidgets/ConfigurePrinterWidget.cs @@ -87,7 +87,8 @@ namespace MatterHackers.MatterControl primaryTabControl, scrollable, theme, - hasClose: false) + hasClose: false, + pointSize: theme.DefaultFontSize) { Name = section.Name + " Tab", InactiveTabColor = Color.Transparent, diff --git a/CustomWidgets/DockingTabControl.cs b/CustomWidgets/DockingTabControl.cs index 26243da36..453c8b973 100644 --- a/CustomWidgets/DockingTabControl.cs +++ b/CustomWidgets/DockingTabControl.cs @@ -213,7 +213,7 @@ namespace MatterHackers.MatterControl.CustomWidgets content, theme, hasClose: kvp.Value is ConfigurePrinterWidget, - pointSize: theme.FontSize11) + pointSize: theme.DefaultFontSize) { Name = tabTitle + " Tab", InactiveTabColor = Color.Transparent, diff --git a/CustomWidgets/PrintingWindow/ZAxisControls.cs b/CustomWidgets/PrintingWindow/ZAxisControls.cs index 75348e4d4..f86a73e2c 100644 --- a/CustomWidgets/PrintingWindow/ZAxisControls.cs +++ b/CustomWidgets/PrintingWindow/ZAxisControls.cs @@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.CustomWidgets { private MoveButtonFactory buttonFactory = new MoveButtonFactory() { - FontSize = 13, + FontSize = ApplicationController.Instance.Theme.DefaultFontSize, }; public ZAxisControls(PrinterConfig printer, ThemeConfig theme, bool smallScreen) : diff --git a/PrinterControls/TerminalWindow/TerminalWidget.cs b/PrinterControls/TerminalWindow/TerminalWidget.cs index 37b55fe96..8a5f8e36d 100644 --- a/PrinterControls/TerminalWindow/TerminalWidget.cs +++ b/PrinterControls/TerminalWindow/TerminalWidget.cs @@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl }; this.AddChild(headerRow); - filterOutput = new CheckBox("Filter Output".Localize()) + filterOutput = new CheckBox("Filter Output".Localize(), textSize: theme.DefaultFontSize) { TextColor = ActiveTheme.Instance.PrimaryTextColor, VAnchor = VAnchor.Bottom, @@ -85,7 +85,7 @@ namespace MatterHackers.MatterControl }; headerRow.AddChild(filterOutput); - autoUppercase = new CheckBox("Auto Uppercase".Localize()) + autoUppercase = new CheckBox("Auto Uppercase".Localize(), textSize: theme.DefaultFontSize) { Margin = new BorderDouble(left: 25), Checked = UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalAutoUppercase, true), diff --git a/PrinterControls/XYZJogControls.cs b/PrinterControls/XYZJogControls.cs index 31e3d597f..608430fbf 100644 --- a/PrinterControls/XYZJogControls.cs +++ b/PrinterControls/XYZJogControls.cs @@ -32,7 +32,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using MatterHackers.Agg; -using MatterHackers.Agg.ImageProcessing; using MatterHackers.Agg.Platform; using MatterHackers.Agg.UI; using MatterHackers.Agg.VertexSource; @@ -59,7 +58,10 @@ namespace MatterHackers.MatterControl private MoveButton zPlusControl; private MoveButton zMinusControl; - private MoveButtonFactory moveButtonFactory = new MoveButtonFactory(); + private MoveButtonFactory moveButtonFactory = new MoveButtonFactory() + { + FontSize = ApplicationController.Instance.Theme.DefaultFontSize + }; private PrinterConfig printer; public JogControls(PrinterConfig printer, XYZColors colors) @@ -556,7 +558,10 @@ namespace MatterHackers.MatterControl { FlowLayoutWidget zButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { - MoveButtonFactory moveButtonFactory = new MoveButtonFactory(); + var moveButtonFactory = new MoveButtonFactory() + { + FontSize = ApplicationController.Instance.Theme.DefaultFontSize + }; moveButtonFactory.Colors.Fill.Normal = color; zPlusControl = CreateMoveButton(printer, "Z+", PrinterConnection.Axis.Z, printer.Settings.ZSpeed(), levelingButtons, moveButtonFactory); @@ -805,22 +810,22 @@ namespace MatterHackers.MatterControl { //Create the multi-state button view var buttonViewStates = new ButtonViewStates( - new MoveButtonWidget(label, Colors.Text.Normal) + new MoveButtonWidget(label, Colors.Text.Normal, this.FontSize) { BackgroundColor = Colors.Fill.Normal, BorderWidth = this.BorderWidth }, - new MoveButtonWidget(label, Colors.Text.Hover) + new MoveButtonWidget(label, Colors.Text.Hover, this.FontSize) { BackgroundColor = Colors.Fill.Hover, BorderWidth = this.BorderWidth }, - new MoveButtonWidget(label, Colors.Text.Pressed) + new MoveButtonWidget(label, Colors.Text.Pressed, this.FontSize) { BackgroundColor = Colors.Fill.Pressed, BorderWidth = this.BorderWidth }, - new MoveButtonWidget(label, Colors.Text.Disabled) + new MoveButtonWidget(label, Colors.Text.Disabled, this.FontSize) { BackgroundColor = Colors.Fill.Disabled, BorderWidth = this.BorderWidth diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index e78bda278..92cc2e237 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -109,7 +109,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration Margin = new BorderDouble(top: 8), VAnchor = VAnchor.Stretch, HAnchor = HAnchor.Stretch, - MinimumSize = new Vector2(200, 200) + MinimumSize = new Vector2(200, 200), }; primaryTabControl.TabBar.BackgroundColor = theme.ActiveTabBarBackground; @@ -130,7 +130,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration primaryTabControl, content, theme, - hasClose: false) + hasClose: false, + pointSize: theme.DefaultFontSize) { Name = category.Name + " Tab", InactiveTabColor = Color.Transparent, diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index f3461d676..62ffc915f 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit f3461d6760b2f460c25d6ef924d5f87f83835876 +Subproject commit 62ffc915f217c8a2232810fb4f567f9b4b1009f3 From 429ed369fdabf4204778d6b501dff7269ded2253 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 12 Jan 2018 14:36:47 -0800 Subject: [PATCH 5/5] Remove Agg.UI prefix, simplify --- PrinterControls/XYZJogControls.cs | 78 +++++++++++++++++-------------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/PrinterControls/XYZJogControls.cs b/PrinterControls/XYZJogControls.cs index 608430fbf..a3b3c1819 100644 --- a/PrinterControls/XYZJogControls.cs +++ b/PrinterControls/XYZJogControls.cs @@ -74,7 +74,7 @@ namespace MatterHackers.MatterControl FlowLayoutWidget allControlsTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); - allControlsTopToBottom.HAnchor |= Agg.UI.HAnchor.Stretch; + allControlsTopToBottom.HAnchor |= HAnchor.Stretch; { FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget(); @@ -87,7 +87,7 @@ namespace MatterHackers.MatterControl xYZControls.AddChild(xyGrid); FlowLayoutWidget zButtons = CreateZButtons(printer, XYZColors.zColor, buttonSeparationDistance, out zPlusControl, out zMinusControl); - zButtons.VAnchor = Agg.UI.VAnchor.Bottom; + zButtons.VAnchor = VAnchor.Bottom; xYZControls.AddChild(zButtons); xYZWithDistance.AddChild(xYZControls); } @@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl // add in some movement radio buttons FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget(); TextWidget buttonsLabel = new TextWidget("Distance:", textColor: Color.White); - buttonsLabel.VAnchor = Agg.UI.VAnchor.Center; + buttonsLabel.VAnchor = VAnchor.Center; //setMoveDistanceControl.AddChild(buttonsLabel); { @@ -106,21 +106,21 @@ namespace MatterHackers.MatterControl var radioList = new ObservableCollection(); movePointZeroTwoMmButton = buttonFactory.GenerateRadioButton("0.02"); - movePointZeroTwoMmButton.VAnchor = Agg.UI.VAnchor.Center; + movePointZeroTwoMmButton.VAnchor = VAnchor.Center; movePointZeroTwoMmButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(.02); }; movePointZeroTwoMmButton.SiblingRadioButtonList = radioList; radioList.Add(movePointZeroTwoMmButton); moveRadioButtons.AddChild(movePointZeroTwoMmButton); RadioButton pointOneButton = buttonFactory.GenerateRadioButton("0.1"); - pointOneButton.VAnchor = Agg.UI.VAnchor.Center; + pointOneButton.VAnchor = VAnchor.Center; pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(.1); }; pointOneButton.SiblingRadioButtonList = radioList; radioList.Add(pointOneButton); moveRadioButtons.AddChild(pointOneButton); moveOneMmButton = buttonFactory.GenerateRadioButton("1"); - moveOneMmButton.VAnchor = Agg.UI.VAnchor.Center; + moveOneMmButton.VAnchor = VAnchor.Center; moveOneMmButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(1); }; moveOneMmButton.SiblingRadioButtonList = radioList; radioList.Add(moveOneMmButton); @@ -137,7 +137,7 @@ namespace MatterHackers.MatterControl tooBigForBabyStepping.AddChild(tooBigFlowLayout); tenButton = buttonFactory.GenerateRadioButton("10"); - tenButton.VAnchor = Agg.UI.VAnchor.Center; + tenButton.VAnchor = VAnchor.Center; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(10); }; tenButton.SiblingRadioButtonList = radioList; radioList.Add(tenButton); @@ -145,7 +145,7 @@ namespace MatterHackers.MatterControl tooBigFlowLayout.AddChild(tenButton); oneHundredButton = buttonFactory.GenerateRadioButton("100"); - oneHundredButton.VAnchor = Agg.UI.VAnchor.Center; + oneHundredButton.VAnchor = VAnchor.Center; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(100); }; oneHundredButton.SiblingRadioButtonList = radioList; radioList.Add(oneHundredButton); @@ -162,11 +162,11 @@ namespace MatterHackers.MatterControl tooBigFlowLayout.AddChild(new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8) { Margin = new BorderDouble(left: 10), - VAnchor = Agg.UI.VAnchor.Center + VAnchor = VAnchor.Center }); } - setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.Left; + setMoveDistanceControl.HAnchor = HAnchor.Left; xYZWithDistance.AddChild(setMoveDistanceControl); } @@ -176,7 +176,7 @@ namespace MatterHackers.MatterControl allControlsLeftToRight.AddChild(GetHotkeyControlContainer()); #endif GuiWidget barBetweenZAndE = new GuiWidget(2, 2); - barBetweenZAndE.VAnchor = Agg.UI.VAnchor.Stretch; + barBetweenZAndE.VAnchor = VAnchor.Stretch; barBetweenZAndE.BackgroundColor = Color.White; barBetweenZAndE.Margin = new BorderDouble(distanceBetweenControls, 5); allControlsLeftToRight.AddChild(barBetweenZAndE); @@ -438,7 +438,7 @@ namespace MatterHackers.MatterControl TextWidget eMinusControlLabel = new TextWidget("Retract".Localize(), pointSize: 11); eMinusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; - eMinusControlLabel.VAnchor = Agg.UI.VAnchor.Center; + eMinusControlLabel.VAnchor = VAnchor.Center; eMinusButtonAndText.AddChild(eMinusControlLabel); eButtons.AddChild(eMinusButtonAndText); @@ -484,7 +484,7 @@ namespace MatterHackers.MatterControl TextWidget ePlusControlLabel = new TextWidget("Extrude".Localize(), pointSize: 11); ePlusControlLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; - ePlusControlLabel.VAnchor = Agg.UI.VAnchor.Center; + ePlusControlLabel.VAnchor = VAnchor.Center; ePlusButtonAndText.AddChild(ePlusControlLabel); eButtons.AddChild(ePlusButtonAndText); ePlusButtonAndText.HAnchor = HAnchor.Fit; @@ -496,7 +496,7 @@ namespace MatterHackers.MatterControl // add in some movement radio buttons FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget(); TextWidget buttonsLabel = new TextWidget("Distance:", textColor: Color.White); - buttonsLabel.VAnchor = Agg.UI.VAnchor.Center; + buttonsLabel.VAnchor = VAnchor.Center; //setMoveDistanceControl.AddChild(buttonsLabel); { @@ -504,15 +504,15 @@ namespace MatterHackers.MatterControl var moveRadioButtons = new FlowLayoutWidget(); RadioButton oneButton = buttonFactory.GenerateRadioButton("1"); - oneButton.VAnchor = Agg.UI.VAnchor.Center; + oneButton.VAnchor = VAnchor.Center; oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(1); }; moveRadioButtons.AddChild(oneButton); RadioButton tenButton = buttonFactory.GenerateRadioButton("10"); - tenButton.VAnchor = Agg.UI.VAnchor.Center; + tenButton.VAnchor = VAnchor.Center; tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(10); }; moveRadioButtons.AddChild(tenButton); RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100"); - oneHundredButton.VAnchor = Agg.UI.VAnchor.Center; + oneHundredButton.VAnchor = VAnchor.Center; oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetEMoveAmount(100); }; moveRadioButtons.AddChild(oneHundredButton); tenButton.Checked = true; @@ -521,10 +521,10 @@ namespace MatterHackers.MatterControl } var mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8); - mmLabel.VAnchor = Agg.UI.VAnchor.Center; + mmLabel.VAnchor = VAnchor.Center; mmLabel.Margin = new BorderDouble(left: 10); setMoveDistanceControl.AddChild(mmLabel); - setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.Left; + setMoveDistanceControl.HAnchor = HAnchor.Left; eButtons.AddChild(setMoveDistanceControl); eButtons.HAnchor = HAnchor.Fit; @@ -569,10 +569,12 @@ namespace MatterHackers.MatterControl zPlusControl.ToolTipText = "Move Z positive".Localize(); zButtons.AddChild(zPlusControl); - GuiWidget spacer = new GuiWidget(2, buttonSeparationDistance); - spacer.HAnchor = Agg.UI.HAnchor.Center; - spacer.BackgroundColor = XYZColors.zColor; - zButtons.AddChild(spacer); + // spacer + zButtons.AddChild(new GuiWidget(2, buttonSeparationDistance) + { + HAnchor = HAnchor.Center, + BackgroundColor = XYZColors.zColor + }); zMinusControl = CreateMoveButton(printer, "Z-", PrinterConnection.Axis.Z, printer.Settings.ZSpeed(), levelingButtons, moveButtonFactory); zMinusControl.ToolTipText = "Move Z negative".Localize(); @@ -589,17 +591,19 @@ namespace MatterHackers.MatterControl FlowLayoutWidget xButtons = new FlowLayoutWidget(); { moveButtonFactory.Colors.Fill.Normal = XYZColors.xColor; - xButtons.HAnchor |= Agg.UI.HAnchor.Center; - xButtons.VAnchor |= Agg.UI.VAnchor.Center; + xButtons.HAnchor |= HAnchor.Center; + xButtons.VAnchor |= VAnchor.Center; xMinusControl = CreateMoveButton(printer, "X-", PrinterConnection.Axis.X, printer.Settings.XSpeed(), false, moveButtonFactory); xMinusControl.ToolTipText = "Move X negative".Localize(); xButtons.AddChild(xMinusControl); - GuiWidget spacer = new GuiWidget(xMinusControl.Width + buttonSeparationDistance * 2, 2); - spacer.VAnchor = Agg.UI.VAnchor.Center; - spacer.BackgroundColor = XYZColors.xColor; - xButtons.AddChild(spacer); + // spacer + xButtons.AddChild(new GuiWidget(xMinusControl.Width + buttonSeparationDistance * 2, 2) + { + VAnchor = VAnchor.Center, + BackgroundColor = XYZColors.xColor + }); xPlusControl = CreateMoveButton(printer, "X+", PrinterConnection.Axis.X, printer.Settings.XSpeed(), false, moveButtonFactory); xPlusControl.ToolTipText = "Move X positive".Localize(); @@ -610,16 +614,18 @@ namespace MatterHackers.MatterControl FlowLayoutWidget yButtons = new FlowLayoutWidget(FlowDirection.TopToBottom); { moveButtonFactory.Colors.Fill.Normal = XYZColors.yColor; - yButtons.HAnchor |= Agg.UI.HAnchor.Center; - yButtons.VAnchor |= Agg.UI.VAnchor.Center; + yButtons.HAnchor |= HAnchor.Center; + yButtons.VAnchor |= VAnchor.Center; yPlusControl = CreateMoveButton(printer, "Y+", PrinterConnection.Axis.Y, printer.Settings.YSpeed(), false, moveButtonFactory); yPlusControl.ToolTipText = "Move Y positive".Localize(); yButtons.AddChild(yPlusControl); - GuiWidget spacer = new GuiWidget(2, buttonSeparationDistance); - spacer.HAnchor = Agg.UI.HAnchor.Center; - spacer.BackgroundColor = XYZColors.yColor; - yButtons.AddChild(spacer); + // spacer + yButtons.AddChild(new GuiWidget(2, buttonSeparationDistance) + { + HAnchor = HAnchor.Center, + BackgroundColor = XYZColors.yColor + }); yMinusControl = CreateMoveButton(printer, "Y-", PrinterConnection.Axis.Y, printer.Settings.YSpeed(), false, moveButtonFactory); yMinusControl.ToolTipText = "Move Y negative".Localize(); @@ -629,7 +635,7 @@ namespace MatterHackers.MatterControl } xyGrid.HAnchor = HAnchor.Fit; xyGrid.VAnchor = VAnchor.Fit; - xyGrid.VAnchor = Agg.UI.VAnchor.Bottom; + xyGrid.VAnchor = VAnchor.Bottom; xyGrid.Margin = new BorderDouble(0, 5, distanceBetweenControls, 5); return xyGrid; }