improving layout
This commit is contained in:
parent
624ac2db7b
commit
daa407bf83
4 changed files with 35 additions and 25 deletions
|
|
@ -1060,13 +1060,13 @@ namespace MatterHackers.MatterControl
|
|||
},
|
||||
taskActions: new RunningTaskOptions()
|
||||
{
|
||||
PauseAction = (action) => UiThread.RunOnIdle(() =>
|
||||
PauseAction = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
paused = true;
|
||||
printerConnection.TimeHaveBeenHoldingTemperature.Stop();
|
||||
}),
|
||||
PauseToolTip = "Pause automatic heater shutdown".Localize(),
|
||||
ResumeAction = (action) => UiThread.RunOnIdle(() =>
|
||||
ResumeAction = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
paused = false;
|
||||
printerConnection.TimeHaveBeenHoldingTemperature.Start();
|
||||
|
|
@ -1973,7 +1973,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
ExpansionSerializationKey = $"{nameof(MonitorPrintTask)}_expanded",
|
||||
RichProgressWidget = () => PrinterTabPage.PrintProgressWidget(printer, this.Theme),
|
||||
PauseAction = (action) => UiThread.RunOnIdle(() =>
|
||||
PauseAction = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
printer.Connection.RequestPause();
|
||||
}),
|
||||
|
|
@ -1983,7 +1983,7 @@ namespace MatterHackers.MatterControl
|
|||
},
|
||||
PauseToolTip = "Pause Print".Localize(),
|
||||
PauseText = "Pause".Localize(),
|
||||
ResumeAction = (action) => UiThread.RunOnIdle(() =>
|
||||
ResumeAction = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
printer.Connection.Resume();
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -102,9 +102,9 @@ namespace MatterHackers.MatterControl
|
|||
/// </summary>
|
||||
public Func<bool> IsPaused { get; set; }
|
||||
|
||||
public Action<Action> PauseAction { get; set; }
|
||||
public Action PauseAction { get; set; }
|
||||
|
||||
public Action<Action> ResumeAction { get; set; }
|
||||
public Action ResumeAction { get; set; }
|
||||
|
||||
public Action<Action> StopAction { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -245,21 +245,22 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
public override void OnDrawBackground(Graphics2D graphics2D)
|
||||
{
|
||||
var bounds = this.LocalBounds;
|
||||
var rect = new RoundedRect(bounds.Left, bounds.Bottom, bounds.Right, bounds.Top, RoundRadius);
|
||||
|
||||
if (BackgroundColor.Alpha0To255 > 0)
|
||||
{
|
||||
var bounds = this.LocalBounds;
|
||||
var rect = new RoundedRect(bounds.Left, bounds.Bottom, bounds.Right, bounds.Top, RoundRadius);
|
||||
graphics2D.Render(rect, BackgroundColor);
|
||||
}
|
||||
|
||||
if (RenderOutline)
|
||||
{
|
||||
var stroke = 1 * GuiWidget.DeviceScale;
|
||||
var expand = stroke / 2;
|
||||
rect = new RoundedRect(bounds.Left + expand, bounds.Bottom + expand, bounds.Right - expand, bounds.Top - expand, RoundRadius);
|
||||
var rectOutline = new Stroke(rect, stroke);
|
||||
if (BorderColor.Alpha0To255 > 0 && RenderOutline)
|
||||
{
|
||||
var stroke = 1 * GuiWidget.DeviceScale;
|
||||
var expand = stroke / 2;
|
||||
rect = new RoundedRect(bounds.Left + expand, bounds.Bottom + expand, bounds.Right - expand, bounds.Top - expand, RoundRadius);
|
||||
var rectOutline = new Stroke(rect, stroke);
|
||||
|
||||
graphics2D.Render(rectOutline, BorderColor);
|
||||
}
|
||||
graphics2D.Render(rectOutline, BorderColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
taskDetails.Options?.PauseAction,
|
||||
taskDetails.Options?.PauseToolTip ?? "Pause".Localize(),
|
||||
"",
|
||||
theme);
|
||||
theme,
|
||||
0);
|
||||
|
||||
if (taskDetails.Options?.IsPaused != null)
|
||||
{
|
||||
|
|
@ -133,7 +134,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
pauseButton.Click += (s, e) =>
|
||||
{
|
||||
taskDetails.Options?.PauseAction(null);
|
||||
taskDetails.Options?.PauseAction();
|
||||
pauseButton.Visible = false;
|
||||
resumeButton.Visible = true;
|
||||
};
|
||||
|
|
@ -145,13 +146,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
taskDetails.Options?.ResumeAction,
|
||||
taskDetails.Options?.ResumeToolTip ?? "Resume".Localize(),
|
||||
"",
|
||||
theme);
|
||||
theme,
|
||||
0);
|
||||
// start with it hidden
|
||||
resumeButton.Visible = false;
|
||||
|
||||
resumeButton.Click += (s, e) =>
|
||||
{
|
||||
taskDetails.Options?.ResumeAction(null);
|
||||
taskDetails.Options?.ResumeAction();
|
||||
pauseButton.Visible = true;
|
||||
resumeButton.Visible = false;
|
||||
};
|
||||
|
|
@ -162,7 +164,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
taskDetails.Options?.StopAction,
|
||||
taskDetails.Options?.StopToolTip ?? "Cancel".Localize(),
|
||||
"Stop Task Button",
|
||||
theme);
|
||||
theme,
|
||||
5);
|
||||
|
||||
stopButton.Click += (s, e) =>
|
||||
{
|
||||
|
|
@ -210,7 +213,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
taskDetails.ProgressChanged += TaskDetails_ProgressChanged;
|
||||
}
|
||||
|
||||
private static GuiWidget CreateIconOrTextButton(string iconFilename, string buttonText, Action<Action> clickAction, string toolTip, string name, ThemeConfig theme)
|
||||
private static GuiWidget CreateIconOrTextButton(string iconFilename,
|
||||
string buttonText,
|
||||
Object clickAction,
|
||||
string toolTip,
|
||||
string name,
|
||||
ThemeConfig theme,
|
||||
double marginX)
|
||||
{
|
||||
if (string.IsNullOrEmpty(buttonText))
|
||||
{
|
||||
|
|
@ -228,13 +237,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
theme.DefaultFontSize = 8;
|
||||
var pauseButton = new TextIconButton(buttonText, StaticData.Instance.LoadIcon(iconFilename, 12, 12, theme.InvertIcons), theme)
|
||||
{
|
||||
Margin = new BorderDouble(5, 0),
|
||||
Margin = new BorderDouble(marginX, 0),
|
||||
Padding = new BorderDouble(7, 3),
|
||||
VAnchor = VAnchor.Fit | VAnchor.Center,
|
||||
HAnchor = HAnchor.Fit,
|
||||
BackgroundColor = new Color(theme.AccentMimimalOverlay, 50),
|
||||
// BackgroundColor = new Color(theme.AccentMimimalOverlay, 50),
|
||||
HoverColor = theme.AccentMimimalOverlay,
|
||||
BorderColor = theme.PrimaryAccentColor,
|
||||
BorderColor = theme.TextColor,
|
||||
RenderOutline = true,
|
||||
|
||||
// Margin = theme.ButtonSpacing,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue