From 7eec6753e210ede322d826f7366356d1497a2bce Mon Sep 17 00:00:00 2001 From: larsbrubaker Date: Thu, 3 Jul 2014 10:19:45 -0700 Subject: [PATCH] Renamed MainScreenTabView -> FirstPanelTabView --- ApplicationView/CompactSlidePanel.cs | 2 +- .../{MainScreenTabView.cs => FirstPanelTabView.cs} | 10 +++++----- ApplicationView/WidescreenPanel.cs | 2 +- MatterControl.csproj | 2 +- PrintQueue/QueueDataView.cs | 13 +++++++------ 5 files changed, 15 insertions(+), 14 deletions(-) rename ApplicationView/{MainScreenTabView.cs => FirstPanelTabView.cs} (96%) diff --git a/ApplicationView/CompactSlidePanel.cs b/ApplicationView/CompactSlidePanel.cs index 31f294725..49475658b 100644 --- a/ApplicationView/CompactSlidePanel.cs +++ b/ApplicationView/CompactSlidePanel.cs @@ -88,7 +88,7 @@ namespace MatterHackers.MatterControl this.LeftPanel.AddChild(new PrintProgressBar()); // construct the main controls tab control - mainControlsTabControl = new MainScreenTabView(queueDataView); + mainControlsTabControl = new FirstPanelTabView(queueDataView); advancedControlsButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; advancedControlsButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; diff --git a/ApplicationView/MainScreenTabView.cs b/ApplicationView/FirstPanelTabView.cs similarity index 96% rename from ApplicationView/MainScreenTabView.cs rename to ApplicationView/FirstPanelTabView.cs index 71fdce841..a07a8c44c 100644 --- a/ApplicationView/MainScreenTabView.cs +++ b/ApplicationView/FirstPanelTabView.cs @@ -51,9 +51,9 @@ using MatterHackers.MatterControl.PrintHistory; namespace MatterHackers.MatterControl { - class MainScreenTabView : TabControl + class FirstPanelTabView : TabControl { - static int tabStateBeforeChangePanels = 0; + public static int firstPanelCurrentTab = 0; TabPage QueueTabPage; TabPage LibraryTabPage; @@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl QueueDataView queueDataView; event EventHandler unregisterEvents; - public MainScreenTabView(QueueDataView queueDataView) + public FirstPanelTabView(QueueDataView queueDataView) { this.queueDataView = queueDataView; this.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; @@ -101,7 +101,7 @@ namespace MatterHackers.MatterControl WidescreenPanel.PreChangePannels.RegisterEvent(SaveCurrentTab, ref unregisterEvents); - SelectedTabIndex = tabStateBeforeChangePanels; + SelectedTabIndex = firstPanelCurrentTab; } void NumQueueItemsChanged(object sender, EventArgs widgetEvent) @@ -113,7 +113,7 @@ namespace MatterHackers.MatterControl void SaveCurrentTab(object sender, EventArgs e) { - tabStateBeforeChangePanels = SelectedTabIndex; + firstPanelCurrentTab = SelectedTabIndex; } public override void OnClosed(EventArgs e) diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index bc897c92e..aa175a685 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -241,7 +241,7 @@ namespace MatterHackers.MatterControl ColumnOne.VAnchor = VAnchor.ParentBottomTop; ColumnOne.AddChild(new ActionBarPlus(queueDataView)); ColumnOne.AddChild(new PrintProgressBar()); - ColumnOne.AddChild(new MainScreenTabView(queueDataView)); + ColumnOne.AddChild(new FirstPanelTabView(queueDataView)); ColumnOne.Width = 500; //Ordering here matters - must go after children are added } diff --git a/MatterControl.csproj b/MatterControl.csproj index fdc8703ab..463056764 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -96,7 +96,7 @@ - + diff --git a/PrintQueue/QueueDataView.cs b/PrintQueue/QueueDataView.cs index 7d34e21ca..fb748ea50 100644 --- a/PrintQueue/QueueDataView.cs +++ b/PrintQueue/QueueDataView.cs @@ -33,6 +33,7 @@ using MatterHackers.Agg; using MatterHackers.Agg.Image; using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; +using MatterHackers.MatterControl; using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.PrinterCommunication; using MatterHackers.VectorMath; @@ -41,6 +42,8 @@ namespace MatterHackers.MatterControl.PrintQueue { public class QueueDataView : ScrollableWidget { + public static int selectedQueueItemIndex = -1; + event EventHandler unregisterEvents; // make this private so it can only be built from the Instance @@ -193,8 +196,6 @@ namespace MatterHackers.MatterControl.PrintQueue } } - static int lastSelectedTabOnAnyView = -1; - public int SelectedIndex { get @@ -343,14 +344,14 @@ namespace MatterHackers.MatterControl.PrintQueue PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(PrintItemChange, ref unregisterEvents); - WidescreenPanel.PreChangePannels.RegisterEvent(SaveCurrentTab, ref unregisterEvents); + WidescreenPanel.PreChangePannels.RegisterEvent(SaveCurrentlySelctedItemIndex, ref unregisterEvents); - SelectedIndex = lastSelectedTabOnAnyView; + SelectedIndex = selectedQueueItemIndex; } - void SaveCurrentTab(object sender, EventArgs e) + void SaveCurrentlySelctedItemIndex(object sender, EventArgs e) { - lastSelectedTabOnAnyView = SelectedIndex; + selectedQueueItemIndex = SelectedIndex; }