updating ui hints
fixing issue with group
This commit is contained in:
parent
2c602e0ba5
commit
2a2a717265
14 changed files with 157 additions and 31 deletions
|
|
@ -271,6 +271,24 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
break;
|
||||
|
||||
case Keys.G:
|
||||
if (view3D.Printer == null
|
||||
|| (view3D.Printer != null && view3D.Printer.ViewState.ViewMode == PartViewMode.Model))
|
||||
{
|
||||
var scene = view3D.sceneContext.Scene;
|
||||
if (scene.SelectedItem != null
|
||||
&& scene.SelectedItem is SelectionGroupObject3D
|
||||
&& scene.SelectedItem.Children.Count > 1)
|
||||
{
|
||||
var group = new GroupHolesAppliedObject3D();
|
||||
group.WrapSelectedItemAndSelect(scene);
|
||||
}
|
||||
}
|
||||
|
||||
keyEvent.Handled = true;
|
||||
keyEvent.SuppressKeyPress = true;
|
||||
break;
|
||||
|
||||
case Keys.Z:
|
||||
if (keyEvent.Control)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1518,8 +1518,11 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
set
|
||||
{
|
||||
_uiHint = value;
|
||||
UiHintChanged?.Invoke(this, null);
|
||||
if (_uiHint != value)
|
||||
{
|
||||
_uiHint = value;
|
||||
UiHintChanged?.Invoke(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1086,6 +1086,7 @@ namespace MatterHackers.MatterControl
|
|||
&& scene.SelectedItem is SelectionGroupObject3D
|
||||
&& scene.SelectedItem.Children.Count > 1,
|
||||
Icon = (theme) => StaticData.Instance.LoadIcon("group.png", 16, 16).SetPreMultiply(),
|
||||
UiHint = "G Key".Localize(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1324,6 +1325,7 @@ namespace MatterHackers.MatterControl
|
|||
IsEnabled = (sceneContext) => IsMeshObject(sceneContext.Scene.SelectedItem),
|
||||
ShowInModifyMenu = (sceneContext) => false,
|
||||
TitleGetter = () => "Remove".Localize(),
|
||||
UiHint = "Delete Key".Localize(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ namespace MatterHackers.Agg.UI
|
|||
|
||||
public string HelpText => this.HelpTextGetter?.Invoke();
|
||||
|
||||
public string UiHint { get; set; }
|
||||
|
||||
public Func<string> TitleGetter { get; set; }
|
||||
|
||||
public string Title => this.TitleGetter?.Invoke();
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.DataConverters3D.UndoCommands;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow.View3D;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
|
|
@ -54,13 +55,43 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
Name = "Group".Localize();
|
||||
}
|
||||
|
||||
public override void Apply(UndoBuffer undoBuffer)
|
||||
{
|
||||
using (RebuildLock())
|
||||
{
|
||||
var newChildren = new List<IObject3D>();
|
||||
// push our matrix into a copy of our children
|
||||
foreach (var child in this.SourceContainer.Children)
|
||||
{
|
||||
var newChild = child.Clone();
|
||||
newChildren.Add(newChild);
|
||||
newChild.Matrix *= this.Matrix;
|
||||
}
|
||||
|
||||
// and replace us with the children
|
||||
var replaceCommand = new ReplaceCommand(new[] { this }, newChildren, maintainCenterAndZHeight: false);
|
||||
|
||||
if (undoBuffer != null)
|
||||
{
|
||||
undoBuffer.AddAndDo(replaceCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceCommand.Do();
|
||||
}
|
||||
}
|
||||
|
||||
Invalidate(InvalidateType.Children);
|
||||
}
|
||||
|
||||
[HideFromEditor]
|
||||
public override SelectedChildren SelectedChildren
|
||||
{
|
||||
get
|
||||
{
|
||||
var selections = new SelectedChildren();
|
||||
|
||||
foreach(var child in SourceContainer.DescendantsAndSelfMultipleChildrenFirstOrSelf().Children.Where(i => i.WorldOutputType(this) == PrintOutputTypes.Hole))
|
||||
foreach(var child in SourceContainer.DescendantsAndSelfMultipleChildrenFirstOrSelf().Children.Where(i => i.WorldOutputType(this) == PrintOutputTypes.Hole && !(i is OperationSourceObject3D) ))
|
||||
{
|
||||
selections.Add(child.ID);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,37 +80,42 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
}
|
||||
}
|
||||
|
||||
private object locker = new object();
|
||||
|
||||
[JsonIgnore]
|
||||
public IObject3D SourceContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
IObject3D sourceContainer = this.Children.FirstOrDefault(c => c is OperationSourceObject3D);
|
||||
if (sourceContainer == null)
|
||||
lock (locker)
|
||||
{
|
||||
using (this.RebuildLock())
|
||||
IObject3D sourceContainer = this.Children.FirstOrDefault(c => c is OperationSourceObject3D);
|
||||
if (sourceContainer == null)
|
||||
{
|
||||
sourceContainer = new OperationSourceObject3D();
|
||||
|
||||
// Move all the children to sourceContainer
|
||||
this.Children.Modify(thisChildren =>
|
||||
using (this.RebuildLock())
|
||||
{
|
||||
sourceContainer.Children.Modify(sourceChildren =>
|
||||
sourceContainer = new OperationSourceObject3D();
|
||||
|
||||
// Move all the children to sourceContainer
|
||||
this.Children.Modify(thisChildren =>
|
||||
{
|
||||
foreach (var child in thisChildren)
|
||||
sourceContainer.Children.Modify(sourceChildren =>
|
||||
{
|
||||
sourceChildren.Add(child);
|
||||
}
|
||||
});
|
||||
foreach (var child in thisChildren)
|
||||
{
|
||||
sourceChildren.Add(child);
|
||||
}
|
||||
});
|
||||
|
||||
// and then add the source container to this
|
||||
thisChildren.Clear();
|
||||
thisChildren.Add(sourceContainer);
|
||||
});
|
||||
thisChildren.Add(sourceContainer);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sourceContainer;
|
||||
return sourceContainer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
ApplicationController.Instance.UiHint = "Click to edit values".Localize();
|
||||
}
|
||||
else
|
||||
else if (ApplicationController.Instance.UiHint == "Click to edit values".Localize())
|
||||
{
|
||||
ApplicationController.Instance.UiHint = "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,6 +171,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
var errors = printer.Validate();
|
||||
|
||||
var startPrintButton = CreateStartPrintButton("Start Print".Localize(), printer, menuTheme, out bool printEnabled);
|
||||
startPrintButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Ctrl + P".Localize();
|
||||
startPrintButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
|
||||
startPrintButton.Click += (s, e) => this.CloseMenu();
|
||||
|
||||
var hasErrors = errors.Any(e => e.ErrorLevel == ValidationErrorLevel.Error);
|
||||
|
|
|
|||
|
|
@ -361,7 +361,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ToolTipText = "Select Parts".Localize(),
|
||||
Margin = theme.ButtonSpacing,
|
||||
};
|
||||
|
||||
|
||||
partSelectButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "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));
|
||||
partSelectButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.PartSelect;
|
||||
buttonGroupA.Add(partSelectButton);
|
||||
|
|
@ -372,7 +374,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ToolTipText = "Rotate View".Localize(),
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
rotateButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Rotate: Right Mouse Button | Ctrl + Left Mouse Button".Localize();
|
||||
rotateButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "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));
|
||||
rotateButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Rotate;
|
||||
|
|
@ -384,7 +386,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ToolTipText = "Move View".Localize(),
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
translateButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Move: Middle Mouse Button | Ctrl + Shift + Left Mouse Button".Localize();
|
||||
translateButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "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));
|
||||
translateButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Translate;
|
||||
|
|
@ -396,7 +398,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ToolTipText = "Zoom View".Localize(),
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
zoomButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Zoom: Mouse Wheel | Ctrl + Alt + Left Mouse Button".Localize();
|
||||
zoomButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "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));
|
||||
zoomButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Scale;
|
||||
|
|
@ -468,6 +470,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ToolTipText = "Reset View".Localize(),
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
homeButton.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = "W Key";
|
||||
homeButton.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
|
||||
AddRoundButton(homeButton, RotatedMargin(homeButton, MathHelper.Tau * .3)).Click += (s, e) => viewControls3D.NotifyResetView();
|
||||
|
||||
var zoomToSelectionButton = new IconButton(StaticData.Instance.LoadIcon("select.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
|
|
@ -476,6 +480,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ToolTipText = "Zoom to Selection".Localize(),
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
zoomToSelectionButton.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = "Z Key";
|
||||
zoomToSelectionButton.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
|
||||
void SetZoomEnabled(object s, EventArgs e)
|
||||
{
|
||||
zoomToSelectionButton.Enabled = this.Scene.SelectedItem != null
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Margin = theme.ButtonSpacing,
|
||||
VAnchor = VAnchor.Center
|
||||
};
|
||||
undoButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Ctrl + z".Localize();
|
||||
undoButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
|
||||
undoButton.Click += (sender, e) =>
|
||||
{
|
||||
sceneContext.Scene.Undo();
|
||||
|
|
@ -146,6 +148,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Enabled = false,
|
||||
VAnchor = VAnchor.Center
|
||||
};
|
||||
redoButton.MouseEnterBounds += (s, e) => ApplicationController.Instance.UiHint = "Ctrl + Y, Ctrl + Shift + Z".Localize();
|
||||
redoButton.MouseLeaveBounds += (s, e) => ApplicationController.Instance.UiHint = "";
|
||||
redoButton.Click += (sender, e) =>
|
||||
{
|
||||
sceneContext.Scene.Redo();
|
||||
|
|
@ -258,6 +262,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
HoverColor = theme.ToolbarButtonHover,
|
||||
MouseDownColor = theme.ToolbarButtonDown,
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(namedAction.UiHint))
|
||||
{
|
||||
button.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = namedAction.UiHint;
|
||||
button.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -423,6 +433,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
var operationButton = new OperationIconButton(operation, sceneContext, theme);
|
||||
if (!string.IsNullOrEmpty(operation.UiHint))
|
||||
{
|
||||
operationButton.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = operation.UiHint;
|
||||
operationButton.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
|
||||
}
|
||||
operationButtons.Add(operationButton, operation);
|
||||
|
||||
buttonGroup.AddChild(operationButton);
|
||||
|
|
@ -484,6 +499,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
iconButton.SetIcon(operation.Icon(theme));
|
||||
iconButton.ToolTipText = operation.HelpText ?? operation.Title;
|
||||
|
||||
if (!string.IsNullOrEmpty(operation.UiHint))
|
||||
{
|
||||
iconButton.MouseEnterBounds += (s1, e1) => ApplicationController.Instance.UiHint = operation.UiHint;
|
||||
iconButton.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
|
||||
}
|
||||
|
||||
UserSettings.Instance.set(operationGroup.GroupRecordId, operationGroup.Operations.IndexOf(operation).ToString());
|
||||
|
||||
defaultOperation = operation;
|
||||
|
|
|
|||
|
|
@ -158,16 +158,16 @@ namespace MatterHackers.MatterControl
|
|||
("ctrl + -","Zoom out".Localize()),
|
||||
("← → ↑ ↓","Rotate".Localize()),
|
||||
("shift + ← → ↑ ↓","Pan".Localize()),
|
||||
//("f","Zoom to fit".Localize()),
|
||||
("w","Zoom to window".Localize()),
|
||||
("z","Zoom to selection".Localize()),
|
||||
("ctrl + a","Select all".Localize()),
|
||||
("space bar","Clear selection".Localize()),
|
||||
("esc","Cancel command".Localize()),
|
||||
("ctrl + s","Save".Localize()),
|
||||
("ctrl + z","Undo".Localize()),
|
||||
("ctrl + y","Redo".Localize()),
|
||||
("ctrl + p","Print".Localize()),
|
||||
("delete","Delete selection".Localize()),
|
||||
("space bar","Clear selection".Localize()),
|
||||
("esc","Cancel command".Localize()),
|
||||
//("enter","Accept command".Localize())
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1150,6 +1150,18 @@ Translated:Creating Threads
|
|||
English:Creation Data
|
||||
Translated:Creation Data
|
||||
|
||||
English:Ctrl + A = Select Alll, 'Space' = Clear Selection, 'ESC' = Cancel Drag
|
||||
Translated:Ctrl + A = Select Alll, 'Space' = Clear Selection, 'ESC' = Cancel Drag
|
||||
|
||||
English:Ctrl + Y | Ctrl + Shift + Z
|
||||
Translated:Ctrl + Y | Ctrl + Shift + Z
|
||||
|
||||
English:Ctrl + Y, Ctrl + Shift + Z
|
||||
Translated:Ctrl + Y, Ctrl + Shift + Z
|
||||
|
||||
English:Ctrl + z
|
||||
Translated:Ctrl + z
|
||||
|
||||
English:Cube
|
||||
Translated:Cube
|
||||
|
||||
|
|
@ -1204,6 +1216,9 @@ Translated:Define New
|
|||
English:Delete
|
||||
Translated:Delete
|
||||
|
||||
English:Delete Key
|
||||
Translated:Delete Key
|
||||
|
||||
English:Delete Printer
|
||||
Translated:Delete Printer
|
||||
|
||||
|
|
@ -1933,6 +1948,9 @@ Translated:Fuzzy Frequency
|
|||
English:Fuzzy Thickness
|
||||
Translated:Fuzzy Thickness
|
||||
|
||||
English:G Key
|
||||
Translated:G Key
|
||||
|
||||
English:g/cm³
|
||||
Translated:g/cm³
|
||||
|
||||
|
|
@ -2968,6 +2986,12 @@ Translated:Move Z positive
|
|||
English:Move: Middle Mouse Button | Ctrl + Shift + Left Mouse Button
|
||||
Translated:Move: Middle Mouse Button | Ctrl + Shift + Left Mouse Button
|
||||
|
||||
English:Move: Middle Mouse Button | Ctrl + Shift + Left Mouse Button | Shift Arrow Keys
|
||||
Translated:Move: Middle Mouse Button | Ctrl + Shift + Left Mouse Button | Shift Arrow Keys
|
||||
|
||||
English:Move: Middle Mouse Button, Ctrl + Shift + Left Mouse Button, Shift Arrow Keys
|
||||
Translated:Move: Middle Mouse Button, Ctrl + Shift + Left Mouse Button, Shift Arrow Keys
|
||||
|
||||
English:Movement
|
||||
Translated:Movement
|
||||
|
||||
|
|
@ -4153,6 +4177,12 @@ Translated:Rotate View
|
|||
English:Rotate: Right Mouse Button | Ctrl + Left Mouse Button
|
||||
Translated:Rotate: Right Mouse Button | Ctrl + Left Mouse Button
|
||||
|
||||
English:Rotate: Right Mouse Button | Ctrl + Left Mouse Button | Arrow Keys
|
||||
Translated:Rotate: Right Mouse Button | Ctrl + Left Mouse Button | Arrow Keys
|
||||
|
||||
English:Rotate: Right Mouse Button, Ctrl + Left Mouse Button, Arrow Keys
|
||||
Translated:Rotate: Right Mouse Button, Ctrl + Left Mouse Button, Arrow Keys
|
||||
|
||||
English:Rotation Distance
|
||||
Translated:Rotation Distance
|
||||
|
||||
|
|
@ -6403,3 +6433,9 @@ Translated:Zoom View
|
|||
English:Zoom: Mouse Wheel | Ctrl + Alt + Left Mouse Button
|
||||
Translated:Zoom: Mouse Wheel | Ctrl + Alt + Left Mouse Button
|
||||
|
||||
English:Zoom: Mouse Wheel | Ctrl + Alt + Left Mouse Button | Ctrl + '+' & Ctrl + '-'
|
||||
Translated:Zoom: Mouse Wheel | Ctrl + Alt + Left Mouse Button | Ctrl + '+' & Ctrl + '-'
|
||||
|
||||
English:Zoom: Mouse Wheel, Ctrl + Alt + Left Mouse Button, Ctrl + '+' & Ctrl + '-'
|
||||
Translated:Zoom: Mouse Wheel, Ctrl + Alt + Left Mouse Button, Ctrl + '+' & Ctrl + '-'
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit d318d70f3f2772d1b987a63291a1860c7dfc04f9
|
||||
Subproject commit 389d7aa2b2a790792b847814cf1702d4e562e5e4
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 9e115e5373d44f9cc7fdcee0e3290b1e88c39970
|
||||
Subproject commit e525a40b09db6c88c20742fd51c2215cc5bfc0a5
|
||||
Loading…
Add table
Add a link
Reference in a new issue