Better expose reusable components

- Move ActiveView3D reference to ApplicationController
- Use ActivewView3D reference rather than ChildrenRecursive search
- Reuse EditPrinter button on action bar to get more tests passing
- Move IsContentFileType helper to LibraryConfig
- Make PlatingHelpers operate on IEnumerable<IObject3D> versus Scene
- Pass Scene.Children rather than Scene
- When plating multiple items, pass the updated IEnumerable context
This commit is contained in:
John Lewin 2017-06-02 13:17:30 -07:00
parent 955373f4de
commit 55e217641a
15 changed files with 72 additions and 68 deletions

View file

@ -57,10 +57,7 @@ namespace MatterHackers.MatterControl.ActionBar
printerSelector.AddPrinter += (s, e) => WizardWindow.ShowPrinterSetup(true);
this.AddChild(printerSelector);
editPrinterButton = TextImageButtonFactory.GetThemedEditButton();
editPrinterButton.Name = "Edit Printer Button";
editPrinterButton.VAnchor = VAnchor.ParentCenter;
editPrinterButton.Click += UiNavigation.OpenEditPrinterWizard_Click;
editPrinterButton = CreatePrinterEditButton();
this.AddChild(editPrinterButton);
printerSelectorAndEditOverlay = new GuiWidget()
@ -75,6 +72,17 @@ namespace MatterHackers.MatterControl.ActionBar
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
}
public static Button CreatePrinterEditButton()
{
var button = TextImageButtonFactory.GetThemedEditButton();
button.Name = "Edit Printer Button";
button.VAnchor = VAnchor.ParentCenter;
button.Click += UiNavigation.OpenEditPrinterWizard_Click;
return button;
}
public override void OnClosed(ClosedEventArgs e)
{
unregisterEvents?.Invoke(this, null);
@ -244,22 +252,9 @@ namespace MatterHackers.MatterControl.ActionBar
this.VAnchor = VAnchor.FitToChildren;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
if (false)
{
// Create the image button with the normal and disabled ImageBuffers
connectButton = new SimpleButton("Connect".Localize().ToUpper(), StaticData.Instance.LoadIcon("connect.png", 16, 16))
{
Name = "Connect to printer button",
ToolTipText = "Connect to the currently selected printer".Localize(),
ImageMargin = 6,
Margin = 6,
MinimumSize = new VectorMath.Vector2(100, 0)
};
}
else
{
connectButton = buttonFactory.Generate("Connect".Localize().ToUpper(), StaticData.Instance.LoadIcon("connect.png", 16, 16));
}
connectButton = buttonFactory.Generate("Connect".Localize().ToUpper(), StaticData.Instance.LoadIcon("connect.png", 16, 16));
connectButton.Name = "Connect to printer button";
connectButton.ToolTipText = "Connect to the currently selected printer".Localize();
connectButton.Click += (s, e) =>
{
if (connectButton.Enabled)