Improving right click printer menu
This commit is contained in:
parent
f6204e0eec
commit
731378eb75
6 changed files with 47 additions and 58 deletions
|
|
@ -39,8 +39,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
public class SimpleButton : GuiWidget
|
||||
{
|
||||
private bool mouseInBounds = false;
|
||||
|
||||
protected ThemeConfig theme;
|
||||
|
||||
private bool hasKeyboardFocus;
|
||||
|
|
@ -59,20 +57,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
public Color MouseDownColor { get; set; } = Color.Transparent;
|
||||
|
||||
public override void OnMouseEnterBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
mouseInBounds = true;
|
||||
base.OnMouseEnterBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
mouseInBounds = false;
|
||||
base.OnMouseLeaveBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnMouseDown(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseDown(mouseEvent);
|
||||
|
|
@ -104,17 +88,30 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
base.OnKeyUp(keyEvent);
|
||||
}
|
||||
|
||||
public override void OnMouseEnterBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnMouseEnterBounds(mouseEvent);
|
||||
}
|
||||
|
||||
public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnMouseLeaveBounds(mouseEvent);
|
||||
}
|
||||
|
||||
public override Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
var firstWidgetUnderMouse = ContainsFirstUnderMouseRecursive();
|
||||
if (this.MouseCaptured
|
||||
&& mouseInBounds
|
||||
&& firstWidgetUnderMouse
|
||||
&& this.Enabled)
|
||||
{
|
||||
return this.MouseDownColor;
|
||||
}
|
||||
else if (mouseInBounds
|
||||
else if (firstWidgetUnderMouse
|
||||
&& this.Enabled)
|
||||
{
|
||||
return this.HoverColor;
|
||||
|
|
@ -129,7 +126,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
public override void OnFocusChanged(EventArgs e)
|
||||
{
|
||||
hasKeyboardFocus = this.Focused && !mouseInBounds;
|
||||
hasKeyboardFocus = this.Focused && !ContainsFirstUnderMouseRecursive();
|
||||
this.Invalidate();
|
||||
|
||||
base.OnFocusChanged(e);
|
||||
|
|
@ -159,20 +156,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
graphics2D.Render(rectOutline, theme.EditFieldColors.Focused.BorderColor);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Enabled
|
||||
{
|
||||
get => base.Enabled;
|
||||
set
|
||||
{
|
||||
base.Enabled = value;
|
||||
|
||||
if (!base.Enabled)
|
||||
{
|
||||
mouseInBounds = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SimpleFlowButton : FlowLayoutWidget
|
||||
|
|
|
|||
|
|
@ -173,8 +173,7 @@ namespace MatterHackers.MatterControl.Plugins.Lithophane
|
|||
|
||||
public ImageBufferImageData(ImageBuffer image, double pixelWidth)
|
||||
{
|
||||
resizedImage = this.ToResizedGrayscale(image, pixelWidth);
|
||||
resizedImage.FlipY();
|
||||
resizedImage = this.ToResizedGrayscale(image, pixelWidth).MirrorY();
|
||||
}
|
||||
|
||||
public int Width => resizedImage.Width;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ using System.Runtime.CompilerServices;
|
|||
using System.Threading.Tasks;
|
||||
using MatterControlLib;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
|
|
@ -771,12 +772,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
var textWidget = new TextWidget("Move Tab", pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
|
||||
{
|
||||
Padding = PopupMenu.MenuPadding.Clone(right: 0),
|
||||
Margin = PopupMenu.MenuPadding.Clone(PopupMenu.MenuPadding.Left - 5, right: 5),
|
||||
VAnchor = VAnchor.Center,
|
||||
};
|
||||
moveButtons.AddChild(textWidget);
|
||||
var moveLeftButton = new TextButton("<<".Localize(), theme)
|
||||
var buttonSize = 24 * DeviceScale;
|
||||
var moveLeftButton = new IconButton(StaticData.Instance.LoadIcon("fa-angle-right_12.png", 14, 14, theme.InvertIcons).MirrorX(), theme)
|
||||
{
|
||||
Width = buttonSize,
|
||||
Height = buttonSize,
|
||||
Margin = new BorderDouble(3, 0),
|
||||
HoverColor = theme.AccentMimimalOverlay,
|
||||
VAnchor = VAnchor.Center,
|
||||
};
|
||||
moveLeftButton.Click += (s, e) =>
|
||||
|
|
@ -786,8 +792,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
moveButtons.AddChild(moveLeftButton);
|
||||
|
||||
var moveRightButton = new TextButton(">>".Localize(), theme)
|
||||
var moveRightButton = new IconButton(StaticData.Instance.LoadIcon("fa-angle-right_12.png", 14, 14, theme.InvertIcons), theme)
|
||||
{
|
||||
Width = buttonSize,
|
||||
Height = buttonSize,
|
||||
Margin = new BorderDouble(3, 0),
|
||||
HoverColor = theme.AccentMimimalOverlay,
|
||||
VAnchor = VAnchor.Center,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public class PopupMenuButton : PopupButton
|
||||
{
|
||||
private readonly ThemeConfig theme;
|
||||
private bool mouseInBounds;
|
||||
private bool _drawArrow = false;
|
||||
private VertexStorage dropArrow = DropArrow.DownArrow;
|
||||
private RectangleDouble dropButtonBounds = RectangleDouble.ZeroIntersection;
|
||||
|
|
@ -125,6 +124,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
base.OnBoundsChanged(e);
|
||||
}
|
||||
|
||||
public override void OnMouseEnterBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnMouseEnterBounds(mouseEvent);
|
||||
}
|
||||
|
||||
public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnMouseLeaveBounds(mouseEvent);
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
base.OnDraw(graphics2D);
|
||||
|
|
@ -147,33 +158,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnMouseEnterBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
mouseInBounds = true;
|
||||
base.OnMouseEnterBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
mouseInBounds = false;
|
||||
base.OnMouseLeaveBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
var firstWidgetUnderMouse = FirstWidgetUnderMouse;
|
||||
if (!MenuVisible
|
||||
&& this.MouseCaptured
|
||||
&& mouseInBounds
|
||||
&& firstWidgetUnderMouse
|
||||
&& this.Enabled)
|
||||
{
|
||||
return this.MouseDownColor;
|
||||
}
|
||||
else if (!MenuVisible
|
||||
&& mouseInBounds
|
||||
&& firstWidgetUnderMouse
|
||||
&& this.Enabled)
|
||||
{
|
||||
return this.HoverColor;
|
||||
|
|
|
|||
|
|
@ -270,8 +270,7 @@ namespace MatterHackers.MatterControl.Tour
|
|||
}
|
||||
else
|
||||
{
|
||||
var leftArrow = new ImageBuffer(rightArrow);
|
||||
leftArrow.FlipX();
|
||||
var leftArrow = new ImageBuffer(rightArrow).MirrorX();
|
||||
|
||||
this.Image = leftArrow;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 97889bbc2ac142ad04a176a2c73b789266c499ce
|
||||
Subproject commit be0aedaf800379d1409c5758ddb282fc63b0f98e
|
||||
Loading…
Add table
Add a link
Reference in a new issue