Took out the help text widget and the message action row (replaced by tool tips)
This commit is contained in:
parent
90414866a2
commit
abe8bbd2b8
11 changed files with 15 additions and 282 deletions
|
|
@ -52,22 +52,4 @@ namespace MatterHackers.MatterControl
|
|||
base.OnClosed(e);
|
||||
}
|
||||
}
|
||||
|
||||
internal class MessageActionRow : ActionRowBase
|
||||
{
|
||||
protected override void AddChildElements()
|
||||
{
|
||||
if (HelpTextWidget.Instance.Parent != null)
|
||||
{
|
||||
HelpTextWidget.Instance.Parent.RemoveChild(HelpTextWidget.Instance);
|
||||
}
|
||||
|
||||
this.AddChild(HelpTextWidget.Instance);
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
this.Margin = new BorderDouble(0, 3, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
using MatterHackers.VectorMath;
|
||||
using System;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class HelpTextWidget : TextWidget
|
||||
{
|
||||
private string defaultHelpMessage = "";
|
||||
private string hoverHelpMessage = "";
|
||||
|
||||
public bool showHoverText = false;
|
||||
|
||||
private static HelpTextWidget globalInstance;
|
||||
|
||||
public static HelpTextWidget Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (globalInstance == null)
|
||||
{
|
||||
globalInstance = new HelpTextWidget("");
|
||||
}
|
||||
return globalInstance;
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowHoverText(string message)
|
||||
{
|
||||
if (this.Text != message)
|
||||
{
|
||||
hoverHelpMessage = message;
|
||||
if (!showHoverText)
|
||||
{
|
||||
showHoverText = true;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void HideHoverText()
|
||||
{
|
||||
showHoverText = false;
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public HelpTextWidget(string initialText)
|
||||
: base(initialText, pointSize: 10, ellipsisIfClipped: true)
|
||||
{
|
||||
this.HAnchor = HAnchor.ParentLeftRight;
|
||||
this.VAnchor = VAnchor.ParentCenter;
|
||||
this.Margin = new BorderDouble(0);
|
||||
this.TextColor = RGBA_Bytes.White;
|
||||
this.MinimumSize = new Vector2(LocalBounds.Width, LocalBounds.Height);
|
||||
AddHandlers();
|
||||
setHelpMessageFromStatus();
|
||||
}
|
||||
|
||||
private void SetDefaultMessage(string message)
|
||||
{
|
||||
if (message != this.defaultHelpMessage)
|
||||
{
|
||||
this.defaultHelpMessage = message;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private event EventHandler unregisterEvents;
|
||||
|
||||
private void AddHandlers()
|
||||
{
|
||||
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
unregisterEvents(this, null);
|
||||
}
|
||||
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
private void onPrinterStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
setHelpMessageFromStatus();
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
if (this.showHoverText == true && this.Text != hoverHelpMessage)
|
||||
{
|
||||
this.Text = hoverHelpMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.Text != defaultHelpMessage)
|
||||
{
|
||||
this.Text = defaultHelpMessage;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnDraw(graphics2D);
|
||||
}
|
||||
|
||||
private void setHelpMessageFromStatus()
|
||||
{
|
||||
string newMessage = getHelpMessageFromStatus();
|
||||
SetDefaultMessage(newMessage);
|
||||
}
|
||||
|
||||
private string getHelpMessageFromStatus()
|
||||
{
|
||||
return "";
|
||||
//if (ActivePrinterProfile.Instance.ActivePrinter == null)
|
||||
//{
|
||||
// return LocalizedString.Get("Press 'Connect' to choose a printer.");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// switch (PrinterCommunication.Instance.CommunicationState)
|
||||
// {
|
||||
// case PrinterCommunication.CommunicationStates.Disconnected:
|
||||
// return LocalizedString.Get("Not connected. Press 'Connect' to enable printing.");
|
||||
// case PrinterCommunication.CommunicationStates.AttemptingToConnect:
|
||||
// string attemptToConnect = LocalizedString.Get ("Attempting to Connect");
|
||||
// string attemptToConnectFull = string.Format ("{0}...", attemptToConnect);
|
||||
// return attemptToConnectFull;
|
||||
// case PrinterCommunication.CommunicationStates.ConnectionLost:
|
||||
// case PrinterCommunication.CommunicationStates.FailedToConnect:
|
||||
// return LocalizedString.Get("Unable to communicate with printer.");
|
||||
// case PrinterCommunication.CommunicationStates.Connected:
|
||||
// if (PrinterCommunication.Instance.ActivePrintItem != null)
|
||||
// {
|
||||
// return LocalizedString.Get("Press 'Start' to begin your print.");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return LocalizedString.Get("No items to select. Press 'Add' to select a file to print.");
|
||||
// }
|
||||
// default:
|
||||
// return "";
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -224,8 +224,6 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
container.AddChild(activePrintStatus);
|
||||
//container.AddChild(activePrintInfo);
|
||||
container.AddChild(printActionRow);
|
||||
container.AddChild(new VerticalSpacer());
|
||||
container.AddChild(new MessageActionRow());
|
||||
|
||||
return container;
|
||||
}
|
||||
|
|
@ -239,8 +237,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
Button autoLevelButton = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath);
|
||||
autoLevelButton.Cursor = Cursors.Hand;
|
||||
autoLevelButton.Margin = new Agg.BorderDouble(top: 3);
|
||||
autoLevelButton.MouseEnterBounds += (sender, mouseEvent) => { HelpTextWidget.Instance.ShowHoverText("Print leveling is enabled."); };
|
||||
autoLevelButton.MouseLeaveBounds += (sender, mouseEvent) => { HelpTextWidget.Instance.HideHoverText(); };
|
||||
autoLevelButton.ToolTipText = "Print leveling is enabled.".Localize();
|
||||
autoLevelButton.Visible = ActivePrinterProfile.Instance.DoPrintLeveling;
|
||||
|
||||
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent((sender, e) =>
|
||||
|
|
|
|||
|
|
@ -41,21 +41,14 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
: base("150.3°")
|
||||
{
|
||||
temperatureTypeName.Text = "Print Bed";
|
||||
AddHandlers();
|
||||
setToCurrentTemperature();
|
||||
ToolTipText = "Current bed temperature".Localize();
|
||||
preheatButton.ToolTipText = "Preheat the Bed".Localize();
|
||||
PrinterConnectionAndCommunication.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
|
||||
}
|
||||
|
||||
private event EventHandler unregisterEvents;
|
||||
|
||||
private void AddHandlers()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
|
||||
this.MouseEnterBounds += onMouseEnterBounds;
|
||||
this.MouseLeaveBounds += onMouseLeaveBounds;
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
|
|
@ -65,16 +58,6 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
private void onMouseEnterBounds(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.ShowHoverText(LocalizedString.Get("Bed Temperature"));
|
||||
}
|
||||
|
||||
private void onMouseLeaveBounds(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.HideHoverText();
|
||||
}
|
||||
|
||||
private void setToCurrentTemperature()
|
||||
{
|
||||
string tempDirectionIndicator = "";
|
||||
|
|
|
|||
|
|
@ -42,22 +42,16 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
: base("150.3°")
|
||||
{
|
||||
temperatureTypeName.Text = "Extruder";
|
||||
AddHandlers();
|
||||
setToCurrentTemperature();
|
||||
|
||||
ToolTipText = "Current extruder temperature".Localize();
|
||||
preheatButton.ToolTipText = "Preheat the Extruder".Localize();
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
|
||||
}
|
||||
|
||||
private event EventHandler unregisterEvents;
|
||||
|
||||
private void AddHandlers()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
|
||||
this.MouseEnterBounds += onMouseEnterBounds;
|
||||
this.MouseLeaveBounds += onMouseLeaveBounds;
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
|
|
@ -67,16 +61,6 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
private void onMouseEnterBounds(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.ShowHoverText(LocalizedString.Get("Extruder Temperature"));
|
||||
}
|
||||
|
||||
private void onMouseLeaveBounds(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.HideHoverText();
|
||||
}
|
||||
|
||||
private void setToCurrentTemperature()
|
||||
{
|
||||
string tempDirectionIndicator = "";
|
||||
|
|
|
|||
|
|
@ -90,8 +90,6 @@ namespace MatterHackers.MatterControl
|
|||
advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom;
|
||||
advancedControlsLinkButton.Cursor = Cursors.Hand;
|
||||
advancedControlsLinkButton.Click += new EventHandler(AdvancedControlsButton_Click);
|
||||
advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsAdvancedControlsLink);
|
||||
advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsAdvancedControlsLink);
|
||||
|
||||
GuiWidget hSpacer = new GuiWidget();
|
||||
hSpacer.HAnchor = HAnchor.ParentLeftRight;
|
||||
|
|
@ -107,7 +105,7 @@ namespace MatterHackers.MatterControl
|
|||
// do the right panel
|
||||
{
|
||||
this.RightPanel.AddChild(new PrintProgressBar());
|
||||
ThirdPanelTabView thirdPanelTabView = new ThirdPanelTabView(AdvancedControlsButton_Click, onMouseEnterBoundsPrintQueueLink, onMouseLeaveBoundsPrintQueueLink);
|
||||
ThirdPanelTabView thirdPanelTabView = new ThirdPanelTabView(AdvancedControlsButton_Click);
|
||||
thirdPanelTabView.Name = "For - CompactSlidePanel";
|
||||
this.RightPanel.AddChild(thirdPanelTabView);
|
||||
}
|
||||
|
|
@ -134,26 +132,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
private void onMouseEnterBoundsAdvancedControlsLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.ShowHoverText(LocalizedString.Get("View Manual Printer Controls and Slicing Settings"));
|
||||
}
|
||||
|
||||
private void onMouseLeaveBoundsAdvancedControlsLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.HideHoverText();
|
||||
}
|
||||
|
||||
private void onMouseEnterBoundsPrintQueueLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.ShowHoverText(LocalizedString.Get("View Queue and Library"));
|
||||
}
|
||||
|
||||
private void onMouseLeaveBoundsPrintQueueLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.HideHoverText();
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
|
|
|
|||
|
|
@ -43,20 +43,14 @@ namespace MatterHackers.MatterControl
|
|||
private Button advancedControlsBackButton;
|
||||
private SliceSettingsWidget sliceSettingsWidget;
|
||||
private EventHandler AdvancedControlsButton_Click;
|
||||
private EventHandler onMouseEnterBoundsPrintQueueLink;
|
||||
private EventHandler onMouseLeaveBoundsPrintQueueLink;
|
||||
|
||||
private TabControl advancedControls2;
|
||||
|
||||
public ThirdPanelTabView(EventHandler AdvancedControlsButton_Click = null,
|
||||
EventHandler onMouseEnterBoundsPrintQueueLink = null,
|
||||
EventHandler onMouseLeaveBoundsPrintQueueLink = null)
|
||||
public ThirdPanelTabView(EventHandler AdvancedControlsButton_Click = null)
|
||||
{
|
||||
this.AdvancedControlsButton_Click = AdvancedControlsButton_Click;
|
||||
this.onMouseEnterBoundsPrintQueueLink = onMouseEnterBoundsPrintQueueLink;
|
||||
this.onMouseLeaveBoundsPrintQueueLink = onMouseLeaveBoundsPrintQueueLink;
|
||||
|
||||
advancedControls2 = CreateNewAdvancedControls(AdvancedControlsButton_Click, onMouseEnterBoundsPrintQueueLink, onMouseLeaveBoundsPrintQueueLink);
|
||||
advancedControls2 = CreateNewAdvancedControls(AdvancedControlsButton_Click);
|
||||
|
||||
AddChild(advancedControls2);
|
||||
|
||||
|
|
@ -81,7 +75,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private static readonly string ThirdPanelTabView_AdvancedControls_CurrentTab = "ThirdPanelTabView_AdvancedControls_CurrentTab";
|
||||
|
||||
private TabControl CreateNewAdvancedControls(EventHandler AdvancedControlsButton_Click, EventHandler onMouseEnterBoundsPrintQueueLink, EventHandler onMouseLeaveBoundsPrintQueueLink)
|
||||
private TabControl CreateNewAdvancedControls(EventHandler AdvancedControlsButton_Click)
|
||||
{
|
||||
TabControl advancedControls = new TabControl();
|
||||
|
||||
|
|
@ -105,8 +99,6 @@ namespace MatterHackers.MatterControl
|
|||
advancedControlsBackButton.VAnchor = VAnchor.ParentBottom;
|
||||
advancedControlsBackButton.Cursor = Cursors.Hand;
|
||||
advancedControlsBackButton.Click += new EventHandler(AdvancedControlsButton_Click);
|
||||
advancedControlsBackButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsPrintQueueLink);
|
||||
advancedControlsBackButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsPrintQueueLink);
|
||||
|
||||
advancedControls.TabBar.AddChild(advancedControlsBackButton);
|
||||
}
|
||||
|
|
@ -183,13 +175,9 @@ namespace MatterHackers.MatterControl
|
|||
if (advancedControlsBackButton != null)
|
||||
{
|
||||
advancedControlsBackButton.Click -= new EventHandler(AdvancedControlsButton_Click);
|
||||
advancedControlsBackButton.MouseEnterBounds -= new EventHandler(onMouseEnterBoundsPrintQueueLink);
|
||||
advancedControlsBackButton.MouseLeaveBounds -= new EventHandler(onMouseLeaveBoundsPrintQueueLink);
|
||||
}
|
||||
|
||||
advancedControls2 = CreateNewAdvancedControls(AdvancedControlsButton_Click,
|
||||
onMouseEnterBoundsPrintQueueLink,
|
||||
onMouseLeaveBoundsPrintQueueLink);
|
||||
advancedControls2 = CreateNewAdvancedControls(AdvancedControlsButton_Click);
|
||||
AddChild(advancedControls2, advancedControlsIndex);
|
||||
|
||||
// This is a hack to make the panel remain on the screen. It would be great to debug it and understand
|
||||
|
|
|
|||
|
|
@ -94,26 +94,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
private void onMouseEnterBoundsAdvancedControlsLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.ShowHoverText("View Manual Printer Controls and Slicing Settings");
|
||||
}
|
||||
|
||||
private void onMouseLeaveBoundsAdvancedControlsLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.HideHoverText();
|
||||
}
|
||||
|
||||
private void onMouseEnterBoundsPrintQueueLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.ShowHoverText("View Queue and Library");
|
||||
}
|
||||
|
||||
private void onMouseLeaveBoundsPrintQueueLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.HideHoverText();
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
|
|
|
|||
|
|
@ -184,8 +184,6 @@ namespace MatterHackers.MatterControl
|
|||
buttonViewWidget.Height = this.FixedHeight;
|
||||
textImageButton.Height = this.FixedHeight;
|
||||
|
||||
textImageButton.MouseEnterBounds += new EventHandler(onEnterTooltipButton);
|
||||
textImageButton.MouseLeaveBounds += new EventHandler(onExitTooltipButton);
|
||||
return textImageButton;
|
||||
}
|
||||
|
||||
|
|
@ -238,17 +236,6 @@ namespace MatterHackers.MatterControl
|
|||
return groupLableAndEditControl;
|
||||
}
|
||||
|
||||
private void onEnterTooltipButton(object sender, EventArgs e)
|
||||
{
|
||||
Button button = sender as Button;
|
||||
HelpTextWidget.Instance.ShowHoverText(button.ToolTipText);
|
||||
}
|
||||
|
||||
private void onExitTooltipButton(object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.HideHoverText();
|
||||
}
|
||||
|
||||
public CheckBox GenerateCheckBoxButton(string label, string normalImageName = null, string normalToPressedImageName = null, string pressedImageName = null, string pressedToNormalImageName = null, string pressedLabel = null)
|
||||
{
|
||||
CheckBoxViewStates checkBoxButtonViewWidget = getCheckBoxButtonView(label, normalImageName, normalToPressedImageName, pressedImageName, pressedToNormalImageName, pressedLabel);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,6 @@
|
|||
<Compile Include="ActionBar\ActionBarBaseControls.cs" />
|
||||
<Compile Include="ActionBar\ActionBarPlus.cs" />
|
||||
<Compile Include="ActionBar\TemperatureWidgetBed.cs" />
|
||||
<Compile Include="ActionBar\HelpTextWidget.cs" />
|
||||
<Compile Include="ActionBar\PrintActionRow.cs" />
|
||||
<Compile Include="ActionBar\PrinterActionRow.cs" />
|
||||
<Compile Include="ActionBar\PrintStatusRow.cs" />
|
||||
|
|
|
|||
|
|
@ -3673,3 +3673,9 @@ Translated:Zoom (Ctrl + L. Mouse)
|
|||
English:Enter Multi Select mode
|
||||
Translated:Enter Multi Select mode
|
||||
|
||||
English:Print leveling is enabled.
|
||||
Translated:Print leveling is enabled.
|
||||
|
||||
English:Edit notification settings
|
||||
Translated:Edit notification settings
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue