diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs index 3c6029195..f613ea409 100644 --- a/ApplicationView/ApplicationController.cs +++ b/ApplicationView/ApplicationController.cs @@ -1597,6 +1597,8 @@ namespace MatterHackers.MatterControl public static IObject3D ClipboardItem { get; internal set; } public Action ShareLibraryItem { get; set; } + public List Workspaces { get; } = new List(); + public event EventHandler AddPrintersTabRightElement; public void NotifyPrintersTabRightElement(GuiWidget sourceExentionArea) diff --git a/PartPreviewWindow/PartPreviewContent.cs b/PartPreviewWindow/PartPreviewContent.cs index 708f68ba2..7cb66f431 100644 --- a/PartPreviewWindow/PartPreviewContent.cs +++ b/PartPreviewWindow/PartPreviewContent.cs @@ -1,5 +1,5 @@ /* -Copyright (c) 2017, Lars Brubaker +Copyright (c) 2018, Lars Brubaker, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without @@ -28,19 +28,14 @@ either expressed or implied, of the FreeBSD Project. */ using System; -using System.IO; using System.Linq; -using System.Reflection; using MatterHackers.Agg; using MatterHackers.Agg.Platform; using MatterHackers.Agg.UI; using MatterHackers.Localizations; -using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.PartPreviewWindow.PlusTab; -using MatterHackers.MatterControl.SettingsManagement; using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.VectorMath; -using Newtonsoft.Json; namespace MatterHackers.MatterControl.PartPreviewWindow { @@ -165,28 +160,26 @@ namespace MatterHackers.MatterControl.PartPreviewWindow ApplicationController.Instance.NotifyPrintersTabRightElement(extensionArea); - // Show start page during initial application startup - { - tabControl.AddTab( - new ChromeTab("Start".Localize(), tabControl, tabControl.NewTabPage(), theme, hasClose: false) - { - MinimumSize = new Vector2(0, theme.TabButtonHeight), - Name = "Start Tab", - Padding = new BorderDouble(15, 0) - }); - } + // Show fixed start page + tabControl.AddTab( + new ChromeTab("Start".Localize(), tabControl, tabControl.NewTabPage(), theme, hasClose: false) + { + MinimumSize = new Vector2(0, theme.TabButtonHeight), + Name = "Start Tab", + Padding = new BorderDouble(15, 0) + }); // Add a tab for the current printer if (ActiveSliceSettings.Instance.PrinterSelected) { - string tabTitle = ActiveSliceSettings.Instance.GetValue(SettingsKey.printer_name); - this.CreatePrinterTab(printer, theme, tabTitle); - } - else - { + this.CreatePrinterTab(printer, theme, printer.Settings.GetValue(SettingsKey.printer_name)); } - // ************** Restore active tabs..... ****************** + // Restore active tabs + foreach (var bed in ApplicationController.Instance.Workspaces) + { + this.CreatePartTab("New Part", bed, theme); + } } internal ChromeTab CreatePrinterTab(PrinterConfig printer, ThemeConfig theme, string tabTitle) diff --git a/PartPreviewWindow/PlusTab/ExplorerBar.cs b/PartPreviewWindow/PlusTab/ExplorerBar.cs index 1873c8884..bf4f60677 100644 --- a/PartPreviewWindow/PlusTab/ExplorerBar.cs +++ b/PartPreviewWindow/PlusTab/ExplorerBar.cs @@ -299,18 +299,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab { UiThread.RunOnIdle(async () => { - BedConfig bed; - partPreviewContent.CreatePartTab( - "New Part", - bed = new BedConfig(), - theme); - + var bed = new BedConfig(); await bed.LoadContent( new EditContext() { ContentStore = ApplicationController.Instance.Library.PartHistory, SourceItem = BedConfig.NewPlatingItem(ApplicationController.Instance.Library.PartHistory) }); + + ApplicationController.Instance.Workspaces.Add(bed); + + partPreviewContent.CreatePartTab( + "New Part", + bed, + theme); }); }; toolbar.AddChild(emptyPlateButton);