Made 'Open', 'Save' and 'Bed' more intuitive
Added more sliders Fixed issue with load progress indicator not clearing Made value display update for more sliders
This commit is contained in:
parent
2077cf7987
commit
a238c8c4b0
14 changed files with 73 additions and 61 deletions
|
|
@ -549,6 +549,7 @@ namespace MatterHackers.MatterControl
|
|||
Name = buttonParams.ButtonName,
|
||||
Enabled = buttonParams.ButtonEnabled,
|
||||
ToolTipText = buttonParams.ButtonTooltip,
|
||||
Padding = new BorderDouble(5, 0, 5, 0)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -578,14 +579,11 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
|
||||
menuButton.Name = buttonParams.ButtonName + " Menu SplitButton";
|
||||
if (buttonParams.ButtonText == null)
|
||||
menuButton.BackgroundColor = buttonParams.BackgroundColor;
|
||||
if (menuButton.BackgroundColor == Color.Transparent)
|
||||
{
|
||||
menuButton.BackgroundColor = this.ToolbarButtonBackground;
|
||||
}
|
||||
else
|
||||
{
|
||||
menuButton.BackgroundColor = this.MinimalShade;
|
||||
}
|
||||
|
||||
menuButton.HoverColor = this.ToolbarButtonHover;
|
||||
menuButton.MouseDownColor = this.ToolbarButtonDown;
|
||||
|
|
@ -768,5 +766,7 @@ namespace MatterHackers.MatterControl
|
|||
public Action<PopupMenu> ExtendPopupMenu { get; set; }
|
||||
|
||||
public string ButtonText { get; set; }
|
||||
|
||||
public Color BackgroundColor { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -108,7 +108,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
var ratioToApply = PinchRatio;
|
||||
|
||||
var distFromCenter = pos.X - aabb.Center.X;
|
||||
var distanceToPinch = distFromCenter * (1 - PinchRatio);
|
||||
var delta = (aabb.Center.X + distFromCenter * ratioToApply) - pos.X;
|
||||
|
||||
// find out how much to pinch based on y position
|
||||
|
|
|
|||
|
|
@ -414,6 +414,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Path));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
[DisplayName("Back Ratio")]
|
||||
[Description("Describes the percent that the back of the part will be pinched")]
|
||||
[DescriptionImage("https://lh3.googleusercontent.com/CAi26qYHHdneoU0yhaY2bdVU4RJP7PDCjEUrC3i-smstyvm2FC_dteHU16eYyEyK9krCyK3C2TkSpE5YDcAkHBwq40ddaLBQ13yVdQCB")]
|
||||
public double PinchPercent { get; set; } = 50;
|
||||
[Slider(0, 300, Easing.EaseType.Quadratic, snapDistance: 1)]
|
||||
public DoubleOrExpression PinchPercent { get; set; } = 50;
|
||||
|
||||
public override Task Rebuild()
|
||||
{
|
||||
|
|
@ -73,7 +74,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
bool valuesChanged = false;
|
||||
|
||||
PinchPercent = agg_basics.Clamp(PinchPercent, 0, 3, ref valuesChanged);
|
||||
var pinchPercent = PinchPercent.ClampIfNotCalculated(this, 0, 300, ref valuesChanged);
|
||||
|
||||
foreach (var sourceItem in SourceContainer.VisibleMeshes())
|
||||
{
|
||||
|
|
@ -87,7 +88,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
var pos = originalMesh.Vertices[i];
|
||||
pos = pos.Transform(itemMatrix);
|
||||
|
||||
var ratioToApply = PinchPercent / 100.0;
|
||||
var ratioToApply = pinchPercent / 100.0;
|
||||
|
||||
var distFromCenter = pos.X - aabb.Center.X;
|
||||
var distanceToPinch = distFromCenter * (1 - ratioToApply);
|
||||
|
|
@ -116,10 +117,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
SourceContainer.Visible = false;
|
||||
rebuildLocks.Dispose();
|
||||
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
|
||||
Invalidate(InvalidateType.Children);
|
||||
return Task.CompletedTask;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public DoubleOrExpression CalculationHeight { get; set; } = .1;
|
||||
|
||||
[DisplayName("Expand")]
|
||||
[Slider(1, 100, Easing.EaseType.Quadratic, snapDistance: 1)]
|
||||
[Slider(1, 30, Easing.EaseType.Quadratic, snapDistance: .5)]
|
||||
public DoubleOrExpression BaseSize { get; set; } = 3;
|
||||
|
||||
[Slider(1, 20, Easing.EaseType.Quadratic, snapDistance: .1)]
|
||||
|
|
@ -257,6 +257,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
string thumbnailId = libraryItem.ID;
|
||||
|
||||
var thumbnail = GetThumbnail(object3D, thumbnailId, width, height);
|
||||
var thumbnail = GenerateThumbnail(object3D, thumbnailId, width, height);
|
||||
if (thumbnail != null)
|
||||
{
|
||||
// Cache content thumbnail
|
||||
|
|
@ -151,7 +151,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
// Limit to private scope until need returns
|
||||
private ImageBuffer GetThumbnail(IObject3D item, string thumbnailId, int width, int height)
|
||||
private ImageBuffer GenerateThumbnail(IObject3D item, string thumbnailId, int width, int height)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1057,12 +1057,17 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
if (mouseEvent.Button == MouseButtons.XButton1)
|
||||
{
|
||||
// user pressed the back button
|
||||
breadCrumbWidget.NavigateBack();
|
||||
NavigateBack();
|
||||
}
|
||||
|
||||
base.OnMouseDown(mouseEvent);
|
||||
}
|
||||
|
||||
public void NavigateBack()
|
||||
{
|
||||
breadCrumbWidget.NavigateBack();
|
||||
}
|
||||
|
||||
public override void OnMouseMove(MouseEventArgs mouseEvent)
|
||||
{
|
||||
if (PositionWithinLocalBounds(mouseEvent.X, mouseEvent.Y)
|
||||
|
|
|
|||
|
|
@ -60,6 +60,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
}
|
||||
|
||||
public PopupMenuButton(string text, ImageBuffer imageBuffer, ThemeConfig theme)
|
||||
: this(new TextIconButton(text, imageBuffer, theme)
|
||||
{
|
||||
Padding = new BorderDouble(5, 0, 5, 0),
|
||||
}, theme)
|
||||
{
|
||||
}
|
||||
|
||||
public PopupMenuButton(GuiWidget viewWidget, ThemeConfig theme)
|
||||
: base(viewWidget)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,6 +93,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
e.Graphics2D.PopTransform();
|
||||
}
|
||||
|
||||
if (view3DWidget?.Scene?.Contains(TrackingObject) != true)
|
||||
{
|
||||
RemoveProgressBar();
|
||||
}
|
||||
}
|
||||
|
||||
public void ProgressReporter(double progress0To1, string processingState)
|
||||
|
|
@ -104,13 +109,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (progress0To1 > 1.1)
|
||||
{
|
||||
view3DWidget?.Invalidate();
|
||||
progressBar.Close();
|
||||
if (view3DWidget != null)
|
||||
{
|
||||
view3DWidget.AfterDraw -= View3DWidget_AfterDraw;
|
||||
}
|
||||
RemoveProgressBar();
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveProgressBar()
|
||||
{
|
||||
progressBar.Close();
|
||||
if (view3DWidget != null)
|
||||
{
|
||||
view3DWidget.AfterDraw -= View3DWidget_AfterDraw;
|
||||
}
|
||||
view3DWidget?.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -210,6 +210,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
var exportGCodeButton = menuTheme.CreateSplitButton(new SplitButtonParams()
|
||||
{
|
||||
ButtonText = "Export".Localize(),
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
ButtonTooltip = exportPlugin.Enabled ? exportType : exportPlugin.DisabledReason,
|
||||
ExtendPopupMenu = (popupMenu) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private readonly Dictionary<GuiWidget, SceneOperation> operationButtons;
|
||||
private MainViewWidget mainViewWidget = null;
|
||||
private readonly PopupMenuButton bedMenuButton;
|
||||
private readonly ThemeConfig theme;
|
||||
private readonly UndoBuffer undoBuffer;
|
||||
private readonly IconButton undoButton;
|
||||
private readonly IconButton redoButton;
|
||||
|
|
@ -95,7 +94,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public ViewControls3D(PartWorkspace workspace, ThemeConfig theme, UndoBuffer undoBuffer, bool isPrinterType, bool showPrintButton)
|
||||
: base(theme)
|
||||
{
|
||||
this.theme = theme;
|
||||
this.undoBuffer = undoBuffer;
|
||||
this.ActionArea.Click += (s, e) =>
|
||||
{
|
||||
|
|
@ -127,16 +125,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.sceneContext = workspace.SceneContext;
|
||||
this.workspace = workspace;
|
||||
|
||||
string iconPath;
|
||||
this.AddChild(CreateOpenButton(sceneContext, theme));
|
||||
|
||||
this.AddChild(CreateAddButton(sceneContext, theme));
|
||||
this.AddChild(CreateOpenFileButton(theme));
|
||||
|
||||
this.AddChild(CreateSaveButton(theme));
|
||||
|
||||
this.AddChild(new ToolbarSeparator(theme.GetBorderColor(50), theme.SeparatorMargin));
|
||||
|
||||
bedMenuButton = new PopupMenuButton(StaticData.Instance.LoadIcon("bed.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
bedMenuButton = new PopupMenuButton("Bed".Localize(), StaticData.Instance.LoadIcon("bed.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "Bed Options Menu",
|
||||
ToolTipText = "Bed",
|
||||
Enabled = true,
|
||||
Margin = theme.ButtonSpacing,
|
||||
VAnchor = VAnchor.Center,
|
||||
|
|
@ -147,12 +146,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
this.AddChild(new ToolbarSeparator(theme.GetBorderColor(50), theme.SeparatorMargin));
|
||||
|
||||
this.AddChild(CreateOpenButton(theme));
|
||||
|
||||
this.AddChild(CreateSaveButton(theme));
|
||||
|
||||
this.AddChild(new ToolbarSeparator(theme.GetBorderColor(50), theme.SeparatorMargin));
|
||||
|
||||
undoButton = new IconButton(StaticData.Instance.LoadIcon("undo.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "3D View Undo",
|
||||
|
|
@ -509,14 +502,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
redoButton.Enabled = undoBuffer.RedoCount > 0;
|
||||
}
|
||||
|
||||
private IconButton CreateOpenButton(ThemeConfig theme)
|
||||
private GuiWidget CreateOpenFileButton(ThemeConfig theme)
|
||||
{
|
||||
var openButton = new IconButton(StaticData.Instance.LoadIcon("fa-folder-open_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var popupMenu = new PopupMenuButton("", theme)
|
||||
{
|
||||
Margin = theme.ButtonSpacing,
|
||||
ToolTipText = "Open File".Localize(),
|
||||
Name = "Open File Button"
|
||||
};
|
||||
|
||||
if (popupMenu.Children<SimpleButton>().FirstOrDefault() is SimpleButton simpleButton)
|
||||
{
|
||||
simpleButton.Padding = 0;
|
||||
};
|
||||
|
||||
var openMenuItems = new PopupMenu(ApplicationController.Instance.MenuTheme);
|
||||
popupMenu.PopupContent = openMenuItems;
|
||||
|
||||
var openButton = openMenuItems.CreateMenuItem("Open File".Localize(), StaticData.Instance.LoadIcon("fa-folder-open_16.png", 16, 16).SetToColor(theme.TextColor));
|
||||
|
||||
openButton.Click += (s, e) =>
|
||||
{
|
||||
var extensionsWithoutPeriod = new HashSet<string>(ApplicationSettings.OpenDesignFileParams.Split('|').First().Split(',').Select(t => t.Trim().Trim('.')));
|
||||
|
|
@ -543,7 +545,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
});
|
||||
}, .1);
|
||||
};
|
||||
return openButton;
|
||||
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
private void UpdateToolbarButtons(object sender, EventArgs e)
|
||||
|
|
@ -576,30 +579,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
private GuiWidget CreateAddButton(ISceneContext sceneContext, ThemeConfig theme)
|
||||
private GuiWidget CreateOpenButton(ISceneContext sceneContext, ThemeConfig theme)
|
||||
{
|
||||
var buttonView = new TextIconButton(
|
||||
"",
|
||||
StaticData.Instance.LoadIcon("cube_add.png", 16, 16).SetToColor(theme.TextColor),
|
||||
theme);
|
||||
|
||||
// Remove right Padding for drop style
|
||||
buttonView.Padding = buttonView.Padding.Clone(right: 0);
|
||||
|
||||
var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme)
|
||||
{
|
||||
HAnchor = HAnchor.Fit,
|
||||
VAnchor = VAnchor.Fit,
|
||||
};
|
||||
|
||||
var openColor = theme.ResolveColor(theme.BackgroundColor, theme.SlightShade);
|
||||
|
||||
PopupMenuButton libraryPopup = null;
|
||||
libraryPopup = new PopupMenuButton(buttonView, theme)
|
||||
libraryPopup = new PopupMenuButton("Open".Localize(), StaticData.Instance.LoadIcon("fa-folder-open_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
MakeScrollable = false,
|
||||
Name = "Add Content Menu",
|
||||
ToolTipText = "Add Content".Localize(),
|
||||
AlwaysKeepOpen = true,
|
||||
DynamicPopupContent = () =>
|
||||
{
|
||||
|
|
@ -678,8 +666,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
HoverColor = theme.ToolbarButtonHover,
|
||||
MouseDownColor = theme.ToolbarButtonDown,
|
||||
OpenColor = openColor,
|
||||
DrawArrow = true,
|
||||
Margin = theme.ButtonSpacing,
|
||||
// DrawArrow = true,
|
||||
Margin = 0,
|
||||
PopupBorderColor = Color.Transparent,
|
||||
PopupHAnchor = HAnchor.Fit,
|
||||
PopupVAnchor = VAnchor.Fit
|
||||
|
|
@ -720,6 +708,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
return theme.CreateSplitButton(new SplitButtonParams()
|
||||
{
|
||||
ButtonText = "Save".Localize(),
|
||||
ButtonName = "Save",
|
||||
Icon = StaticData.Instance.LoadIcon("save_grey_16x.png", 16, 16).SetToColor(theme.TextColor),
|
||||
ButtonAction = (menuButton) =>
|
||||
|
|
@ -740,7 +729,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
menuButton.Enabled = true;
|
||||
}).ConfigureAwait(false);
|
||||
},
|
||||
ButtonTooltip = "Save".Localize(),
|
||||
ExtendPopupMenu = (PopupMenu popupMenu) =>
|
||||
{
|
||||
var saveAs = popupMenu.CreateMenuItem("Save As".Localize());
|
||||
|
|
|
|||
BIN
StaticData/Icons/Library/computer_icon.png
Normal file
BIN
StaticData/Icons/Library/computer_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
|
|
@ -1 +1 @@
|
|||
Subproject commit 51adb3d9b5bcd805a53faac324527c6e0121deb2
|
||||
Subproject commit da9b0722d31c00b9c02cd5afda29cdb7305209dc
|
||||
Loading…
Add table
Add a link
Reference in a new issue