spelling of Panel (fixed)
Got the left and right border buttons to be fast.
This commit is contained in:
parent
9c142bdbf8
commit
367b87dd01
6 changed files with 92 additions and 85 deletions
|
|
@ -65,15 +65,15 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
GuiWidget LeftPanel
|
||||
{
|
||||
get { return GetPannel(0); }
|
||||
get { return GetPanel(0); }
|
||||
}
|
||||
|
||||
GuiWidget RightPanel
|
||||
{
|
||||
get { return GetPannel(1); }
|
||||
get { return GetPanel(1); }
|
||||
}
|
||||
|
||||
static int lastPannelIndexOnClose = 0;
|
||||
static int lastPanelIndexOnClose = 0;
|
||||
static int lastAdvanceControlsIndex = 0;
|
||||
public CompactSlidePanel(QueueDataView queueDataView, SliceSettingsWidget.UiState sliceSettingsUiState)
|
||||
: base(2)
|
||||
|
|
@ -125,19 +125,19 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
AddHandlers();
|
||||
|
||||
SetPannelIndexImediate(lastPannelIndexOnClose);
|
||||
SetPanelIndexImediate(lastPanelIndexOnClose);
|
||||
advancedControlsTabControl.SelectedTabIndex = lastAdvanceControlsIndex;
|
||||
}
|
||||
|
||||
void AdvancedControlsButton_Click(object sender, MouseEventArgs mouseEvent)
|
||||
{
|
||||
if (this.PannelIndex == 0)
|
||||
if (this.PanelIndex == 0)
|
||||
{
|
||||
this.PannelIndex = 1;
|
||||
this.PanelIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.PannelIndex = 0;
|
||||
this.PanelIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
lastPannelIndexOnClose = PannelIndex;
|
||||
lastPanelIndexOnClose = PanelIndex;
|
||||
lastAdvanceControlsIndex = advancedControlsTabControl.SelectedTabIndex;
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,16 +93,16 @@ namespace MatterHackers.MatterControl
|
|||
public override void OnParentChanged(EventArgs e)
|
||||
{
|
||||
lastNumberVisible = 0;
|
||||
RecreateAllPannels();
|
||||
RecreateAllPanels();
|
||||
base.OnParentChanged(e);
|
||||
}
|
||||
|
||||
static int lastNumberVisible;
|
||||
void onBoundsChanges(Object sender, EventArgs e)
|
||||
{
|
||||
if (NumberOfVisiblePannels() != lastNumberVisible)
|
||||
if (NumberOfVisiblePanels() != lastNumberVisible)
|
||||
{
|
||||
RecreateAllPannels();
|
||||
RecreateAllPanels();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,13 +177,13 @@ namespace MatterHackers.MatterControl
|
|||
void onRightBorderClick(object sender, EventArgs e)
|
||||
{
|
||||
RightBorderLine.Hidden = !RightBorderLine.Hidden;
|
||||
UiThread.RunOnIdle(RecreateAllPannels);
|
||||
UiThread.RunOnIdle(SetPanelVisblilityForBorderLines);
|
||||
}
|
||||
|
||||
void onLeftBorderClick(object sender, EventArgs e)
|
||||
{
|
||||
LeftBorderLine.Hidden = !LeftBorderLine.Hidden;
|
||||
UiThread.RunOnIdle(RecreateAllPannels);
|
||||
UiThread.RunOnIdle(SetPanelVisblilityForBorderLines);
|
||||
}
|
||||
|
||||
void onActivePrintItemChanged(object sender, EventArgs e)
|
||||
|
|
@ -260,7 +260,7 @@ namespace MatterHackers.MatterControl
|
|||
ColumnThree.Width = 590; //Ordering here matters - must go after children are added
|
||||
}
|
||||
|
||||
int NumberOfVisiblePannels()
|
||||
int NumberOfVisiblePanels()
|
||||
{
|
||||
if (this.Width < Max1ColumnWidth)
|
||||
{
|
||||
|
|
@ -276,25 +276,51 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
void RecreateAllPannels(object state = null)
|
||||
void RecreateAllPanels(object state = null)
|
||||
{
|
||||
if (Width == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
StoreUiState();
|
||||
RemovePannelsAndCreateEmpties();
|
||||
RemovePanelsAndCreateEmpties();
|
||||
|
||||
int numberOfPannels = NumberOfVisiblePannels();
|
||||
int numberOfPanels = NumberOfVisiblePanels();
|
||||
|
||||
switch (numberOfPannels)
|
||||
switch (numberOfPanels)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
ApplicationWidget.Instance.WidescreenMode = false;
|
||||
|
||||
LoadCompactView();
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
ApplicationWidget.Instance.WidescreenMode = true;
|
||||
|
||||
LoadColumnOne();
|
||||
LoadColumnTwo();
|
||||
LoadColumnThree();
|
||||
break;
|
||||
}
|
||||
|
||||
SetPanelVisblilityForBorderLines(state);
|
||||
|
||||
RestoreUiState();
|
||||
lastNumberVisible = numberOfPanels;
|
||||
}
|
||||
|
||||
void SetPanelVisblilityForBorderLines(object state = null)
|
||||
{
|
||||
int numberOfPanels = NumberOfVisiblePanels();
|
||||
|
||||
switch (numberOfPanels)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
ColumnThree.Visible = false;
|
||||
ColumnTwo.Visible = false;
|
||||
ColumnOne.Visible = true;
|
||||
|
|
@ -308,20 +334,11 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
ApplicationWidget.Instance.WidescreenMode = true;
|
||||
|
||||
LoadColumnOne();
|
||||
LoadColumnTwo();
|
||||
LoadColumnThree();
|
||||
}
|
||||
|
||||
if (numberOfPannels == 2)
|
||||
if (numberOfPanels == 2)
|
||||
{
|
||||
if (this.Width < Max2ColumnWidth && !RightBorderLine.Hidden)
|
||||
{
|
||||
//Queue column and advanced controls columns show
|
||||
|
||||
ColumnTwo.Visible = LeftBorderLine.Hidden;
|
||||
ColumnThree.Visible = !RightBorderLine.Hidden;
|
||||
ColumnOne.Visible = true;
|
||||
|
|
@ -334,8 +351,6 @@ namespace MatterHackers.MatterControl
|
|||
else if (LeftBorderLine.Hidden)
|
||||
{
|
||||
//Queue column and preview column shown
|
||||
ApplicationWidget.Instance.WidescreenMode = true;
|
||||
|
||||
ColumnThree.Visible = !RightBorderLine.Hidden;
|
||||
ColumnTwo.Visible = !LeftBorderLine.Hidden;
|
||||
ColumnOne.AnchorAll();
|
||||
|
|
@ -348,11 +363,9 @@ namespace MatterHackers.MatterControl
|
|||
RightBorderLine.Visible = true;
|
||||
}
|
||||
}
|
||||
else // number of pannels == 3
|
||||
else // number of panels == 3
|
||||
{
|
||||
//All three columns shown
|
||||
ApplicationWidget.Instance.WidescreenMode = true;
|
||||
|
||||
ColumnThree.Visible = !RightBorderLine.Hidden;
|
||||
ColumnTwo.Visible = !LeftBorderLine.Hidden;
|
||||
|
||||
|
|
@ -367,9 +380,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
RestoreUiState();
|
||||
lastNumberVisible = numberOfPannels;
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
|
|
@ -377,7 +387,7 @@ namespace MatterHackers.MatterControl
|
|||
base.OnDraw(graphics2D);
|
||||
}
|
||||
|
||||
private void RemovePannelsAndCreateEmpties()
|
||||
private void RemovePanelsAndCreateEmpties()
|
||||
{
|
||||
RemoveAllChildren();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class SlidePanel : GuiWidget
|
||||
{
|
||||
public List<GuiWidget> pannels = new List<GuiWidget>();
|
||||
public List<GuiWidget> panels = new List<GuiWidget>();
|
||||
|
||||
int currentPannelIndex = -1;
|
||||
int desiredPannelIndex = 0;
|
||||
int currentPanelIndex = -1;
|
||||
int desiredPanelIndex = 0;
|
||||
Stopwatch timeHasBeenChanging = new Stopwatch();
|
||||
|
||||
public SlidePanel(int count)
|
||||
|
|
@ -25,46 +22,46 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
GuiWidget newPannel = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
pannels.Add(newPannel);
|
||||
AddChild(newPannel);
|
||||
GuiWidget newPanel = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
panels.Add(newPanel);
|
||||
AddChild(newPanel);
|
||||
}
|
||||
}
|
||||
|
||||
public int PannelIndex
|
||||
public int PanelIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentPannelIndex;
|
||||
return currentPanelIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (currentPannelIndex != value)
|
||||
if (currentPanelIndex != value)
|
||||
{
|
||||
desiredPannelIndex = value;
|
||||
desiredPanelIndex = value;
|
||||
timeHasBeenChanging.Restart();
|
||||
SetSlidePosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPannelIndexImediate(int index)
|
||||
public void SetPanelIndexImediate(int index)
|
||||
{
|
||||
desiredPannelIndex = index;
|
||||
desiredPanelIndex = index;
|
||||
SetSlidePosition();
|
||||
}
|
||||
|
||||
public GuiWidget GetPannel(int index)
|
||||
public GuiWidget GetPanel(int index)
|
||||
{
|
||||
return pannels[index];
|
||||
return panels[index];
|
||||
}
|
||||
|
||||
public override void OnBoundsChanged(EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < pannels.Count; i++)
|
||||
for (int i = 0; i < panels.Count; i++)
|
||||
{
|
||||
pannels[i].LocalBounds = LocalBounds;
|
||||
panels[i].LocalBounds = LocalBounds;
|
||||
}
|
||||
SetSlidePosition();
|
||||
base.OnBoundsChanged(e);
|
||||
|
|
@ -73,7 +70,7 @@ namespace MatterHackers.MatterControl
|
|||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
base.OnDraw(graphics2D);
|
||||
if (currentPannelIndex != desiredPannelIndex)
|
||||
if (currentPanelIndex != desiredPanelIndex)
|
||||
{
|
||||
SetSlidePosition();
|
||||
Invalidate();
|
||||
|
|
@ -82,13 +79,13 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
void SetSlidePosition()
|
||||
{
|
||||
if (currentPannelIndex != desiredPannelIndex)
|
||||
if (currentPanelIndex != desiredPanelIndex)
|
||||
{
|
||||
// set this based on the time that has elapsed and it should give us a nice result (we can even ease in ease out)
|
||||
double maxOffsetPerDraw = timeHasBeenChanging.ElapsedMilliseconds;
|
||||
|
||||
double desiredOffset = desiredPannelIndex * -Width;
|
||||
double currentOffset = pannels[0].OriginRelativeParent.x;
|
||||
double desiredOffset = desiredPanelIndex * -Width;
|
||||
double currentOffset = panels[0].OriginRelativeParent.x;
|
||||
double delta = desiredOffset - currentOffset;
|
||||
if (delta < 0)
|
||||
{
|
||||
|
|
@ -101,23 +98,23 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
double offsetThisDraw = currentOffset + delta;
|
||||
|
||||
for (int i = 0; i < pannels.Count; i++)
|
||||
for (int i = 0; i < panels.Count; i++)
|
||||
{
|
||||
pannels[i].OriginRelativeParent = new Vector2(offsetThisDraw, 0);
|
||||
panels[i].OriginRelativeParent = new Vector2(offsetThisDraw, 0);
|
||||
offsetThisDraw += Width;
|
||||
}
|
||||
|
||||
if (currentOffset + delta == desiredOffset)
|
||||
{
|
||||
currentPannelIndex = desiredPannelIndex;
|
||||
currentPanelIndex = desiredPanelIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double desiredOffset = desiredPannelIndex * -Width;
|
||||
for (int i = 0; i < pannels.Count; i++)
|
||||
double desiredOffset = desiredPanelIndex * -Width;
|
||||
for (int i = 0; i < panels.Count; i++)
|
||||
{
|
||||
pannels[i].OriginRelativeParent = new Vector2(desiredOffset, 0);
|
||||
panels[i].OriginRelativeParent = new Vector2(desiredOffset, 0);
|
||||
desiredOffset += Width;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
bool startedSliceFromGenerateButton = false;
|
||||
Button generateGCodeButton;
|
||||
FlowLayoutWidget buttonBottomPanel;
|
||||
FlowLayoutWidget layerSelectionButtonsPannel;
|
||||
FlowLayoutWidget layerSelectionButtonsPanel;
|
||||
|
||||
FlowLayoutWidget modelOptionsContainer;
|
||||
FlowLayoutWidget displayOptionsContainer;
|
||||
|
|
@ -101,17 +101,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
generateGCodeButton.Click += new ButtonBase.ButtonEventHandler(generateButton_Click);
|
||||
buttonBottomPanel.AddChild(generateGCodeButton);
|
||||
|
||||
layerSelectionButtonsPannel = new FlowLayoutWidget(FlowDirection.RightToLeft);
|
||||
layerSelectionButtonsPannel.HAnchor = HAnchor.ParentLeftRight;
|
||||
layerSelectionButtonsPannel.Padding = new BorderDouble(0);
|
||||
layerSelectionButtonsPanel = new FlowLayoutWidget(FlowDirection.RightToLeft);
|
||||
layerSelectionButtonsPanel.HAnchor = HAnchor.ParentLeftRight;
|
||||
layerSelectionButtonsPanel.Padding = new BorderDouble(0);
|
||||
|
||||
GuiWidget holdPannelOpen = new GuiWidget(1, generateGCodeButton.Height);
|
||||
layerSelectionButtonsPannel.AddChild(holdPannelOpen);
|
||||
GuiWidget holdPanelOpen = new GuiWidget(1, generateGCodeButton.Height);
|
||||
layerSelectionButtonsPanel.AddChild(holdPanelOpen);
|
||||
|
||||
if (widgetHasCloseButton)
|
||||
{
|
||||
Button closeButton = textImageButtonFactory.Generate(LocalizedString.Get("Close"));
|
||||
layerSelectionButtonsPannel.AddChild(closeButton);
|
||||
layerSelectionButtonsPanel.AddChild(closeButton);
|
||||
closeButton.Click += (sender, e) =>
|
||||
{
|
||||
CloseOnIdle();
|
||||
|
|
@ -169,12 +169,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
centerPartPreviewAndControls.AddChild(gcodeDispalyWidget);
|
||||
|
||||
buttonRightPanel = CreateRightButtonPannel();
|
||||
buttonRightPanel = CreateRightButtonPanel();
|
||||
centerPartPreviewAndControls.AddChild(buttonRightPanel);
|
||||
|
||||
// add in a spacer
|
||||
layerSelectionButtonsPannel.AddChild(new GuiWidget(HAnchor.ParentLeftRight));
|
||||
buttonBottomPanel.AddChild(layerSelectionButtonsPannel);
|
||||
layerSelectionButtonsPanel.AddChild(new GuiWidget(HAnchor.ParentLeftRight));
|
||||
buttonBottomPanel.AddChild(layerSelectionButtonsPanel);
|
||||
|
||||
mainContainerTopToBottom.AddChild(centerPartPreviewAndControls);
|
||||
mainContainerTopToBottom.AddChild(buttonBottomPanel);
|
||||
|
|
@ -193,7 +193,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
AddHandlers();
|
||||
}
|
||||
|
||||
private FlowLayoutWidget CreateRightButtonPannel()
|
||||
private FlowLayoutWidget CreateRightButtonPanel()
|
||||
{
|
||||
FlowLayoutWidget buttonRightPanel = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
buttonRightPanel.Width = 200;
|
||||
|
|
@ -500,11 +500,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
SetLayerWidget setLayerWidget = new SetLayerWidget(gcodeViewWidget);
|
||||
setLayerWidget.VAnchor = Agg.UI.VAnchor.ParentTop;
|
||||
layerSelectionButtonsPannel.AddChild(setLayerWidget);
|
||||
layerSelectionButtonsPanel.AddChild(setLayerWidget);
|
||||
|
||||
LayerNavigationWidget navigationWidget = new LayerNavigationWidget(gcodeViewWidget);
|
||||
navigationWidget.Margin = new BorderDouble(0, 0, 20, 0);
|
||||
layerSelectionButtonsPannel.AddChild(navigationWidget);
|
||||
layerSelectionButtonsPanel.AddChild(navigationWidget);
|
||||
|
||||
selectLayerSlider = new Slider(new Vector2(), 10, 0, gcodeViewWidget.LoadedGCode.NumChangesInZ - 1, Orientation.Vertical);
|
||||
selectLayerSlider.ValueChanged += new EventHandler(selectLayerSlider_ValueChanged);
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
buttonBottomPanel.Padding = new BorderDouble(3, 3);
|
||||
buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
buttonRightPanel = CreateRightButtonPannel(viewerVolume.y);
|
||||
buttonRightPanel = CreateRightButtonPanel(viewerVolume.y);
|
||||
|
||||
CreateOptionsContent();
|
||||
|
||||
|
|
@ -880,7 +880,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
AddScaleControls(scaleOptionContainer);
|
||||
}
|
||||
|
||||
private FlowLayoutWidget CreateRightButtonPannel(double buildHeight)
|
||||
private FlowLayoutWidget CreateRightButtonPanel(double buildHeight)
|
||||
{
|
||||
FlowLayoutWidget buttonRightPanel = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
buttonRightPanel.Width = 200;
|
||||
|
|
|
|||
|
|
@ -537,13 +537,13 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.textImageButtonFactory.FixedHeight = TallButtonHeight;
|
||||
|
||||
Button showSDPrintingPannel = textImageButtonFactory.Generate("SD Card Manager".ToUpper());
|
||||
showSDPrintingPannel.Margin = new BorderDouble(left: 10);
|
||||
showSDPrintingPannel.Click += (sender, e) =>
|
||||
Button showSDPrintingPanel = textImageButtonFactory.Generate("SD Card Manager".ToUpper());
|
||||
showSDPrintingPanel.Margin = new BorderDouble(left: 10);
|
||||
showSDPrintingPanel.Click += (sender, e) =>
|
||||
{
|
||||
SDCardManager.Show();
|
||||
};
|
||||
buttonBar.AddChild(showSDPrintingPannel);
|
||||
buttonBar.AddChild(showSDPrintingPanel);
|
||||
|
||||
sdCardControlsContainer.AddChild(buttonBar);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue