Got the advanced controls panel to keeps its state between the compact view and the wide screen view.
This commit is contained in:
parent
5589b4e737
commit
4bdba6d740
5 changed files with 25 additions and 95 deletions
|
|
@ -53,9 +53,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
event EventHandler unregisterEvents;
|
||||
|
||||
ThirdPanelTabView thirdPanelTabView;
|
||||
TabControl mainControlsTabControl;
|
||||
private delegate void ReloadPanel();
|
||||
public TabPage QueueTabPage;
|
||||
public TabPage AboutTabPage;
|
||||
|
||||
|
|
@ -117,13 +115,10 @@ namespace MatterHackers.MatterControl
|
|||
// do the right panel
|
||||
{
|
||||
this.RightPanel.AddChild(new PrintProgressBar());
|
||||
thirdPanelTabView = new ThirdPanelTabView(sliceSettingsUiState, AdvancedControlsButton_Click, onMouseEnterBoundsPrintQueueLink, onMouseLeaveBoundsPrintQueueLink);
|
||||
ThirdPanelTabView thirdPanelTabView = new ThirdPanelTabView(AdvancedControlsButton_Click, onMouseEnterBoundsPrintQueueLink, onMouseLeaveBoundsPrintQueueLink);
|
||||
this.RightPanel.AddChild(thirdPanelTabView);
|
||||
}
|
||||
|
||||
// make sure we reload when we need to
|
||||
ApplicationWidget.Instance.ReloadPanelTrigger.RegisterEvent(ReloadBackPanel, ref unregisterEvents);
|
||||
|
||||
WidescreenPanel.PreChangePannels.RegisterEvent(SaveCurrentPanelIndex, ref unregisterEvents);
|
||||
|
||||
SetPanelIndexImediate(lastPanelIndexBeforeReload);
|
||||
|
|
@ -179,10 +174,5 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
//Empty function used as placeholder
|
||||
}
|
||||
|
||||
public void ReloadBackPanel(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
UiThread.RunOnIdle(thirdPanelTabView.ReloadSliceSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace MatterHackers.MatterControl
|
|||
public class ApplicationWidget : GuiWidget
|
||||
{
|
||||
static ApplicationWidget globalInstance;
|
||||
public RootedObjectEventHandler ReloadPanelTrigger = new RootedObjectEventHandler();
|
||||
public RootedObjectEventHandler ReloadAdvancedControlsPanelTrigger = new RootedObjectEventHandler();
|
||||
public RootedObjectEventHandler CloudSyncStatusChanged = new RootedObjectEventHandler();
|
||||
|
||||
public SlicePresetsWindow EditSlicePresetsWindow { get; set;}
|
||||
|
|
@ -97,8 +97,6 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
UiThread.RunOnIdle((state) =>
|
||||
{
|
||||
widescreenPanel.StoreUiState();
|
||||
|
||||
// give the widget a chance to hear about the close before they are actually colsed.
|
||||
bool cancelClose;
|
||||
this.OnClosing(out cancelClose);
|
||||
|
|
@ -129,7 +127,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public void ReloadAdvancedControlsPanel()
|
||||
{
|
||||
ReloadPanelTrigger.CallEvents(this, null);
|
||||
ReloadAdvancedControlsPanelTrigger.CallEvents(this, null);
|
||||
}
|
||||
|
||||
public void ChangeCloudSyncStatus()
|
||||
|
|
|
|||
|
|
@ -64,8 +64,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
TabControl advancedControls2;
|
||||
|
||||
public ThirdPanelTabView(SliceSettingsWidget.UiState sliceSettingsUiState,
|
||||
ButtonBase.ButtonEventHandler AdvancedControlsButton_Click = null,
|
||||
public ThirdPanelTabView(ButtonBase.ButtonEventHandler AdvancedControlsButton_Click = null,
|
||||
EventHandler onMouseEnterBoundsPrintQueueLink = null,
|
||||
EventHandler onMouseLeaveBoundsPrintQueueLink = null)
|
||||
{
|
||||
|
|
@ -73,15 +72,30 @@ namespace MatterHackers.MatterControl
|
|||
this.onMouseEnterBoundsPrintQueueLink = onMouseEnterBoundsPrintQueueLink;
|
||||
this.onMouseLeaveBoundsPrintQueueLink = onMouseLeaveBoundsPrintQueueLink;
|
||||
|
||||
advancedControls2 = CreateNewAdvancedControls(sliceSettingsUiState, AdvancedControlsButton_Click, onMouseEnterBoundsPrintQueueLink, onMouseLeaveBoundsPrintQueueLink);
|
||||
advancedControls2 = CreateNewAdvancedControls(new SliceSettingsWidget.UiState(), AdvancedControlsButton_Click, onMouseEnterBoundsPrintQueueLink, onMouseLeaveBoundsPrintQueueLink);
|
||||
|
||||
AddChild(advancedControls2);
|
||||
|
||||
WidescreenPanel.PreChangePannels.RegisterEvent(SaveCurrentPanelIndex, ref unregisterEvents);
|
||||
ApplicationWidget.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent(ReloadBackPanel, ref unregisterEvents);
|
||||
|
||||
AnchorAll();
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
unregisterEvents(this, null);
|
||||
}
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
public void ReloadBackPanel(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
UiThread.RunOnIdle(ReloadSliceSettings);
|
||||
}
|
||||
|
||||
void SaveCurrentPanelIndex(object sender, EventArgs e)
|
||||
{
|
||||
if (advancedControls2.Children.Count > 0)
|
||||
|
|
@ -129,17 +143,17 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
//Add the tab contents for 'Advanced Controls'
|
||||
string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), "Controls Tab", 14,
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), "Controls Tab", 16,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
string sliceSettingsLabel = LocalizedString.Get("Slice Settings").ToUpper();
|
||||
sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), "Slice Settings Tab", 14,
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), "Slice Settings Tab", 16,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
string configurationLabel = LocalizedString.Get("Configuration").ToUpper();
|
||||
ScrollableWidget configurationControls = new PrinterConfigurationPage();
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), "Configuration Tab", 14,
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), "Configuration Tab", 16,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
advancedControls.SelectedTabIndex = lastAdvanceControlsIndex;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ namespace MatterHackers.MatterControl
|
|||
static int lastNumberOfVisiblePanels;
|
||||
|
||||
SliceSettingsWidget sliceSettingsWidget;
|
||||
TabControl advancedControls;
|
||||
public TabPage AboutTabPage;
|
||||
TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
|
||||
RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;
|
||||
|
|
@ -91,7 +90,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(LoadSettingsOnPrinterChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
|
||||
ApplicationWidget.Instance.ReloadPanelTrigger.RegisterEvent(ReloadAdvancedControlsPanel, ref unregisterEvents);
|
||||
ApplicationWidget.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent(ReloadAdvancedControlsPanel, ref unregisterEvents);
|
||||
this.BoundsChanged += new EventHandler(onBoundsChanges);
|
||||
}
|
||||
|
||||
|
|
@ -139,52 +138,6 @@ namespace MatterHackers.MatterControl
|
|||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
void AdvancedControlsClosed(object sender, EventArgs e)
|
||||
{
|
||||
advancedControls.Closed -= AdvancedControlsClosed;
|
||||
advancedControls = null;
|
||||
}
|
||||
|
||||
TabControl CreateNewAdvancedControlsTab(SliceSettingsWidget.UiState sliceSettingsUiState)
|
||||
{
|
||||
StoreUiState();
|
||||
|
||||
advancedControls = new TabControl();
|
||||
advancedControls.Closed += AdvancedControlsClosed;
|
||||
advancedControls.AnchorAll();
|
||||
advancedControls.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
advancedControls.TabBar.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
|
||||
advancedControls.TabBar.Margin = new BorderDouble(0, 0);
|
||||
advancedControls.TabBar.Padding = new BorderDouble(0, 2);
|
||||
|
||||
advancedControlsButtonFactory.invertImageLocation = false;
|
||||
|
||||
GuiWidget manualPrinterControls = new ManualPrinterControls();
|
||||
ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
|
||||
manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
|
||||
manualPrinterControlsScrollArea.AnchorAll();
|
||||
manualPrinterControlsScrollArea.AddChild(manualPrinterControls);
|
||||
|
||||
//Add the tab contents for 'Advanced Controls'
|
||||
string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), "Controls Tab", 16,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
string sliceSettingsLabel = LocalizedString.Get("Slice Settings").ToUpper();
|
||||
sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), "Slice Settings Tab", 16,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
string configurationLabel = LocalizedString.Get("Configuration").ToUpper();
|
||||
ScrollableWidget configurationControls = new PrinterConfigurationPage();
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), "ConfigurationPage Tab", 16,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
RestoreUiState();
|
||||
|
||||
return advancedControls;
|
||||
}
|
||||
|
||||
void onRightBorderClick(object sender, EventArgs e)
|
||||
{
|
||||
RightBorderLine.Hidden = !RightBorderLine.Hidden;
|
||||
|
|
@ -207,22 +160,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public void StoreUiState()
|
||||
{
|
||||
if (advancedControls != null)
|
||||
{
|
||||
MainScreenUiState.lastAdvancedControlsTab = advancedControls.SelectedTabIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void RestoreUiState()
|
||||
{
|
||||
if (MainScreenUiState.lastAdvancedControlsTab != MainScreenUiState.EmpytValue && advancedControls != null)
|
||||
{
|
||||
advancedControls.SelectedTabIndex = MainScreenUiState.lastAdvancedControlsTab;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadCompactView()
|
||||
{
|
||||
queueDataView = new QueueDataView();
|
||||
|
|
@ -264,7 +201,7 @@ namespace MatterHackers.MatterControl
|
|||
void LoadColumnThree(object state = null)
|
||||
{
|
||||
ColumnThree.RemoveAllChildren();
|
||||
ColumnThree.AddChild(CreateNewAdvancedControlsTab(sliceSettingsUiState));
|
||||
ColumnThree.AddChild(new ThirdPanelTabView());
|
||||
ColumnThree.Width = 590; //Ordering here matters - must go after children are added
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +228,6 @@ namespace MatterHackers.MatterControl
|
|||
return;
|
||||
}
|
||||
PreChangePannels.CallEvents(this, null);
|
||||
StoreUiState();
|
||||
RemovePanelsAndCreateEmpties();
|
||||
|
||||
int numberOfPanels = NumberOfVisiblePanels();
|
||||
|
|
@ -312,7 +248,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
LoadColumnOne();
|
||||
// make sure we restore the state of column one because LoadColumnThree is going to save it.
|
||||
RestoreUiState();
|
||||
LoadColumnTwo();
|
||||
LoadColumnThree();
|
||||
break;
|
||||
|
|
@ -320,7 +255,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
SetColumnVisibility(state);
|
||||
|
||||
RestoreUiState();
|
||||
lastNumberOfVisiblePanels = numberOfPanels;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue