refactoring

This commit is contained in:
MatterHackers 2023-04-02 19:37:15 -07:00
parent eaa93cb087
commit 7795457e73
10 changed files with 65 additions and 74 deletions

View file

@ -30,13 +30,11 @@ either expressed or implied, of the FreeBSD Project.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -46,7 +44,6 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using global::MatterControl.Printing; using global::MatterControl.Printing;
using Markdig.Agg; using Markdig.Agg;
using Markdig.Syntax.Inlines;
using MatterControlLib.Library.OpenInto; using MatterControlLib.Library.OpenInto;
using MatterHackers.Agg; using MatterHackers.Agg;
using MatterHackers.Agg.Font; using MatterHackers.Agg.Font;
@ -71,7 +68,6 @@ using MatterHackers.MatterControl.PrintHistory;
using MatterHackers.MatterControl.PrintQueue; using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.SettingsManagement; using MatterHackers.MatterControl.SettingsManagement;
using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.Tour;
using MatterHackers.PolygonMesh; using MatterHackers.PolygonMesh;
using MatterHackers.PolygonMesh.Processors; using MatterHackers.PolygonMesh.Processors;
using MatterHackers.VectorMath; using MatterHackers.VectorMath;
@ -1648,11 +1644,12 @@ namespace MatterHackers.MatterControl
/// <summary> /// <summary>
/// Set or get the current ui hint for the thing the mouse is over /// Set or get the current ui hint for the thing the mouse is over
/// </summary> /// </summary>
public string UiHint public string GetUiHint()
{ {
get => _uiHint; return _uiHint;
}
set public void SetUiHint(string value)
{ {
if (_uiHint != value) if (_uiHint != value)
{ {
@ -1660,7 +1657,6 @@ namespace MatterHackers.MatterControl
UiHintChanged?.Invoke(this, null); UiHintChanged?.Invoke(this, null);
} }
} }
}
public event EventHandler UiHintChanged; public event EventHandler UiHintChanged;
@ -2673,4 +2669,24 @@ namespace MatterHackers.MatterControl
public Action Action { get; set; } public Action Action { get; set; }
} }
} }
public static class SetUiHintExtensions
{
// GuiWidget extension
public static void SetActiveUiHint(this GuiWidget widget, string value)
{
if (ApplicationController.Instance.GetUiHint() != value)
{
void MouseHasLeftBounds(object s, EventArgs e)
{
ApplicationController.Instance.SetUiHint("");
widget.MouseLeaveBounds -= MouseHasLeftBounds;
}
widget.MouseLeaveBounds += MouseHasLeftBounds;
ApplicationController.Instance.SetUiHint(value);
}
}
}
} }

View file

@ -96,10 +96,10 @@ namespace MatterHackers.MatterControl.DesignTools
{ {
if (DownOnControl) if (DownOnControl)
{ {
ApplicationController.Instance.UiHint = ""; ApplicationController.Instance.SetUiHint("");
DownOnControl = false; DownOnControl = false;
setPosition(mouseDownPosition); setPosition(mouseDownPosition);
ApplicationController.Instance.UiHint = ""; ApplicationController.Instance.SetUiHint("");
} }
} }
@ -144,7 +144,7 @@ namespace MatterHackers.MatterControl.DesignTools
public void OnMouseDown(Mouse3DEventArgs mouseEvent3D) public void OnMouseDown(Mouse3DEventArgs mouseEvent3D)
{ {
DownOnControl = true; DownOnControl = true;
ApplicationController.Instance.UiHint = UiHint; ApplicationController.Instance.SetUiHint(UiHint);
mouseDownPosition = getPosition(); mouseDownPosition = getPosition();
// Make sure we always get a new hit plane // Make sure we always get a new hit plane
ResetHitPlane(); ResetHitPlane();
@ -219,7 +219,7 @@ namespace MatterHackers.MatterControl.DesignTools
{ {
DownOnControl = false; DownOnControl = false;
editComplete(mouseDownPosition); editComplete(mouseDownPosition);
ApplicationController.Instance.UiHint = ""; ApplicationController.Instance.SetUiHint("");
} }
} }

View file

@ -1149,9 +1149,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
tasksContainer.AddChild(runningTaskPanel); tasksContainer.AddChild(runningTaskPanel);
} }
if (!string.IsNullOrEmpty(ApplicationController.Instance.UiHint)) if (!string.IsNullOrEmpty(ApplicationController.Instance.GetUiHint()))
{ {
statusMessage.Text = ApplicationController.Instance.UiHint; statusMessage.Text = ApplicationController.Instance.GetUiHint();
statusMessage.Visible = true; statusMessage.Visible = true;
var parent = statusMessage.Parent; var parent = statusMessage.Parent;
if (parent.Children.IndexOf(statusMessage) != parent.Children.Count - 1) if (parent.Children.IndexOf(statusMessage) != parent.Children.Count - 1)

View file

@ -283,12 +283,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
TabBar.MouseEnterBounds += (s, e) => TabBar.MouseEnterBounds += (s, e) =>
{ {
ApplicationController.Instance.UiHint = "You can drag and drop .mcx files here to open them"; TabBar.SetActiveUiHint("You can drag and drop .mcx files here to open them");
};
TabBar.MouseLeaveBounds += (s, e) =>
{
ApplicationController.Instance.UiHint = "";
}; };
this.TabBar.MouseUp += (s, e) => this.TabBar.MouseUp += (s, e) =>

View file

@ -120,7 +120,7 @@ namespace MatterHackers.MeshVisualizer
{ {
if (!string.IsNullOrEmpty(UiHint)) if (!string.IsNullOrEmpty(UiHint))
{ {
ApplicationController.Instance.UiHint = ""; ApplicationController.Instance.SetUiHint("");
} }
} }
@ -132,7 +132,7 @@ namespace MatterHackers.MeshVisualizer
this.Object3DControlContext.GuiSurface.Invalidate(); this.Object3DControlContext.GuiSurface.Invalidate();
if (!string.IsNullOrEmpty(UiHint)) if (!string.IsNullOrEmpty(UiHint))
{ {
ApplicationController.Instance.UiHint = UiHint; ApplicationController.Instance.SetUiHint(UiHint);
} }
} }
} }
@ -148,7 +148,7 @@ namespace MatterHackers.MeshVisualizer
if (!string.IsNullOrEmpty(UiHint)) if (!string.IsNullOrEmpty(UiHint))
{ {
ApplicationController.Instance.UiHint = ""; ApplicationController.Instance.SetUiHint("");
} }
} }

View file

@ -480,11 +480,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
lastControlMessage = "Click to edit values".Localize(); lastControlMessage = "Click to edit values".Localize();
} }
ApplicationController.Instance.UiHint = lastControlMessage; ApplicationController.Instance.SetUiHint(lastControlMessage);
} }
else if (ApplicationController.Instance.UiHint == lastControlMessage) else if (ApplicationController.Instance.GetUiHint() == lastControlMessage)
{ {
ApplicationController.Instance.UiHint = ""; ApplicationController.Instance.SetUiHint("");
} }
} }
} }

View file

@ -171,8 +171,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var errors = printer.Validate(); var errors = printer.Validate();
var startPrintButton = CreateStartPrintButton("Start Print".Localize(), printer, menuTheme, out bool printEnabled); var startPrintButton = CreateStartPrintButton("Start Print".Localize(), printer, menuTheme, out bool printEnabled);
startPrintButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Ctrl + P".Localize(); startPrintButton.MouseEnterBounds += (s, e) => startPrintButton.SetActiveUiHint("Ctrl + P".Localize());
startPrintButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
startPrintButton.Click += (s, e) => this.CloseMenu(); startPrintButton.Click += (s, e) => this.CloseMenu();
var hasErrors = errors.Any(e => e.ErrorLevel == ValidationErrorLevel.Error); var hasErrors = errors.Any(e => e.ErrorLevel == ValidationErrorLevel.Error);

View file

@ -363,8 +363,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Margin = theme.ButtonSpacing, Margin = theme.ButtonSpacing,
}; };
partSelectButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Ctrl + A = Select Alll, 'Space' = Clear Selection, 'ESC' = Cancel Drag".Localize(); partSelectButton.MouseEnterBounds += (s, e) => partSelectButton.SetActiveUiHint("Ctrl + A = Select Alll, 'Space' = Clear Selection, 'ESC' = Cancel Drag".Localize());
partSelectButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
AddRoundButton(partSelectButton, RotatedMargin(partSelectButton, MathHelper.Tau * .15)); AddRoundButton(partSelectButton, RotatedMargin(partSelectButton, MathHelper.Tau * .15));
partSelectButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.PartSelect; partSelectButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.PartSelect;
buttonGroupA.Add(partSelectButton); buttonGroupA.Add(partSelectButton);
@ -375,8 +374,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ToolTipText = "Rotate View".Localize(), ToolTipText = "Rotate View".Localize(),
Margin = theme.ButtonSpacing Margin = theme.ButtonSpacing
}; };
rotateButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Rotate: Right Mouse Button, Ctrl + Left Mouse Button, Arrow Keys".Localize(); rotateButton.MouseEnterBounds += (s, e) => rotateButton.SetActiveUiHint("Rotate: Right Mouse Button, Ctrl + Left Mouse Button, Arrow Keys".Localize());
rotateButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
AddRoundButton(rotateButton, RotatedMargin(rotateButton, MathHelper.Tau * .05)); AddRoundButton(rotateButton, RotatedMargin(rotateButton, MathHelper.Tau * .05));
rotateButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Rotate; rotateButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Rotate;
buttonGroupA.Add(rotateButton); buttonGroupA.Add(rotateButton);
@ -387,8 +385,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ToolTipText = "Move View".Localize(), ToolTipText = "Move View".Localize(),
Margin = theme.ButtonSpacing Margin = theme.ButtonSpacing
}; };
translateButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Move: Middle Mouse Button, Ctrl + Shift + Left Mouse Button, Shift Arrow Keys".Localize(); translateButton.MouseEnterBounds += (s, e) => translateButton.SetActiveUiHint("Move: Middle Mouse Button, Ctrl + Shift + Left Mouse Button, Shift Arrow Keys".Localize());
translateButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
AddRoundButton(translateButton, RotatedMargin(translateButton , - MathHelper.Tau * .05)); AddRoundButton(translateButton, RotatedMargin(translateButton , - MathHelper.Tau * .05));
translateButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Translate; translateButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Translate;
buttonGroupA.Add(translateButton); buttonGroupA.Add(translateButton);
@ -399,8 +396,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ToolTipText = "Zoom View".Localize(), ToolTipText = "Zoom View".Localize(),
Margin = theme.ButtonSpacing Margin = theme.ButtonSpacing
}; };
zoomButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Zoom: Mouse Wheel, Ctrl + Alt + Left Mouse Button, Ctrl + '+' & Ctrl + '-'".Localize(); zoomButton.MouseEnterBounds += (s, e) => zoomButton.SetActiveUiHint("Zoom: Mouse Wheel, Ctrl + Alt + Left Mouse Button, Ctrl + '+' & Ctrl + '-'".Localize());
zoomButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
AddRoundButton(zoomButton, RotatedMargin(zoomButton, - MathHelper.Tau * .15)); AddRoundButton(zoomButton, RotatedMargin(zoomButton, - MathHelper.Tau * .15));
zoomButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Scale; zoomButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Scale;
buttonGroupA.Add(zoomButton); buttonGroupA.Add(zoomButton);
@ -471,8 +467,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ToolTipText = "Reset View".Localize(), ToolTipText = "Reset View".Localize(),
Margin = theme.ButtonSpacing Margin = theme.ButtonSpacing
}; };
homeButton.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = "W Key"; homeButton.MouseEnterBounds += (s1, e1) => homeButton.SetActiveUiHint("W Key");
homeButton.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
AddRoundButton(homeButton, RotatedMargin(homeButton, MathHelper.Tau * .3)).Click += (s, e) => viewControls3D.NotifyResetView(); AddRoundButton(homeButton, RotatedMargin(homeButton, MathHelper.Tau * .3)).Click += (s, e) => viewControls3D.NotifyResetView();
var zoomToSelectionButton = new ThemedIconButton(StaticData.Instance.LoadIcon("select.png", 16, 16).SetToColor(theme.TextColor), theme) var zoomToSelectionButton = new ThemedIconButton(StaticData.Instance.LoadIcon("select.png", 16, 16).SetToColor(theme.TextColor), theme)
@ -481,8 +476,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ToolTipText = "Zoom to Selection".Localize(), ToolTipText = "Zoom to Selection".Localize(),
Margin = theme.ButtonSpacing Margin = theme.ButtonSpacing
}; };
zoomToSelectionButton.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = "Z Key"; zoomToSelectionButton.MouseEnterBounds += (s1, e1) => zoomToSelectionButton.SetActiveUiHint("Z Key");
zoomToSelectionButton.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
void SetZoomEnabled(object s, EventArgs e) void SetZoomEnabled(object s, EventArgs e)
{ {
zoomToSelectionButton.Enabled = this.Scene.SelectedItem != null zoomToSelectionButton.Enabled = this.Scene.SelectedItem != null
@ -507,8 +501,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Checked = turntableEnabled, Checked = turntableEnabled,
//DoubleBuffer = true, //DoubleBuffer = true,
}; };
turnTableButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Switch between turn table and trackball modes".Localize(); turnTableButton.MouseEnterBounds += (s, e) => turnTableButton.SetActiveUiHint("Switch between turn table and trackball modes".Localize());
turnTableButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
AddRoundButton(turnTableButton, RotatedMargin(turnTableButton, -MathHelper.Tau * .4)); // 2 button position AddRoundButton(turnTableButton, RotatedMargin(turnTableButton, -MathHelper.Tau * .4)); // 2 button position
turnTableButton.CheckedStateChanged += (s, e) => turnTableButton.CheckedStateChanged += (s, e) =>
@ -534,8 +527,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
SiblingRadioButtonList = new List<GuiWidget>(), SiblingRadioButtonList = new List<GuiWidget>(),
Checked = TrackballTumbleWidget.PerspectiveMode, Checked = TrackballTumbleWidget.PerspectiveMode,
}; };
projectionButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Turn on and off perspective rendering".Localize(); projectionButton.MouseEnterBounds += (s, e) => projectionButton.SetActiveUiHint("Turn on and off perspective rendering".Localize());
projectionButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
AddRoundButton(projectionButton, RotatedMargin(projectionButton, -MathHelper.Tau * .3)); AddRoundButton(projectionButton, RotatedMargin(projectionButton, -MathHelper.Tau * .3));
projectionButton.CheckedStateChanged += (s, e) => projectionButton.CheckedStateChanged += (s, e) =>
{ {
@ -564,8 +556,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ToggleButton = true, ToggleButton = true,
SiblingRadioButtonList = new List<GuiWidget>(), SiblingRadioButtonList = new List<GuiWidget>(),
}; };
bedButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Hide and show the bed".Localize(); bedButton.MouseEnterBounds += (s, e) => bedButton.SetActiveUiHint("Hide and show the bed".Localize());
bedButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
AddRoundButton(bedButton, new Vector2((cubeCenterFromRightTop.X + 18 * scale - bedButton.Width / 2) / scale, startHeight)); AddRoundButton(bedButton, new Vector2((cubeCenterFromRightTop.X + 18 * scale - bedButton.Width / 2) / scale, startHeight));
var printAreaButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon("print_area.png", 16, 16).SetToColor(theme.TextColor), theme) var printAreaButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon("print_area.png", 16, 16).SetToColor(theme.TextColor), theme)
@ -623,8 +614,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Mate = new MateOptions(MateEdge.Right, MateEdge.Top) Mate = new MateOptions(MateEdge.Right, MateEdge.Top)
} }
}; };
modelViewStyleButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Change the current rendering mode".Localize(); modelViewStyleButton.MouseEnterBounds += (s, e) => modelViewStyleButton.SetActiveUiHint("Change the current rendering mode".Localize());
modelViewStyleButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
modelViewStyleButton.AnchorMate.Mate.VerticalEdge = MateEdge.Bottom; modelViewStyleButton.AnchorMate.Mate.VerticalEdge = MateEdge.Bottom;
modelViewStyleButton.AnchorMate.Mate.HorizontalEdge = MateEdge.Right; modelViewStyleButton.AnchorMate.Mate.HorizontalEdge = MateEdge.Right;
@ -660,8 +650,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Mate = new MateOptions(MateEdge.Right, MateEdge.Top) Mate = new MateOptions(MateEdge.Right, MateEdge.Top)
} }
}; };
gridSnapButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Adjust the grid that objects will snap to when moved".Localize(); gridSnapButton.MouseEnterBounds += (s, e) => gridSnapButton.SetActiveUiHint("Adjust the grid that objects will snap to when moved".Localize());
gridSnapButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
gridSnapButton.AnchorMate.Mate.VerticalEdge = MateEdge.Bottom; gridSnapButton.AnchorMate.Mate.VerticalEdge = MateEdge.Bottom;
gridSnapButton.AnchorMate.Mate.HorizontalEdge = MateEdge.Right; gridSnapButton.AnchorMate.Mate.HorizontalEdge = MateEdge.Right;

View file

@ -131,8 +131,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Margin = theme.ButtonSpacing, Margin = theme.ButtonSpacing,
VAnchor = VAnchor.Center VAnchor = VAnchor.Center
}; };
undoButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Ctrl + z".Localize(); undoButton.MouseEnterBounds += (s, e) => undoButton.SetActiveUiHint("Ctrl + z".Localize());
undoButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
undoButton.Click += (sender, e) => undoButton.Click += (sender, e) =>
{ {
sceneContext.Scene.Undo(); sceneContext.Scene.Undo();
@ -148,8 +147,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Enabled = false, Enabled = false,
VAnchor = VAnchor.Center VAnchor = VAnchor.Center
}; };
redoButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Ctrl + Y, Ctrl + Shift + Z".Localize(); redoButton.MouseEnterBounds += (s, e) => redoButton.SetActiveUiHint("Ctrl + Y, Ctrl + Shift + Z".Localize());
redoButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
redoButton.Click += (sender, e) => redoButton.Click += (sender, e) =>
{ {
sceneContext.Scene.Redo(); sceneContext.Scene.Redo();
@ -265,8 +263,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (!string.IsNullOrEmpty(namedAction.UiHint)) if (!string.IsNullOrEmpty(namedAction.UiHint))
{ {
button.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = namedAction.UiHint; button.MouseEnterBounds += (s1, e1) => button.SetActiveUiHint(namedAction.UiHint);
button.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
} }
} }
else else
@ -476,8 +473,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var operationButton = new OperationIconButton(operation, sceneContext, theme); var operationButton = new OperationIconButton(operation, sceneContext, theme);
if (!string.IsNullOrEmpty(operation.UiHint)) if (!string.IsNullOrEmpty(operation.UiHint))
{ {
operationButton.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = operation.UiHint; operationButton.MouseEnterBounds += (s1, e1) => operationButton.SetActiveUiHint(operation.UiHint);
operationButton.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
} }
operationButtons.Add(operationButton, operation); operationButtons.Add(operationButton, operation);
@ -542,8 +538,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (!string.IsNullOrEmpty(operation.UiHint)) if (!string.IsNullOrEmpty(operation.UiHint))
{ {
iconButton.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = operation.UiHint; iconButton.MouseEnterBounds += (s1, e1) => iconButton.SetActiveUiHint(operation.UiHint);
iconButton.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
} }
UserSettings.Instance.set(operationGroup.GroupRecordId, operationGroup.Operations.IndexOf(operation).ToString()); UserSettings.Instance.set(operationGroup.GroupRecordId, operationGroup.Operations.IndexOf(operation).ToString());
@ -770,6 +765,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
foreach (var (button, operation) in operationButtons.Select(kvp => (kvp.Key, kvp.Value))) foreach (var (button, operation) in operationButtons.Select(kvp => (kvp.Key, kvp.Value)))
{ {
button.Enabled = operation.IsEnabled?.Invoke(sceneContext) ?? false; button.Enabled = operation.IsEnabled?.Invoke(sceneContext) ?? false;
button.MouseEnterBounds += (s, e) => button.SetActiveUiHint(operation.Title);
button.ToolTipText = operation.Title; button.ToolTipText = operation.Title;
if (!button.Enabled if (!button.Enabled
&& !string.IsNullOrEmpty(operation.HelpText)) && !string.IsNullOrEmpty(operation.HelpText))

View file

@ -59,13 +59,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
if (internalTextEditWidget != null if (internalTextEditWidget != null
&& double.TryParse(internalTextEditWidget.Text, out double value)) && double.TryParse(internalTextEditWidget.Text, out double value))
{ {
ApplicationController.Instance.UiHint = "Up Arrow = +1, Down Arrow = -1, (Shift * 10, Control / 10)".Localize(); guiWidget.SetActiveUiHint("Up Arrow = +1, Down Arrow = -1, (Shift * 10, Control / 10)".Localize());
} }
}; };
guiWidget.MouseLeaveBounds += (s, e) =>
{
ApplicationController.Instance.UiHint = "";
};
} }
private static void InternalTextEditWidget_KeyDown(object sender, KeyEventArgs e) private static void InternalTextEditWidget_KeyDown(object sender, KeyEventArgs e)