2014-01-29 19:09:30 -08:00
|
|
|
|
/*
|
2014-02-15 18:06:03 -08:00
|
|
|
|
Copyright (c) 2014, Lars Brubaker
|
2014-01-29 19:09:30 -08:00
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
2015-04-08 15:20:10 -07:00
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
2014-01-29 19:09:30 -08:00
|
|
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright notice, this
|
2015-04-08 15:20:10 -07:00
|
|
|
|
list of conditions and the following disclaimer.
|
2014-01-29 19:09:30 -08:00
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
2015-04-08 15:20:10 -07:00
|
|
|
|
and/or other materials provided with the distribution.
|
2014-01-29 19:09:30 -08:00
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
The views and conclusions contained in the software and documentation are those
|
2015-04-08 15:20:10 -07:00
|
|
|
|
of the authors and should not be interpreted as representing official policies,
|
2014-01-29 19:09:30 -08:00
|
|
|
|
either expressed or implied, of the FreeBSD Project.
|
|
|
|
|
|
*/
|
2014-11-06 15:19:38 -08:00
|
|
|
|
|
2017-08-26 15:51:12 +03:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Diagnostics;
|
2020-10-19 16:24:58 -07:00
|
|
|
|
using System.Linq;
|
2019-03-25 14:23:45 -07:00
|
|
|
|
using MatterControl.Printing;
|
2014-01-29 19:09:30 -08:00
|
|
|
|
using MatterHackers.Agg;
|
2017-08-20 02:34:39 -07:00
|
|
|
|
using MatterHackers.Agg.Platform;
|
2017-08-26 15:51:12 +03:00
|
|
|
|
using MatterHackers.Agg.UI;
|
2014-01-29 19:09:30 -08:00
|
|
|
|
using MatterHackers.Localizations;
|
2014-08-26 12:06:16 -07:00
|
|
|
|
using MatterHackers.MatterControl.CustomWidgets;
|
2019-03-25 14:23:45 -07:00
|
|
|
|
using MatterHackers.MatterControl.PartPreviewWindow;
|
2014-01-29 19:09:30 -08:00
|
|
|
|
|
|
|
|
|
|
namespace MatterHackers.MatterControl
|
2014-11-06 15:19:38 -08:00
|
|
|
|
{
|
2018-09-07 14:49:26 -07:00
|
|
|
|
public class TerminalWidget : FlowLayoutWidget, ICloseableTab
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
|
|
|
|
|
private CheckBox autoUppercase;
|
2022-07-15 17:28:39 -07:00
|
|
|
|
private ThemedTextEditWidget manualCommandTextEdit;
|
2015-04-08 15:20:10 -07:00
|
|
|
|
private TextScrollWidget textScrollWidget;
|
2017-09-17 13:30:05 -07:00
|
|
|
|
private PrinterConfig printer;
|
2019-03-25 14:23:45 -07:00
|
|
|
|
|
|
|
|
|
|
private List<string> commandHistory = new List<string>();
|
|
|
|
|
|
private int commandHistoryIndex = 0;
|
2017-09-03 11:48:08 -07:00
|
|
|
|
|
2018-07-12 09:22:28 -07:00
|
|
|
|
public TerminalWidget(PrinterConfig printer, ThemeConfig theme)
|
2017-08-26 19:19:35 +03:00
|
|
|
|
: base(FlowDirection.TopToBottom)
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
2017-09-17 13:30:05 -07:00
|
|
|
|
this.printer = printer;
|
2015-08-07 11:38:58 -07:00
|
|
|
|
this.Name = "TerminalWidget";
|
2015-04-08 15:20:10 -07:00
|
|
|
|
this.Padding = new BorderDouble(5, 0);
|
|
|
|
|
|
|
2017-08-26 19:43:46 +03:00
|
|
|
|
// Header
|
|
|
|
|
|
var headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight)
|
|
|
|
|
|
{
|
|
|
|
|
|
HAnchor = HAnchor.Left | HAnchor.Stretch,
|
2017-08-27 00:23:10 +03:00
|
|
|
|
Padding = new BorderDouble(0, 8)
|
2017-08-26 19:43:46 +03:00
|
|
|
|
};
|
|
|
|
|
|
this.AddChild(headerRow);
|
2017-08-26 19:19:35 +03:00
|
|
|
|
|
2019-03-29 22:09:35 -07:00
|
|
|
|
headerRow.AddChild(CreateVisibilityOptions(theme));
|
2017-08-26 18:27:24 +03:00
|
|
|
|
|
2018-01-12 14:05:04 -08:00
|
|
|
|
autoUppercase = new CheckBox("Auto Uppercase".Localize(), textSize: theme.DefaultFontSize)
|
2017-08-26 19:19:35 +03:00
|
|
|
|
{
|
2017-08-27 00:23:10 +03:00
|
|
|
|
Margin = new BorderDouble(left: 25),
|
2017-08-27 01:08:29 +03:00
|
|
|
|
Checked = UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalAutoUppercase, true),
|
2018-11-03 09:13:07 -07:00
|
|
|
|
TextColor = theme.TextColor,
|
2019-03-25 14:23:45 -07:00
|
|
|
|
VAnchor = VAnchor.Center
|
2017-08-26 19:19:35 +03:00
|
|
|
|
};
|
2017-08-26 19:49:44 +03:00
|
|
|
|
autoUppercase.CheckedStateChanged += (s, e) =>
|
2017-08-26 19:19:35 +03:00
|
|
|
|
{
|
2017-08-27 01:08:29 +03:00
|
|
|
|
UserSettings.Instance.Fields.SetBool(UserSettingsKey.TerminalAutoUppercase, autoUppercase.Checked);
|
2017-08-26 19:19:35 +03:00
|
|
|
|
};
|
2017-08-26 19:43:46 +03:00
|
|
|
|
headerRow.AddChild(autoUppercase);
|
2015-04-08 15:20:10 -07:00
|
|
|
|
|
2017-08-26 19:43:46 +03:00
|
|
|
|
// Body
|
2018-10-21 20:15:45 -07:00
|
|
|
|
var bodyRow = new FlowLayoutWidget()
|
|
|
|
|
|
{
|
|
|
|
|
|
Margin = new BorderDouble(bottom: 4),
|
|
|
|
|
|
HAnchor = HAnchor.Stretch,
|
|
|
|
|
|
VAnchor = VAnchor.Stretch
|
|
|
|
|
|
};
|
2017-08-26 19:43:46 +03:00
|
|
|
|
this.AddChild(bodyRow);
|
2017-08-26 15:51:12 +03:00
|
|
|
|
|
2020-10-06 07:50:47 -07:00
|
|
|
|
textScrollWidget = new TextScrollWidget(printer, printer.Connection.TerminalLog)
|
2017-08-26 19:19:35 +03:00
|
|
|
|
{
|
2018-10-13 17:58:54 -07:00
|
|
|
|
BackgroundColor = theme.MinimalShade,
|
2018-11-03 09:13:07 -07:00
|
|
|
|
TextColor = theme.TextColor,
|
2017-08-26 19:19:35 +03:00
|
|
|
|
HAnchor = HAnchor.Stretch,
|
|
|
|
|
|
VAnchor = VAnchor.Stretch,
|
2017-08-27 00:23:10 +03:00
|
|
|
|
Margin = 0,
|
2017-08-26 19:19:35 +03:00
|
|
|
|
Padding = new BorderDouble(3, 0)
|
|
|
|
|
|
};
|
2017-08-26 19:43:46 +03:00
|
|
|
|
bodyRow.AddChild(textScrollWidget);
|
2018-10-21 20:15:45 -07:00
|
|
|
|
bodyRow.AddChild(new TextScrollBar(textScrollWidget, 15)
|
|
|
|
|
|
{
|
|
|
|
|
|
ThumbColor = theme.AccentMimimalOverlay,
|
|
|
|
|
|
BackgroundColor = theme.SlightShade,
|
|
|
|
|
|
Margin = 0
|
|
|
|
|
|
});
|
2017-08-26 19:19:35 +03:00
|
|
|
|
|
2019-03-25 14:23:45 -07:00
|
|
|
|
textScrollWidget.LineFilterFunction = lineData =>
|
|
|
|
|
|
{
|
2019-04-02 16:40:11 -07:00
|
|
|
|
var line = lineData.Line;
|
|
|
|
|
|
var output = lineData.Direction == TerminalLine.MessageDirection.ToPrinter;
|
2019-03-25 14:23:45 -07:00
|
|
|
|
var outputLine = line;
|
|
|
|
|
|
|
2019-03-25 17:55:52 -07:00
|
|
|
|
var lineWithoutChecksum = GCodeFile.GetLineWithoutChecksum(line);
|
|
|
|
|
|
|
|
|
|
|
|
// and set this as the output if desired
|
2019-03-29 22:09:35 -07:00
|
|
|
|
if (output
|
|
|
|
|
|
&& !UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowChecksum, true))
|
2019-03-25 14:23:45 -07:00
|
|
|
|
{
|
2019-03-25 17:55:52 -07:00
|
|
|
|
outputLine = lineWithoutChecksum;
|
2019-03-25 14:23:45 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-03-29 22:09:35 -07:00
|
|
|
|
if (!output
|
|
|
|
|
|
&& lineWithoutChecksum == "ok"
|
2019-03-25 14:23:45 -07:00
|
|
|
|
&& !UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowOks, true))
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2019-03-29 22:09:35 -07:00
|
|
|
|
else if (output
|
|
|
|
|
|
&& lineWithoutChecksum.StartsWith("M105")
|
2019-03-25 14:23:45 -07:00
|
|
|
|
&& !UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowTempRequests, true))
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2019-03-29 22:09:35 -07:00
|
|
|
|
else if (output
|
|
|
|
|
|
&& (lineWithoutChecksum.StartsWith("G0 ") || lineWithoutChecksum.StartsWith("G1 "))
|
2019-03-25 14:23:45 -07:00
|
|
|
|
&& !UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowMovementRequests, true))
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2019-03-29 22:09:35 -07:00
|
|
|
|
else if (!output
|
|
|
|
|
|
&& (lineWithoutChecksum.StartsWith("T") || lineWithoutChecksum.StartsWith("ok T"))
|
2019-03-25 14:23:45 -07:00
|
|
|
|
&& !UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowTempResponse, true))
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2019-03-29 22:09:35 -07:00
|
|
|
|
else if (!output
|
|
|
|
|
|
&& lineWithoutChecksum == "wait"
|
|
|
|
|
|
&& !UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowWaitResponse, false))
|
2019-03-25 14:23:45 -07:00
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowInputOutputMarks, true))
|
|
|
|
|
|
{
|
2019-04-03 11:21:17 -07:00
|
|
|
|
switch (lineData.Direction)
|
2019-03-25 14:23:45 -07:00
|
|
|
|
{
|
2019-04-03 11:21:17 -07:00
|
|
|
|
case TerminalLine.MessageDirection.FromPrinter:
|
|
|
|
|
|
outputLine = "→ " + outputLine;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case TerminalLine.MessageDirection.ToPrinter:
|
|
|
|
|
|
outputLine = "← " + outputLine;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case TerminalLine.MessageDirection.ToTerminal:
|
|
|
|
|
|
outputLine = "* " + outputLine;
|
|
|
|
|
|
break;
|
2019-03-25 14:23:45 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return outputLine;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2017-08-26 19:43:46 +03:00
|
|
|
|
// Input Row
|
|
|
|
|
|
var inputRow = new FlowLayoutWidget(FlowDirection.LeftToRight)
|
2017-08-26 19:19:35 +03:00
|
|
|
|
{
|
|
|
|
|
|
BackgroundColor = this.BackgroundColor,
|
2017-08-26 20:18:23 +03:00
|
|
|
|
HAnchor = HAnchor.Stretch,
|
|
|
|
|
|
Margin = new BorderDouble(bottom: 2)
|
2017-08-26 19:19:35 +03:00
|
|
|
|
};
|
2017-08-26 19:43:46 +03:00
|
|
|
|
this.AddChild(inputRow);
|
2017-08-26 19:19:35 +03:00
|
|
|
|
|
2023-12-03 19:00:41 -08:00
|
|
|
|
manualCommandTextEdit = new ThemedTextEditWidget("", theme, typeFace: ApplicationController.Instance.GetTypeFace("Liberation_Mono"))
|
2017-08-26 19:19:35 +03:00
|
|
|
|
{
|
|
|
|
|
|
Margin = new BorderDouble(right: 3),
|
|
|
|
|
|
HAnchor = HAnchor.Stretch,
|
|
|
|
|
|
VAnchor = VAnchor.Bottom
|
|
|
|
|
|
};
|
|
|
|
|
|
manualCommandTextEdit.ActualTextEditWidget.EnterPressed += (s, e) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
SendManualCommand();
|
|
|
|
|
|
};
|
2017-08-26 19:55:55 +03:00
|
|
|
|
manualCommandTextEdit.ActualTextEditWidget.KeyDown += (s, keyEvent) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
bool changeToHistory = false;
|
|
|
|
|
|
if (keyEvent.KeyCode == Keys.Up)
|
|
|
|
|
|
{
|
|
|
|
|
|
commandHistoryIndex--;
|
|
|
|
|
|
if (commandHistoryIndex < 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
commandHistoryIndex = 0;
|
|
|
|
|
|
}
|
2020-10-19 16:24:58 -07:00
|
|
|
|
|
2017-08-26 19:55:55 +03:00
|
|
|
|
changeToHistory = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (keyEvent.KeyCode == Keys.Down)
|
|
|
|
|
|
{
|
|
|
|
|
|
commandHistoryIndex++;
|
|
|
|
|
|
if (commandHistoryIndex > commandHistory.Count - 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
commandHistoryIndex = commandHistory.Count - 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
changeToHistory = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (keyEvent.KeyCode == Keys.Escape)
|
|
|
|
|
|
{
|
|
|
|
|
|
manualCommandTextEdit.Text = "";
|
|
|
|
|
|
}
|
2015-04-08 15:20:10 -07:00
|
|
|
|
|
2017-08-26 19:55:55 +03:00
|
|
|
|
if (changeToHistory && commandHistory.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
manualCommandTextEdit.Text = commandHistory[commandHistoryIndex];
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2017-08-26 19:43:46 +03:00
|
|
|
|
inputRow.AddChild(manualCommandTextEdit);
|
2017-08-26 19:19:35 +03:00
|
|
|
|
|
2017-08-26 19:43:46 +03:00
|
|
|
|
// Footer
|
2017-08-27 00:57:54 +03:00
|
|
|
|
var toolbarPadding = theme.ToolbarPadding;
|
2017-08-26 19:43:46 +03:00
|
|
|
|
var footerRow = new FlowLayoutWidget
|
2017-08-26 19:19:35 +03:00
|
|
|
|
{
|
|
|
|
|
|
HAnchor = HAnchor.Stretch,
|
2017-08-26 20:18:23 +03:00
|
|
|
|
Padding = new BorderDouble(0, toolbarPadding.Bottom, toolbarPadding.Right, toolbarPadding.Top)
|
2017-08-26 19:19:35 +03:00
|
|
|
|
};
|
2017-08-26 19:43:46 +03:00
|
|
|
|
this.AddChild(footerRow);
|
|
|
|
|
|
|
2018-06-25 09:28:36 -07:00
|
|
|
|
var sendButton = theme.CreateDialogButton("Send".Localize());
|
2018-10-21 20:15:45 -07:00
|
|
|
|
sendButton.Margin = theme.ButtonSpacing;
|
2017-08-26 19:48:25 +03:00
|
|
|
|
sendButton.Click += (s, e) =>
|
2017-08-26 19:43:46 +03:00
|
|
|
|
{
|
|
|
|
|
|
SendManualCommand();
|
|
|
|
|
|
};
|
2017-08-26 19:48:25 +03:00
|
|
|
|
footerRow.AddChild(sendButton);
|
2017-08-26 19:19:35 +03:00
|
|
|
|
|
2018-06-25 09:28:36 -07:00
|
|
|
|
var clearButton = theme.CreateDialogButton("Clear".Localize());
|
2017-08-26 19:48:25 +03:00
|
|
|
|
clearButton.Margin = theme.ButtonSpacing;
|
2017-08-26 19:49:44 +03:00
|
|
|
|
clearButton.Click += (s, e) =>
|
2017-08-26 19:19:35 +03:00
|
|
|
|
{
|
2017-09-17 13:30:05 -07:00
|
|
|
|
printer.Connection.TerminalLog.Clear();
|
2017-08-26 19:19:35 +03:00
|
|
|
|
};
|
2020-10-27 13:05:13 -07:00
|
|
|
|
|
2017-08-26 19:48:25 +03:00
|
|
|
|
footerRow.AddChild(clearButton);
|
2017-08-26 19:19:35 +03:00
|
|
|
|
|
2018-06-25 09:28:36 -07:00
|
|
|
|
var exportButton = theme.CreateDialogButton("Export".Localize());
|
2017-08-26 19:48:25 +03:00
|
|
|
|
exportButton.Margin = theme.ButtonSpacing;
|
2017-08-26 19:49:44 +03:00
|
|
|
|
exportButton.Click += (s, e) =>
|
2017-08-26 19:19:35 +03:00
|
|
|
|
{
|
2021-03-01 10:57:27 -08:00
|
|
|
|
UiThread.RunOnIdle(() => TerminalLog.Export(printer.Connection));
|
2017-08-26 19:19:35 +03:00
|
|
|
|
};
|
2017-08-26 19:48:25 +03:00
|
|
|
|
footerRow.AddChild(exportButton);
|
2015-04-08 15:20:10 -07:00
|
|
|
|
|
2017-08-26 19:43:46 +03:00
|
|
|
|
footerRow.AddChild(new HorizontalSpacer());
|
2015-04-08 15:20:10 -07:00
|
|
|
|
|
|
|
|
|
|
this.AnchorAll();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-03-29 22:09:35 -07:00
|
|
|
|
private GuiWidget CreateVisibilityOptions(ThemeConfig theme)
|
2016-07-24 17:26:24 -07:00
|
|
|
|
{
|
2019-03-29 22:09:35 -07:00
|
|
|
|
var visibilityOptionsButton = new PopupMenuButton("Visibility Options", theme)
|
2019-03-25 14:23:45 -07:00
|
|
|
|
{
|
|
|
|
|
|
VAnchor = VAnchor.Center
|
|
|
|
|
|
};
|
2015-04-08 15:20:10 -07:00
|
|
|
|
|
2019-03-25 14:23:45 -07:00
|
|
|
|
var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme);
|
2015-05-28 11:03:45 -07:00
|
|
|
|
|
2019-03-29 22:09:35 -07:00
|
|
|
|
visibilityOptionsButton.PopupContent = popupMenu;
|
2019-03-25 14:23:45 -07:00
|
|
|
|
|
|
|
|
|
|
// put in options for filtering various output
|
|
|
|
|
|
popupMenu.CreateBoolMenuItem(
|
2019-03-29 22:09:35 -07:00
|
|
|
|
"Line Checksums".Localize(),
|
2019-03-25 14:23:45 -07:00
|
|
|
|
() => UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowChecksum, true),
|
|
|
|
|
|
(isChecked) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
UserSettings.Instance.Fields.SetBool(UserSettingsKey.TerminalShowChecksum, isChecked);
|
|
|
|
|
|
textScrollWidget.RebuildFilteredList();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
popupMenu.CreateBoolMenuItem(
|
2019-03-29 22:09:35 -07:00
|
|
|
|
"In / Out Indicators".Localize(),
|
2019-03-25 14:23:45 -07:00
|
|
|
|
() => UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowInputOutputMarks, true),
|
|
|
|
|
|
(isChecked) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
UserSettings.Instance.Fields.SetBool(UserSettingsKey.TerminalShowInputOutputMarks, isChecked);
|
|
|
|
|
|
textScrollWidget.RebuildFilteredList();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2019-03-29 22:09:35 -07:00
|
|
|
|
// request section
|
|
|
|
|
|
popupMenu.CreateSeparator();
|
|
|
|
|
|
|
2019-03-25 14:23:45 -07:00
|
|
|
|
popupMenu.CreateBoolMenuItem(
|
2019-03-29 22:09:35 -07:00
|
|
|
|
"Temperature Requests".Localize(),
|
2019-03-25 14:23:45 -07:00
|
|
|
|
() => UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowTempRequests, true),
|
|
|
|
|
|
(isChecked) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
UserSettings.Instance.Fields.SetBool(UserSettingsKey.TerminalShowTempRequests, isChecked);
|
|
|
|
|
|
textScrollWidget.RebuildFilteredList();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
popupMenu.CreateBoolMenuItem(
|
2019-03-29 22:09:35 -07:00
|
|
|
|
"Movement Requests".Localize(),
|
2019-03-25 14:23:45 -07:00
|
|
|
|
() => UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowMovementRequests, true),
|
|
|
|
|
|
(isChecked) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
UserSettings.Instance.Fields.SetBool(UserSettingsKey.TerminalShowMovementRequests, isChecked);
|
|
|
|
|
|
textScrollWidget.RebuildFilteredList();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2019-03-29 22:09:35 -07:00
|
|
|
|
// response section
|
|
|
|
|
|
popupMenu.CreateSeparator();
|
|
|
|
|
|
|
2019-03-25 14:23:45 -07:00
|
|
|
|
popupMenu.CreateBoolMenuItem(
|
2019-03-29 22:09:35 -07:00
|
|
|
|
"Temperature Responses".Localize(),
|
2019-03-25 14:23:45 -07:00
|
|
|
|
() => UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowTempResponse, true),
|
|
|
|
|
|
(isChecked) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
UserSettings.Instance.Fields.SetBool(UserSettingsKey.TerminalShowTempResponse, isChecked);
|
|
|
|
|
|
textScrollWidget.RebuildFilteredList();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
popupMenu.CreateBoolMenuItem(
|
2019-03-29 22:09:35 -07:00
|
|
|
|
"'Ok' Responses".Localize(),
|
|
|
|
|
|
() => UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowOks, true),
|
|
|
|
|
|
(isChecked) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
UserSettings.Instance.Fields.SetBool(UserSettingsKey.TerminalShowOks, isChecked);
|
|
|
|
|
|
textScrollWidget.RebuildFilteredList();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
popupMenu.CreateBoolMenuItem(
|
|
|
|
|
|
"'Wait' Responses".Localize(),
|
|
|
|
|
|
() => UserSettings.Instance.Fields.GetBool(UserSettingsKey.TerminalShowWaitResponse, false),
|
2019-03-25 14:23:45 -07:00
|
|
|
|
(isChecked) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
UserSettings.Instance.Fields.SetBool(UserSettingsKey.TerminalShowWaitResponse, isChecked);
|
|
|
|
|
|
textScrollWidget.RebuildFilteredList();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2019-03-29 22:09:35 -07:00
|
|
|
|
return visibilityOptionsButton;
|
2019-03-25 14:23:45 -07:00
|
|
|
|
}
|
2015-04-08 15:20:10 -07:00
|
|
|
|
|
2017-08-26 18:27:24 +03:00
|
|
|
|
private void SendManualCommand()
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
|
|
|
|
|
string textToSend = manualCommandTextEdit.Text.Trim();
|
|
|
|
|
|
if (autoUppercase.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
textToSend = textToSend.ToUpper();
|
|
|
|
|
|
}
|
2020-10-19 16:24:58 -07:00
|
|
|
|
|
|
|
|
|
|
if (commandHistory.LastOrDefault() != textToSend)
|
|
|
|
|
|
{
|
|
|
|
|
|
commandHistory.Add(textToSend);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-04-08 15:20:10 -07:00
|
|
|
|
commandHistoryIndex = commandHistory.Count;
|
2020-10-19 16:24:58 -07:00
|
|
|
|
|
2018-01-04 17:30:48 -08:00
|
|
|
|
printer.Connection.QueueLine(textToSend);
|
2015-04-08 15:20:10 -07:00
|
|
|
|
manualCommandTextEdit.Text = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-03-25 14:23:45 -07:00
|
|
|
|
}
|