From dc949d72cdcfc706948e11010bdbd4d5b6e5ab0c Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Fri, 26 Jun 2020 17:01:21 -0700 Subject: [PATCH] Improve layout of new tool tips Fix issue with openGL not having glGenBuffers --- .../GCodeRenderer/GCodeVertexBuffer.cs | 24 +++++++++++++++++-- MatterControl.Winforms/InspectForm.cs | 1 + .../ApplicationView/ApplicationController.cs | 4 ++-- .../Utilities/MarkdigAgg/MarkdownWidget.cs | 14 +++++++---- Submodules/agg-sharp | 2 +- 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/MatterControl.OpenGL/GCodeRenderer/GCodeVertexBuffer.cs b/MatterControl.OpenGL/GCodeRenderer/GCodeVertexBuffer.cs index 6979f7939..e704b0593 100644 --- a/MatterControl.OpenGL/GCodeRenderer/GCodeVertexBuffer.cs +++ b/MatterControl.OpenGL/GCodeRenderer/GCodeVertexBuffer.cs @@ -45,8 +45,16 @@ namespace MatterHackers.GCodeVisualizer public GCodeVertexBuffer(int[] indexData, ColorVertexData[] colorData) { - GL.GenBuffers(1, out vertexID); - GL.GenBuffers(1, out indexID); + try + { + throw new Exception(); + GL.GenBuffers(1, out vertexID); + GL.GenBuffers(1, out indexID); + } + catch + { + return; + } // Set vertex data vertexLength = colorData.Length; @@ -79,6 +87,12 @@ namespace MatterHackers.GCodeVisualizer public void RenderRange(int offset, int count) { + if (vertexID == 0) + { + // not allocated don't render + return; + } + GL.EnableClientState(ArrayCap.ColorArray); GL.EnableClientState(ArrayCap.NormalArray); GL.EnableClientState(ArrayCap.VertexArray); @@ -115,6 +129,12 @@ namespace MatterHackers.GCodeVisualizer protected virtual void Dispose(bool disposing) { + if (vertexID == 0) + { + // not allocated don't dispose + return; + } + // release unmanaged resources if (!disposed) { diff --git a/MatterControl.Winforms/InspectForm.cs b/MatterControl.Winforms/InspectForm.cs index 1ebac80ed..219dbcb2a 100644 --- a/MatterControl.Winforms/InspectForm.cs +++ b/MatterControl.Winforms/InspectForm.cs @@ -301,6 +301,7 @@ namespace MatterHackers.MatterControl private void DebugMenus_CheckedChanged(object sender, EventArgs e) { PopupWidget.DebugKeepOpen = debugMenus.Checked; + ToolTipManager.DebugKeepOpen = debugMenus.Checked; } private void SceneTreeView_AfterSelect(object sender, TreeViewEventArgs e) diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs index f7fe4ed90..b687b63ba 100644 --- a/MatterControlLib/ApplicationView/ApplicationController.cs +++ b/MatterControlLib/ApplicationView/ApplicationController.cs @@ -215,7 +215,7 @@ namespace MatterHackers.MatterControl { var toolTipPopover = new ClickablePopover(ArrowDirection.Up, new BorderDouble(0, 0), 7, 0); - var markdownWidegt = new MarkdownWidget(Theme) + var markdownWidegt = new MarkdownWidget(Theme, false) { HAnchor = HAnchor.Absolute, VAnchor = VAnchor.Fit, @@ -228,7 +228,7 @@ namespace MatterHackers.MatterControl markdownWidegt.Markdown = toolTipText; markdownWidegt.Width = 350; var maxLineWidth = markdownWidegt.Descendants().Max(i => i.MaxLineWidth); - markdownWidegt.Width = maxLineWidth + 30; + markdownWidegt.Width = maxLineWidth + 15; return markdownWidegt; } diff --git a/MatterControlLib/Utilities/MarkdigAgg/MarkdownWidget.cs b/MatterControlLib/Utilities/MarkdigAgg/MarkdownWidget.cs index 7f13aab2e..e5c22a8f1 100644 --- a/MatterControlLib/Utilities/MarkdigAgg/MarkdownWidget.cs +++ b/MatterControlLib/Utilities/MarkdigAgg/MarkdownWidget.cs @@ -62,10 +62,16 @@ namespace Markdig.Agg this.theme = theme; this.HAnchor = HAnchor.Stretch; this.ScrollArea.HAnchor = HAnchor.Stretch; - this.ScrollArea.Margin = new BorderDouble(0, 0, 15, 0); - - this.VAnchor = scrollContent ? VAnchor.Stretch : VAnchor.Fit; - this.ScrollArea.VAnchor = scrollContent ? VAnchor.Fit : VAnchor.Fit; + this.ScrollArea.VAnchor = VAnchor.Fit; + if (scrollContent) + { + this.VAnchor = VAnchor.Stretch; + this.ScrollArea.Margin = new BorderDouble(0, 0, 15, 0); + } + else + { + this.VAnchor = VAnchor.Fit; + } var lastScroll = this.TopLeftOffset; this.ScrollPositionChanged += (s, e) => diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index db169f730..779d00997 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit db169f730fbb4e5b5792f1fa28ed472d424e7097 +Subproject commit 779d00997e34eab7e2981e14bc8d91056b43e9aa