commit
b9d8880ddc
16 changed files with 468 additions and 279 deletions
|
|
@ -47,7 +47,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else
|
||||
{
|
||||
this.AddChild(new PrinterConnectAndSelectControl());
|
||||
this.AddChild(new PrinterConnectButton(ApplicationController.Instance.Theme.BreadCrumbButtonFactory));
|
||||
this.AddChild(new PrintStatusRow());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
private void AddChildElements()
|
||||
{
|
||||
FlowLayoutWidget temperatureWidgets = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
var temperatureWidgets = new FlowLayoutWidget();
|
||||
{
|
||||
extruderTemperatureWidget = new TemperatureWidgetExtruder();
|
||||
temperatureWidgets.AddChild(extruderTemperatureWidget);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2016, Lars Brubaker
|
||||
Copyright (c) 2017, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -30,37 +30,49 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.ImageProcessing;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.ActionBar
|
||||
{
|
||||
public class PrinterConnectAndSelectControl : FlowLayoutWidget
|
||||
public class PrinterSelectEditDropdown : FlowLayoutWidget
|
||||
{
|
||||
private Button connectPrinterButton;
|
||||
private Button editPrinterButton;
|
||||
private string disconnectAndCancelTitle = "Disconnect and stop the current print?".Localize();
|
||||
private string disconnectAndCancelMessage = "WARNING: Disconnecting will stop the current print.\n\nAre you sure you want to disconnect?".Localize();
|
||||
private Button disconnectPrinterButton;
|
||||
private PrinterSelector printerSelector;
|
||||
GuiWidget printerSelectorAndEditOverlay;
|
||||
|
||||
private GuiWidget printerSelectorAndEditOverlay;
|
||||
private Button editPrinterButton;
|
||||
private EventHandler unregisterEvents;
|
||||
static EventHandler staticUnregisterEvents;
|
||||
|
||||
public PrinterConnectAndSelectControl()
|
||||
public PrinterSelectEditDropdown()
|
||||
{
|
||||
this.HAnchor = HAnchor.ParentLeftRight;
|
||||
printerSelector = new PrinterSelector()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
Cursor = Cursors.Hand,
|
||||
Margin = new BorderDouble(0, 6, 0, 3)
|
||||
};
|
||||
printerSelector.AddPrinter += (s, e) => WizardWindow.ShowPrinterSetup(true);
|
||||
this.AddChild(printerSelector);
|
||||
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
editPrinterButton = TextImageButtonFactory.GetThemedEditButton();
|
||||
editPrinterButton.Name = "Edit Printer Button";
|
||||
editPrinterButton.VAnchor = VAnchor.ParentCenter;
|
||||
editPrinterButton.Click += UiNavigation.OpenEditPrinterWizard_Click;
|
||||
this.AddChild(editPrinterButton);
|
||||
|
||||
AddChildElements();
|
||||
printerSelectorAndEditOverlay = new GuiWidget()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
VAnchor = VAnchor.ParentBottomTop,
|
||||
Selectable = false,
|
||||
};
|
||||
this.AddChild(printerSelectorAndEditOverlay);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
|
|
@ -69,188 +81,276 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
protected void AddChildElements()
|
||||
private void SetVisibleStates(object sender, EventArgs e)
|
||||
{
|
||||
var buttonFactory = ApplicationController.Instance.Theme.PrinterConnectButtonFactory;
|
||||
// connect and disconnect buttons
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
var normalImage = StaticData.Instance.LoadIcon("connect.png", 32, 32);
|
||||
bool printerIsPrintingOrPaused = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
|
||||
|
||||
editPrinterButton.Enabled = ActiveSliceSettings.Instance.PrinterSelected && !printerIsPrintingOrPaused;
|
||||
printerSelector.Enabled = !printerIsPrintingOrPaused;
|
||||
if (printerIsPrintingOrPaused)
|
||||
{
|
||||
printerSelectorAndEditOverlay.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150);
|
||||
}
|
||||
else
|
||||
{
|
||||
printerSelectorAndEditOverlay.BackgroundColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class ResetButton : GuiWidget
|
||||
{
|
||||
private readonly string resetConnectionText = "Reset\nConnection".Localize().ToUpper();
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
public ResetButton(TextImageButtonFactory buttonFactory)
|
||||
{
|
||||
this.HAnchor = HAnchor.ParentLeftRight | HAnchor.FitToChildren;
|
||||
this.VAnchor = VAnchor.FitToChildren;
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
Button resetConnectionButton = buttonFactory.Generate(resetConnectionText, "e_stop4.png");
|
||||
resetConnectionButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.show_reset_connection);
|
||||
resetConnectionButton.Click += (s, e) =>
|
||||
{
|
||||
UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.RebootBoard);
|
||||
};
|
||||
this.AddChild(resetConnectionButton);
|
||||
|
||||
ActiveSliceSettings.SettingChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
var stringEvent = e as StringEventArgs;
|
||||
if (stringEvent?.Data == SettingsKey.show_reset_connection)
|
||||
{
|
||||
resetConnectionButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.show_reset_connection);
|
||||
}
|
||||
}, ref unregisterEvents);
|
||||
}
|
||||
}
|
||||
|
||||
public class SimpleButton : FlowLayoutWidget
|
||||
{
|
||||
public ImageBuffer Image { get; set; }
|
||||
public BorderDouble ImageMargin { get; set; }
|
||||
public BorderDouble ImagePadding { get; set; }
|
||||
public double FontSize { get; set; } = 12;
|
||||
|
||||
public int BorderWidth { get; set; }
|
||||
|
||||
public RGBA_Bytes BorderColor { get; set; } = RGBA_Bytes.Transparent;
|
||||
|
||||
private int borderRadius = 0;
|
||||
|
||||
public SimpleButton(string text, ImageBuffer image = null)
|
||||
{
|
||||
this.HAnchor = HAnchor.ParentLeft | HAnchor.FitToChildren;
|
||||
this.VAnchor = VAnchor.ParentTop | VAnchor.FitToChildren;
|
||||
|
||||
this.Text = text;
|
||||
this.Image = image;
|
||||
|
||||
this.AddChild(new GuiWidget() { BackgroundColor = RGBA_Bytes.Green, Height = 10, Width = 20 });
|
||||
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (this.Image != null)
|
||||
{
|
||||
this.AddChild(
|
||||
new ImageWidget(this.Image)
|
||||
{
|
||||
Margin = ImageMargin,
|
||||
Padding = ImagePadding,
|
||||
VAnchor = VAnchor.ParentBottomTop,
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.Text))
|
||||
{
|
||||
this.AddChild(new TextWidget(this.Text, pointSize: this.FontSize));
|
||||
}
|
||||
|
||||
this.AddChild(new GuiWidget() { BackgroundColor = RGBA_Bytes.Red, Height = 10, Width = 20 });
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnLayout(LayoutEventArgs layoutEventArgs)
|
||||
{
|
||||
base.OnLayout(layoutEventArgs);
|
||||
}
|
||||
|
||||
/*
|
||||
public override void OnLoad(EventArgs args)
|
||||
{
|
||||
if (this.Image != null)
|
||||
{
|
||||
this.AddChild(new ImageWidget(this.Image)
|
||||
{
|
||||
Margin = ImageMargin
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.Text))
|
||||
{
|
||||
this.AddChild(new TextWidget(this.Text, pointSize: this.FontSize));
|
||||
}
|
||||
|
||||
base.OnLoad(args);
|
||||
}*/
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
if (this.BorderColor.Alpha0To255 > 0)
|
||||
{
|
||||
RectangleDouble borderRectangle = LocalBounds;
|
||||
|
||||
if (BorderWidth > 0)
|
||||
{
|
||||
if (BorderWidth == 1)
|
||||
{
|
||||
graphics2D.Rectangle(borderRectangle, this.BorderColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics2D.Render(
|
||||
new Stroke(
|
||||
new RoundedRect(borderRectangle, this.borderRadius),
|
||||
BorderWidth),
|
||||
this.BorderColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.OnDraw(graphics2D);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterConnectButton : GuiWidget
|
||||
{
|
||||
private readonly string disconnectAndCancelTitle = "Disconnect and stop the current print?".Localize();
|
||||
private readonly string disconnectAndCancelMessage = "WARNING: Disconnecting will stop the current print.\n\nAre you sure you want to disconnect?".Localize();
|
||||
|
||||
private GuiWidget connectButton;
|
||||
private Button disconnectButton;
|
||||
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
public PrinterConnectButton(TextImageButtonFactory buttonFactory)
|
||||
{
|
||||
this.HAnchor = HAnchor.ParentLeft | HAnchor.FitToChildren;
|
||||
this.VAnchor = VAnchor.FitToChildren;
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
if (false)
|
||||
{
|
||||
// Create the image button with the normal and disabled ImageBuffers
|
||||
connectPrinterButton = buttonFactory.Generate("Connect".Localize().ToUpper(), normalImage);
|
||||
connectPrinterButton.Name = "Connect to printer button";
|
||||
connectPrinterButton.ToolTipText = "Connect to the currently selected printer".Localize();
|
||||
connectPrinterButton.Margin = new BorderDouble(0, 0, 3, 3);
|
||||
|
||||
connectPrinterButton.VAnchor = VAnchor.ParentTop;
|
||||
connectPrinterButton.Cursor = Cursors.Hand;
|
||||
connectPrinterButton.Click += (s, e) =>
|
||||
connectButton = new SimpleButton("Connect".Localize().ToUpper(), StaticData.Instance.LoadIcon("connect.png", 16, 16))
|
||||
{
|
||||
Button buttonClicked = ((Button)s);
|
||||
if (buttonClicked.Enabled)
|
||||
{
|
||||
if (ActiveSliceSettings.Instance.PrinterSelected)
|
||||
{
|
||||
UserRequestedConnectToActivePrinter();
|
||||
}
|
||||
}
|
||||
Name = "Connect to printer button",
|
||||
ToolTipText = "Connect to the currently selected printer".Localize(),
|
||||
ImageMargin = 6,
|
||||
Margin = 6,
|
||||
MinimumSize = new VectorMath.Vector2(100, 0)
|
||||
};
|
||||
|
||||
disconnectPrinterButton = buttonFactory.Generate("Disconnect".Localize().ToUpper(), StaticData.Instance.LoadIcon("connect.png", 32, 32));
|
||||
disconnectPrinterButton.Name = "Disconnect from printer button";
|
||||
disconnectPrinterButton.ToolTipText = "Disconnect from current printer".Localize();
|
||||
disconnectPrinterButton.Margin = new BorderDouble(6, 0, 3, 3);
|
||||
disconnectPrinterButton.VAnchor = VAnchor.ParentTop;
|
||||
disconnectPrinterButton.Cursor = Cursors.Hand;
|
||||
disconnectPrinterButton.Click += (s, e) => UiThread.RunOnIdle(OnIdleDisconnect);
|
||||
|
||||
this.AddChild(connectPrinterButton);
|
||||
this.AddChild(disconnectPrinterButton);
|
||||
}
|
||||
|
||||
// printer selector and edit button
|
||||
else
|
||||
{
|
||||
GuiWidget container = new GuiWidget()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
VAnchor = VAnchor.FitToChildren,
|
||||
};
|
||||
|
||||
FlowLayoutWidget printerSelectorAndEditButton = new FlowLayoutWidget()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
};
|
||||
|
||||
printerSelector = new PrinterSelector()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
Cursor = Cursors.Hand,
|
||||
Margin = new BorderDouble(0, 6, 0, 3)
|
||||
};
|
||||
printerSelector.AddPrinter += (s, e) => WizardWindow.ShowPrinterSetup(true);
|
||||
// make sure the control can get smaller but maintains its height
|
||||
printerSelector.MinimumSize = new Vector2(0, connectPrinterButton.MinimumSize.y);
|
||||
printerSelectorAndEditButton.AddChild(printerSelector);
|
||||
|
||||
editPrinterButton = TextImageButtonFactory.GetThemedEditButton();
|
||||
editPrinterButton.Name = "Edit Printer Button";
|
||||
editPrinterButton.VAnchor = VAnchor.ParentCenter;
|
||||
editPrinterButton.Click += UiNavigation.OpenEditPrinterWizard_Click;
|
||||
printerSelectorAndEditButton.AddChild(editPrinterButton);
|
||||
|
||||
container.AddChild(printerSelectorAndEditButton);
|
||||
printerSelectorAndEditOverlay = new GuiWidget()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
VAnchor = VAnchor.ParentBottomTop,
|
||||
Selectable = false,
|
||||
};
|
||||
container.AddChild(printerSelectorAndEditOverlay);
|
||||
|
||||
this.AddChild(container);
|
||||
connectButton = buttonFactory.Generate("Connect".Localize().ToUpper(), StaticData.Instance.LoadIcon("connect.png", 16, 16));
|
||||
}
|
||||
|
||||
// reset connection button
|
||||
connectButton.Click += (s, e) =>
|
||||
{
|
||||
string resetConnectionText = "Reset\nConnection".Localize().ToUpper();
|
||||
Button resetConnectionButton = buttonFactory.Generate(resetConnectionText, "e_stop4.png");
|
||||
resetConnectionButton.Margin = new BorderDouble(6, 0, 3, 3);
|
||||
this.AddChild(resetConnectionButton);
|
||||
|
||||
resetConnectionButton.Click += (s, e) =>
|
||||
if (connectButton.Enabled)
|
||||
{
|
||||
UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.RebootBoard);
|
||||
};
|
||||
resetConnectionButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.show_reset_connection);
|
||||
|
||||
ActiveSliceSettings.SettingChanged.RegisterEvent((sender, e) =>
|
||||
{
|
||||
StringEventArgs stringEvent = e as StringEventArgs;
|
||||
if (stringEvent != null)
|
||||
if (ActiveSliceSettings.Instance.PrinterSelected)
|
||||
{
|
||||
if (stringEvent.Data == SettingsKey.show_reset_connection)
|
||||
{
|
||||
resetConnectionButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.show_reset_connection);
|
||||
}
|
||||
UserRequestedConnectToActivePrinter();
|
||||
}
|
||||
}, ref unregisterEvents);
|
||||
}
|
||||
};
|
||||
this.AddChild(connectButton);
|
||||
|
||||
disconnectButton = buttonFactory.Generate("Disconnect".Localize().ToUpper(), StaticData.Instance.LoadIcon("connect.png", 16, 16));
|
||||
disconnectButton.Name = "Disconnect from printer button";
|
||||
disconnectButton.Visible = false;
|
||||
disconnectButton.ToolTipText = "Disconnect from current printer".Localize();
|
||||
disconnectButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
{
|
||||
StyledMessageBox.ShowMessageBox(
|
||||
(bool disconnectCancel) =>
|
||||
{
|
||||
if (disconnectCancel)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Stop(false);
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
}
|
||||
},
|
||||
disconnectAndCancelMessage,
|
||||
disconnectAndCancelTitle,
|
||||
StyledMessageBox.MessageType.YES_NO,
|
||||
"Disconnect".Localize(),
|
||||
"Stay Connected".Localize());
|
||||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
}
|
||||
});
|
||||
//this.AddChild(disconnectButton);
|
||||
|
||||
foreach (var child in Children)
|
||||
{
|
||||
child.VAnchor = VAnchor.ParentTop;
|
||||
child.HAnchor = HAnchor.ParentLeft;
|
||||
child.Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
// Bind connect button states to active printer state
|
||||
this.SetConnectionButtonVisibleState();
|
||||
this.SetVisibleStates(null, null);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
{
|
||||
unregisterEvents?.Invoke(this, null);
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
static public void UserRequestedConnectToActivePrinter()
|
||||
{
|
||||
if (staticUnregisterEvents != null)
|
||||
{
|
||||
staticUnregisterEvents(null, null);
|
||||
staticUnregisterEvents = null;
|
||||
}
|
||||
PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter(true);
|
||||
}
|
||||
|
||||
private void onConfirmStopPrint(bool messageBoxResponse)
|
||||
private void SetVisibleStates(object sender, EventArgs e)
|
||||
{
|
||||
if (messageBoxResponse)
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Stop(false);
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
printerSelector.Invalidate();
|
||||
}
|
||||
}
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
|
||||
{
|
||||
disconnectButton.Visible = true;
|
||||
connectButton.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
disconnectButton.Visible = false;
|
||||
connectButton.Visible = true;
|
||||
}
|
||||
|
||||
private void OnIdleDisconnect()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
{
|
||||
StyledMessageBox.ShowMessageBox(onConfirmStopPrint, disconnectAndCancelMessage, disconnectAndCancelTitle, StyledMessageBox.MessageType.YES_NO, "Disconnect".Localize(), "Stay Connected".Localize());
|
||||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
printerSelector.Invalidate();
|
||||
}
|
||||
}
|
||||
var communicationState = PrinterConnectionAndCommunication.Instance.CommunicationState;
|
||||
|
||||
private void onPrinterStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
UiThread.RunOnIdle(SetConnectionButtonVisibleState);
|
||||
}
|
||||
// Ensure connect buttons are locked while long running processes are executing to prevent duplicate calls into said actions
|
||||
connectButton.Enabled = ActiveSliceSettings.Instance.PrinterSelected
|
||||
&& communicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect;
|
||||
|
||||
private void SetConnectionButtonVisibleState()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
|
||||
{
|
||||
disconnectPrinterButton.Visible = true;
|
||||
connectPrinterButton.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
disconnectPrinterButton.Visible = false;
|
||||
connectPrinterButton.Visible = true;
|
||||
}
|
||||
|
||||
var communicationState = PrinterConnectionAndCommunication.Instance.CommunicationState;
|
||||
|
||||
// Ensure connect buttons are locked while long running processes are executing to prevent duplicate calls into said actions
|
||||
connectPrinterButton.Enabled = communicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect && ActiveSliceSettings.Instance.PrinterSelected;
|
||||
bool printerIsPrintigOrPause = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
|
||||
editPrinterButton.Enabled = ActiveSliceSettings.Instance.PrinterSelected && !printerIsPrintigOrPause;
|
||||
printerSelector.Enabled = !printerIsPrintigOrPause;
|
||||
if(printerIsPrintigOrPause)
|
||||
{
|
||||
printerSelectorAndEditOverlay.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150);
|
||||
}
|
||||
else
|
||||
{
|
||||
printerSelectorAndEditOverlay.BackgroundColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
}
|
||||
disconnectPrinterButton.Enabled = communicationState != PrinterConnectionAndCommunication.CommunicationStates.Disconnecting;
|
||||
disconnectButton.Enabled = communicationState != PrinterConnectionAndCommunication.CommunicationStates.Disconnecting;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -47,12 +47,14 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private GuiWidget sliceSettingsWidget;
|
||||
|
||||
private TabControl advancedTab;
|
||||
private TabControl tabControl;
|
||||
|
||||
public AdvancedControlsPanel()
|
||||
{
|
||||
advancedTab = CreateAdvancedControlsTab();
|
||||
AddChild(advancedTab);
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
tabControl = CreateTabControl();
|
||||
AddChild(tabControl);
|
||||
AnchorAll();
|
||||
|
||||
ApplicationController.Instance.AdvancedControlsPanelReloading.RegisterEvent((s, e) => UiThread.RunOnIdle(ReloadSliceSettings), ref unregisterEvents);
|
||||
|
|
@ -65,19 +67,19 @@ namespace MatterHackers.MatterControl
|
|||
public void ReloadSliceSettings()
|
||||
{
|
||||
WidescreenPanel.PreChangePanels.CallEvents(null, null);
|
||||
if (advancedTab.HasBeenClosed)
|
||||
if (tabControl.HasBeenClosed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PopOutManager.SaveIfClosed = false;
|
||||
// remove the advance control and replace it with new ones built for the selected printer
|
||||
int advancedControlsIndex = GetChildIndex(advancedTab);
|
||||
int advancedControlsIndex = GetChildIndex(tabControl);
|
||||
RemoveChild(advancedControlsIndex);
|
||||
advancedTab.Close();
|
||||
tabControl.Close();
|
||||
|
||||
advancedTab = CreateAdvancedControlsTab();
|
||||
AddChild(advancedTab, advancedControlsIndex);
|
||||
tabControl = CreateTabControl();
|
||||
AddChild(tabControl, advancedControlsIndex);
|
||||
PopOutManager.SaveIfClosed = true;
|
||||
}
|
||||
|
||||
|
|
@ -87,24 +89,17 @@ namespace MatterHackers.MatterControl
|
|||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
private TabControl CreateAdvancedControlsTab()
|
||||
private TabControl CreateTabControl()
|
||||
{
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
var advancedControls = new TabControl(separator: new HorizontalLine(alpha: 50));
|
||||
advancedControls.TabBar.BorderColor = RGBA_Bytes.Transparent; // ActiveTheme.Instance.SecondaryTextColor;
|
||||
advancedControls.TabBar.Margin = 0;
|
||||
advancedControls.TabBar.Padding = 0;
|
||||
|
||||
int textSize = 14;
|
||||
var newTabControl = ApplicationController.Instance.Theme.CreateTabControl();
|
||||
|
||||
RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;
|
||||
|
||||
var libraryTabPage = new TabPage(new PrintLibraryWidget(), "Library".Localize().ToUpper());
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(
|
||||
newTabControl.AddTab(new SimpleTextTabWidget(
|
||||
libraryTabPage,
|
||||
"Library Tab",
|
||||
textSize,
|
||||
newTabControl.TextPointSize,
|
||||
ActiveTheme.Instance.TabLabelSelected,
|
||||
new RGBA_Bytes(),
|
||||
unselectedTextColor,
|
||||
|
|
@ -123,16 +118,16 @@ namespace MatterHackers.MatterControl
|
|||
new TabPage(sliceSettingsWidget, "Settings".Localize().ToUpper()),
|
||||
SliceSettingsTabName,
|
||||
new Vector2(590, 400),
|
||||
textSize);
|
||||
newTabControl.TextPointSize);
|
||||
|
||||
var controlsPopOut = new PopOutTextTabWidget(
|
||||
new TabPage(new ManualPrinterControls(), "Controls".Localize().ToUpper()),
|
||||
ControlsTabName,
|
||||
new Vector2(400, 300),
|
||||
textSize);
|
||||
newTabControl.TextPointSize);
|
||||
|
||||
advancedControls.AddTab(sliceSettingPopOut);
|
||||
advancedControls.AddTab(controlsPopOut);
|
||||
newTabControl.AddTab(sliceSettingPopOut);
|
||||
newTabControl.AddTab(controlsPopOut);
|
||||
|
||||
#if !__ANDROID__
|
||||
if (!UserSettings.Instance.IsTouchScreen)
|
||||
|
|
@ -142,17 +137,17 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
#endif
|
||||
|
||||
advancedControls.AddTab(
|
||||
newTabControl.AddTab(
|
||||
new SimpleTextTabWidget(
|
||||
new TabPage(new PrinterConfigurationScrollWidget(), "Options".Localize().ToUpper()),
|
||||
"Options Tab",
|
||||
textSize,
|
||||
newTabControl.TextPointSize,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
// MatterControl historically started with the queue selected, force to 0 to remain consistent
|
||||
advancedControls.SelectedTabIndex = 0;
|
||||
newTabControl.SelectedTabIndex = 0;
|
||||
|
||||
return advancedControls;
|
||||
return newTabControl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -70,6 +70,10 @@ namespace MatterHackers.MatterControl
|
|||
public TextImageButtonFactory ImageButtonFactory { get; private set; }
|
||||
public TextImageButtonFactory ActionRowButtonFactory { get; private set; }
|
||||
public TextImageButtonFactory PrinterConnectButtonFactory { get; private set; }
|
||||
public TextImageButtonFactory BreadCrumbButtonFactory { get; internal set; }
|
||||
public TextImageButtonFactory BreadCrumbButtonFactorySmallMargins { get; internal set; }
|
||||
|
||||
public RGBA_Bytes TabBodyBackground => new RGBA_Bytes(ActiveTheme.Instance.TertiaryBackgroundColor, 160);
|
||||
|
||||
TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
|
||||
private EventHandler unregisterEvents;
|
||||
|
|
@ -82,17 +86,18 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public void RebuildTheme()
|
||||
{
|
||||
var theme = ActiveTheme.Instance;
|
||||
this.ImageButtonFactory = new TextImageButtonFactory()
|
||||
{
|
||||
normalFillColor = RGBA_Bytes.Transparent,
|
||||
normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
|
||||
normalTextColor = ActiveTheme.Instance.SecondaryTextColor,
|
||||
pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
|
||||
normalTextColor = theme.SecondaryTextColor,
|
||||
pressedTextColor = theme.PrimaryTextColor,
|
||||
hoverTextColor = theme.PrimaryTextColor,
|
||||
hoverBorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 200),
|
||||
disabledFillColor = RGBA_Bytes.Transparent,
|
||||
disabledBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100),
|
||||
disabledTextColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100),
|
||||
disabledBorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 100),
|
||||
disabledTextColor = new RGBA_Bytes(theme.PrimaryTextColor, 100),
|
||||
FixedHeight = fizedHeightA,
|
||||
fontSize = fontSizeA,
|
||||
borderWidth = borderWidth
|
||||
|
|
@ -114,18 +119,51 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.PrinterConnectButtonFactory = new TextImageButtonFactory()
|
||||
{
|
||||
normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
normalBorderColor = (ActiveTheme.Instance.IsDarkTheme) ? new RGBA_Bytes(77, 77, 77) : new RGBA_Bytes(190, 190, 190),
|
||||
hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
disabledTextColor = ActiveTheme.Instance.TabLabelUnselected,
|
||||
disabledFillColor = ActiveTheme.Instance.PrimaryBackgroundColor,
|
||||
disabledBorderColor = ActiveTheme.Instance.SecondaryBackgroundColor,
|
||||
hoverFillColor = ActiveTheme.Instance.PrimaryBackgroundColor,
|
||||
normalTextColor = theme.PrimaryTextColor,
|
||||
normalBorderColor = (theme.IsDarkTheme) ? new RGBA_Bytes(77, 77, 77) : new RGBA_Bytes(190, 190, 190),
|
||||
hoverTextColor = theme.PrimaryTextColor,
|
||||
pressedTextColor = theme.PrimaryTextColor,
|
||||
disabledTextColor = theme.TabLabelUnselected,
|
||||
disabledFillColor = theme.PrimaryBackgroundColor,
|
||||
disabledBorderColor = theme.SecondaryBackgroundColor,
|
||||
hoverFillColor = theme.PrimaryBackgroundColor,
|
||||
hoverBorderColor = new RGBA_Bytes(128, 128, 128),
|
||||
invertImageLocation = false,
|
||||
borderWidth = 1
|
||||
};
|
||||
|
||||
this.BreadCrumbButtonFactory = new TextImageButtonFactory()
|
||||
{
|
||||
normalTextColor = theme.PrimaryTextColor,
|
||||
hoverTextColor = theme.PrimaryTextColor,
|
||||
pressedTextColor = theme.PrimaryTextColor,
|
||||
disabledTextColor = theme.TertiaryBackgroundColor,
|
||||
Margin = new BorderDouble(16, 0),
|
||||
borderWidth = 0,
|
||||
FixedHeight = 32,
|
||||
};
|
||||
|
||||
this.BreadCrumbButtonFactorySmallMargins = new TextImageButtonFactory()
|
||||
{
|
||||
normalTextColor = theme.PrimaryTextColor,
|
||||
hoverTextColor = theme.PrimaryTextColor,
|
||||
pressedTextColor = theme.PrimaryTextColor,
|
||||
disabledTextColor = theme.TertiaryBackgroundColor,
|
||||
Margin = new BorderDouble(8, 0),
|
||||
borderWidth = 0,
|
||||
FixedHeight = 32,
|
||||
};
|
||||
}
|
||||
|
||||
internal TabControl CreateTabControl()
|
||||
{
|
||||
var advancedControls = new TabControl(separator: new HorizontalLine(alpha: 50));
|
||||
advancedControls.TabBar.BorderColor = RGBA_Bytes.Transparent; // theme.SecondaryTextColor;
|
||||
advancedControls.TabBar.Margin = 0;
|
||||
advancedControls.TabBar.Padding = 0;
|
||||
advancedControls.TextPointSize = 14;
|
||||
|
||||
return advancedControls;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -622,8 +660,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public RGBA_Bytes TabBodyBackground => new RGBA_Bytes(ActiveTheme.Instance.TertiaryBackgroundColor, 160);
|
||||
|
||||
public string CachePath(ILibraryItem libraryItem)
|
||||
{
|
||||
// TODO: Use content SHA
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace MatterHackers.MatterControl
|
|||
: base(true)
|
||||
{
|
||||
ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
|
||||
this.BackgroundColor = ApplicationController.Instance.TabBodyBackground;
|
||||
this.BackgroundColor = ApplicationController.Instance.Theme.TabBodyBackground;
|
||||
AnchorAll();
|
||||
AddChild(new PrinterConfigurationWidget());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,16 +39,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
public class FolderBreadCrumbWidget : FlowLayoutWidget
|
||||
{
|
||||
private ListView listView;
|
||||
private TextImageButtonFactory navigationButtonFactory = new TextImageButtonFactory()
|
||||
{
|
||||
normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
disabledTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
Margin = new BorderDouble(10, 0),
|
||||
borderWidth = 0,
|
||||
FixedHeight = 30
|
||||
};
|
||||
|
||||
public FolderBreadCrumbWidget(ListView listView)
|
||||
{
|
||||
|
|
@ -56,8 +46,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
this.Name = "FolderBreadCrumbWidget";
|
||||
UiThread.RunOnIdle(() => SetBreadCrumbs(listView.ActiveContainer));
|
||||
HAnchor = HAnchor.ParentLeftRight;
|
||||
|
||||
navigationButtonFactory.disabledFillColor = navigationButtonFactory.normalFillColor;
|
||||
}
|
||||
|
||||
public static IEnumerable<ILibraryContainer> ItemAndParents(ILibraryContainer item)
|
||||
|
|
@ -72,6 +60,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
public void SetBreadCrumbs(ILibraryContainer currentContainer)
|
||||
{
|
||||
var buttonFactory = ApplicationController.Instance.Theme.BreadCrumbButtonFactory;
|
||||
this.CloseAllChildren();
|
||||
|
||||
bool haveFilterRunning = !string.IsNullOrEmpty(currentContainer.KeywordFilter);
|
||||
|
|
@ -79,7 +68,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
var icon = LibraryProviderHelpers.LoadInvertIcon("FileDialog", "up_folder_20.png");
|
||||
//icon = LibraryProviderHelpers.ResizeImage(icon, 20, 20);
|
||||
|
||||
Button upbutton = navigationButtonFactory.Generate("", icon);
|
||||
Button upbutton = buttonFactory.Generate("", icon);
|
||||
upbutton.Name = "Library Up Button";
|
||||
upbutton.Margin = 0;
|
||||
upbutton.Click += (s, e) =>
|
||||
|
|
@ -106,7 +95,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
});
|
||||
}
|
||||
|
||||
Button gotoProviderButton = navigationButtonFactory.Generate(container.Name);
|
||||
Button gotoProviderButton = buttonFactory.Generate(container.Name);
|
||||
gotoProviderButton.Name = "Bread Crumb Button " + container.Name;
|
||||
gotoProviderButton.Margin = new BorderDouble(firstItem ? 0 : 3, 0, 3, 0);
|
||||
gotoProviderButton.Click += (s, e) =>
|
||||
|
|
@ -128,11 +117,11 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
Button searchResultsButton = null;
|
||||
if (UserSettings.Instance.IsTouchScreen)
|
||||
{
|
||||
searchResultsButton = navigationButtonFactory.Generate("Search Results".Localize(), "icon_search_32x32.png");
|
||||
searchResultsButton = buttonFactory.Generate("Search Results".Localize(), "icon_search_32x32.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
searchResultsButton = navigationButtonFactory.Generate("Search Results".Localize(), "icon_search_24x24.png");
|
||||
searchResultsButton = buttonFactory.Generate("Search Results".Localize(), "icon_search_24x24.png");
|
||||
}
|
||||
searchResultsButton.Name = "Bread Crumb Button " + "Search Results";
|
||||
searchResultsButton.Margin = new BorderDouble(3, 0);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
public PrintLibraryWidget()
|
||||
{
|
||||
this.Padding = new BorderDouble(3);
|
||||
this.BackgroundColor = ApplicationController.Instance.TabBodyBackground;
|
||||
this.BackgroundColor = ApplicationController.Instance.Theme.TabBodyBackground;
|
||||
this.AnchorAll();
|
||||
|
||||
textImageButtonFactory = new TextImageButtonFactory()
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ using MatterHackers.Localizations;
|
|||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
using System;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
|
|
@ -65,6 +66,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public GuiWidget PopupContent { get; set; }
|
||||
|
||||
public Func<GuiWidget> DynamicPopupContent { get; set; }
|
||||
|
||||
public bool AlignToRightEdge { get; set; }
|
||||
|
||||
public override void OnMouseDown(MouseEventArgs mouseEvent)
|
||||
|
|
@ -88,7 +91,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
overflowMenuActive = true;
|
||||
|
||||
this.PopupContent.ClearRemovedFlag();
|
||||
this.PopupContent?.ClearRemovedFlag();
|
||||
|
||||
if (this.DynamicPopupContent != null)
|
||||
{
|
||||
this.PopupContent = this.DynamicPopupContent();
|
||||
}
|
||||
|
||||
if (this.PopupContent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var popupWidget = new PopupWidget(this.PopupContent, this, Vector2.Zero, Direction.Down, 0, this.AlignToRightEdge)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,10 +98,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private void LoadPrintItem(PrintItemWrapper printItem)
|
||||
{
|
||||
tabControl = new TabControl();
|
||||
tabControl.TabBar.BorderColor = RGBA_Bytes.Transparent;
|
||||
|
||||
tabControl.TabBar.Padding = new BorderDouble(top: 6);
|
||||
var activeSettings = ActiveSliceSettings.Instance;
|
||||
tabControl = ApplicationController.Instance.Theme.CreateTabControl();
|
||||
|
||||
RGBA_Bytes selectedTabColor;
|
||||
if (!UserSettings.Instance.IsTouchScreen)
|
||||
|
|
@ -115,18 +113,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
selectedTabColor = ActiveTheme.Instance.SecondaryAccentColor;
|
||||
}
|
||||
|
||||
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.build_height);
|
||||
double buildHeight = activeSettings.GetValue<double>(SettingsKey.build_height);
|
||||
|
||||
// put in the 3D view
|
||||
partPreviewView = new View3DWidget(printItem,
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), buildHeight),
|
||||
ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center),
|
||||
ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape),
|
||||
new Vector3(activeSettings.GetValue<Vector2>(SettingsKey.bed_size), buildHeight),
|
||||
activeSettings.GetValue<Vector2>(SettingsKey.print_center),
|
||||
activeSettings.GetValue<BedShape>(SettingsKey.bed_shape),
|
||||
windowMode,
|
||||
autoRotate3DView,
|
||||
openMode);
|
||||
|
||||
TabPage partPreview3DView = new TabPage(partPreviewView, string.Format("3D {0} ", "View".Localize()).ToUpper());
|
||||
string tabTitle = !activeSettings.PrinterSelected ? "Printer".Localize() : activeSettings.GetValue(SettingsKey.printer_name);
|
||||
|
||||
TabPage partPreview3DView = new TabPage(partPreviewView, tabTitle.ToUpper());
|
||||
|
||||
// put in the gcode view
|
||||
ViewGcodeBasic.WindowMode gcodeWindowMode = ViewGcodeBasic.WindowMode.Embeded;
|
||||
|
|
@ -136,9 +136,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
viewGcodeBasic = new ViewGcodeBasic(
|
||||
new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), buildHeight),
|
||||
ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center),
|
||||
ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape), gcodeWindowMode);
|
||||
new Vector3(activeSettings.GetValue<Vector2>(SettingsKey.bed_size), buildHeight),
|
||||
activeSettings.GetValue<Vector2>(SettingsKey.print_center),
|
||||
activeSettings.GetValue<BedShape>(SettingsKey.bed_shape), gcodeWindowMode);
|
||||
|
||||
if (windowMode == View3DWidget.WindowMode.StandAlone)
|
||||
{
|
||||
|
|
@ -146,32 +146,53 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
viewGcodeBasic.Closed += (s, e) => Close();
|
||||
}
|
||||
|
||||
TabPage layerView = new TabPage(viewGcodeBasic, "Layer View".Localize().ToUpper());
|
||||
Tab printerTab;
|
||||
var layerView = new TabPage(viewGcodeBasic, "Layer View".Localize().ToUpper());
|
||||
|
||||
int tabPointSize = 16;
|
||||
// add the correct tabs based on whether we are stand alone or embedded
|
||||
Tab threeDViewTab;
|
||||
if (windowMode == View3DWidget.WindowMode.StandAlone || UserSettings.Instance.IsTouchScreen)
|
||||
// add the correct tabs based on whether we are stand alone or embedded
|
||||
if (windowMode == View3DWidget.WindowMode.StandAlone || UserSettings.Instance.IsTouchScreen)
|
||||
{
|
||||
threeDViewTab = new SimpleTextTabWidget(partPreview3DView, "3D View Tab", tabPointSize,
|
||||
selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
|
||||
tabControl.AddTab(threeDViewTab);
|
||||
layerViewTab = new SimpleTextTabWidget(layerView, "Layer View Tab", tabPointSize,
|
||||
selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
|
||||
tabControl.AddTab(layerViewTab);
|
||||
printerTab = new SimpleTextTabWidget(
|
||||
partPreview3DView,
|
||||
"3D View Tab",
|
||||
tabControl.TextPointSize,
|
||||
selectedTabColor,
|
||||
new RGBA_Bytes(),
|
||||
ActiveTheme.Instance.TabLabelUnselected,
|
||||
new RGBA_Bytes());
|
||||
|
||||
|
||||
layerViewTab = new SimpleTextTabWidget(
|
||||
layerView,
|
||||
"Layer View Tab",
|
||||
tabControl.TextPointSize,
|
||||
selectedTabColor,
|
||||
new RGBA_Bytes(),
|
||||
ActiveTheme.Instance.TabLabelUnselected,
|
||||
new RGBA_Bytes());
|
||||
}
|
||||
else
|
||||
{
|
||||
threeDViewTab = new PopOutTextTabWidget(partPreview3DView, "3D View Tab", new Vector2(590, 400), tabPointSize);
|
||||
tabControl.AddTab(threeDViewTab);
|
||||
layerViewTab = new PopOutTextTabWidget(layerView, "Layer View Tab", new Vector2(590, 400), tabPointSize);
|
||||
tabControl.AddTab(layerViewTab);
|
||||
printerTab = new PopOutTextTabWidget(
|
||||
partPreview3DView,
|
||||
"3D View Tab",
|
||||
new Vector2(590, 400),
|
||||
tabControl.TextPointSize);
|
||||
|
||||
layerViewTab = new PopOutTextTabWidget(
|
||||
layerView,
|
||||
"Layer View Tab",
|
||||
new Vector2(590, 400),
|
||||
tabControl.TextPointSize);
|
||||
}
|
||||
|
||||
threeDViewTab.ToolTipText = "Preview 3D Design".Localize();
|
||||
layerViewTab.ToolTipText = "Preview layer Tool Paths".Localize();
|
||||
printerTab.ToolTipText = "Preview 3D Design".Localize();
|
||||
layerViewTab.ToolTipText = "Preview layer Tool Paths".Localize();
|
||||
|
||||
this.AddChild(tabControl);
|
||||
tabControl.AddTab(printerTab);
|
||||
tabControl.AddTab(layerViewTab);
|
||||
|
||||
this.AddChild(tabControl);
|
||||
}
|
||||
|
||||
public override void OnLoad(EventArgs args)
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ using MatterHackers.Agg;
|
|||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.ActionBar;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.EeProm;
|
||||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
|
||||
public partial class View3DWidget : PartPreview3DWidget
|
||||
{
|
||||
public class PrinterActionsBar : FlowLayoutWidget
|
||||
|
|
@ -48,12 +48,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public PrinterActionsBar()
|
||||
{
|
||||
this.Padding = new BorderDouble(0, 0, 10, 0);
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
this.Padding = new BorderDouble(0, 5);
|
||||
this.HAnchor = HAnchor.ParentLeftRight;
|
||||
this.VAnchor = VAnchor.FitToChildren;
|
||||
|
||||
var buttonFactory = ApplicationController.Instance.Theme.PrinterConnectButtonFactory;
|
||||
var buttonFactory = ApplicationController.Instance.Theme.BreadCrumbButtonFactory;
|
||||
|
||||
this.AddChild(new PrinterConnectButton(buttonFactory));
|
||||
//this.AddChild(new ResetButton(buttonFactory));
|
||||
|
||||
//ImageBuffer terminalSettingsImage = StaticData.Instance.LoadIcon("terminal-24x24.png", 24, 24).InvertLightness();
|
||||
var terminalButton = buttonFactory.Generate("Terminal".Localize().ToUpper());
|
||||
|
|
@ -67,13 +69,32 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
levelingImage.InvertLightness();
|
||||
}*/
|
||||
|
||||
Button configureEePromButton = buttonFactory.Generate("EEProm".Localize().ToUpper());
|
||||
configureEePromButton.Click += configureEePromButton_Click;
|
||||
this.AddChild(configureEePromButton);
|
||||
|
||||
this.AddChild(new PrinterConnectAndSelectControl());
|
||||
//this.AddChild(new PrintStatusRow());
|
||||
|
||||
this.AddChild(new PrintStatusRow());
|
||||
this.AddChild(new HorizontalSpacer());
|
||||
|
||||
var overflowDropdown = new OverflowDropdown(allowLightnessInvert: true)
|
||||
{
|
||||
AlignToRightEdge = true,
|
||||
DynamicPopupContent = GeneratePopupContent
|
||||
};
|
||||
this.AddChild(overflowDropdown);
|
||||
}
|
||||
|
||||
private GuiWidget GeneratePopupContent()
|
||||
{
|
||||
var widgetToPop = new FlowLayoutWidget();
|
||||
|
||||
widgetToPop.AddChild(new PrinterSelectEditDropdown());
|
||||
|
||||
//widgetToPop.AddChild("more stuff...");
|
||||
|
||||
return widgetToPop;
|
||||
}
|
||||
|
||||
private void configureEePromButton_Click(object sender, EventArgs mouseEvent)
|
||||
|
|
|
|||
|
|
@ -249,6 +249,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.printItemWrapper = printItemWrapper;
|
||||
this.Name = "View3DWidget";
|
||||
|
||||
this.BackgroundColor = ApplicationController.Instance.Theme.TabBodyBackground;
|
||||
|
||||
FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
|
||||
mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
|
||||
|
|
@ -257,7 +259,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
centerPartPreviewAndControls.Name = "centerPartPreviewAndControls";
|
||||
centerPartPreviewAndControls.AnchorAll();
|
||||
|
||||
var textImageButtonFactory = ApplicationController.Instance.Theme.ImageButtonFactory;
|
||||
var textImageButtonFactory = ApplicationController.Instance.Theme.BreadCrumbButtonFactorySmallMargins;
|
||||
|
||||
mainContainerTopToBottom.AddChild(new PrinterActionsBar());
|
||||
|
||||
|
|
@ -1579,6 +1581,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
return true;
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
DynamicDropDownMenu menu = CreateMenu(direction);
|
||||
|
||||
for (int index = 1; index < buttonList.Count; index++)
|
||||
{
|
||||
menu.addItem(buttonList[index].Item1, buttonList[index].Item2);
|
||||
}
|
||||
|
||||
SplitButton splitButton = new SplitButton(button, menu);
|
||||
*/
|
||||
|
||||
SplitButtonFactory splitButtonFactory = new SplitButtonFactory();
|
||||
splitButtonFactory.FixedHeight = 40 * GuiWidget.DeviceScale;
|
||||
|
||||
|
|
|
|||
|
|
@ -203,9 +203,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public GuiWidget ShowOverflowMenu()
|
||||
{
|
||||
var topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
var popupContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
|
||||
topToBottom.AddChild(
|
||||
popupContainer.AddChild(
|
||||
AddCheckbox(
|
||||
"Show Print Bed".Localize(),
|
||||
"Show Help Checkbox",
|
||||
|
|
@ -223,7 +223,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
double buildHeight = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.build_height);
|
||||
if (buildHeight > 0)
|
||||
{
|
||||
topToBottom.AddChild(
|
||||
popupContainer.AddChild(
|
||||
AddCheckbox(
|
||||
"Show Print Area".Localize(),
|
||||
"Show Help Checkbox",
|
||||
|
|
@ -245,12 +245,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Margin = new BorderDouble(5, 5, 5, 0)
|
||||
};
|
||||
|
||||
topToBottom.AddChild(new HorizontalLine());
|
||||
popupContainer.AddChild(new HorizontalLine());
|
||||
CreateRenderTypeRadioButtons(widget);
|
||||
|
||||
topToBottom.AddChild(widget);
|
||||
popupContainer.AddChild(widget);
|
||||
|
||||
return topToBottom;
|
||||
return popupContainer;
|
||||
}
|
||||
|
||||
private void CreateRenderTypeRadioButtons(GuiWidget parentContainer)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public ManualPrinterControls()
|
||||
{
|
||||
this.BackgroundColor = ApplicationController.Instance.TabBodyBackground;
|
||||
this.BackgroundColor = ApplicationController.Instance.Theme.TabBodyBackground;
|
||||
AnchorAll();
|
||||
if (UserSettings.Instance.IsTouchScreen)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public SliceSettingsWidget(List<PrinterSettingsLayer> layerCascade = null, NamedSettingsLayers viewFilter = NamedSettingsLayers.All)
|
||||
{
|
||||
this.BackgroundColor = ApplicationController.Instance.TabBodyBackground;
|
||||
this.BackgroundColor = ApplicationController.Instance.Theme.TabBodyBackground;
|
||||
|
||||
this.layerCascade = layerCascade;
|
||||
this.viewFilter = viewFilter;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 13a3198ab50b5b316a03cddc7252703913b0f936
|
||||
Subproject commit 2f9dae6bfe229b4870b36b8d163374237cb99a64
|
||||
Loading…
Add table
Add a link
Reference in a new issue