Merge pull request #2183 from jlewin/design_tools

Revise splitter styling, get splitter cursors working
This commit is contained in:
johnlewin 2017-06-17 12:16:54 -07:00 committed by GitHub
commit 0e8baa7c44
4 changed files with 23 additions and 8 deletions

View file

@ -84,6 +84,7 @@ namespace MatterHackers.MatterControl
public TextImageButtonFactory ViewControlsButtonFactory { get; internal set; }
public RGBA_Bytes SplitterBackground { get; internal set; } = new RGBA_Bytes(0, 0, 0, 60);
public int SplitterWidth => (int)(7 * (GuiWidget.DeviceScale <= 1 ? GuiWidget.DeviceScale : GuiWidget.DeviceScale * 1.4));
public RGBA_Bytes SlightShade { get; } = new RGBA_Bytes(0, 0, 0, 40);

View file

@ -62,7 +62,7 @@ namespace MatterHackers.MatterControl
{
Padding = new BorderDouble(4),
SplitterDistance = 254,
SplitterWidth = 10,
SplitterWidth = ApplicationController.Instance.Theme.SplitterWidth,
SplitterBackground = ApplicationController.Instance.Theme.SplitterBackground
};
library3DViewSplitter.AnchorAll();

View file

@ -112,7 +112,8 @@ namespace MatterHackers.MatterControl.CustomWidgets
{
Width = 640,
VAnchor = VAnchor.ParentBottomTop,
BorderColor = ApplicationController.Instance.Theme.SplitterBackground
BorderColor = ApplicationController.Instance.Theme.SplitterBackground,
SplitterWidth = ApplicationController.Instance.Theme.SplitterWidth
};
tabControl = ApplicationController.Instance.Theme.CreateTabControl();
@ -190,26 +191,39 @@ namespace MatterHackers.MatterControl.CustomWidgets
private double downWidth = 0;
private bool mouseDownOnBar = false;
private double mouseDownX;
private int resizeWidth = 10;
int splitterWidth = 10;
public int SplitterWidth
{
get => splitterWidth;
set
{
if (splitterWidth != value)
{
splitterWidth = value;
this.Padding = new BorderDouble(splitterWidth, 0, 0, 0);
}
}
}
internal ResizeContainer()
{
this.Padding = new BorderDouble(resizeWidth, 0, 0, 0);
this.HAnchor = HAnchor.AbsolutePosition;
this.Cursor = Cursors.WaitCursor;
this.Cursor = Cursors.VSplit;
}
public RGBA_Bytes BorderColor { get; set; } = ActiveTheme.Instance.TertiaryBackgroundColor;
public override void OnDraw(Graphics2D graphics2D)
{
graphics2D.FillRectangle(LocalBounds.Left, LocalBounds.Bottom, LocalBounds.Left + resizeWidth, LocalBounds.Top, this.BorderColor);
graphics2D.FillRectangle(LocalBounds.Left, LocalBounds.Bottom, LocalBounds.Left + this.SplitterWidth, LocalBounds.Top, this.BorderColor);
base.OnDraw(graphics2D);
}
public override void OnMouseDown(MouseEventArgs mouseEvent)
{
if (mouseEvent.Position.x < resizeWidth)
if (mouseEvent.Position.x < this.SplitterWidth)
{
mouseDownOnBar = true;
mouseDownX = TransformToScreenSpace(mouseEvent.Position).x;

@ -1 +1 @@
Subproject commit 97aa01e04e3130a61a886bcd662e37397ebef546
Subproject commit 9eff487923109de08ca238fcf8af255f2e4b3ddd