From 6303aac2c5b76cbe67a7fa6967e9abe7a62aac8f Mon Sep 17 00:00:00 2001 From: John Lewin Date: Sat, 17 Jun 2017 11:53:33 -0700 Subject: [PATCH] Revise splitter styling, get splitter cursors working --- ApplicationView/ApplicationController.cs | 1 + ApplicationView/WidescreenPanel.cs | 2 +- CustomWidgets/DockingTabControl.cs | 26 ++++++++++++++++++------ Submodules/agg-sharp | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs index 5282deaf6..84e3c21a1 100644 --- a/ApplicationView/ApplicationController.cs +++ b/ApplicationView/ApplicationController.cs @@ -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); diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index 08be4cc27..d68b3e692 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -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(); diff --git a/CustomWidgets/DockingTabControl.cs b/CustomWidgets/DockingTabControl.cs index dbc1d9891..47c160463 100644 --- a/CustomWidgets/DockingTabControl.cs +++ b/CustomWidgets/DockingTabControl.cs @@ -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; diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 97aa01e04..9eff48792 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 97aa01e04e3130a61a886bcd662e37397ebef546 +Subproject commit 9eff487923109de08ca238fcf8af255f2e4b3ddd