From a54a59e25f2caa1bb48d9ac4ee3c897b3c8ce4b3 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 9 Dec 2014 15:16:08 -0800 Subject: [PATCH] Putting a menu to switch view settings. Made the trace data build faster. Made ungroup understand mesh collections better Made the slice settings layer index be an enum so it is clearer what is being accessed Put menu items into separate files --- ApplicationView/ApplicationMenuRow.cs | 311 ------------------ ApplicationView/MenuRow/ApplicationMenuRow.cs | 80 +++++ ApplicationView/MenuRow/MenuOptionFile.cs | 140 ++++++++ ApplicationView/MenuRow/MenuOptionHelp.cs | 124 +++++++ ApplicationView/MenuRow/MenuOptionHelpView.cs | 90 +++++ ApplicationView/WidescreenPanel.cs | 8 +- .../ApplicationSettingsView.cs | 13 +- MatterControl.csproj | 5 +- PartPreviewWindow/PlatingHelper.cs | 17 +- PartPreviewWindow/View3D/View3DUngroup.cs | 20 +- SettingsManagement/OemSettings.cs | 2 +- SlicerConfiguration/ActiveSliceSettings.cs | 9 +- SlicerConfiguration/SliceSettingsWidget.cs | 4 +- StaticData/OEMSettings/Settings.json | 2 +- 14 files changed, 475 insertions(+), 350 deletions(-) delete mode 100644 ApplicationView/ApplicationMenuRow.cs create mode 100644 ApplicationView/MenuRow/ApplicationMenuRow.cs create mode 100644 ApplicationView/MenuRow/MenuOptionFile.cs create mode 100644 ApplicationView/MenuRow/MenuOptionHelp.cs create mode 100644 ApplicationView/MenuRow/MenuOptionHelpView.cs diff --git a/ApplicationView/ApplicationMenuRow.cs b/ApplicationView/ApplicationMenuRow.cs deleted file mode 100644 index 864a7a0ef..000000000 --- a/ApplicationView/ApplicationMenuRow.cs +++ /dev/null @@ -1,311 +0,0 @@ -using System; -using System.IO; -using MatterHackers.Agg; -using MatterHackers.Agg.UI; -using MatterHackers.Localizations; -using MatterHackers.MatterControl.CustomWidgets; -using MatterHackers.MatterControl.DataStorage; -using MatterHackers.MatterControl.ContactForm; -using MatterHackers.MatterControl.PrinterCommunication; -using MatterHackers.MatterControl.PrinterControls.PrinterConnections; -using MatterHackers.MatterControl.PrintQueue; -using MatterHackers.VectorMath; - -namespace MatterHackers.MatterControl -{ - public class ApplicationMenuRow : FlowLayoutWidget - { - static FlowLayoutWidget rightElement; - - public ApplicationMenuRow() - :base(FlowDirection.LeftToRight) - { - LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); - linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; - linkButtonFactory.fontSize = 8; - - Button signInLink = linkButtonFactory.Generate("(Sign Out)"); - signInLink.VAnchor = Agg.UI.VAnchor.ParentCenter; - signInLink.Margin = new BorderDouble(top: 0); - - this.HAnchor = HAnchor.ParentLeftRight; - this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; - - MenuOptionFile menuOptionFile = new MenuOptionFile(); - - //TextWidget menuOptionFile = new TextWidget("FILE", pointSize: 10); - - //menuOptionFile.TextColor = ActiveTheme.Instance.PrimaryTextColor; - - MenuOptionHelp menuOptionHelp = new MenuOptionHelp(); - - rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight); - rightElement.Height = 24; - rightElement.Margin = new BorderDouble(bottom: 4); - //rightElement.VAnchor = Agg.UI.VAnchor.ParentCenter; - - this.AddChild(menuOptionFile); - this.AddChild(menuOptionHelp); - this.AddChild(new HorizontalSpacer()); - this.AddChild(rightElement); - - this.Padding = new BorderDouble(0, 0, 6, 0); - - if (privateAddRightElement != null) - { - privateAddRightElement(rightElement); - } - } - - public delegate void AddRightElementDelegate(GuiWidget iconContainer); - private static event AddRightElementDelegate privateAddRightElement; - public static event AddRightElementDelegate AddRightElement - { - add - { - privateAddRightElement += value; - // and call it right away - value(rightElement); - } - - remove - { - privateAddRightElement -= value; - } - } - } - - public class MenuOptionFile : GuiWidget - { - public DropDownMenu MenuDropList; - private TupleList> menuItems; - - public MenuOptionFile() - { - MenuDropList = new DropDownMenu("File".Localize().ToUpper(), Direction.Down,pointSize:10); - MenuDropList.MenuItemsPadding = new BorderDouble(0); - MenuDropList.Margin = new BorderDouble(0); - MenuDropList.Padding = new BorderDouble(0); - - SetMenuItems(); - - AddChild(MenuDropList); - this.Width = 44 * TextWidget.GlobalPointSizeScaleRatio;; - this.Height = 22 * TextWidget.GlobalPointSizeScaleRatio;; - this.Margin = new BorderDouble(0); - this.Padding = new BorderDouble(0); - this.VAnchor = Agg.UI.VAnchor.ParentCenter; - this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); - this.MenuDropList.OpenOffset = new Vector2(0, 0); - } - - void MenuDropList_SelectionChanged(object sender, EventArgs e) - { - string menuSelection = ((DropDownMenu)sender).SelectedValue; - foreach (Tuple> item in menuItems) - { - if (item.Item1 == menuSelection) - { - if (item.Item2 != null) - { - item.Item2(); - } - } - } - } - - void SetMenuItems() - { - menuItems = new TupleList> - { - {LocalizedString.Get("Add Printer"), addPrinter_Click}, - {LocalizedString.Get("Add File"), importFile_Click}, - {LocalizedString.Get("Exit"), exit_Click}, - }; - - BorderDouble padding = MenuDropList.MenuItemsPadding; - //Add the menu items to the menu itself - foreach (Tuple> item in menuItems) - { - MenuDropList.MenuItemsPadding = new BorderDouble(8,4,8,4) * TextWidget.GlobalPointSizeScaleRatio; - MenuDropList.AddItem(item.Item1,pointSize:10); - } - MenuDropList.Padding = padding; - } - - - bool addPrinter_Click() - { - UiThread.RunOnIdle((state) => - { - ConnectionWindow.Show(); - }); - return true; - } - - bool importFile_Click() - { - UiThread.RunOnIdle((state) => - { - FileDialog.OpenFileDialog( - new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams) - { - MultiSelect = true, - ActionButtonLabel = "Add to Queue", - Title = "MatterControl: Select A File" - }, - (openParams) => - { - if (openParams.FileNames != null) - { - foreach (string loadedFileName in openParams.FileNames) - { - QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), Path.GetFullPath(loadedFileName)))); - } - } - - }); - - }); - return true; - } - - string cannotExitWhileActiveMessage = "Oops! You cannot exit while a print is active.".Localize(); - string cannotExitWhileActiveTitle = "Unable to Exit"; - bool exit_Click() - { - UiThread.RunOnIdle((state) => - { - GuiWidget parent = this; - while (parent as MatterControlApplication == null) - { - parent = parent.Parent; - } - - if(PrinterConnectionAndCommunication.Instance.PrinterIsPrinting) - { - StyledMessageBox.ShowMessageBox(null, cannotExitWhileActiveMessage, cannotExitWhileActiveTitle); - } - else - { - - MatterControlApplication app = parent as MatterControlApplication; - app.RestartOnClose = false; - app.Close(); - - } - - }); - return true; - } - } - - public class MenuOptionHelp : GuiWidget - { - public DropDownMenu MenuDropList; - private TupleList> menuItems; - - public MenuOptionHelp() - { - MenuDropList = new DropDownMenu("Help".Localize().ToUpper(), Direction.Down, pointSize: 10); - MenuDropList.MenuItemsPadding = new BorderDouble(0); - MenuDropList.Margin = new BorderDouble(0); - MenuDropList.Padding = new BorderDouble(0); - - SetMenuItems(); - - AddChild(MenuDropList); - this.Width = 48 * TextWidget.GlobalPointSizeScaleRatio; - this.Height = 22 * TextWidget.GlobalPointSizeScaleRatio; - this.Margin = new BorderDouble(0); - this.Padding = new BorderDouble(0); - this.VAnchor = Agg.UI.VAnchor.ParentCenter; - this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); - this.MenuDropList.OpenOffset = new Vector2(0, 0); - } - - void MenuDropList_SelectionChanged(object sender, EventArgs e) - { - string menuSelection = ((DropDownMenu)sender).SelectedValue; - foreach (Tuple> item in menuItems) - { - if (item.Item1 == menuSelection) - { - if (item.Item2 != null) - { - item.Item2(); - } - } - } - } - - void SetMenuItems() - { - menuItems = new TupleList> - { - {LocalizedString.Get("Getting Started"), gettingStarted_Click}, - {LocalizedString.Get("View Help"), help_Click}, - {LocalizedString.Get("Report a Bug"), bug_Click}, - {LocalizedString.Get("Release Notes"), notes_Click}, - {LocalizedString.Get("About MatterControl"), about_Click}, - }; - - BorderDouble padding = MenuDropList.MenuItemsPadding; - //Add the menu items to the menu itself - foreach (Tuple> item in menuItems) - { - MenuDropList.MenuItemsPadding = new BorderDouble(8, 4, 8, 4) * TextWidget.GlobalPointSizeScaleRatio; - MenuDropList.AddItem(item.Item1, pointSize: 10); - } - MenuDropList.Padding = padding; - } - - - bool bug_Click() - { - - UiThread.RunOnIdle((state) => - { - ContactFormWindow.Open(); - }); - return true; - } - - bool help_Click() - { - UiThread.RunOnIdle((state) => - { - System.Diagnostics.Process.Start("http://www.mattercontrol.com/articles"); - }); - return true; - } - - bool about_Click() - { - UiThread.RunOnIdle((state) => - { - AboutWindow.Show(); - }); - return true; - } - - bool notes_Click() - { - UiThread.RunOnIdle((state) => - { - System.Diagnostics.Process.Start("http://wiki.mattercontrol.com/Release_Notes"); - }); - return true; - } - - bool gettingStarted_Click() - { - UiThread.RunOnIdle((state) => - { - System.Diagnostics.Process.Start("http://www.mattercontrol.com/articles/mattercontrol-getting-started"); - }); - - return true; - } - } -} diff --git a/ApplicationView/MenuRow/ApplicationMenuRow.cs b/ApplicationView/MenuRow/ApplicationMenuRow.cs new file mode 100644 index 000000000..2d2e06bee --- /dev/null +++ b/ApplicationView/MenuRow/ApplicationMenuRow.cs @@ -0,0 +1,80 @@ +using System; +using System.IO; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.Localizations; +using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.MatterControl.DataStorage; +using MatterHackers.MatterControl.ContactForm; +using MatterHackers.MatterControl.PrinterCommunication; +using MatterHackers.MatterControl.PrinterControls.PrinterConnections; +using MatterHackers.MatterControl.PrintQueue; +using MatterHackers.VectorMath; + +namespace MatterHackers.MatterControl +{ + public class ApplicationMenuRow : FlowLayoutWidget + { + static FlowLayoutWidget rightElement; + + public ApplicationMenuRow() + :base(FlowDirection.LeftToRight) + { + LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); + linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; + linkButtonFactory.fontSize = 8; + + Button signInLink = linkButtonFactory.Generate("(Sign Out)"); + signInLink.VAnchor = Agg.UI.VAnchor.ParentCenter; + signInLink.Margin = new BorderDouble(top: 0); + + this.HAnchor = HAnchor.ParentLeftRight; + this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; + + // put in the file menu + MenuOptionFile menuOptionFile = new MenuOptionFile(); + this.AddChild(menuOptionFile); + + // put in the view menu + MenuOptionView viewOptionFile = new MenuOptionView(); + this.AddChild(viewOptionFile); + + // put in the help menu + MenuOptionHelp menuOptionHelp = new MenuOptionHelp(); + this.AddChild(menuOptionHelp); + + // put in a spacer + this.AddChild(new HorizontalSpacer()); + + // make an object that can hold custom content on the right (like the sign in) + rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight); + rightElement.Height = 24; + rightElement.Margin = new BorderDouble(bottom: 4); + this.AddChild(rightElement); + + this.Padding = new BorderDouble(0, 0, 6, 0); + + if (privateAddRightElement != null) + { + privateAddRightElement(rightElement); + } + } + + public delegate void AddRightElementDelegate(GuiWidget iconContainer); + private static event AddRightElementDelegate privateAddRightElement; + public static event AddRightElementDelegate AddRightElement + { + add + { + privateAddRightElement += value; + // and call it right away + value(rightElement); + } + + remove + { + privateAddRightElement -= value; + } + } + } +} diff --git a/ApplicationView/MenuRow/MenuOptionFile.cs b/ApplicationView/MenuRow/MenuOptionFile.cs new file mode 100644 index 000000000..25152bc55 --- /dev/null +++ b/ApplicationView/MenuRow/MenuOptionFile.cs @@ -0,0 +1,140 @@ +using System; +using System.IO; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.Localizations; +using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.MatterControl.DataStorage; +using MatterHackers.MatterControl.ContactForm; +using MatterHackers.MatterControl.PrinterCommunication; +using MatterHackers.MatterControl.PrinterControls.PrinterConnections; +using MatterHackers.MatterControl.PrintQueue; +using MatterHackers.VectorMath; + +namespace MatterHackers.MatterControl +{ + public class MenuOptionFile : GuiWidget + { + public DropDownMenu MenuDropList; + private TupleList> menuItems; + + public MenuOptionFile() + { + MenuDropList = new DropDownMenu("File".Localize().ToUpper(), Direction.Down,pointSize:10); + MenuDropList.MenuItemsPadding = new BorderDouble(0); + MenuDropList.Margin = new BorderDouble(0); + MenuDropList.Padding = new BorderDouble(0); + + SetMenuItems(); + + AddChild(MenuDropList); + this.Width = 44 * TextWidget.GlobalPointSizeScaleRatio;; + this.Height = 22 * TextWidget.GlobalPointSizeScaleRatio;; + this.Margin = new BorderDouble(0); + this.Padding = new BorderDouble(0); + this.VAnchor = Agg.UI.VAnchor.ParentCenter; + this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); + this.MenuDropList.OpenOffset = new Vector2(0, 0); + } + + void MenuDropList_SelectionChanged(object sender, EventArgs e) + { + string menuSelection = ((DropDownMenu)sender).SelectedValue; + foreach (Tuple> item in menuItems) + { + if (item.Item1 == menuSelection) + { + if (item.Item2 != null) + { + item.Item2(); + } + } + } + } + + void SetMenuItems() + { + menuItems = new TupleList> + { + {LocalizedString.Get("Add Printer"), addPrinter_Click}, + {LocalizedString.Get("Add File"), importFile_Click}, + {LocalizedString.Get("Exit"), exit_Click}, + }; + + BorderDouble padding = MenuDropList.MenuItemsPadding; + //Add the menu items to the menu itself + foreach (Tuple> item in menuItems) + { + MenuDropList.MenuItemsPadding = new BorderDouble(8,4,8,4) * TextWidget.GlobalPointSizeScaleRatio; + MenuDropList.AddItem(item.Item1,pointSize:10); + } + MenuDropList.Padding = padding; + } + + + bool addPrinter_Click() + { + UiThread.RunOnIdle((state) => + { + ConnectionWindow.Show(); + }); + return true; + } + + bool importFile_Click() + { + UiThread.RunOnIdle((state) => + { + FileDialog.OpenFileDialog( + new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams) + { + MultiSelect = true, + ActionButtonLabel = "Add to Queue", + Title = "MatterControl: Select A File" + }, + (openParams) => + { + if (openParams.FileNames != null) + { + foreach (string loadedFileName in openParams.FileNames) + { + QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), Path.GetFullPath(loadedFileName)))); + } + } + + }); + + }); + return true; + } + + string cannotExitWhileActiveMessage = "Oops! You cannot exit while a print is active.".Localize(); + string cannotExitWhileActiveTitle = "Unable to Exit"; + bool exit_Click() + { + UiThread.RunOnIdle((state) => + { + GuiWidget parent = this; + while (parent as MatterControlApplication == null) + { + parent = parent.Parent; + } + + if(PrinterConnectionAndCommunication.Instance.PrinterIsPrinting) + { + StyledMessageBox.ShowMessageBox(null, cannotExitWhileActiveMessage, cannotExitWhileActiveTitle); + } + else + { + + MatterControlApplication app = parent as MatterControlApplication; + app.RestartOnClose = false; + app.Close(); + + } + + }); + return true; + } + } +} diff --git a/ApplicationView/MenuRow/MenuOptionHelp.cs b/ApplicationView/MenuRow/MenuOptionHelp.cs new file mode 100644 index 000000000..5da6abd51 --- /dev/null +++ b/ApplicationView/MenuRow/MenuOptionHelp.cs @@ -0,0 +1,124 @@ +using System; +using System.IO; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.Localizations; +using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.MatterControl.DataStorage; +using MatterHackers.MatterControl.ContactForm; +using MatterHackers.MatterControl.PrinterCommunication; +using MatterHackers.MatterControl.PrinterControls.PrinterConnections; +using MatterHackers.MatterControl.PrintQueue; +using MatterHackers.VectorMath; + +namespace MatterHackers.MatterControl +{ + public class MenuOptionHelp : GuiWidget + { + public DropDownMenu MenuDropList; + private TupleList> menuItems; + + public MenuOptionHelp() + { + MenuDropList = new DropDownMenu("Help".Localize().ToUpper(), Direction.Down, pointSize: 10); + MenuDropList.MenuItemsPadding = new BorderDouble(0); + MenuDropList.Margin = new BorderDouble(0); + MenuDropList.Padding = new BorderDouble(0); + + SetMenuItems(); + + AddChild(MenuDropList); + this.Width = 48 * TextWidget.GlobalPointSizeScaleRatio; + this.Height = 22 * TextWidget.GlobalPointSizeScaleRatio; + this.Margin = new BorderDouble(0); + this.Padding = new BorderDouble(0); + this.VAnchor = Agg.UI.VAnchor.ParentCenter; + this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); + this.MenuDropList.OpenOffset = new Vector2(0, 0); + } + + void MenuDropList_SelectionChanged(object sender, EventArgs e) + { + string menuSelection = ((DropDownMenu)sender).SelectedValue; + foreach (Tuple> item in menuItems) + { + if (item.Item1 == menuSelection) + { + if (item.Item2 != null) + { + item.Item2(); + } + } + } + } + + void SetMenuItems() + { + menuItems = new TupleList> + { + {LocalizedString.Get("Getting Started"), gettingStarted_Click}, + {LocalizedString.Get("View Help"), help_Click}, + {LocalizedString.Get("Report a Bug"), bug_Click}, + {LocalizedString.Get("Release Notes"), notes_Click}, + {LocalizedString.Get("About MatterControl"), about_Click}, + }; + + BorderDouble padding = MenuDropList.MenuItemsPadding; + //Add the menu items to the menu itself + foreach (Tuple> item in menuItems) + { + MenuDropList.MenuItemsPadding = new BorderDouble(8, 4, 8, 4) * TextWidget.GlobalPointSizeScaleRatio; + MenuDropList.AddItem(item.Item1, pointSize: 10); + } + MenuDropList.Padding = padding; + } + + + bool bug_Click() + { + + UiThread.RunOnIdle((state) => + { + ContactFormWindow.Open(); + }); + return true; + } + + bool help_Click() + { + UiThread.RunOnIdle((state) => + { + System.Diagnostics.Process.Start("http://www.mattercontrol.com/articles"); + }); + return true; + } + + bool about_Click() + { + UiThread.RunOnIdle((state) => + { + AboutWindow.Show(); + }); + return true; + } + + bool notes_Click() + { + UiThread.RunOnIdle((state) => + { + System.Diagnostics.Process.Start("http://wiki.mattercontrol.com/Release_Notes"); + }); + return true; + } + + bool gettingStarted_Click() + { + UiThread.RunOnIdle((state) => + { + System.Diagnostics.Process.Start("http://www.mattercontrol.com/articles/mattercontrol-getting-started"); + }); + + return true; + } + } +} diff --git a/ApplicationView/MenuRow/MenuOptionHelpView.cs b/ApplicationView/MenuRow/MenuOptionHelpView.cs new file mode 100644 index 000000000..01e5634be --- /dev/null +++ b/ApplicationView/MenuRow/MenuOptionHelpView.cs @@ -0,0 +1,90 @@ +using System; +using System.IO; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.Localizations; +using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.MatterControl.DataStorage; +using MatterHackers.MatterControl.ContactForm; +using MatterHackers.MatterControl.PrinterCommunication; +using MatterHackers.MatterControl.PrinterControls.PrinterConnections; +using MatterHackers.MatterControl.PrintQueue; +using MatterHackers.VectorMath; + +namespace MatterHackers.MatterControl +{ + public class MenuOptionView : GuiWidget + { + public DropDownMenu MenuDropList; + private TupleList> menuItems; + + public MenuOptionView() + { + MenuDropList = new DropDownMenu("View".Localize().ToUpper(), Direction.Down, pointSize: 10); + MenuDropList.MenuItemsPadding = new BorderDouble(0); + MenuDropList.Margin = new BorderDouble(0); + MenuDropList.Padding = new BorderDouble(0); + + SetMenuItems(); + + AddChild(MenuDropList); + this.Width = 48 * TextWidget.GlobalPointSizeScaleRatio; + this.Height = 22 * TextWidget.GlobalPointSizeScaleRatio; + this.Margin = new BorderDouble(0); + this.Padding = new BorderDouble(0); + this.VAnchor = Agg.UI.VAnchor.ParentCenter; + this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); + this.MenuDropList.OpenOffset = new Vector2(0, 0); + } + + void MenuDropList_SelectionChanged(object sender, EventArgs e) + { + string menuSelection = ((DropDownMenu)sender).SelectedValue; + foreach (Tuple> item in menuItems) + { + if (item.Item1 == menuSelection) + { + if (item.Item2 != null) + { + item.Item2(); + } + } + } + } + + void SetMenuItems() + { + menuItems = new TupleList> + { + {LocalizedString.Get("Simple"), simple_Click}, + {LocalizedString.Get("Intermediat"), intermediate_Click}, + {LocalizedString.Get("Advanced"), advanced_Click}, + }; + + BorderDouble padding = MenuDropList.MenuItemsPadding; + //Add the menu items to the menu itself + foreach (Tuple> item in menuItems) + { + MenuDropList.MenuItemsPadding = new BorderDouble(8, 4, 8, 4) * TextWidget.GlobalPointSizeScaleRatio; + MenuDropList.AddItem(item.Item1, pointSize: 10); + } + MenuDropList.Padding = padding; + } + + + bool advanced_Click() + { + return true; + } + + bool intermediate_Click() + { + return true; + } + + bool simple_Click() + { + return true; + } + } +} diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index be47dafe6..a5e956885 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -194,7 +194,7 @@ namespace MatterHackers.MatterControl double buildHeight = ActiveSliceSettings.Instance.BuildHeight; - if (OemSettings.Instance.UseLiteInterface) + if (OemSettings.Instance.UseLiteInterfaceByDefault) { PartPreviewContent partViewContent = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, true, View3DWidget.AutoRotate.Enabled, false); partViewContent.AnchorAll(); @@ -248,7 +248,7 @@ namespace MatterHackers.MatterControl } else { - if (OemSettings.Instance.UseLiteInterface) + if (OemSettings.Instance.UseLiteInterfaceByDefault) { return 2; } @@ -281,7 +281,7 @@ namespace MatterHackers.MatterControl break; case 2: - if (OemSettings.Instance.UseLiteInterface) + if (OemSettings.Instance.UseLiteInterfaceByDefault) { ApplicationController.Instance.WidescreenMode = false; LoadCompactView(); @@ -340,7 +340,7 @@ namespace MatterHackers.MatterControl case 2: Padding = new BorderDouble(4); ColumnOne.Visible = true; - if (OemSettings.Instance.UseLiteInterface) + if (OemSettings.Instance.UseLiteInterfaceByDefault) { LeftBorderLine.Visible = true; RightBorderLine.Visible = false; diff --git a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs index fac195aae..847ada14d 100644 --- a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs +++ b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs @@ -69,9 +69,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage this.textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; this.linkButtonFactory.fontSize = 11; - } - - + } private FlowLayoutWidget GetThemeControl() { @@ -107,13 +105,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage currentColorThemeBorder.AddChild(currentColorTheme); ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget(colorToChangeTo: currentColorTheme); - themeSelector.Margin = new BorderDouble(right: 5); - - + themeSelector.Margin = new BorderDouble(right: 5); colorSelectorContainer.AddChild(themeSelector); - colorSelectorContainer.AddChild(currentColorThemeBorder); - + colorSelectorContainer.AddChild(currentColorThemeBorder); buttonRow.AddChild(settingLabel); buttonRow.AddChild(colorSelectorContainer); @@ -127,7 +122,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Margin = new BorderDouble(top: 4); - TextWidget settingsLabel = new TextWidget(LocalizedString.Get("Change Display Mode")); settingsLabel.AutoExpandBoundsToText = true; settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; @@ -142,7 +136,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage RestartApplication(); }; - FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); optionsContainer.Margin = new BorderDouble(bottom: 6); diff --git a/MatterControl.csproj b/MatterControl.csproj index b65e770fc..a9b9919a7 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -99,7 +99,10 @@ - + + + + diff --git a/PartPreviewWindow/PlatingHelper.cs b/PartPreviewWindow/PlatingHelper.cs index 97f77d453..41d222887 100644 --- a/PartPreviewWindow/PlatingHelper.cs +++ b/PartPreviewWindow/PlatingHelper.cs @@ -248,19 +248,10 @@ namespace MatterHackers.MatterControl reportProgress(currentAction / (double)totalActionCount, "Creating Trace Group", out continueProcessing); } -#if false // this is to do some timing on creating tracking info - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); -#endif - perMeshGroupInfo[meshGroupIndex].meshTraceableData.Add(BoundingVolumeHierarchy.CreateNewHierachy(allPolys)); - //perMeshGroupInfo[meshGroupIndex].meshTraceableData.Add(new UnboundCollection(allPolys)); -#if false - stopWatch.Stop(); - using (StreamWriter outputStream = File.AppendText("output.txt")) - { - outputStream.WriteLine("Plating Helper BoundingVolumeHierarchy.CreateNewHierachy {0:0.00} seconds".FormatWith(stopWatch.Elapsed.TotalSeconds)); - } -#endif + // put all the polys into an unbound collection so the work is done quickely + IRayTraceable traceData = BoundingVolumeHierarchy.CreateNewHierachy(allPolys, 1); + //IRayTraceable traceData = new UnboundCollection(allPolys, UnboundCollection.OptomizeOption.OptomizeOnUse); + perMeshGroupInfo[meshGroupIndex].meshTraceableData.Add(traceData); } } } diff --git a/PartPreviewWindow/View3D/View3DUngroup.cs b/PartPreviewWindow/View3D/View3DUngroup.cs index 27cb77d53..15f5d4d70 100644 --- a/PartPreviewWindow/View3D/View3DUngroup.cs +++ b/PartPreviewWindow/View3D/View3DUngroup.cs @@ -74,11 +74,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY); int indexBeingReplaced = SelectedMeshGroupIndex; + List discreetMeshes = new List(); asynchMeshGroups[indexBeingReplaced].Transform(asynchMeshGroupTransforms[indexBeingReplaced].TotalTransform); - List discreetMeshes = CreateDiscreteMeshes.SplitConnectedIntoMeshes(asynchMeshGroups[indexBeingReplaced], (double progress0To1, string processingState, out bool continueProcessing) => + // if there are multiple meshes than just make them separate groups + if (asynchMeshGroups[indexBeingReplaced].Meshes.Count > 1) { - BackgroundWorker_ProgressChanged(progress0To1 * .5, processingState, out continueProcessing); - }); + foreach(Mesh mesh in asynchMeshGroups[indexBeingReplaced].Meshes) + { + discreetMeshes.Add(mesh); + } + } + else // actually try and cut up the mesh into separate parts + { + discreetMeshes = CreateDiscreteMeshes.SplitConnectedIntoMeshes(asynchMeshGroups[indexBeingReplaced], (double progress0To1, string processingState, out bool continueProcessing) => + { + BackgroundWorker_ProgressChanged(progress0To1 * .5, processingState, out continueProcessing); + }); + } asynchMeshGroups.RemoveAt(indexBeingReplaced); asynchPlatingDatas.RemoveAt(indexBeingReplaced); @@ -102,7 +114,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // and create selection info PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, addedMeshIndex, (double progress0To1, string processingState, out bool continueProcessing) => { - BackgroundWorker_ProgressChanged(progress0To1 * .5 + .5, processingState, out continueProcessing); + BackgroundWorker_ProgressChanged(.5 + progress0To1 * .5 * currentRatioDone, processingState, out continueProcessing); }); currentRatioDone += ratioPerDiscreetMesh; } diff --git a/SettingsManagement/OemSettings.cs b/SettingsManagement/OemSettings.cs index 2ea242a64..4cc102c61 100644 --- a/SettingsManagement/OemSettings.cs +++ b/SettingsManagement/OemSettings.cs @@ -34,7 +34,7 @@ namespace MatterHackers.MatterControl.SettingsManagement } } - public bool UseLiteInterface = false; + public bool UseLiteInterfaceByDefault = false; public string ThemeColor = ""; diff --git a/SlicerConfiguration/ActiveSliceSettings.cs b/SlicerConfiguration/ActiveSliceSettings.cs index 8d80c51ee..90671e6bd 100644 --- a/SlicerConfiguration/ActiveSliceSettings.cs +++ b/SlicerConfiguration/ActiveSliceSettings.cs @@ -468,17 +468,20 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return "Unknown"; } + + public enum SettingsStackLayers { CurrentSetings = 0, SaveSettings = 1, QualitySettings = 2, MatterialSettings = 3}; /// /// Returns whether or not the setting is overridden by the active layer /// /// /// - public bool SettingExistsInLayer(string sliceSetting, int layer=0) + public bool SettingExistsInLayer(string sliceSetting, SettingsStackLayers layer = SettingsStackLayers.CurrentSetings) { bool settingExistsInLayer; - if (layer < activeSettingsLayers.Count) + int layerIndex = (int)layer; + if (layerIndex < activeSettingsLayers.Count) { - settingExistsInLayer = (activeSettingsLayers[layer].settingsDictionary.ContainsKey(sliceSetting)); + settingExistsInLayer = (activeSettingsLayers[layerIndex].settingsDictionary.ContainsKey(sliceSetting)); } else { diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 6e3e106bc..57a15634e 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -542,11 +542,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor; settingName.VAnchor = Agg.UI.VAnchor.ParentCenter; - if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3)) + if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, ActiveSliceSettings.SettingsStackLayers.MatterialSettings)) { addMaterialOverlay = true; } - else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 2)) + else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, ActiveSliceSettings.SettingsStackLayers.QualitySettings)) { addQualityOverlay = true; } diff --git a/StaticData/OEMSettings/Settings.json b/StaticData/OEMSettings/Settings.json index 5e28ce444..6c7a5600e 100644 --- a/StaticData/OEMSettings/Settings.json +++ b/StaticData/OEMSettings/Settings.json @@ -1,5 +1,5 @@ { - "UseLiteInterface": false, + "UseLiteInterfaceByDefault": false, "ThemeColor": "", "AffiliateCode": "5NEP8W", "WindowTitleExtra": "",