Made a 2 panel mode. Took out the other 3 panel mode.

This commit is contained in:
larsbrubaker 2014-12-15 15:44:26 -08:00
parent 740d003723
commit 82b529f30e
4 changed files with 16 additions and 183 deletions

View file

@ -54,8 +54,7 @@ namespace MatterHackers.MatterControl
{ {
public class WidescreenPanel : FlowLayoutWidget public class WidescreenPanel : FlowLayoutWidget
{ {
static readonly int ColumnOneFixedWidth = 500; static readonly int ColumnOneFixedWidth = 590;
static readonly int ColumnTheeFixedWidth = 590;
static int lastNumberOfVisiblePanels; static int lastNumberOfVisiblePanels;
public TabPage AboutTabPage; public TabPage AboutTabPage;
@ -64,14 +63,9 @@ namespace MatterHackers.MatterControl
FlowLayoutWidget ColumnOne; FlowLayoutWidget ColumnOne;
FlowLayoutWidget ColumnTwo; FlowLayoutWidget ColumnTwo;
FlowLayoutWidget ColumnThree;
double Force1PanelWidth = 990 * TextWidget.GlobalPointSizeScaleRatio; double Force1PanelWidth = 990 * TextWidget.GlobalPointSizeScaleRatio;
double Force2PanelWidth = 1590 * TextWidget.GlobalPointSizeScaleRatio; double Force2PanelWidth = 1590 * TextWidget.GlobalPointSizeScaleRatio;
View3DWidget part3DView;
ViewGcodeBasic partGcodeView;
PanelSeparator RightBorderLine;
GuiWidget leftBorderLine; GuiWidget leftBorderLine;
event EventHandler unregisterEvents; event EventHandler unregisterEvents;
@ -143,13 +137,6 @@ namespace MatterHackers.MatterControl
base.OnClosed(e); base.OnClosed(e);
} }
void onRightBorderClick(object sender, EventArgs e)
{
RightBorderLine.PushedRight = !RightBorderLine.PushedRight;
UserSettings.Instance.Fields.ThirdPannelVisible = !RightBorderLine.PushedRight;
UiThread.RunOnIdle(SetColumnVisibility);
}
void onActivePrintItemChanged(object sender, EventArgs e) void onActivePrintItemChanged(object sender, EventArgs e)
{ {
if (NumberOfVisiblePanels() > 1) if (NumberOfVisiblePanels() > 1)
@ -183,6 +170,12 @@ namespace MatterHackers.MatterControl
{ {
ColumnTwo.CloseAndRemoveAllChildren(); ColumnTwo.CloseAndRemoveAllChildren();
#if true
PartPreviewContent partViewContent = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, true, View3DWidget.AutoRotate.Enabled, false);
partViewContent.AnchorAll();
ColumnTwo.AddChild(partViewContent);
#else
double buildHeight = ActiveSliceSettings.Instance.BuildHeight; double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
part3DView = new View3DWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem, part3DView = new View3DWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem,
@ -203,34 +196,19 @@ namespace MatterHackers.MatterControl
ColumnTwo.AddChild(part3DView); ColumnTwo.AddChild(part3DView);
ColumnTwo.AddChild(partGcodeView); ColumnTwo.AddChild(partGcodeView);
#endif
ColumnTwo.AnchorAll(); ColumnTwo.AnchorAll();
} }
static int ColumnThreeCount = 0;
void LoadColumnThree(object state = null)
{
ColumnThree.CloseAndRemoveAllChildren();
ThirdPanelTabView thirdPanelTabView = new ThirdPanelTabView();
thirdPanelTabView.Name = "For - WideScreenPanel {0}".FormatWith(ColumnThreeCount++);
ColumnThree.AddChild(thirdPanelTabView);
ColumnThree.Width = ColumnTheeFixedWidth; //Ordering here matters - must go after children are added
}
int NumberOfVisiblePanels() int NumberOfVisiblePanels()
{ {
if (this.Width < Force1PanelWidth) if (this.Width < Force1PanelWidth)
{ {
return 1; return 1;
} }
else if (this.Width < Force2PanelWidth)
{ return 2;
return 2;
}
else
{
return 3;
}
} }
public void RecreateAllPanels(object state = null) public void RecreateAllPanels(object state = null)
@ -253,13 +231,9 @@ namespace MatterHackers.MatterControl
break; break;
case 2: case 2:
case 3: ApplicationController.Instance.WidescreenMode = false;
ApplicationController.Instance.WidescreenMode = true; LoadCompactView();
LoadColumnTwo();
LoadColumnOne();
// make sure we restore the state of column one because LoadColumnThree is going to save it.
LoadColumnTwo();
LoadColumnThree();
break; break;
} }
@ -276,13 +250,11 @@ namespace MatterHackers.MatterControl
{ {
case 1: case 1:
{ {
ColumnThree.Visible = false;
ColumnTwo.Visible = false; ColumnTwo.Visible = false;
ColumnOne.Visible = true; ColumnOne.Visible = true;
Padding = new BorderDouble(0); Padding = new BorderDouble(0);
RightBorderLine.Visible = false;
leftBorderLine.Visible = false; leftBorderLine.Visible = false;
} }
break; break;
@ -290,35 +262,9 @@ namespace MatterHackers.MatterControl
case 2: case 2:
Padding = new BorderDouble(4); Padding = new BorderDouble(4);
ColumnOne.Visible = true; ColumnOne.Visible = true;
RightBorderLine.Visible = true; ColumnTwo.Visible = true;
if (RightBorderLine.PushedRight)
{
leftBorderLine.Visible = true;
ColumnThree.Visible = false;
ColumnTwo.Visible = true;
ColumnOne.HAnchor = Agg.UI.HAnchor.None;
}
else
{
leftBorderLine.Visible = false;
ColumnThree.Visible = true;
ColumnTwo.Visible = false;
ColumnOne.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
}
break;
case 3:
//All three columns shown
Padding = new BorderDouble(4);
//If the middle column is hidden, left/right anchor the left column
ColumnOne.HAnchor = Agg.UI.HAnchor.None; ColumnOne.HAnchor = Agg.UI.HAnchor.None;
ColumnOne.Width = ColumnOneFixedWidth; ColumnOne.Width = ColumnOneFixedWidth; // it can hold the slice settings so it needs to be bigger.
ColumnOne.Visible = true;
leftBorderLine.Visible = true;
RightBorderLine.Visible = true;
ColumnThree.Visible = !RightBorderLine.PushedRight;
break; break;
} }
} }
@ -334,11 +280,6 @@ namespace MatterHackers.MatterControl
ColumnOne = new FlowLayoutWidget(FlowDirection.TopToBottom); ColumnOne = new FlowLayoutWidget(FlowDirection.TopToBottom);
ColumnTwo = new FlowLayoutWidget(FlowDirection.TopToBottom); ColumnTwo = new FlowLayoutWidget(FlowDirection.TopToBottom);
ColumnThree = new FlowLayoutWidget(FlowDirection.TopToBottom);
ColumnThree.VAnchor = VAnchor.ParentBottomTop;
RightBorderLine = new PanelSeparator();
RightBorderLine.PushedRight = !UserSettings.Instance.Fields.ThirdPannelVisible;
AddChild(ColumnOne); AddChild(ColumnOne);
leftBorderLine = new GuiWidget(vAnchor: VAnchor.ParentBottomTop); leftBorderLine = new GuiWidget(vAnchor: VAnchor.ParentBottomTop);
@ -352,19 +293,11 @@ namespace MatterHackers.MatterControl
}; };
AddChild(leftBorderLine); AddChild(leftBorderLine);
AddChild(ColumnTwo); AddChild(ColumnTwo);
AddChild(RightBorderLine);
AddChild(ColumnThree);
RightBorderLine.Click += new EventHandler(onRightBorderClick);
} }
public void ReloadAdvancedControlsPanel(object state) public void ReloadAdvancedControlsPanel(object state)
{ {
PreChangePanels.CallEvents(this, null); PreChangePanels.CallEvents(this, null);
if (NumberOfVisiblePanels() > 1)
{
UiThread.RunOnIdle(LoadColumnThree);
}
} }
public void LoadSettingsOnPrinterChanged(object sender, EventArgs e) public void LoadSettingsOnPrinterChanged(object sender, EventArgs e)

View file

@ -1,99 +0,0 @@
using System;
using System.IO;
using MatterHackers.Agg.Image;
using MatterHackers.Agg;
using MatterHackers.VectorMath;
using MatterHackers.Agg.Font;
using MatterHackers.Agg.Transform;
using MatterHackers.Agg.VertexSource;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.DataStorage;
namespace MatterHackers.MatterControl.CustomWidgets
{
class PanelSeparator : ClickWidget
{
RGBA_Bytes defaultBackgroundColor;
RGBA_Bytes hoverBackgroundColor;
bool pushedRight;
ImageBuffer rightArrowIndicator;
ImageBuffer leftArrowIndicator;
public bool PushedRight
{
get { return pushedRight; }
set
{
if (pushedRight != value)
{
pushedRight = value;
}
}
}
public override void OnDraw(Graphics2D graphics2D)
{
BackBuffer.SetRecieveBlender(new BlenderBGRA());
RectangleDouble bounds = LocalBounds;
TypeFacePrinter printer;
Vector2 center = new Vector2((bounds.Right - bounds.Left) / 2, (bounds.Top - bounds.Bottom) / 2);
int textMargin = 20;
if (pushedRight)
{
printer = new TypeFacePrinter("Advanced Controls", justification: Justification.Center, baseline: Baseline.BoundsCenter);
Vector2 textSize = printer.GetSize();
graphics2D.Render(leftArrowIndicator, new Vector2(center.x - leftArrowIndicator.Width / 2, center.y - leftArrowIndicator.Height / 2 - (textSize.x / 2 + textMargin)));
graphics2D.Render(leftArrowIndicator, new Vector2(center.x - leftArrowIndicator.Width / 2, center.y - leftArrowIndicator.Height / 2 + (textSize.x / 2 + textMargin)));
}
else
{
printer = new TypeFacePrinter("Part View", justification: Justification.Center, baseline: Baseline.BoundsCenter);
Vector2 textSize = printer.GetSize();
graphics2D.Render(rightArrowIndicator, new Vector2(center.x - rightArrowIndicator.Width / 2, center.y - rightArrowIndicator.Height / 2 - (textSize.x / 2 + textMargin)));
graphics2D.Render(rightArrowIndicator, new Vector2(center.x - rightArrowIndicator.Width / 2, center.y - rightArrowIndicator.Height / 2 + (textSize.x / 2 + textMargin)));
}
VertexSourceApplyTransform rotated = new VertexSourceApplyTransform(printer, Affine.NewRotation(MathHelper.Tau / 4));
VertexSourceApplyTransform positioned = new VertexSourceApplyTransform(rotated, Affine.NewTranslation(center.x, center.y));
graphics2D.Render(positioned, RGBA_Bytes.White);
base.OnDraw(graphics2D);
}
public PanelSeparator()
: base(24, 1)
{
AddHandlers();
hoverBackgroundColor = new RGBA_Bytes(100, 100, 100);
defaultBackgroundColor = new RGBA_Bytes(160, 160, 160);
rightArrowIndicator = StaticData.Instance.LoadIcon("icon_arrow_right_16x16.png");
leftArrowIndicator = StaticData.Instance.LoadIcon("icon_arrow_left_16x16.png");
this.PushedRight = false;
this.BackgroundColor = defaultBackgroundColor;
this.VAnchor = VAnchor.ParentBottomTop;
this.Margin = new BorderDouble(8, 0);
this.Cursor = Cursors.Hand;
DoubleBuffer = true;
}
void AddHandlers()
{
this.MouseEnterBounds += new EventHandler(PanelSeparator_MouseEnterBounds);
this.MouseLeaveBounds += new EventHandler(PanelSeparator_MouseLeaveBounds);
}
void PanelSeparator_MouseLeaveBounds(object sender, EventArgs e)
{
this.BackgroundColor = defaultBackgroundColor;
}
void PanelSeparator_MouseEnterBounds(object sender, EventArgs e)
{
this.BackgroundColor = hoverBackgroundColor;
}
}
}

View file

@ -122,7 +122,6 @@
<Compile Include="CustomWidgets\DoubleSolidSlider.cs" /> <Compile Include="CustomWidgets\DoubleSolidSlider.cs" />
<Compile Include="CustomWidgets\FatFlatClickWidget.cs" /> <Compile Include="CustomWidgets\FatFlatClickWidget.cs" />
<Compile Include="CustomWidgets\FlowSpacers.cs" /> <Compile Include="CustomWidgets\FlowSpacers.cs" />
<Compile Include="CustomWidgets\PanelSeparator.cs" />
<Compile Include="CustomWidgets\SlideWidget.cs" /> <Compile Include="CustomWidgets\SlideWidget.cs" />
<Compile Include="CustomWidgets\SolidProgressControl.cs" /> <Compile Include="CustomWidgets\SolidProgressControl.cs" />
<Compile Include="CustomWidgets\SolidSlider.cs" /> <Compile Include="CustomWidgets\SolidSlider.cs" />

View file

@ -134,7 +134,7 @@ namespace MatterHackers.MatterControl
} }
this.AddChild(ApplicationController.Instance.MainView); this.AddChild(ApplicationController.Instance.MainView);
this.MinimumSize = new Vector2(400, 400); this.MinimumSize = new Vector2(570, 600);
this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off
#if false // this is to test freeing gcodefile memory #if false // this is to test freeing gcodefile memory