From de0070eb35f4454ac1dff41eb121b399141fa3bd Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Mon, 8 Dec 2014 18:18:38 -0800 Subject: [PATCH] Some working on streamlining the ui and creating a new 'simple' mode. --- ApplicationView/CompactTabView.cs | 8 +- ApplicationView/ThirdPanelTabView.cs | 10 +- ApplicationView/WidescreenPanel.cs | 140 ++++++++++++--------- SettingsManagement/OemSettings.cs | 13 +- SlicerConfiguration/SliceSettingsWidget.cs | 6 + StaticData/OEMSettings/Settings.json | 27 +++- StaticData/SliceSettings/Layouts.txt | 2 +- 7 files changed, 132 insertions(+), 74 deletions(-) diff --git a/ApplicationView/CompactTabView.cs b/ApplicationView/CompactTabView.cs index f8f7067fc..3072f3035 100644 --- a/ApplicationView/CompactTabView.cs +++ b/ApplicationView/CompactTabView.cs @@ -130,15 +130,15 @@ namespace MatterHackers.MatterControl ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); //Add the tab contents for 'Advanced Controls' + string sliceSettingsLabel = LocalizedString.Get("Settings").ToUpper(); + sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState); + sliceTabPage = new TabPage(sliceSettingsWidget, sliceSettingsLabel); + string printerControlsLabel = LocalizedString.Get("Controls").ToUpper(); manualControlsPage = new TabPage(manualPrinterControls, printerControlsLabel); this.AddTab(new SimpleTextTabWidget(manualControlsPage, "Controls Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); - string sliceSettingsLabel = LocalizedString.Get("Slice Settings").ToUpper(); - sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState); - sliceTabPage = new TabPage(sliceSettingsWidget, sliceSettingsLabel); - this.AddTab(new SimpleTextTabWidget(sliceTabPage, "Slice Settings Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); diff --git a/ApplicationView/ThirdPanelTabView.cs b/ApplicationView/ThirdPanelTabView.cs index 35fa305e9..4d0e1777b 100644 --- a/ApplicationView/ThirdPanelTabView.cs +++ b/ApplicationView/ThirdPanelTabView.cs @@ -149,15 +149,15 @@ namespace MatterHackers.MatterControl RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected; //Add the tab contents for 'Advanced Controls' - string printerControlsLabel = LocalizedString.Get("Controls").ToUpper(); - advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), "Controls Tab", textSize, - ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); - - string sliceSettingsLabel = LocalizedString.Get("Slice Settings").ToUpper(); + string sliceSettingsLabel = LocalizedString.Get("Settings").ToUpper(); sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState); advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), "Slice Settings Tab", textSize, ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); + string printerControlsLabel = LocalizedString.Get("Controls").ToUpper(); + advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), "Controls Tab", textSize, + ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); + string configurationLabel = LocalizedString.Get("Configuration").ToUpper(); ScrollableWidget configurationControls = new PrinterConfigurationScrollWidget(); advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), "Configuration Tab", textSize, diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index 93e8120b9..be47dafe6 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -26,7 +26,6 @@ The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ -//#define NEW_TWO_COLUMN_MODE using System; using System.Collections.Generic; using System.Linq; @@ -43,6 +42,7 @@ using MatterHackers.VectorMath; using MatterHackers.MatterControl; using MatterHackers.MatterControl.PrintQueue; using MatterHackers.MatterControl.SlicerConfiguration; +using MatterHackers.MatterControl.SettingsManagement; using MatterHackers.MatterControl.PrintLibrary; using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.CustomWidgets; @@ -194,31 +194,34 @@ namespace MatterHackers.MatterControl double buildHeight = ActiveSliceSettings.Instance.BuildHeight; -#if NEW_TWO_COLUMN_MODE - PartPreviewContent partViewContent = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, true, View3DWidget.AutoRotate.Enabled, false); - partViewContent.AnchorAll(); - - ColumnTwo.AddChild(partViewContent); -#else - part3DView = new View3DWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem, - new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), - ActiveSliceSettings.Instance.BedCenter, - ActiveSliceSettings.Instance.BedShape, - View3DWidget.WindowType.Embeded, - View3DWidget.AutoRotate.Enabled); - part3DView.Margin = new BorderDouble(bottom: 4); - part3DView.AnchorAll(); + if (OemSettings.Instance.UseLiteInterface) + { + PartPreviewContent partViewContent = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, true, View3DWidget.AutoRotate.Enabled, false); + partViewContent.AnchorAll(); - partGcodeView = new ViewGcodeBasic(PrinterConnectionAndCommunication.Instance.ActivePrintItem, - new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), - ActiveSliceSettings.Instance.BedCenter, - ActiveSliceSettings.Instance.BedShape, - false); - partGcodeView.AnchorAll(); + ColumnTwo.AddChild(partViewContent); + } + else + { + part3DView = new View3DWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem, + new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), + ActiveSliceSettings.Instance.BedCenter, + ActiveSliceSettings.Instance.BedShape, + View3DWidget.WindowType.Embeded, + View3DWidget.AutoRotate.Enabled); + part3DView.Margin = new BorderDouble(bottom: 4); + part3DView.AnchorAll(); - ColumnTwo.AddChild(part3DView); - ColumnTwo.AddChild(partGcodeView); -#endif + partGcodeView = new ViewGcodeBasic(PrinterConnectionAndCommunication.Instance.ActivePrintItem, + new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), + ActiveSliceSettings.Instance.BedCenter, + ActiveSliceSettings.Instance.BedShape, + false); + partGcodeView.AnchorAll(); + + ColumnTwo.AddChild(part3DView); + ColumnTwo.AddChild(partGcodeView); + } ColumnTwo.AnchorAll(); } @@ -245,6 +248,10 @@ namespace MatterHackers.MatterControl } else { + if (OemSettings.Instance.UseLiteInterface) + { + return 2; + } return 3; } } @@ -273,16 +280,24 @@ namespace MatterHackers.MatterControl LoadCompactView(); break; -#if NEW_TWO_COLUMN_MODE case 2: - ApplicationController.Instance.WidescreenMode = false; - LoadCompactView(); - LoadColumnTwo(); - LoadColumnThree(); + if (OemSettings.Instance.UseLiteInterface) + { + ApplicationController.Instance.WidescreenMode = false; + LoadCompactView(); + LoadColumnTwo(); + LoadColumnThree(); + } + else + { + ApplicationController.Instance.WidescreenMode = true; + + LoadColumnOne(); + // make sure we restore the state of column one because LoadColumnThree is going to save it. + LoadColumnTwo(); + LoadColumnThree(); + } break; -#else - case 2: -#endif case 3: ApplicationController.Instance.WidescreenMode = true; @@ -325,40 +340,43 @@ namespace MatterHackers.MatterControl case 2: Padding = new BorderDouble(4); ColumnOne.Visible = true; -#if NEW_TWO_COLUMN_MODE - LeftBorderLine.Visible = true; - RightBorderLine.Visible = false; - ColumnTwo.Visible = true; - ColumnThree.Visible = false; - ColumnOne.HAnchor = Agg.UI.HAnchor.None; - ColumnOne.Width = ColumnTheeFixedWidth; // it can hold the slice settings so it needs to be bigger. -#else - RightBorderLine.Visible = true; - if (RightBorderLine.Hidden) + if (OemSettings.Instance.UseLiteInterface) { LeftBorderLine.Visible = true; - if (LeftBorderLine.Hidden) - { - ColumnThree.Visible = false; - ColumnTwo.Visible = false; - ColumnOne.HAnchor = Agg.UI.HAnchor.ParentLeftRight; - - } - else - { - ColumnThree.Visible = false; - ColumnTwo.Visible = true; - ColumnOne.HAnchor = Agg.UI.HAnchor.None; - } - } + RightBorderLine.Visible = false; + ColumnTwo.Visible = true; + ColumnThree.Visible = false; + ColumnOne.HAnchor = Agg.UI.HAnchor.None; + ColumnOne.Width = ColumnTheeFixedWidth; // it can hold the slice settings so it needs to be bigger. + } else { - LeftBorderLine.Visible = false; - ColumnThree.Visible = true; - ColumnTwo.Visible = false; - ColumnOne.HAnchor = Agg.UI.HAnchor.ParentLeftRight; + RightBorderLine.Visible = true; + if (RightBorderLine.Hidden) + { + LeftBorderLine.Visible = true; + if (LeftBorderLine.Hidden) + { + ColumnThree.Visible = false; + ColumnTwo.Visible = false; + ColumnOne.HAnchor = Agg.UI.HAnchor.ParentLeftRight; + + } + else + { + ColumnThree.Visible = false; + ColumnTwo.Visible = true; + ColumnOne.HAnchor = Agg.UI.HAnchor.None; + } + } + else + { + LeftBorderLine.Visible = false; + ColumnThree.Visible = true; + ColumnTwo.Visible = false; + ColumnOne.HAnchor = Agg.UI.HAnchor.ParentLeftRight; + } } -#endif break; case 3: diff --git a/SettingsManagement/OemSettings.cs b/SettingsManagement/OemSettings.cs index d97d19644..2ea242a64 100644 --- a/SettingsManagement/OemSettings.cs +++ b/SettingsManagement/OemSettings.cs @@ -21,12 +21,21 @@ namespace MatterHackers.MatterControl.SettingsManagement { string oemSettings = StaticData.Instance.ReadAllText(Path.Combine("OEMSettings", "Settings.json")); instance = JsonConvert.DeserializeObject(oemSettings) as OemSettings; +#if false + string output = JsonConvert.SerializeObject(instance, Formatting.Indented); + using (StreamWriter outfile = new StreamWriter("Settings.json")) + { + outfile.Write(output); + } +#endif } return instance; } } + public bool UseLiteInterface = false; + public string ThemeColor = ""; public string AffiliateCode = ""; @@ -52,8 +61,8 @@ namespace MatterHackers.MatterControl.SettingsManagement PreloadedLibraryFiles.Add("uno"); PreloadedLibraryFiles.Add("dos"); AffiliateCode = "testcode"; - string pathToOemSettings = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "OEMSettings", "Settings.json"); - File.WriteAllText(pathToOemSettings, JsonConvert.SerializeObject(this)); + string pathToOemSettings = Path.Combine(".", "OEMSettings", "Settings.json"); + File.WriteAllText(pathToOemSettings, JsonConvert.SerializeObject(this, Formatting.Indented)); #endif } } diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 9fc526c7f..6e3e106bc 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -161,6 +161,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration tabBar.MinimumSize = new Vector2(sideTabBarsMinimumWidth, tabBar.MinimumSize.y); } + if (sideTabBarsListForLayout.Count == 1) + { + sideTabBarsListForLayout[0].MinimumSize = new Vector2(0, 0); + sideTabBarsListForLayout[0].Width = 0; + } + // add in the ability to turn on and off help text { showHelpBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; diff --git a/StaticData/OEMSettings/Settings.json b/StaticData/OEMSettings/Settings.json index f3cb7613a..5e28ce444 100644 --- a/StaticData/OEMSettings/Settings.json +++ b/StaticData/OEMSettings/Settings.json @@ -1 +1,26 @@ -{"AffiliateCode":"5NEP8W","ShowShopButton":true,"PrinterWhiteList":["Airwolf 3D","Type A Machines","Other","SeeMeCNC","Printrbot","Deezmaker","Blue Eagle Labs","RoBo 3D","Solidoodle","Portabee","Lulzbot","3D Stuffmaker","Velleman"],"PreloadedLibraryFiles":["Calibration - Box.stl"]} \ No newline at end of file +{ + "UseLiteInterface": false, + "ThemeColor": "", + "AffiliateCode": "5NEP8W", + "WindowTitleExtra": "", + "ShowShopButton": true, + "CheckForUpdatesOnFirstRun": false, + "PrinterWhiteList": [ + "Airwolf 3D", + "Type A Machines", + "Other", + "SeeMeCNC", + "Printrbot", + "Deezmaker", + "Blue Eagle Labs", + "RoBo 3D", + "Solidoodle", + "Portabee", + "Lulzbot", + "3D Stuffmaker", + "Velleman" + ], + "PreloadedLibraryFiles": [ + "Calibration - Box.stl" + ] +} \ No newline at end of file diff --git a/StaticData/SliceSettings/Layouts.txt b/StaticData/SliceSettings/Layouts.txt index 17390dcf5..269159886 100644 --- a/StaticData/SliceSettings/Layouts.txt +++ b/StaticData/SliceSettings/Layouts.txt @@ -1,5 +1,5 @@ Simple - Single + Settings Single Print layer_height