Adding mare ui hints
This commit is contained in:
parent
50e62fe607
commit
5ffd29ab7b
8 changed files with 109 additions and 16 deletions
|
|
@ -127,7 +127,7 @@ namespace MatterControlLib.Library.OpenInto
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationController.Instance.Tasks.Execute(
|
ApplicationController.Instance.Tasks.Execute(
|
||||||
"Twist".Localize(),
|
"Open".Localize(),
|
||||||
null,
|
null,
|
||||||
async (reporter, cancellationToken) =>
|
async (reporter, cancellationToken) =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -397,7 +397,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
|
|
||||||
statusMessage = tasksContainer.AddChild(new TextWidget("")
|
statusMessage = tasksContainer.AddChild(new TextWidget("")
|
||||||
{
|
{
|
||||||
Margin = new BorderDouble(5, 0, 0, 3),
|
Margin = new BorderDouble(5, 0, 5, 3),
|
||||||
TextColor = theme.TextColor,
|
TextColor = theme.TextColor,
|
||||||
VAnchor = VAnchor.Center,
|
VAnchor = VAnchor.Center,
|
||||||
PointSize = theme.FontSize9,
|
PointSize = theme.FontSize9,
|
||||||
|
|
|
||||||
|
|
@ -471,15 +471,26 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
&& hitObject3DControl is Object3DControl object3DControl2
|
&& hitObject3DControl is Object3DControl object3DControl2
|
||||||
&& object3DControl2.RootSelection != null)
|
&& object3DControl2.RootSelection != null)
|
||||||
{
|
{
|
||||||
ApplicationController.Instance.UiHint = "Click to edit values".Localize();
|
if (!string.IsNullOrEmpty(object3DControl2.UiHint))
|
||||||
|
{
|
||||||
|
lastControlMessage = "Click and drag".Localize() + " : " + object3DControl2.UiHint + " : " + "Click once to edit values".Localize(); ;
|
||||||
}
|
}
|
||||||
else if (ApplicationController.Instance.UiHint == "Click to edit values".Localize())
|
else
|
||||||
|
{
|
||||||
|
lastControlMessage = "Click to edit values".Localize();
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationController.Instance.UiHint = lastControlMessage;
|
||||||
|
}
|
||||||
|
else if (ApplicationController.Instance.UiHint == lastControlMessage)
|
||||||
{
|
{
|
||||||
ApplicationController.Instance.UiHint = "";
|
ApplicationController.Instance.UiHint = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string lastControlMessage = "";
|
||||||
|
|
||||||
public override void OnMouseUp(MouseEventArgs mouseEvent)
|
public override void OnMouseUp(MouseEventArgs mouseEvent)
|
||||||
{
|
{
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
|
||||||
|
|
||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
|
using g3;
|
||||||
using MatterHackers.Agg;
|
using MatterHackers.Agg;
|
||||||
using MatterHackers.Agg.Platform;
|
using MatterHackers.Agg.Platform;
|
||||||
using MatterHackers.Agg.UI;
|
using MatterHackers.Agg.UI;
|
||||||
|
|
@ -506,6 +507,8 @@ 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.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) =>
|
||||||
|
|
@ -531,6 +534,8 @@ 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.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) =>
|
||||||
{
|
{
|
||||||
|
|
@ -559,6 +564,9 @@ 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.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)
|
||||||
{
|
{
|
||||||
|
|
@ -615,6 +623,9 @@ 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.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;
|
||||||
var marginCenter = cubeCenterFromRightTop.X / scale;
|
var marginCenter = cubeCenterFromRightTop.X / scale;
|
||||||
|
|
@ -649,6 +660,9 @@ 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.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;
|
||||||
AddRoundButton(gridSnapButton, new Vector2(marginCenter, startHeight + 2 * ySpacing), true);
|
AddRoundButton(gridSnapButton, new Vector2(marginCenter, startHeight + 2 * ySpacing), true);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ of the authors and should not be interpreted as representing official policies,
|
||||||
either expressed or implied, of the FreeBSD Project.
|
either expressed or implied, of the FreeBSD Project.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using Lucene.Net.Tartarus.Snowball;
|
||||||
using MatterHackers.Agg.UI;
|
using MatterHackers.Agg.UI;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
|
|
@ -80,6 +81,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
|
|
||||||
textEditWidget.ActualTextEditWidget.TextChanged += ActualTextEditWidget_TextChanged;
|
textEditWidget.ActualTextEditWidget.TextChanged += ActualTextEditWidget_TextChanged;
|
||||||
|
|
||||||
|
NumberField.SetupUpAndDownArrows(textEditWidget.ActualTextEditWidget);
|
||||||
|
|
||||||
this.Content = aligner;
|
this.Content = aligner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ either expressed or implied, of the FreeBSD Project.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using MatterHackers.Agg.UI;
|
using MatterHackers.Agg.UI;
|
||||||
|
using MatterHackers.Localizations;
|
||||||
|
using MatterHackers.MeshVisualizer;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl.SlicerConfiguration
|
namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
{
|
{
|
||||||
|
|
@ -45,6 +47,68 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetupUpAndDownArrows(GuiWidget guiWidget)
|
||||||
|
{
|
||||||
|
guiWidget.KeyDown += InternalTextEditWidget_KeyDown;
|
||||||
|
|
||||||
|
guiWidget.MouseEnterBounds += (s, e) =>
|
||||||
|
{
|
||||||
|
var textEditWidget = s as TextEditWidget;
|
||||||
|
var internalTextEditWidget = textEditWidget.InternalTextEditWidget;
|
||||||
|
|
||||||
|
if (internalTextEditWidget != null
|
||||||
|
&& double.TryParse(internalTextEditWidget.Text, out double value))
|
||||||
|
{
|
||||||
|
ApplicationController.Instance.UiHint = "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)
|
||||||
|
{
|
||||||
|
var textEditWidget = sender as TextEditWidget;
|
||||||
|
var internalTextEditWidget = textEditWidget.InternalTextEditWidget;
|
||||||
|
|
||||||
|
if (internalTextEditWidget != null)
|
||||||
|
{
|
||||||
|
var amount = 1.0;
|
||||||
|
if (e.Shift)
|
||||||
|
{
|
||||||
|
amount = 10;
|
||||||
|
}
|
||||||
|
else if (e.Control)
|
||||||
|
{
|
||||||
|
amount = .1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the up arrow is pressed and the text is a number
|
||||||
|
if (e.KeyCode == Keys.Up)
|
||||||
|
{
|
||||||
|
if (double.TryParse(internalTextEditWidget.Text, out double value))
|
||||||
|
{
|
||||||
|
value += amount;
|
||||||
|
internalTextEditWidget.Text = value.ToString();
|
||||||
|
e.Handled = true;
|
||||||
|
internalTextEditWidget.OnEditComplete(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (e.KeyCode == Keys.Down)
|
||||||
|
{
|
||||||
|
if (double.TryParse(internalTextEditWidget.Text, out double value))
|
||||||
|
{
|
||||||
|
value -= amount;
|
||||||
|
internalTextEditWidget.Text = value.ToString();
|
||||||
|
e.Handled = true;
|
||||||
|
internalTextEditWidget.OnEditComplete(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Initialize(int tabIndex)
|
public override void Initialize(int tabIndex)
|
||||||
{
|
{
|
||||||
numberEdit = new ThemedNumberEdit(0, theme, pixelWidth: ControlWidth, allowDecimals: this.AllowDecimals, allowNegatives: this.AllowNegatives, tabIndex: tabIndex)
|
numberEdit = new ThemedNumberEdit(0, theme, pixelWidth: ControlWidth, allowDecimals: this.AllowDecimals, allowNegatives: this.AllowNegatives, tabIndex: tabIndex)
|
||||||
|
|
@ -62,6 +126,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
userInitiated: true);
|
userInitiated: true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
SetupUpAndDownArrows(numberEdit.ActuallNumberEdit);
|
||||||
|
|
||||||
this.Content = numberEdit;
|
this.Content = numberEdit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue