All buttons switch to agg themed buttons
This commit is contained in:
parent
02be841100
commit
3307e204ee
79 changed files with 218 additions and 881 deletions
|
|
@ -381,7 +381,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
// material can be changed even when the printer is not connected
|
||||
alwaysEnabled.Add(materialSettingsRow);
|
||||
// add in a shop button
|
||||
var shopButton = new TextIconButton("Shop".Localize(), StaticData.Instance.LoadIcon("cart.png", 16, 16).SetToColor(menuTheme.TextColor), theme)
|
||||
var shopButton = new ThemedTextIconButton("Shop".Localize(), StaticData.Instance.LoadIcon("cart.png", 16, 16).SetToColor(menuTheme.TextColor), theme)
|
||||
{
|
||||
BackgroundColor = theme.SlightShade,
|
||||
HoverColor = theme.SlightShade.WithAlpha(75),
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ namespace MatterHackers.MatterControl
|
|||
progressPanel.AddChild(
|
||||
new TextWidget(ex.Message, pointSize: theme.FontSize9, textColor: errorTextColor));
|
||||
|
||||
var closeButton = new TextButton("Close", theme)
|
||||
var closeButton = new ThemedTextButton("Close", theme)
|
||||
{
|
||||
BackgroundColor = theme.SlightShade,
|
||||
HAnchor = HAnchor.Right,
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
this.AddChild(row);
|
||||
|
||||
row.AddChild(new IconButton(StaticData.Instance.LoadIcon("mh-app-logo.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
row.AddChild(new ThemedIconButton(StaticData.Instance.LoadIcon("mh-app-logo.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing,
|
||||
|
|
|
|||
|
|
@ -90,11 +90,11 @@ namespace MatterHackers.MatterControl
|
|||
menuButton.HoverColor = hoverColor;
|
||||
break;
|
||||
|
||||
case SimpleFlowButton flowButton:
|
||||
case ThemedFlowButton flowButton:
|
||||
flowButton.HoverColor = hoverColor;
|
||||
break;
|
||||
|
||||
case SimpleButton button:
|
||||
case ThemedButton button:
|
||||
button.HoverColor = hoverColor;
|
||||
break;
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
foreach (var actionButton in namedActionButtons.Group)
|
||||
{
|
||||
var button = new TextButton(actionButton.Title, theme)
|
||||
var button = new ThemedTextButton(actionButton.Title, theme)
|
||||
{
|
||||
Border = new BorderDouble(1, 0, 0, 0),
|
||||
BorderColor = theme.MinimalShade,
|
||||
|
|
@ -227,9 +227,9 @@ namespace MatterHackers.MatterControl
|
|||
return popupMenu;
|
||||
}
|
||||
|
||||
public static RadioTextButton CreateMicroRadioButton(this ThemeConfig theme, string text, IList<GuiWidget> siblingRadioButtonList = null)
|
||||
public static ThemedRadioTextButton CreateMicroRadioButton(this ThemeConfig theme, string text, IList<GuiWidget> siblingRadioButtonList = null)
|
||||
{
|
||||
var radioButton = new RadioTextButton(text, theme, theme.FontSize8)
|
||||
var radioButton = new ThemedRadioTextButton(text, theme, theme.FontSize8)
|
||||
{
|
||||
SiblingRadioButtonList = siblingRadioButtonList,
|
||||
Padding = new BorderDouble(5, 0),
|
||||
|
|
@ -266,7 +266,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public static GuiWidget CreateSearchButton(this ThemeConfig theme)
|
||||
{
|
||||
return new IconButton(StaticData.Instance.LoadIcon("icon_search_24x24.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
return new ThemedIconButton(StaticData.Instance.LoadIcon("icon_search_24x24.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Search".Localize(),
|
||||
};
|
||||
|
|
@ -288,7 +288,7 @@ namespace MatterHackers.MatterControl
|
|||
GuiWidget innerButton;
|
||||
if (buttonParams.ButtonText == null)
|
||||
{
|
||||
innerButton = new IconButton(buttonParams.Icon, theme)
|
||||
innerButton = new ThemedIconButton(buttonParams.Icon, theme)
|
||||
{
|
||||
Name = buttonParams.ButtonName + " Inner SplitButton",
|
||||
Enabled = buttonParams.ButtonEnabled,
|
||||
|
|
@ -302,7 +302,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
if (buttonParams.Icon == null)
|
||||
{
|
||||
innerButton = new TextButton(buttonParams.ButtonText, theme)
|
||||
innerButton = new ThemedTextButton(buttonParams.ButtonText, theme)
|
||||
{
|
||||
Name = buttonParams.ButtonName,
|
||||
Enabled = buttonParams.ButtonEnabled,
|
||||
|
|
@ -311,7 +311,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else
|
||||
{
|
||||
innerButton = new TextIconButton(buttonParams.ButtonText, buttonParams.Icon, theme)
|
||||
innerButton = new ThemedTextIconButton(buttonParams.ButtonText, buttonParams.Icon, theme)
|
||||
{
|
||||
Name = buttonParams.ButtonName,
|
||||
Enabled = buttonParams.ButtonEnabled,
|
||||
|
|
@ -375,11 +375,11 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
switch (guiWidget)
|
||||
{
|
||||
case SimpleFlowButton flowButton:
|
||||
case ThemedFlowButton flowButton:
|
||||
flowButton.HoverColor = parentIsToolbar ? theme.ToolbarButtonHover : Color.Transparent;
|
||||
break;
|
||||
|
||||
case SimpleButton button:
|
||||
case ThemedButton button:
|
||||
button.HoverColor = parentIsToolbar ? theme.ToolbarButtonHover : Color.Transparent;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
if (printer.Connection.Paused)
|
||||
{
|
||||
var resumePrintingButton = new TextButton("Resume Printing".Localize(), theme)
|
||||
var resumePrintingButton = new ThemedTextButton("Resume Printing".Localize(), theme)
|
||||
{
|
||||
Name = "Resume Printing Button",
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
public DoneUnloadingPage(PrinterSetupWizard setupWizard, int extruderIndex)
|
||||
: base(setupWizard, "Filament Unloaded".Localize(), "Success!\n\nYour filament should now be unloaded".Localize())
|
||||
{
|
||||
var loadFilamentButton = new TextButton("Load Filament".Localize(), theme)
|
||||
var loadFilamentButton = new ThemedTextButton("Load Filament".Localize(), theme)
|
||||
{
|
||||
Name = "Load Filament",
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.ActionBar;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
|
|
@ -64,7 +65,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
NextButton.Visible = false;
|
||||
|
||||
var loadFilamentButton = new TextButton("Load Filament".Localize(), theme)
|
||||
var loadFilamentButton = new ThemedTextButton("Load Filament".Localize(), theme)
|
||||
{
|
||||
Name = "Load Filament",
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
@ -86,7 +87,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
NextButton.Visible = false;
|
||||
|
||||
var alreadyLoadedButton = new TextButton("Already Loaded".Localize(), theme)
|
||||
var alreadyLoadedButton = new ThemedTextButton("Already Loaded".Localize(), theme)
|
||||
{
|
||||
Name = "Already Loaded Button",
|
||||
BackgroundColor = theme.MinimalShade
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public void ShowWizardFinished(Action doneClicked = null)
|
||||
{
|
||||
var doneButton = new TextButton("Done".Localize(), theme)
|
||||
var doneButton = new ThemedTextButton("Done".Localize(), theme)
|
||||
{
|
||||
Name = "Done Button",
|
||||
BackgroundColor = theme.MinimalShade
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ namespace MatterHackers.MatterControl
|
|||
base.OnDraw(graphics2D);
|
||||
}
|
||||
|
||||
private class CalibrationPad : IconButton
|
||||
private class CalibrationPad : ThemedIconButton
|
||||
{
|
||||
public event EventHandler<PrinterConnection.Axis> Hovered;
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
string imageFile = this.ControlIsPinned ? "Pushpin.png" : "PushpinUnpin.png";
|
||||
|
||||
var pinTabButton = new IconButton(StaticData.Instance.LoadIcon(imageFile, 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var pinTabButton = new ThemedIconButton(StaticData.Instance.LoadIcon(imageFile, 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "Pin Settings Button",
|
||||
ToolTipText = this.ControlIsPinned ? "Unpin".Localize() : "Pin".Localize()
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
this.ActionArea.VAnchor = VAnchor.Stretch;
|
||||
this.ActionArea.MinimumSize = new Vector2(0, titleText.Height);
|
||||
|
||||
var editButton = new IconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var editButton = new ThemedIconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = editToolTipText ?? "Edit".Localize(),
|
||||
Name = helpArticle.Name + " Edit"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
public InlineListItemEdit(string title, ThemeConfig theme, string automationName, bool boldFont = false)
|
||||
: base(title, theme, automationName, boldFont)
|
||||
{
|
||||
var removeButton = new IconButton(StaticData.Instance.LoadIcon("remove.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var removeButton = new ThemedIconButton(StaticData.Instance.LoadIcon("remove.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Delete".Localize(),
|
||||
Visible = true,
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
this.ActionArea.VAnchor = VAnchor.Stretch;
|
||||
this.ActionArea.MinimumSize = new Vector2(0, titleText.Height);
|
||||
|
||||
saveButton = new IconButton(StaticData.Instance.LoadIcon("fa-save_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
saveButton = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-save_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Save".Localize(),
|
||||
Visible = false,
|
||||
|
|
@ -106,7 +106,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
var icon = editable ? StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor) : new ImageBuffer(16, 16);
|
||||
|
||||
editButton = new IconButton(icon, theme)
|
||||
editButton = new ThemedIconButton(icon, theme)
|
||||
{
|
||||
ToolTipText = "Edit".Localize(),
|
||||
Name = automationName + " Edit",
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
this.CloseChildren();
|
||||
|
||||
var backButton = new IconButton(StaticData.Instance.LoadIcon(Path.Combine("Library", "back.png"), 20, 20).SetToColor(theme.TextColor), theme)
|
||||
var backButton = new ThemedIconButton(StaticData.Instance.LoadIcon(Path.Combine("Library", "back.png"), 20, 20).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
VAnchor = VAnchor.Fit | VAnchor.Center,
|
||||
Enabled = currentContainer.Parent != null,
|
||||
|
|
|
|||
|
|
@ -1,665 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2019, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
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
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.ImageProcessing;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.CustomWidgets
|
||||
{
|
||||
public class SimpleButton : GuiWidget
|
||||
{
|
||||
protected ThemeConfig theme;
|
||||
|
||||
private bool hasKeyboardFocus;
|
||||
|
||||
public SimpleButton(ThemeConfig theme)
|
||||
{
|
||||
this.theme = theme;
|
||||
this.HoverColor = theme.SlightShade;
|
||||
this.MouseDownColor = theme.MinimalShade;
|
||||
this.Margin = 0;
|
||||
this.Cursor = Cursors.Hand;
|
||||
|
||||
this.TabStop = true;
|
||||
}
|
||||
|
||||
public Color HoverColor { get; set; } = Color.Transparent;
|
||||
|
||||
public Color MouseDownColor { get; set; } = Color.Transparent;
|
||||
|
||||
public override void OnMouseDown(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseDown(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnMouseUp(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseUp(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnClick(MouseEventArgs mouseEvent)
|
||||
{
|
||||
if (mouseEvent.Button == MouseButtons.Left)
|
||||
{
|
||||
base.OnClick(mouseEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKeyUp(KeyEventArgs keyEvent)
|
||||
{
|
||||
if (keyEvent.KeyCode == Keys.Enter
|
||||
|| keyEvent.KeyCode == Keys.Space)
|
||||
{
|
||||
UiThread.RunOnIdle(this.InvokeClick);
|
||||
}
|
||||
|
||||
base.OnKeyUp(keyEvent);
|
||||
}
|
||||
|
||||
public override void OnMouseEnterBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnMouseEnterBounds(mouseEvent);
|
||||
}
|
||||
|
||||
public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
Invalidate();
|
||||
base.OnMouseLeaveBounds(mouseEvent);
|
||||
}
|
||||
|
||||
public override Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
var firstWidgetUnderMouse = ContainsFirstUnderMouseRecursive();
|
||||
if (this.MouseCaptured
|
||||
&& firstWidgetUnderMouse
|
||||
&& this.Enabled)
|
||||
{
|
||||
return this.MouseDownColor;
|
||||
}
|
||||
else if (firstWidgetUnderMouse
|
||||
&& this.Enabled)
|
||||
{
|
||||
return this.HoverColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.BackgroundColor;
|
||||
}
|
||||
}
|
||||
set => base.BackgroundColor = value;
|
||||
}
|
||||
|
||||
public override void OnFocusChanged(EventArgs e)
|
||||
{
|
||||
hasKeyboardFocus = this.Focused && !ContainsFirstUnderMouseRecursive();
|
||||
this.Invalidate();
|
||||
|
||||
base.OnFocusChanged(e);
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
base.OnDraw(graphics2D);
|
||||
|
||||
if (this.TabStop
|
||||
&& hasKeyboardFocus)
|
||||
{
|
||||
var bounds = this.LocalBounds;
|
||||
var stroke = 1 * GuiWidget.DeviceScale;
|
||||
var expand = stroke / 2;
|
||||
var rect = new RoundedRect(bounds.Left + expand,
|
||||
bounds.Bottom + expand,
|
||||
bounds.Right - expand,
|
||||
bounds.Top - expand);
|
||||
rect.radius(BackgroundRadius.SW,
|
||||
BackgroundRadius.SE,
|
||||
BackgroundRadius.NE,
|
||||
BackgroundRadius.NW);
|
||||
|
||||
var rectOutline = new Stroke(rect, stroke);
|
||||
|
||||
graphics2D.Render(rectOutline, theme.EditFieldColors.Focused.BorderColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SimpleFlowButton : FlowLayoutWidget
|
||||
{
|
||||
private bool mouseInBounds = false;
|
||||
|
||||
protected ThemeConfig theme;
|
||||
|
||||
public SimpleFlowButton(ThemeConfig theme)
|
||||
{
|
||||
this.theme = theme;
|
||||
this.HoverColor = theme.SlightShade;
|
||||
this.MouseDownColor = theme.MinimalShade;
|
||||
this.Margin = 0;
|
||||
}
|
||||
|
||||
public Color HoverColor { get; set; } = Color.Transparent;
|
||||
|
||||
public Color MouseDownColor { get; set; } = Color.Transparent;
|
||||
|
||||
public override void OnMouseEnterBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
mouseInBounds = true;
|
||||
base.OnMouseEnterBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
mouseInBounds = false;
|
||||
base.OnMouseLeaveBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnMouseDown(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseDown(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnMouseUp(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseUp(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.MouseCaptured
|
||||
&& mouseInBounds
|
||||
&& this.Enabled)
|
||||
{
|
||||
return this.MouseDownColor;
|
||||
}
|
||||
else if (mouseInBounds
|
||||
&& this.Enabled)
|
||||
{
|
||||
return this.HoverColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.BackgroundColor;
|
||||
}
|
||||
}
|
||||
set => base.BackgroundColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public class IconButton : SimpleButton
|
||||
{
|
||||
protected ImageWidget imageWidget;
|
||||
|
||||
protected ImageBuffer image;
|
||||
|
||||
private IconButton(ThemeConfig theme)
|
||||
: base(theme)
|
||||
{
|
||||
}
|
||||
|
||||
public IconButton(ImageBuffer icon, ThemeConfig theme)
|
||||
: base(theme)
|
||||
{
|
||||
image = icon;
|
||||
this.HAnchor = HAnchor.Absolute;
|
||||
this.VAnchor = VAnchor.Absolute | VAnchor.Center;
|
||||
this.Height = theme.ButtonHeight;
|
||||
this.Width = theme.ButtonHeight;
|
||||
this.BackgroundRadius = theme.ButtonRadius * GuiWidget.DeviceScale;
|
||||
|
||||
imageWidget = new ImageWidget(icon, listenForImageChanged: false)
|
||||
{
|
||||
HAnchor = HAnchor.Center,
|
||||
VAnchor = VAnchor.Center,
|
||||
Selectable = false
|
||||
};
|
||||
|
||||
this.AddChild(imageWidget);
|
||||
}
|
||||
|
||||
public ImageBuffer IconImage => this.Enabled ? image : this.DisabledImage;
|
||||
|
||||
internal void SetIcon(ImageBuffer icon)
|
||||
{
|
||||
image = icon;
|
||||
imageWidget.Image = icon;
|
||||
_disabledImage = null;
|
||||
}
|
||||
|
||||
private ImageBuffer _disabledImage;
|
||||
|
||||
public ImageBuffer DisabledImage
|
||||
{
|
||||
get
|
||||
{
|
||||
// Lazy construct on first access
|
||||
if (_disabledImage == null)
|
||||
{
|
||||
_disabledImage = image.AjustAlpha(0.2);
|
||||
}
|
||||
|
||||
return _disabledImage;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEnabledChanged(EventArgs e)
|
||||
{
|
||||
imageWidget.Image = this.Enabled ? image : this.DisabledImage;
|
||||
this.Invalidate();
|
||||
|
||||
base.OnEnabledChanged(e);
|
||||
}
|
||||
}
|
||||
|
||||
public class RadioIconButton : IconButton, IRadioButton
|
||||
{
|
||||
public IList<GuiWidget> SiblingRadioButtonList { get; set; }
|
||||
|
||||
public event EventHandler CheckedStateChanged;
|
||||
|
||||
public bool ToggleButton { get; set; } = false;
|
||||
|
||||
public RadioIconButton(ImageBuffer icon, ThemeConfig theme)
|
||||
: base(icon, theme)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnClick(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnClick(mouseEvent);
|
||||
|
||||
bool newValue = this.ToggleButton ? !this.Checked : true;
|
||||
|
||||
bool checkStateChanged = newValue != this.Checked;
|
||||
|
||||
this.Checked = newValue;
|
||||
|
||||
// After setting CheckedState, fire event if different
|
||||
if (checkStateChanged)
|
||||
{
|
||||
OnCheckStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _checked;
|
||||
|
||||
public bool Checked
|
||||
{
|
||||
get => _checked;
|
||||
set
|
||||
{
|
||||
if (_checked != value)
|
||||
{
|
||||
_checked = value;
|
||||
if (_checked)
|
||||
{
|
||||
this.UncheckSiblings();
|
||||
}
|
||||
|
||||
this.BackgroundColor = _checked ? theme.MinimalShade : Color.Transparent;
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnCheckStateChanged()
|
||||
{
|
||||
CheckedStateChanged?.Invoke(this, null);
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
if (this.Checked)
|
||||
{
|
||||
if (BackgroundRadius.SW + BackgroundRadius.NW == Width)
|
||||
{
|
||||
void Render(double startRatio)
|
||||
{
|
||||
var stroke = 4 * GuiWidget.DeviceScale;
|
||||
var angle = MathHelper.Tau / 4;
|
||||
var start = MathHelper.Tau * startRatio - angle / 2;
|
||||
var end = MathHelper.Tau * startRatio + angle / 2;
|
||||
var arc = new Arc(Width / 2, Height / 2, Width / 2 - stroke / 2, Height / 2 - stroke / 2, start, end);
|
||||
var background = new Stroke(arc, stroke);
|
||||
graphics2D.Render(background, theme.PrimaryAccentColor.WithAlpha(100));
|
||||
}
|
||||
|
||||
Render(1.0 / 3.0 + .75);
|
||||
Render(2.0 / 3.0 + .75);
|
||||
Render(1.0 + .75);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics2D.Rectangle(0, 0, LocalBounds.Right, 2 * DeviceScale, theme.PrimaryAccentColor);
|
||||
}
|
||||
}
|
||||
|
||||
base.OnDraw(graphics2D);
|
||||
}
|
||||
}
|
||||
|
||||
public class RadioTextButton : TextButton, IRadioButton
|
||||
{
|
||||
public IList<GuiWidget> SiblingRadioButtonList { get; set; }
|
||||
|
||||
public event EventHandler CheckedStateChanged;
|
||||
|
||||
public RadioTextButton(string text, ThemeConfig theme, double pointSize = -1)
|
||||
: base(text, theme, pointSize)
|
||||
{
|
||||
this.SelectedBackgroundColor = theme.SlightShade;
|
||||
}
|
||||
|
||||
public override Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
var firstWidgetUnderMouse = ContainsFirstUnderMouseRecursive();
|
||||
if (this.MouseCaptured
|
||||
&& firstWidgetUnderMouse
|
||||
&& this.Enabled)
|
||||
{
|
||||
if (Checked)
|
||||
{
|
||||
return SelectedBackgroundColor.AdjustLightness(.9).ToColor();
|
||||
}
|
||||
|
||||
return this.MouseDownColor;
|
||||
}
|
||||
else if (firstWidgetUnderMouse
|
||||
&& this.Enabled)
|
||||
{
|
||||
if (Checked)
|
||||
{
|
||||
return SelectedBackgroundColor.AdjustLightness(.8).ToColor();
|
||||
}
|
||||
|
||||
return this.HoverColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.BackgroundColor;
|
||||
}
|
||||
}
|
||||
set => base.BackgroundColor = value;
|
||||
}
|
||||
|
||||
protected override void OnClick(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnClick(mouseEvent);
|
||||
|
||||
bool newValue = true;
|
||||
|
||||
bool checkStateChanged = newValue != this.Checked;
|
||||
|
||||
this.Checked = newValue;
|
||||
|
||||
// After setting CheckedState, fire event if different
|
||||
if (checkStateChanged)
|
||||
{
|
||||
OnCheckStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Color SelectedBackgroundColor { get; set; }
|
||||
|
||||
public Color UnselectedBackgroundColor { get; set; }
|
||||
|
||||
private bool _checked;
|
||||
|
||||
public bool Checked
|
||||
{
|
||||
get => _checked;
|
||||
set
|
||||
{
|
||||
if (_checked != value)
|
||||
{
|
||||
_checked = value;
|
||||
if (_checked)
|
||||
{
|
||||
this.UncheckSiblings();
|
||||
}
|
||||
|
||||
OnCheckStateChanged();
|
||||
}
|
||||
|
||||
this.BackgroundColor = _checked ? this.SelectedBackgroundColor : this.UnselectedBackgroundColor;
|
||||
}
|
||||
}
|
||||
|
||||
public bool DrawUnderline { get; set; } = true;
|
||||
|
||||
public override void OnMouseEnterBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseEnterBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseLeaveBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public virtual void OnCheckStateChanged()
|
||||
{
|
||||
CheckedStateChanged?.Invoke(this, null);
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
if (this.Checked && DrawUnderline)
|
||||
{
|
||||
graphics2D.Rectangle(LocalBounds.Left, 0, LocalBounds.Right, 2, theme.PrimaryAccentColor);
|
||||
}
|
||||
|
||||
base.OnDraw(graphics2D);
|
||||
}
|
||||
}
|
||||
|
||||
public class TextButton : SimpleButton
|
||||
{
|
||||
private readonly TextWidget textWidget;
|
||||
|
||||
public TextButton(string text, ThemeConfig theme, double pointSize = -1)
|
||||
: base(theme)
|
||||
{
|
||||
this.HAnchor = HAnchor.Fit;
|
||||
this.VAnchor = VAnchor.Absolute | VAnchor.Center;
|
||||
this.Height = theme.ButtonHeight;
|
||||
this.Padding = theme.TextButtonPadding;
|
||||
this.TabStop = true;
|
||||
|
||||
this.BackgroundRadius = theme.ButtonRadius * GuiWidget.DeviceScale;
|
||||
|
||||
var textSize = (pointSize != -1) ? pointSize : theme.DefaultFontSize;
|
||||
|
||||
this.AddChild(textWidget = new TextWidget(text, pointSize: textSize, textColor: theme.TextColor)
|
||||
{
|
||||
HAnchor = HAnchor.Center,
|
||||
VAnchor = VAnchor.Center,
|
||||
AutoExpandBoundsToText = true
|
||||
});
|
||||
}
|
||||
|
||||
public Color TextColor
|
||||
{
|
||||
get => textWidget.TextColor;
|
||||
set => textWidget.TextColor = value;
|
||||
}
|
||||
|
||||
public override string Text
|
||||
{
|
||||
get => textWidget.Text;
|
||||
set => textWidget.Text = value;
|
||||
}
|
||||
|
||||
public override bool Enabled
|
||||
{
|
||||
get => base.Enabled;
|
||||
set
|
||||
{
|
||||
base.Enabled = value;
|
||||
textWidget.Enabled = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TextIconButton : SimpleFlowButton
|
||||
{
|
||||
private TextWidget textWidget;
|
||||
|
||||
public bool DrawIconOverlayOnDisabled { get; set; } = false;
|
||||
|
||||
public TextIconButton(string text, ImageBuffer icon, ThemeConfig theme)
|
||||
: base(theme)
|
||||
{
|
||||
this.HAnchor = HAnchor.Fit;
|
||||
this.VAnchor = VAnchor.Absolute | VAnchor.Center;
|
||||
this.Height = theme.ButtonHeight;
|
||||
this.Padding = theme.TextButtonPadding;
|
||||
|
||||
this.BackgroundRadius = theme.ButtonRadius * GuiWidget.DeviceScale;
|
||||
|
||||
this.AddChild(ImageWidget = new ImageWidget(icon)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Selectable = false
|
||||
});
|
||||
|
||||
// TODO: Only needed because TextWidget violates normal padding/margin rules
|
||||
var textContainer = new GuiWidget()
|
||||
{
|
||||
Padding = new BorderDouble(8, 4, 2, 4),
|
||||
HAnchor = HAnchor.Fit,
|
||||
VAnchor = VAnchor.Center | VAnchor.Fit,
|
||||
Selectable = false
|
||||
};
|
||||
this.AddChild(textContainer);
|
||||
|
||||
textContainer.AddChild(textWidget = new TextWidget(text, pointSize: theme.DefaultFontSize, textColor: theme.TextColor));
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
base.OnDraw(graphics2D);
|
||||
|
||||
// now draw an overlay on the image if it is disabled
|
||||
if (DrawIconOverlayOnDisabled && !ImageWidget.Enabled)
|
||||
{
|
||||
graphics2D.Render(new RoundedRect(ImageWidget.TransformToParentSpace(this, ImageWidget.LocalBounds), 0),
|
||||
theme.BackgroundColor.WithAlpha(200));
|
||||
}
|
||||
}
|
||||
|
||||
public void SetIcon(ImageBuffer imageBuffer)
|
||||
{
|
||||
ImageWidget.Image = imageBuffer;
|
||||
}
|
||||
|
||||
public ImageWidget ImageWidget { get; }
|
||||
|
||||
public override string Text { get => textWidget.Text; set => textWidget.Text = value; }
|
||||
}
|
||||
|
||||
public class HoverIconButton : IconButton
|
||||
{
|
||||
private ImageBuffer normalImage;
|
||||
|
||||
private ImageBuffer hoverImage;
|
||||
|
||||
// Single ImageBuffer constructor creates a grayscale copy for use as the normal image
|
||||
// and uses the original as the hover image
|
||||
public HoverIconButton(ImageBuffer icon, ThemeConfig theme)
|
||||
: this(MakeGrayscale(icon), icon, theme)
|
||||
{
|
||||
}
|
||||
|
||||
public HoverIconButton(ImageBuffer icon, ImageBuffer hoverIcon, ThemeConfig theme)
|
||||
: base(icon, theme)
|
||||
{
|
||||
normalImage = icon;
|
||||
hoverImage = hoverIcon;
|
||||
|
||||
this.HAnchor = HAnchor.Absolute;
|
||||
this.VAnchor = VAnchor.Absolute | VAnchor.Center;
|
||||
this.Height = theme.ButtonHeight;
|
||||
this.Width = theme.ButtonHeight;
|
||||
|
||||
imageWidget = new ImageWidget(icon, listenForImageChanged: false)
|
||||
{
|
||||
HAnchor = HAnchor.Center,
|
||||
VAnchor = VAnchor.Center,
|
||||
};
|
||||
|
||||
this.AddChild(imageWidget);
|
||||
}
|
||||
|
||||
public static ImageBuffer MakeGrayscale(ImageBuffer icon)
|
||||
{
|
||||
var hoverIcon = new ImageBuffer(icon);
|
||||
ApplicationController.Instance.MakeGrayscale(hoverIcon);
|
||||
|
||||
return hoverIcon;
|
||||
}
|
||||
|
||||
public override void OnMouseEnterBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
imageWidget.Image = hoverImage;
|
||||
|
||||
base.OnMouseEnterBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
imageWidget.Image = normalImage;
|
||||
|
||||
base.OnMouseLeaveBounds(mouseEvent);
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -522,7 +522,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
private readonly ImageBuffer arrowRight;
|
||||
private readonly ImageBuffer arrowDown;
|
||||
private readonly ImageBuffer placeholder;
|
||||
private readonly IconButton imageButton = null;
|
||||
private readonly ThemedIconButton imageButton = null;
|
||||
|
||||
public TreeExpandWidget(ThemeConfig theme)
|
||||
{
|
||||
|
|
@ -532,7 +532,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
this.Margin = new BorderDouble(right: 4);
|
||||
|
||||
imageButton = new IconButton(placeholder, theme)
|
||||
imageButton = new ThemedIconButton(placeholder, theme)
|
||||
{
|
||||
MinimumSize = new Vector2(16 * DeviceScale, 16 * DeviceScale),
|
||||
VAnchor = VAnchor.Center,
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
}
|
||||
else
|
||||
{
|
||||
var editButton = new TextButton("Edit".Localize(), theme)
|
||||
var editButton = new ThemedTextButton("Edit".Localize(), theme)
|
||||
{
|
||||
Margin = 5,
|
||||
ToolTipText = "Edit OpenSCAD script".Localize()
|
||||
|
|
@ -118,7 +118,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
};
|
||||
actionButtons.AddChild(editButton);
|
||||
|
||||
var updateButton = new TextButton("Update".Localize(), theme)
|
||||
var updateButton = new ThemedTextButton("Update".Localize(), theme)
|
||||
{
|
||||
Margin = 5,
|
||||
ToolTipText = "Compile model".Localize()
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
var showUpdate = context.item.GetType().GetCustomAttributes(typeof(ShowUpdateButtonAttribute), true).FirstOrDefault() as ShowUpdateButtonAttribute;
|
||||
if (showUpdate?.Show == true)
|
||||
{
|
||||
var updateButton = new TextButton("Update".Localize(), theme)
|
||||
var updateButton = new ThemedTextButton("Update".Localize(), theme)
|
||||
{
|
||||
Margin = 5,
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
@ -192,7 +192,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
foreach (var editorButtonData in editorButtonProvider.GetEditorButtonsData())
|
||||
{
|
||||
var editorButton = new TextButton(editorButtonData.Name, theme)
|
||||
var editorButton = new ThemedTextButton(editorButtonData.Name, theme)
|
||||
{
|
||||
Margin = 5,
|
||||
ToolTipText = editorButtonData.HelpText,
|
||||
|
|
@ -984,7 +984,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
// This is the AssetPath property of an asset object, add a button to set the AssetPath from a file
|
||||
// Change button
|
||||
var changeButton = new TextButton(property.Description, theme)
|
||||
var changeButton = new ThemedTextButton(property.Description, theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = 3
|
||||
|
|
@ -1254,7 +1254,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
VAnchor = VAnchor.Center
|
||||
};
|
||||
searchRow.AddChild(searchField);
|
||||
var searchButton = new IconButton(StaticData.Instance.LoadIcon("icon_search_24x24.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var searchButton = new ThemedIconButton(StaticData.Instance.LoadIcon("icon_search_24x24.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Search".Localize(),
|
||||
};
|
||||
|
|
@ -1499,7 +1499,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public static GuiWidget GetUnlockRow(ThemeConfig theme, string url)
|
||||
{
|
||||
var detailsLink = new TextIconButton("Unlock".Localize(), StaticData.Instance.LoadIcon("locked.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var detailsLink = new ThemedTextIconButton("Unlock".Localize(), StaticData.Instance.LoadIcon("locked.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Margin = 5,
|
||||
ToolTipText = "Visit MatterHackers.com to Purchase".Localize()
|
||||
|
|
@ -1517,7 +1517,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
if (item.GetType().GetCustomAttributes(typeof(WebPageLinkAttribute), true).FirstOrDefault() is WebPageLinkAttribute unlockLink)
|
||||
{
|
||||
var detailsLink = new TextIconButton(unlockLink.ButtonName.Localize(), StaticData.Instance.LoadIcon("internet.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var detailsLink = new ThemedTextIconButton(unlockLink.ButtonName.Localize(), StaticData.Instance.LoadIcon("internet.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
ToolTipText = unlockLink.Url,
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
foreach (var item in data.OrderBy(i => i.Name))
|
||||
{
|
||||
var linkButton = new IconButton(linkIcon, theme);
|
||||
var linkButton = new ThemedIconButton(linkIcon, theme);
|
||||
linkButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
ApplicationController.LaunchBrowser(item.Url);
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ namespace MatterHackers.MatterControl
|
|||
graphics = pulseImage.NewGraphics2D();
|
||||
graphics.ImageRenderQuality = Graphics2D.TransformQuality.Best;
|
||||
graphics.RenderMaxSize(pulseLogo, pulseImage.Width / 2 - logoWidth / 2, pulseImage.Height * .42, logoWidth, bounds.Height, out _, preScale: false);
|
||||
IconButton lastButton = null;
|
||||
buttonRow.AddChild(AddButtonText(lastButton = new IconButton(pulseImage, theme)
|
||||
ThemedIconButton lastButton = null;
|
||||
buttonRow.AddChild(AddButtonText(lastButton = new ThemedIconButton(pulseImage, theme)
|
||||
{
|
||||
HAnchor = HAnchor.Fit,
|
||||
VAnchor = VAnchor.Fit,
|
||||
|
|
@ -135,7 +135,7 @@ namespace MatterHackers.MatterControl
|
|||
return printerImage;
|
||||
}
|
||||
|
||||
buttonRow.AddChild(AddButtonText(lastButton = new IconButton(CreateButtonImage("3d_printer.png"), theme)
|
||||
buttonRow.AddChild(AddButtonText(lastButton = new ThemedIconButton(CreateButtonImage("3d_printer.png"), theme)
|
||||
{
|
||||
HAnchor = HAnchor.Fit,
|
||||
VAnchor = VAnchor.Fit,
|
||||
|
|
@ -147,7 +147,7 @@ namespace MatterHackers.MatterControl
|
|||
this.DialogWindow.Close();
|
||||
});
|
||||
|
||||
buttonRow.AddChild(AddButtonText(lastButton = new IconButton(CreateButtonImage("edit_design.png"), theme)
|
||||
buttonRow.AddChild(AddButtonText(lastButton = new ThemedIconButton(CreateButtonImage("edit_design.png"), theme)
|
||||
{
|
||||
HAnchor = HAnchor.Fit,
|
||||
VAnchor = VAnchor.Fit,
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.AddChild(new HorizontalSpacer());
|
||||
|
||||
checkUpdateButton = new IconButton(StaticData.Instance.LoadIcon("fa-refresh_14.png", 14, 14).SetToColor(theme.TextColor), theme)
|
||||
checkUpdateButton = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-refresh_14.png", 14, 14).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Check for Update".Localize(),
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.MinimumSize = new Vector2(0, checkUpdateButton.Height);
|
||||
|
||||
downloadButton = new TextButton("Download Update".Localize(), theme)
|
||||
downloadButton = new ThemedTextButton("Download Update".Localize(), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Visible = false
|
||||
|
|
@ -90,7 +90,7 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
this.AddChild(downloadButton);
|
||||
|
||||
installButton = new TextButton("Install Update".Localize(), theme)
|
||||
installButton = new ThemedTextButton("Install Update".Localize(), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Visible = false
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl.Library.Widgets
|
|||
// Must come before pathButton.Click definition
|
||||
RadioButton copyAndCalibrateOption = null;
|
||||
|
||||
var openButton = new IconButton(StaticData.Instance.LoadIcon("fa-folder-open_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var openButton = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-folder-open_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = new BorderDouble(left: 8),
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
public event EventHandler CheckedStateChanged;
|
||||
|
||||
private IconButton imageButton;
|
||||
private ThemedIconButton imageButton;
|
||||
|
||||
private ImageBuffer arrowRight;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
arrowRight = StaticData.Instance.LoadIcon("fa-angle-right_12.png", 12, 12).SetToColor(theme.TextColor);
|
||||
arrowDown = StaticData.Instance.LoadIcon("fa-angle-down_12.png", 12, 12).SetToColor(theme.TextColor);
|
||||
|
||||
imageButton = new IconButton(arrowRight, theme)
|
||||
imageButton = new ThemedIconButton(arrowRight, theme)
|
||||
{
|
||||
MinimumSize = new Vector2(theme.ButtonHeight, theme.ButtonHeight),
|
||||
VAnchor = VAnchor.Center,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
|
|||
|
||||
if (showOpenButton)
|
||||
{
|
||||
var openButton = new TextButton("Open".Localize(), theme)
|
||||
var openButton = new ThemedTextButton("Open".Localize(), theme)
|
||||
{
|
||||
BackgroundColor = theme.AccentMimimalOverlay,
|
||||
Margin = Margin.Clone(right: 17)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace MatterHackers.MatterControl.Library.Widgets
|
|||
mainRow.AddChild(new HorizontalSpacer());
|
||||
|
||||
// add in the create pulse button
|
||||
var createPulse = new IconButton(StaticData.Instance.LoadIcon("pulse_logo.png", 18, 18).SetToColor(theme.TextColor), theme)
|
||||
var createPulse = new ThemedIconButton(StaticData.Instance.LoadIcon("pulse_logo.png", 18, 18).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "Setup Pulse",
|
||||
VAnchor = VAnchor.Center,
|
||||
|
|
@ -90,7 +90,7 @@ namespace MatterHackers.MatterControl.Library.Widgets
|
|||
mainRow.AddChild(createPulse);
|
||||
|
||||
// add in the create printer button
|
||||
var createPrinter = new IconButton(StaticData.Instance.LoadIcon("md-add-circle_18.png", 18, 18).SetToColor(theme.TextColor), theme)
|
||||
var createPrinter = new ThemedIconButton(StaticData.Instance.LoadIcon("md-add-circle_18.png", 18, 18).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "Create Printer",
|
||||
VAnchor = VAnchor.Center,
|
||||
|
|
@ -106,7 +106,7 @@ namespace MatterHackers.MatterControl.Library.Widgets
|
|||
mainRow.AddChild(createPrinter);
|
||||
|
||||
// add in the import printer button
|
||||
var importPrinter = new IconButton(StaticData.Instance.LoadIcon("md-import_18.png", 18, 18).SetToColor(theme.TextColor), theme)
|
||||
var importPrinter = new ThemedIconButton(StaticData.Instance.LoadIcon("md-import_18.png", 18, 18).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing,
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace MatterHackers.MatterControl.Library.Widgets
|
|||
DoubleClickBehavior = LibraryListView.DoubleClickBehaviors.PreviewItem
|
||||
};
|
||||
|
||||
navBar = new OverflowBar(theme)
|
||||
navBar = new OverflowBar(theme, "File".Localize())
|
||||
{
|
||||
HAnchor = HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Fit,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2019, Kevin Pope, John Lewin
|
||||
Copyright (c) 2022, Kevin Pope, John Lewin, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.Library.Widgets
|
|||
Border = new BorderDouble(top: 1)
|
||||
};
|
||||
|
||||
navBar = new OverflowBar(theme)
|
||||
navBar = new OverflowBar(theme, "File".Localize())
|
||||
{
|
||||
HAnchor = HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Fit,
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
|
|||
|
||||
if (content.group_items.Count > maxStuff)
|
||||
{
|
||||
var moreButton = new TextButton("More".Localize() + "...", theme)
|
||||
var moreButton = new ThemedTextButton("More".Localize() + "...", theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = new BorderDouble(right: leftRightMargin),
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
|
|||
{
|
||||
// add the article group button to the button group
|
||||
// add a content section connected to the button
|
||||
var sectionButton = new TextButton(content.group_title, theme);
|
||||
var sectionButton = new ThemedTextButton(content.group_title, theme);
|
||||
sectionSelectButtons.AddChild(sectionButton);
|
||||
var articleSection = new ArticleSection(content, theme)
|
||||
{
|
||||
|
|
@ -242,7 +242,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
|
|||
|
||||
case "product_group":
|
||||
{
|
||||
var sectionButton = new TextButton(content.group_title, theme);
|
||||
var sectionButton = new ThemedTextButton(content.group_title, theme);
|
||||
sectionSelectButtons.AddChild(sectionButton);
|
||||
var exploreSection = new ProductSection(content, theme)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
|
|||
private List<ProductItem> allIconViews = new List<ProductItem>();
|
||||
private FeedSectionData content;
|
||||
private ThemeConfig theme;
|
||||
private TextButton moreButton;
|
||||
private ThemedTextButton moreButton;
|
||||
|
||||
public ProductSection(FeedSectionData content, ThemeConfig theme)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
var expandedImage = StaticData.Instance.LoadIcon("expand.png", 16, 16).SetToColor(theme.TextColor);
|
||||
var collapsedImage = StaticData.Instance.LoadIcon("collapse.png", 16, 16).SetToColor(theme.TextColor);
|
||||
|
||||
var expandBarButton = new IconButton(expanded ? collapsedImage : expandedImage, theme)
|
||||
var expandBarButton = new ThemedIconButton(expanded ? collapsedImage : expandedImage, theme)
|
||||
{
|
||||
HAnchor = HAnchor.Center,
|
||||
VAnchor = VAnchor.Absolute | VAnchor.Bottom,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ using MatterHackers.MatterControl.CustomWidgets;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public class DropButton : SimpleButton
|
||||
public class DropButton : ThemedButton
|
||||
{
|
||||
public bool MenuVisible { get; private set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
public class GCodeOptionsPanel : FlowLayoutWidget
|
||||
{
|
||||
private RadioIconButton speedsButton;
|
||||
private RadioIconButton materialsButton;
|
||||
private RadioIconButton noColorButton;
|
||||
private ThemedRadioIconButton speedsButton;
|
||||
private ThemedRadioIconButton materialsButton;
|
||||
private ThemedRadioIconButton noColorButton;
|
||||
private View3DConfig gcodeOptions;
|
||||
|
||||
public GCodeOptionsPanel(ISceneContext sceneContext, PrinterConfig printer, ThemeConfig theme)
|
||||
|
|
@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
var buttonGroup = new ObservableCollection<GuiWidget>();
|
||||
|
||||
speedsButton = new RadioIconButton(StaticData.Instance.LoadIcon("speeds.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
speedsButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon("speeds.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroup,
|
||||
Name = "Speeds Button",
|
||||
|
|
@ -74,7 +74,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
buttonPanel.AddChild(speedsButton);
|
||||
|
||||
materialsButton = new RadioIconButton(StaticData.Instance.LoadIcon("materials.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
materialsButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon("materials.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroup,
|
||||
Name = "Materials Button",
|
||||
|
|
@ -87,7 +87,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
buttonPanel.AddChild(materialsButton);
|
||||
|
||||
noColorButton = new RadioIconButton(StaticData.Instance.LoadIcon("no-color.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
noColorButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon("no-color.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroup,
|
||||
Name = "No Color Button",
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
VAnchor = VAnchor.Fit
|
||||
});
|
||||
|
||||
var copyButton = new TextButton("copy".Localize(), theme, 8)
|
||||
var copyButton = new ThemedTextButton("copy".Localize(), theme, 8)
|
||||
{
|
||||
Padding = 5,
|
||||
Margin = new BorderDouble(0, 0, 15, 0),
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
}
|
||||
|
||||
var resetButton = rightContent.AddChild(new TextIconButton("Clear".Localize(), StaticData.Instance.LoadIcon("transparent_grid.png", 16, 16), theme)
|
||||
var resetButton = rightContent.AddChild(new ThemedTextIconButton("Clear".Localize(), StaticData.Instance.LoadIcon("transparent_grid.png", 16, 16), theme)
|
||||
{
|
||||
Margin = new BorderDouble(0, 0, 0, 3),
|
||||
HAnchor = HAnchor.Fit | HAnchor.Left,
|
||||
|
|
@ -258,7 +258,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (getPickedColor != null)
|
||||
{
|
||||
var selectButton = rightContent.AddChild(new TextIconButton("Select".Localize(), StaticData.Instance.LoadIcon("eye_dropper.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var selectButton = rightContent.AddChild(new ThemedTextIconButton("Select".Localize(), StaticData.Instance.LoadIcon("eye_dropper.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Margin = 0,
|
||||
HAnchor = HAnchor.Fit | HAnchor.Left,
|
||||
|
|
|
|||
|
|
@ -830,7 +830,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
moveButtons.AddChild(textWidget);
|
||||
var buttonSize = 24 * DeviceScale;
|
||||
var moveLeftButton = new IconButton(StaticData.Instance.LoadIcon("fa-angle-right_12.png", 14, 14).SetToColor(theme.TextColor).MirrorX(), theme)
|
||||
var moveLeftButton = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-angle-right_12.png", 14, 14).SetToColor(theme.TextColor).MirrorX(), theme)
|
||||
{
|
||||
Width = buttonSize,
|
||||
Height = buttonSize,
|
||||
|
|
@ -846,7 +846,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
moveButtons.AddChild(moveLeftButton);
|
||||
|
||||
var moveRightButton = new IconButton(StaticData.Instance.LoadIcon("fa-angle-right_12.png", 14, 14).SetToColor(theme.TextColor), theme)
|
||||
var moveRightButton = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-angle-right_12.png", 14, 14).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Width = buttonSize,
|
||||
Height = buttonSize,
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.VAnchor = VAnchor.Center;
|
||||
this.theme = theme;
|
||||
|
||||
IconButton = new IconButton(imageBuffer, theme)
|
||||
IconButton = new ThemedIconButton(imageBuffer, theme)
|
||||
{
|
||||
HAnchor = HAnchor.Left,
|
||||
Height = theme.MicroButtonHeight,
|
||||
|
|
@ -105,6 +105,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public ITab LastTab { get; set; }
|
||||
|
||||
public IconButton IconButton { get; }
|
||||
public ThemedIconButton IconButton { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ using MatterHackers.MatterControl.CustomWidgets;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public class OperationIconButton : IconButton
|
||||
public class OperationIconButton : ThemedIconButton
|
||||
{
|
||||
private SceneOperation sceneOperation;
|
||||
private ISceneContext sceneContext;
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
public PopupMenuButton(ImageBuffer imageBuffer, ThemeConfig theme)
|
||||
: this(new IconButton(imageBuffer, theme), theme)
|
||||
: this(new ThemedIconButton(imageBuffer, theme), theme)
|
||||
{
|
||||
}
|
||||
|
||||
public PopupMenuButton(string text, ImageBuffer imageBuffer, ThemeConfig theme)
|
||||
: this(new TextIconButton(text, imageBuffer, theme)
|
||||
: this(new ThemedTextIconButton(text, imageBuffer, theme)
|
||||
{
|
||||
Padding = new BorderDouble(5, 0, 5, 0),
|
||||
}, theme)
|
||||
|
|
@ -86,7 +86,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
public PopupMenuButton(string text, ThemeConfig theme)
|
||||
: this(new TextButton(text, theme)
|
||||
: this(new ThemedTextButton(text, theme)
|
||||
{
|
||||
Selectable = false,
|
||||
Padding = theme.TextButtonPadding.Clone(right: 5)
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
var unloadFilamentButton = new TextButton("Unload Filament".Localize(), theme)
|
||||
var unloadFilamentButton = new ThemedTextButton("Unload Filament".Localize(), theme)
|
||||
{
|
||||
Name = "unload Filament",
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
@ -680,7 +680,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
// add in the move up button
|
||||
var babyStepAmount = .02;
|
||||
var upButton = babySteppingControls.AddChild(new IconButton(StaticData.Instance.LoadIcon("Up Arrow.png", 32, 32).SetToColor(theme.TextColor), theme)
|
||||
var upButton = babySteppingControls.AddChild(new ThemedIconButton(StaticData.Instance.LoadIcon("Up Arrow.png", 32, 32).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
HAnchor = HAnchor.Center,
|
||||
VAnchor = VAnchor.Absolute,
|
||||
|
|
@ -719,7 +719,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
});
|
||||
|
||||
// add in the move down button
|
||||
var downButton = babySteppingControls.AddChild(new IconButton(StaticData.Instance.LoadIcon("Down Arrow.png", 32, 32).SetToColor(theme.TextColor), theme)
|
||||
var downButton = babySteppingControls.AddChild(new ThemedIconButton(StaticData.Instance.LoadIcon("Down Arrow.png", 32, 32).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
HAnchor = HAnchor.Center,
|
||||
VAnchor = VAnchor.Absolute,
|
||||
|
|
@ -765,7 +765,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
// we can only reslice on 64 bit, because in 64 bit we always have the gcode loaded
|
||||
if (IntPtr.Size == 8 || ApplicationController.Instance.Allow32BitReSlice)
|
||||
{
|
||||
var resliceButton = new TextButton("Re-Slice", theme)
|
||||
var resliceButton = new ThemedTextButton("Re-Slice", theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
HAnchor = HAnchor.Right,
|
||||
|
|
@ -842,7 +842,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
resliceMessageRow.AddChild(switchButtonRow);
|
||||
|
||||
var switchButton = new TextButton("Switch", theme)
|
||||
var switchButton = new ThemedTextButton("Switch", theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = new BorderDouble(5),
|
||||
|
|
@ -865,7 +865,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
resliceMessageRow.Visible = false;
|
||||
};
|
||||
|
||||
var cancelButton = new TextButton("Cancel", theme)
|
||||
var cancelButton = new ThemedTextButton("Cancel", theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = new BorderDouble(0, 5),
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.HAnchor = HAnchor.Fit;
|
||||
this.VAnchor = VAnchor.Fit;
|
||||
|
||||
this.AddChild(new IconButton(StaticData.Instance.LoadIcon("web.png", 16, 16), theme)
|
||||
this.AddChild(new ThemedIconButton(StaticData.Instance.LoadIcon("web.png", 16, 16), theme)
|
||||
{
|
||||
Selectable = false
|
||||
});
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (string.IsNullOrEmpty(buttonText))
|
||||
{
|
||||
return new IconButton(StaticData.Instance.LoadIcon(iconFilename, 12, 12).SetToColor(theme.TextColor), theme)
|
||||
return new ThemedIconButton(StaticData.Instance.LoadIcon(iconFilename, 12, 12).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Margin = theme.ButtonSpacing,
|
||||
Enabled = clickAction != null,
|
||||
|
|
@ -239,7 +239,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
var oldSize = theme.DefaultFontSize;
|
||||
theme.DefaultFontSize = 8;
|
||||
var pauseButton = new TextIconButton(buttonText, StaticData.Instance.LoadIcon(iconFilename, 12, 12).SetToColor(theme.TextColor), theme)
|
||||
var pauseButton = new ThemedTextIconButton(buttonText, StaticData.Instance.LoadIcon(iconFilename, 12, 12).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Margin = new BorderDouble(marginX, 0),
|
||||
Padding = new BorderDouble(7, 3),
|
||||
|
|
@ -255,7 +255,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ToolTipText = toolTip,
|
||||
Name = name,
|
||||
};
|
||||
((TextIconButton)pauseButton).BackgroundRadius = pauseButton.Height / 2;
|
||||
((ThemedTextIconButton)pauseButton).BackgroundRadius = pauseButton.Height / 2;
|
||||
theme.DefaultFontSize = oldSize;
|
||||
|
||||
return pauseButton;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace MatterHackers.MatterControl
|
|||
contentRow.AddChild(folderButtonRow);
|
||||
|
||||
// add a create folder button
|
||||
var createFolderButton = new TextIconButton("Create Folder".Localize(), icon, theme)
|
||||
var createFolderButton = new ThemedTextIconButton("Create Folder".Localize(), icon, theme)
|
||||
{
|
||||
Enabled = isEnabled,
|
||||
VAnchor = VAnchor.Absolute,
|
||||
|
|
@ -130,7 +130,7 @@ namespace MatterHackers.MatterControl
|
|||
createFolderButton.Name = "Create Folder In Button";
|
||||
folderButtonRow.AddChild(createFolderButton);
|
||||
|
||||
var refreshButton = new IconButton(StaticData.Instance.LoadIcon("fa-refresh_14.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var refreshButton = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-refresh_14.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Refresh Folder".Localize(),
|
||||
Enabled = isEnabled,
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
// put in a make permanent button
|
||||
var icon = StaticData.Instance.LoadIcon("apply.png", 16, 16).SetToColor(theme.TextColor).SetPreMultiply();
|
||||
applyButton = new IconButton(icon, theme)
|
||||
applyButton = new ThemedIconButton(icon, theme)
|
||||
{
|
||||
Margin = theme.ButtonSpacing,
|
||||
ToolTipText = "Apply".Localize(),
|
||||
|
|
@ -115,7 +115,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
toolbar.AddChild(applyButton);
|
||||
|
||||
// put in a remove button
|
||||
cancelButton = new IconButton(StaticData.Instance.LoadIcon("cancel.png", 16, 16).SetToColor(theme.TextColor).SetPreMultiply(), theme)
|
||||
cancelButton = new ThemedIconButton(StaticData.Instance.LoadIcon("cancel.png", 16, 16).SetToColor(theme.TextColor).SetPreMultiply(), theme)
|
||||
{
|
||||
Margin = theme.ButtonSpacing,
|
||||
ToolTipText = "Cancel".Localize(),
|
||||
|
|
@ -174,8 +174,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public GuiWidget ContentPanel { get; set; }
|
||||
|
||||
private readonly JsonPathContext pathGetter = new JsonPathContext();
|
||||
private readonly IconButton applyButton;
|
||||
private readonly IconButton cancelButton;
|
||||
private readonly ThemedIconButton applyButton;
|
||||
private readonly ThemedIconButton cancelButton;
|
||||
private readonly PopupMenuButton overflowButton;
|
||||
private readonly InteractiveScene scene;
|
||||
private readonly FlowLayoutWidget primaryActionsPanel;
|
||||
|
|
@ -214,7 +214,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
foreach (var primaryAction in primaryActions)
|
||||
{
|
||||
// TODO: Run visible/enable rules on actions, conditionally add/enable as appropriate
|
||||
var button = new IconButton(primaryAction.Icon(theme), theme)
|
||||
var button = new ThemedIconButton(primaryAction.Icon(theme), theme)
|
||||
{
|
||||
// Name = namedAction.Title + " Button",
|
||||
ToolTipText = primaryAction.Title,
|
||||
|
|
@ -648,7 +648,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
private class OperationButton : TextButton
|
||||
private class OperationButton : ThemedTextButton
|
||||
{
|
||||
private readonly SceneOperation sceneOperation;
|
||||
private readonly ISceneContext sceneContext;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
switch (rowIndex)
|
||||
{
|
||||
case 0:
|
||||
var resetButton = new IconButton(StaticData.Instance.LoadIcon("transparent_grid.png"), theme)
|
||||
var resetButton = new ThemedIconButton(StaticData.Instance.LoadIcon("transparent_grid.png"), theme)
|
||||
{
|
||||
Width = scaledButtonSize,
|
||||
Height = scaledButtonSize,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
var gridDistance = object3DControlLayer.SnapGridDistance;
|
||||
|
||||
textButton = this.AddChild(new TextButton(gridDistance.ToString(), theme)
|
||||
textButton = this.AddChild(new ThemedTextButton(gridDistance.ToString(), theme)
|
||||
{
|
||||
Selectable = false,
|
||||
HAnchor = HAnchor.Center
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
return exportPanel;
|
||||
};
|
||||
|
||||
this.AddChild(new TextButton("Export".Localize(), theme)
|
||||
this.AddChild(new ThemedTextButton("Export".Localize(), theme)
|
||||
{
|
||||
Selectable = false,
|
||||
Padding = theme.TextButtonPadding.Clone(right: 5)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
Copyright (c) 2022, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -33,11 +33,9 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.ImageProcessing;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.Library.Widgets;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
|
|
@ -47,8 +45,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
protected static HashSet<Type> ignoredTypes = new HashSet<Type> { typeof(HorizontalLine), typeof(TextEditWithInlineCancel) };
|
||||
protected static HashSet<Type> ignoredInMenuTypes = new HashSet<Type> { typeof(VerticalLine), typeof(HorizontalLine), typeof(TextEditWithInlineCancel), typeof(HorizontalSpacer) };
|
||||
|
||||
public OverflowBar(ThemeConfig theme)
|
||||
: this(null, theme)
|
||||
public OverflowBar(ThemeConfig theme, string text = null)
|
||||
: this(null, theme, text)
|
||||
{ }
|
||||
|
||||
public OverflowBar(ImageBuffer icon, ThemeConfig theme, string text = null)
|
||||
|
|
@ -153,7 +151,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
PopupMenu.MenuItem menuItem;
|
||||
|
||||
var iconButton = widget as IconButton;
|
||||
var iconButton = widget as ThemedIconButton;
|
||||
|
||||
var iconImage = iconButton?.IconImage;
|
||||
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
return printPanel;
|
||||
};
|
||||
|
||||
this.AddChild(new TextButton("Print".Localize(), theme)
|
||||
this.AddChild(new ThemedTextButton("Print".Localize(), theme)
|
||||
{
|
||||
Selectable = false,
|
||||
Padding = theme.TextButtonPadding.Clone(right: 5)
|
||||
|
|
@ -318,7 +318,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
// Enable print option when no validation Errors exists
|
||||
printEnabled = printer.PrintButtonEnabled();
|
||||
|
||||
var startPrintButton = new TextButton(buttonText, theme)
|
||||
var startPrintButton = new ThemedTextButton(buttonText, theme)
|
||||
{
|
||||
Name = "Start Print Button",
|
||||
Enabled = printEnabled
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
internal GuiWidget sliceButton;
|
||||
|
||||
private RadioIconButton layers2DButton;
|
||||
internal RadioIconButton layers3DButton;
|
||||
internal RadioIconButton modelViewButton;
|
||||
private ThemedRadioIconButton layers2DButton;
|
||||
internal ThemedRadioIconButton layers3DButton;
|
||||
internal ThemedRadioIconButton modelViewButton;
|
||||
|
||||
private Dictionary<PartViewMode, RadioIconButton> viewModes = new Dictionary<PartViewMode, RadioIconButton>();
|
||||
private Dictionary<PartViewMode, ThemedRadioIconButton> viewModes = new Dictionary<PartViewMode, ThemedRadioIconButton>();
|
||||
|
||||
public PrinterActionsBar(PrinterConfig printer, PrinterTabPage printerTabPage, ThemeConfig theme)
|
||||
: base(null, theme, "Printer Options".Localize())
|
||||
|
|
@ -80,7 +80,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
// add the reset button first (if there is one)
|
||||
if (printer.Settings.GetValue<bool>(SettingsKey.show_reset_connection))
|
||||
{
|
||||
var resetConnectionButton = new TextIconButton(
|
||||
var resetConnectionButton = new ThemedTextIconButton(
|
||||
"Reset".Localize(),
|
||||
StaticData.Instance.LoadIcon("e_stop.png", 14, 14).SetToColor(theme.TextColor),
|
||||
theme)
|
||||
|
|
@ -154,7 +154,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
var buttonGroupB = new ObservableCollection<GuiWidget>();
|
||||
|
||||
var iconPath = Path.Combine("ViewTransformControls", "model.png");
|
||||
modelViewButton = new RadioIconButton(StaticData.Instance.LoadIcon(iconPath, 16, 16).SetToColor(theme.TextColor), theme)
|
||||
modelViewButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon(iconPath, 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroupB,
|
||||
Name = "Model View Button",
|
||||
|
|
@ -170,7 +170,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
viewModes.Add(PartViewMode.Model, modelViewButton);
|
||||
|
||||
iconPath = Path.Combine("ViewTransformControls", "gcode_3d.png");
|
||||
layers3DButton = new RadioIconButton(StaticData.Instance.LoadIcon(iconPath, 16, 16).SetToColor(theme.TextColor), theme)
|
||||
layers3DButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon(iconPath, 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroupB,
|
||||
Name = "Layers3D Button",
|
||||
|
|
@ -187,7 +187,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.AddChild(layers3DButton);
|
||||
|
||||
iconPath = Path.Combine("ViewTransformControls", "gcode_2d.png");
|
||||
layers2DButton = new RadioIconButton(StaticData.Instance.LoadIcon(iconPath, 16, 16).SetToColor(theme.TextColor), theme)
|
||||
layers2DButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon(iconPath, 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroupB,
|
||||
Name = "Layers2D Button",
|
||||
|
|
@ -239,8 +239,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
printer.ViewState.ViewModeChanged += (s, e) =>
|
||||
{
|
||||
if (viewModes[e.ViewMode] is RadioIconButton activeButton
|
||||
&& viewModes[e.PreviousMode] is RadioIconButton previousButton
|
||||
if (viewModes[e.ViewMode] is ThemedRadioIconButton activeButton
|
||||
&& viewModes[e.PreviousMode] is ThemedRadioIconButton previousButton
|
||||
&& !buttonIsBeingClicked)
|
||||
{
|
||||
// Show slide to animation from previous to current, on completion update view to current by setting active.Checked
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
this.Margin = 0;
|
||||
this.Padding = 0;
|
||||
|
||||
connectButton = new TextIconButton(
|
||||
connectButton = new ThemedTextIconButton(
|
||||
"Connect".Localize(),
|
||||
StaticData.Instance.LoadIcon("connect.png", 14, 14).SetToColor(theme.TextColor),
|
||||
theme)
|
||||
|
|
@ -75,7 +75,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
theme.ApplyPrimaryActionStyle(connectButton);
|
||||
|
||||
// add the cancel stop button
|
||||
cancelConnectButton = new TextIconButton(
|
||||
cancelConnectButton = new ThemedTextIconButton(
|
||||
"Cancel".Localize(),
|
||||
StaticData.Instance.LoadIcon("connect.png", 14, 14).SetToColor(theme.TextColor),
|
||||
theme)
|
||||
|
|
@ -92,7 +92,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
});
|
||||
this.AddChild(cancelConnectButton);
|
||||
|
||||
disconnectButton = new TextIconButton(
|
||||
disconnectButton = new ThemedTextIconButton(
|
||||
"Disconnect".Localize(),
|
||||
StaticData.Instance.LoadIcon("connect.png", 14, 14).SetToColor(theme.TextColor),
|
||||
theme)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public class SliceButton : TextButton
|
||||
public class SliceButton : ThemedTextButton
|
||||
{
|
||||
private PrinterConfig printer;
|
||||
private PrinterTabPage printerTabPage;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
else
|
||||
{
|
||||
// Show info indicator hinting that hover will reveal additional details
|
||||
row.AddChild(new IconButton(infoImage, theme)
|
||||
row.AddChild(new ThemedIconButton(infoImage, theme)
|
||||
{
|
||||
Selectable = false
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
flashBackground.Start();
|
||||
}
|
||||
|
||||
public static void SlideToNewState(this RadioIconButton widget, RadioIconButton newActiveButton, OverflowBar parent, Action animationComplete, ThemeConfig theme)
|
||||
public static void SlideToNewState(this ThemedRadioIconButton widget, ThemedRadioIconButton newActiveButton, OverflowBar parent, Action animationComplete, ThemeConfig theme)
|
||||
{
|
||||
double displayTime = 600;
|
||||
double elapsedMs = 0;
|
||||
|
|
|
|||
|
|
@ -100,10 +100,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public PrinterConfig Printer { get; private set; }
|
||||
|
||||
private readonly PrinterTabPage printerTabPage;
|
||||
private RadioIconButton translateButton;
|
||||
private RadioIconButton rotateButton;
|
||||
private RadioIconButton zoomButton;
|
||||
private RadioIconButton partSelectButton;
|
||||
private ThemedRadioIconButton translateButton;
|
||||
private ThemedRadioIconButton rotateButton;
|
||||
private ThemedRadioIconButton zoomButton;
|
||||
private ThemedRadioIconButton partSelectButton;
|
||||
|
||||
public View3DWidget(PrinterConfig printer, ISceneContext sceneContext, ViewToolBarControls viewControls3D, ThemeConfig theme, DesignTabPage printerTabBase, Object3DControlsLayer.EditorType editorType = Object3DControlsLayer.EditorType.Part)
|
||||
{
|
||||
|
|
@ -247,7 +247,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
titleAndTreeView.AddChild(treeView);
|
||||
|
||||
workspaceName.ActionArea.AddChild(
|
||||
new IconButton(StaticData.Instance.LoadIcon("fa-angle-right_12.png", 12, 12).SetToColor(theme.TextColor), theme)
|
||||
new ThemedIconButton(StaticData.Instance.LoadIcon("fa-angle-right_12.png", 12, 12).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Enabled = false
|
||||
},
|
||||
|
|
@ -257,7 +257,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
workspaceName.ActionArea.Children<TextWidget>().First().Margin = 0;
|
||||
|
||||
// Resize buttons
|
||||
foreach (var iconButton in workspaceName.Descendants<IconButton>())
|
||||
foreach (var iconButton in workspaceName.Descendants<ThemedIconButton>())
|
||||
{
|
||||
iconButton.Height = 26;
|
||||
iconButton.Width = 26;
|
||||
|
|
@ -355,7 +355,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
// add the view controls
|
||||
var buttonGroupA = new ObservableCollection<GuiWidget>();
|
||||
partSelectButton = new RadioIconButton(StaticData.Instance.LoadIcon(Path.Combine("ViewTransformControls", "partSelect.png"), 16, 16).SetToColor(theme.TextColor), theme)
|
||||
partSelectButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon(Path.Combine("ViewTransformControls", "partSelect.png"), 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroupA,
|
||||
ToolTipText = "Select Parts".Localize(),
|
||||
|
|
@ -368,7 +368,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
partSelectButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.PartSelect;
|
||||
buttonGroupA.Add(partSelectButton);
|
||||
|
||||
rotateButton = new RadioIconButton(StaticData.Instance.LoadIcon(Path.Combine("ViewTransformControls", "rotate.png"), 16, 16).SetToColor(theme.TextColor), theme)
|
||||
rotateButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon(Path.Combine("ViewTransformControls", "rotate.png"), 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroupA,
|
||||
ToolTipText = "Rotate View".Localize(),
|
||||
|
|
@ -380,7 +380,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
rotateButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Rotate;
|
||||
buttonGroupA.Add(rotateButton);
|
||||
|
||||
translateButton = new RadioIconButton(StaticData.Instance.LoadIcon(Path.Combine("ViewTransformControls", "translate.png"), 16, 16).SetToColor(theme.TextColor), theme)
|
||||
translateButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon(Path.Combine("ViewTransformControls", "translate.png"), 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroupA,
|
||||
ToolTipText = "Move View".Localize(),
|
||||
|
|
@ -392,7 +392,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
translateButton.Click += (s, e) => viewControls3D.ActiveButton = ViewControls3DButtons.Translate;
|
||||
buttonGroupA.Add(translateButton);
|
||||
|
||||
zoomButton = new RadioIconButton(StaticData.Instance.LoadIcon(Path.Combine("ViewTransformControls", "scale.png"), 16, 16).SetToColor(theme.TextColor), theme)
|
||||
zoomButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon(Path.Combine("ViewTransformControls", "scale.png"), 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
SiblingRadioButtonList = buttonGroupA,
|
||||
ToolTipText = "Zoom View".Localize(),
|
||||
|
|
@ -465,7 +465,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
|
||||
// add the home button
|
||||
var homeButton = new IconButton(StaticData.Instance.LoadIcon("fa-home_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var homeButton = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-home_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Reset View".Localize(),
|
||||
Margin = theme.ButtonSpacing
|
||||
|
|
@ -474,7 +474,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
homeButton.MouseLeaveBounds += (s1, e1) => ApplicationController.Instance.UiHint = "";
|
||||
AddRoundButton(homeButton, RotatedMargin(homeButton, MathHelper.Tau * .3)).Click += (s, e) => viewControls3D.NotifyResetView();
|
||||
|
||||
var zoomToSelectionButton = new IconButton(StaticData.Instance.LoadIcon("select.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var zoomToSelectionButton = new ThemedIconButton(StaticData.Instance.LoadIcon("select.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "Zoom to selection button",
|
||||
ToolTipText = "Zoom to Selection".Localize(),
|
||||
|
|
@ -496,7 +496,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
var turntableEnabled = UserSettings.Instance.get(UserSettingsKey.TurntableMode) != "False";
|
||||
TrackballTumbleWidget.TurntableEnabled = turntableEnabled;
|
||||
|
||||
var turnTableButton = new RadioIconButton(StaticData.Instance.LoadIcon("spin.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var turnTableButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon("spin.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Turntable Mode".Localize(),
|
||||
Margin = theme.ButtonSpacing,
|
||||
|
|
@ -522,7 +522,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
var perspectiveEnabled = UserSettings.Instance.get(UserSettingsKey.PerspectiveMode) != false.ToString();
|
||||
TrackballTumbleWidget.ChangeProjectionMode(perspectiveEnabled, false);
|
||||
var projectionButton = new RadioIconButton(StaticData.Instance.LoadIcon("perspective.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var projectionButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon("perspective.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "Projection mode button",
|
||||
ToolTipText = "Perspective Mode".Localize(),
|
||||
|
|
@ -551,7 +551,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
cubeCenterFromRightTop.X -= bottomButtonOffset;
|
||||
|
||||
// put in the bed and build volume buttons
|
||||
var bedButton = new RadioIconButton(StaticData.Instance.LoadIcon("bed.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var bedButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon("bed.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "Bed Button",
|
||||
ToolTipText = "Show Print Bed".Localize(),
|
||||
|
|
@ -560,7 +560,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
SiblingRadioButtonList = new List<GuiWidget>(),
|
||||
};
|
||||
AddRoundButton(bedButton, new Vector2((cubeCenterFromRightTop.X + 18 * scale - bedButton.Width / 2) / scale, startHeight));
|
||||
var printAreaButton = new RadioIconButton(StaticData.Instance.LoadIcon("print_area.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var printAreaButton = new ThemedRadioIconButton(StaticData.Instance.LoadIcon("print_area.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "Bed Button",
|
||||
ToolTipText = BuildHeightValid() ? "Show Print Area".Localize() : "Define printer build height to enable",
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
public class ViewStyleButton : DropButton
|
||||
{
|
||||
private IconButton iconButton;
|
||||
private ThemedIconButton iconButton;
|
||||
private ISceneContext sceneContext;
|
||||
|
||||
private Dictionary<RenderTypes, (ImageBuffer image, string toolTip)> viewData;
|
||||
|
|
@ -67,7 +67,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
|
||||
var renderType = sceneContext.ViewState.RenderType;
|
||||
this.AddChild(iconButton = new IconButton(viewData[renderType].image, theme)
|
||||
this.AddChild(iconButton = new ThemedIconButton(viewData[renderType].image, theme)
|
||||
{
|
||||
Selectable = false
|
||||
});
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private MainViewWidget mainViewWidget = null;
|
||||
private readonly PopupMenuButton bedMenuButton;
|
||||
private readonly UndoBuffer undoBuffer;
|
||||
private readonly IconButton undoButton;
|
||||
private readonly IconButton redoButton;
|
||||
private readonly ThemedIconButton undoButton;
|
||||
private readonly ThemedIconButton redoButton;
|
||||
|
||||
public ViewToolBarControls(PartWorkspace workspace, ThemeConfig theme, UndoBuffer undoBuffer, bool isPrinterType, bool showPrintButton)
|
||||
{
|
||||
|
|
@ -123,7 +123,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
this.AddChild(new ToolbarSeparator(theme.GetBorderColor(50), theme.SeparatorMargin));
|
||||
|
||||
undoButton = new IconButton(StaticData.Instance.LoadIcon("undo.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
undoButton = new ThemedIconButton(StaticData.Instance.LoadIcon("undo.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "3D View Undo",
|
||||
ToolTipText = "Undo".Localize(),
|
||||
|
|
@ -140,7 +140,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
this.AddChild(undoButton);
|
||||
|
||||
redoButton = new IconButton(StaticData.Instance.LoadIcon("redo.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
redoButton = new ThemedIconButton(StaticData.Instance.LoadIcon("redo.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "3D View Redo",
|
||||
Margin = theme.ButtonSpacing,
|
||||
|
|
@ -159,7 +159,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (showPrintButton)
|
||||
{
|
||||
var printButton = new TextButton("Print", theme)
|
||||
var printButton = new ThemedTextButton("Print", theme)
|
||||
{
|
||||
Name = "Print Button",
|
||||
BackgroundColor = theme.AccentMimimalOverlay
|
||||
|
|
@ -253,7 +253,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (namedAction.Icon != null)
|
||||
{
|
||||
button = new IconButton(namedAction.Icon(theme), theme)
|
||||
button = new ThemedIconButton(namedAction.Icon(theme), theme)
|
||||
{
|
||||
Name = namedAction.Title + " Button",
|
||||
ToolTipText = namedAction.Title,
|
||||
|
|
@ -271,7 +271,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
else
|
||||
{
|
||||
button = new TextButton(namedAction.Title, theme)
|
||||
button = new ThemedTextButton(namedAction.Title, theme)
|
||||
{
|
||||
Name = namedAction.Title + " Button",
|
||||
Margin = theme.ButtonSpacing,
|
||||
|
|
@ -484,7 +484,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
buttonGroup.AddChild(operationButton);
|
||||
}
|
||||
|
||||
var collapseButton = buttonGroup.AddChild(new IconButton(StaticData.Instance.LoadIcon("collapse_single.png", 8, 16).SetToColor(theme.TextColor), theme));
|
||||
var collapseButton = buttonGroup.AddChild(new ThemedIconButton(StaticData.Instance.LoadIcon("collapse_single.png", 8, 16).SetToColor(theme.TextColor), theme));
|
||||
collapseButton.Width = 16 * DeviceScale;
|
||||
collapseButton.ToolTipText = "Collapse".Localize();
|
||||
|
||||
|
|
@ -536,7 +536,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (defaultOperation != operation)
|
||||
{
|
||||
// Update button
|
||||
var iconButton = actionAndDropDown.Children.OfType<IconButton>().First();
|
||||
var iconButton = actionAndDropDown.Children.OfType<ThemedIconButton>().First();
|
||||
iconButton.SetIcon(operation.Icon(theme));
|
||||
iconButton.ToolTipText = operation.HelpText ?? operation.Title;
|
||||
|
||||
|
|
@ -743,7 +743,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
popupMenu.DrawArrow = true;
|
||||
openLibraryButton.Selectable = true;
|
||||
|
||||
if (popupMenu.Children<SimpleButton>().FirstOrDefault() is SimpleButton simpleButton)
|
||||
if (popupMenu.Children<ThemedButton>().FirstOrDefault() is ThemedButton simpleButton)
|
||||
{
|
||||
simpleButton.Padding = 0;
|
||||
};
|
||||
|
|
@ -779,7 +779,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (operation is OperationGroup operationGroup
|
||||
&& button is PopupMenuButton splitButton
|
||||
&& button.Descendants<IconButton>().FirstOrDefault() is IconButton iconButton)
|
||||
&& button.Descendants<ThemedIconButton>().FirstOrDefault() is ThemedIconButton iconButton)
|
||||
{
|
||||
var defaultOperation = operationGroup.GetDefaultOperation();
|
||||
iconButton.Enabled = defaultOperation.IsEnabled(sceneContext);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
null,
|
||||
theme));
|
||||
|
||||
var runWizardButton = new IconButton(StaticData.Instance.LoadIcon("compass.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var runWizardButton = new ThemedIconButton(StaticData.Instance.LoadIcon("compass.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing,
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
{
|
||||
foreach (GCodeMacro macro in printer.Settings.Macros)
|
||||
{
|
||||
var macroButton = new TextButton(GCodeMacro.FixMacroName(macro.Name), theme)
|
||||
var macroButton = new ThemedTextButton(GCodeMacro.FixMacroName(macro.Name), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = new BorderDouble(right: 5)
|
||||
|
|
@ -107,7 +107,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
{
|
||||
var widget = new MacroControls(printer, theme);
|
||||
|
||||
var editButton = new IconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme);
|
||||
var editButton = new ThemedIconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme);
|
||||
editButton.Click += (s, e) =>
|
||||
{
|
||||
DialogWindow.Show(new MacroListPage(printer.Settings));
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
{
|
||||
var widget = new MovementControls(printer, new XYZColors(theme), theme);
|
||||
|
||||
var editButton = new IconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme);
|
||||
var editButton = new ThemedIconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme);
|
||||
editButton.Click += (s, e) => widget.EditOptions();
|
||||
|
||||
return new SectionWidget(
|
||||
|
|
@ -130,7 +130,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
Margin = new BorderDouble(bottom: 10)
|
||||
};
|
||||
|
||||
var homeIcon = new IconButton(StaticData.Instance.LoadIcon("fa-home_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var homeIcon = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-home_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Home X, Y and Z".Localize(),
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
@ -139,7 +139,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
homeIcon.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.XYZ);
|
||||
toolbar.AddChild(homeIcon);
|
||||
|
||||
var homeXButton = new TextButton("X", theme)
|
||||
var homeXButton = new ThemedTextButton("X", theme)
|
||||
{
|
||||
ToolTipText = "Home X".Localize(),
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
homeXButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.X);
|
||||
toolbar.AddChild(homeXButton);
|
||||
|
||||
var homeYButton = new TextButton("Y", theme)
|
||||
var homeYButton = new ThemedTextButton("Y", theme)
|
||||
{
|
||||
ToolTipText = "Home Y".Localize(),
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
@ -157,7 +157,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
homeYButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.Y);
|
||||
toolbar.AddChild(homeYButton);
|
||||
|
||||
var homeZButton = new TextButton("Z", theme)
|
||||
var homeZButton = new ThemedTextButton("Z", theme)
|
||||
{
|
||||
ToolTipText = "Home Z".Localize(),
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
@ -168,7 +168,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
|
||||
if (printer.Settings.GetValue<bool>(SettingsKey.has_c_axis))
|
||||
{
|
||||
var homeCButton = new TextButton("C", theme)
|
||||
var homeCButton = new ThemedTextButton("C", theme)
|
||||
{
|
||||
ToolTipText = "Home C".Localize(),
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
|
|
@ -196,7 +196,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
toolbar.AddChild(new HorizontalSpacer());
|
||||
|
||||
// Create 'Release' button
|
||||
var disableMotors = new TextButton("Release".Localize(), theme)
|
||||
var disableMotors = new ThemedTextButton("Release".Localize(), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ namespace MatterHackers.MatterControl
|
|||
MinimumSize = new Vector2(125, 0)
|
||||
});
|
||||
|
||||
var editButton = new IconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var editButton = new ThemedIconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Name = "Edit Leveling Data Button",
|
||||
ToolTipText = "Edit Leveling Data".Localize(),
|
||||
|
|
@ -345,7 +345,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private GuiWidget AddRunStageButton(string title, ThemeConfig theme, ISetupWizard stage, FlowLayoutWidget leftToRight)
|
||||
{
|
||||
var runStage = leftToRight.AddChild(new TextButton(title, theme)
|
||||
var runStage = leftToRight.AddChild(new ThemedTextButton(title, theme)
|
||||
{
|
||||
VAnchor = VAnchor.Bottom,
|
||||
Enabled = printer.Connection.IsConnected && !printer.Connection.Printing && !printer.Connection.Paused,
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
public class TemperatureControls : FlowLayoutWidget
|
||||
{
|
||||
private PrinterConfig printer;
|
||||
private TextButton preHeatButton;
|
||||
private TextButton offButton;
|
||||
private ThemedTextButton preHeatButton;
|
||||
private ThemedTextButton offButton;
|
||||
|
||||
private TemperatureControls(PrinterConfig printer, ThemeConfig theme)
|
||||
: base(FlowDirection.TopToBottom)
|
||||
|
|
@ -89,7 +89,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
var container = new FlowLayoutWidget();
|
||||
heatersRow.AddChild(container);
|
||||
|
||||
preHeatButton = new TextButton("Preheat".Localize(), theme)
|
||||
preHeatButton = new ThemedTextButton("Preheat".Localize(), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = new BorderDouble(right: 10)
|
||||
|
|
@ -107,7 +107,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
printer.Connection.TurnOffBedAndExtruders(TurnOff.AfterDelay);
|
||||
};
|
||||
|
||||
offButton = new TextButton("Off".Localize(), theme)
|
||||
offButton = new ThemedTextButton("Off".Localize(), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ namespace MatterHackers.MatterControl
|
|||
Margin = new BorderDouble(left: 10)
|
||||
};
|
||||
|
||||
keyboardImage = new IconButton(StaticData.Instance.LoadIcon("hot_key_small_white.png", 19, 12).SetToColor(theme.TextColor), theme)
|
||||
keyboardImage = new ThemedIconButton(StaticData.Instance.LoadIcon("hot_key_small_white.png", 19, 12).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
HAnchor = HAnchor.Center,
|
||||
Margin = new BorderDouble(5),
|
||||
|
|
@ -699,7 +699,7 @@ namespace MatterHackers.MatterControl
|
|||
return xyGrid;
|
||||
}
|
||||
|
||||
public class MoveButton : TextButton
|
||||
public class MoveButton : ThemedTextButton
|
||||
{
|
||||
//Amounts in millimeters
|
||||
public double MoveAmount { get; set; } = 10;
|
||||
|
|
@ -743,7 +743,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public class ExtrudeButton : TextButton
|
||||
public class ExtrudeButton : ThemedTextButton
|
||||
{
|
||||
//Amounts in millimeters
|
||||
public double MoveAmount = 10;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl
|
|||
theme.ApplyBoxStyle(generalSection);
|
||||
|
||||
// Print Notifications
|
||||
var configureNotificationsButton = new IconButton(configureIcon, theme)
|
||||
var configureNotificationsButton = new ThemedIconButton(configureIcon, theme)
|
||||
{
|
||||
Name = "Configure Notification Settings Button",
|
||||
ToolTipText = "Configure Notifications".Localize(),
|
||||
|
|
@ -267,7 +267,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
TextWidget sectionLabel = null;
|
||||
|
||||
var textSizeApplyButton = new TextButton("Apply".Localize(), theme)
|
||||
var textSizeApplyButton = new ThemedTextButton("Apply".Localize(), theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
BackgroundColor = theme.SlightShade,
|
||||
|
|
@ -351,7 +351,7 @@ namespace MatterHackers.MatterControl
|
|||
true,
|
||||
false);
|
||||
|
||||
var openCacheButton = new IconButton(StaticData.Instance.LoadIcon("fa-link_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var openCacheButton = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-link_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Open Folder".Localize(),
|
||||
};
|
||||
|
|
@ -367,7 +367,7 @@ namespace MatterHackers.MatterControl
|
|||
theme),
|
||||
advancedPanel);
|
||||
|
||||
var clearCacheButton = new HoverIconButton(StaticData.Instance.LoadIcon("remove.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var clearCacheButton = new ThemedHoverIconButton(StaticData.Instance.LoadIcon("remove.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Clear Cache".Localize(),
|
||||
};
|
||||
|
|
@ -386,7 +386,7 @@ namespace MatterHackers.MatterControl
|
|||
#if DEBUG
|
||||
var configureIcon = StaticData.Instance.LoadIcon("fa-cog_16.png", 16, 16).SetToColor(theme.TextColor);
|
||||
|
||||
var configurePluginsButton = new IconButton(configureIcon, theme)
|
||||
var configurePluginsButton = new ThemedIconButton(configureIcon, theme)
|
||||
{
|
||||
ToolTipText = "Configure Plugins".Localize(),
|
||||
Margin = 0
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
|
||||
generalPanel.AddChild(buttonContainer);
|
||||
var updateButton = new TextButton("Update Setting".Localize(), theme)
|
||||
var updateButton = new ThemedTextButton("Update Setting".Localize(), theme)
|
||||
{
|
||||
Margin = new BorderDouble(0, 3, 20, 0),
|
||||
Name = setting.key + " Update",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2019, Lars Brubaker, John Lewin
|
||||
Copyright (c) 2022, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
theme.ApplyBottomBorder(toolbar);
|
||||
|
||||
toolbar.AddChild(new TextButton("MatterControl Help".Localize(), theme)
|
||||
toolbar.AddChild(new ThemedTextButton("MatterControl Help".Localize(), theme)
|
||||
{
|
||||
Padding = new BorderDouble(6, 0),
|
||||
Selectable = false
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public abstract class SelectablePrinterPage : DialogPage
|
||||
{
|
||||
protected TextButton nextButton;
|
||||
protected ThemedTextButton nextButton;
|
||||
protected TreeNode rootPrintersNode;
|
||||
|
||||
public SelectablePrinterPage(string continueButtonText)
|
||||
|
|
@ -129,7 +129,7 @@ namespace MatterHackers.MatterControl
|
|||
treeView.ScrollArea.HAnchor = HAnchor.Stretch;
|
||||
contentRow.AddChild(treeView);
|
||||
|
||||
nextButton = new TextButton(continueButtonText, theme)
|
||||
nextButton = new ThemedTextButton(continueButtonText, theme)
|
||||
{
|
||||
Enabled = false
|
||||
};
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ namespace MatterHackers.MatterControl.Tour
|
|||
return new RectangleDouble(0, 0, totalWidth, totalHeight);
|
||||
}
|
||||
|
||||
private class ArrowButton : TextButton
|
||||
private class ArrowButton : ThemedTextButton
|
||||
{
|
||||
public ArrowButton(string text, ArrowDirection arrowDirection, ThemeConfig theme, double pointSize = -1)
|
||||
: base(text, theme, pointSize)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
Name = "Preset Pulldown Container"
|
||||
};
|
||||
|
||||
editButton = new IconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
editButton = new ThemedIconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
ToolTipText = "Edit Selected Setting".Localize(),
|
||||
Enabled = dropDownList.SelectedIndex != -1,
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
if (settingsSection.Name == "Slice Simple"
|
||||
&& UserSettings.Instance.get(UserSettingsKey.SliceSettingsMoreClicked) != "true")
|
||||
{
|
||||
var button = new TextButton("More".Localize(), theme, 8)
|
||||
var button = new ThemedTextButton("More".Localize(), theme, 8)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
BackgroundColor = new Color(theme.AccentMimimalOverlay, 50),
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
if (ShowPortWizardButton)
|
||||
{
|
||||
var configureIcon = new IconButton(StaticData.Instance.LoadIcon("fa-cog_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var configureIcon = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-cog_16.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing,
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
private void EnableReduceWidth(RadioTextButton enumTab)
|
||||
private void EnableReduceWidth(ThemedRadioTextButton enumTab)
|
||||
{
|
||||
var deviceScale = GuiWidget.DeviceScale;
|
||||
var padingSize = enumTab.Padding.Left * deviceScale;
|
||||
|
|
@ -194,7 +194,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
var localIndex = index;
|
||||
|
||||
var radioButton = new RadioTextButton(item.name, theme)
|
||||
var radioButton = new ThemedRadioTextButton(item.name, theme)
|
||||
{
|
||||
ToolTipText = item.description,
|
||||
};
|
||||
|
|
@ -206,7 +206,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
radioButton.CheckedStateChanged += (s, e) =>
|
||||
{
|
||||
var button = s as RadioTextButton;
|
||||
var button = s as ThemedRadioTextButton;
|
||||
button.TextColor = button.Checked ? theme.BackgroundColor : theme.TextColor;
|
||||
};
|
||||
|
||||
|
|
@ -258,9 +258,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.Content = menuRow;
|
||||
}
|
||||
|
||||
public static RadioTextButton CreateThemedRadioButton(string text, string key, string toolTipText, bool startChecked, Action setChecked, ThemeConfig theme)
|
||||
public static ThemedRadioTextButton CreateThemedRadioButton(string text, string key, string toolTipText, bool startChecked, Action setChecked, ThemeConfig theme)
|
||||
{
|
||||
var radioButton = new RadioTextButton(text, theme)
|
||||
var radioButton = new ThemedRadioTextButton(text, theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center | VAnchor.Fit,
|
||||
DrawUnderline = false,
|
||||
|
|
@ -276,7 +276,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
radioButton.CheckedStateChanged += (s, e) =>
|
||||
{
|
||||
var button = s as RadioTextButton;
|
||||
var button = s as ThemedRadioTextButton;
|
||||
button.TextColor = button.Checked ? theme.BackgroundColor : theme.TextColor;
|
||||
};
|
||||
|
||||
|
|
@ -294,9 +294,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return radioButton;
|
||||
}
|
||||
|
||||
public static TextButton CreateThemedButton(string text, string key, string toolTipText, ThemeConfig theme)
|
||||
public static ThemedTextButton CreateThemedButton(string text, string key, string toolTipText, ThemeConfig theme)
|
||||
{
|
||||
var button = new TextButton(text, theme)
|
||||
var button = new ThemedTextButton(text, theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center | VAnchor.Fit,
|
||||
BackgroundRadius = (theme.ButtonRadius + 4) * GuiWidget.DeviceScale,
|
||||
|
|
@ -333,7 +333,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
iconImage = StaticData.Instance.LoadIcon(iconPath);
|
||||
}
|
||||
|
||||
var radioButton = new RadioIconButton(iconImage, theme)
|
||||
var radioButton = new ThemedRadioIconButton(iconImage, theme)
|
||||
{
|
||||
ToolTipText = item.description == null ? item.name : item.description,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
class IpAddessField : UIField
|
||||
{
|
||||
private DropDownList dropdownList;
|
||||
private IconButton refreshButton;
|
||||
private ThemedIconButton refreshButton;
|
||||
|
||||
private PrinterConfig printer;
|
||||
private ThemeConfig theme;
|
||||
|
|
@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
var widget = new FlowLayoutWidget();
|
||||
widget.AddChild(dropdownList);
|
||||
refreshButton = new IconButton(StaticData.Instance.LoadIcon("fa-refresh_14.png", 14, 14).SetToColor(theme.TextColor), theme)
|
||||
refreshButton = new ThemedIconButton(StaticData.Instance.LoadIcon("fa-refresh_14.png", 14, 14).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
Margin = new BorderDouble(left: 5)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.Content.AddChild(inlineEdit);
|
||||
}
|
||||
|
||||
var addItem = new IconButton(StaticData.Instance.LoadIcon("md-add-circle_18.png", 18, 18).SetToColor(theme.TextColor), theme)
|
||||
var addItem = new ThemedIconButton(StaticData.Instance.LoadIcon("md-add-circle_18.png", 18, 18).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
HAnchor = HAnchor.Right | HAnchor.Absolute,
|
||||
Width = theme.ButtonHeight,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public override void Initialize(int tabIndex)
|
||||
{
|
||||
var editButton = new IconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
var editButton = new ThemedIconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
VAnchor = VAnchor.Top,
|
||||
ToolTipText = "Edit".Localize(),
|
||||
|
|
|
|||
|
|
@ -202,6 +202,9 @@ Translated:Action Recommended
|
|||
English:Action Required
|
||||
Translated:Action Required
|
||||
|
||||
English:Actions
|
||||
Translated:Actions
|
||||
|
||||
English:Add
|
||||
Translated:Add
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit f3a1fbc748f00e0b7318909b0854a5627fa0476d
|
||||
Subproject commit 32f66080ec934759c1dd7050e620652dfda347e7
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
using System;
|
||||
/*
|
||||
Copyright (c) 2022, Lars Brubaker
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.MatterControl;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
using MatterHackers.MatterControl.Tests.Automation;
|
||||
using MatterHackers.VectorMath;
|
||||
using NUnit.Framework;
|
||||
|
|
@ -43,7 +43,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
{
|
||||
systemWindow.Padding = systemWindow.Padding.Clone(bottom: 180);
|
||||
|
||||
var button = new TextButton("Popup", systemWindow.Theme)
|
||||
var button = new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "targetA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -102,7 +102,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
{
|
||||
Mate = new MateOptions(MateEdge.Left, MateEdge.Bottom)
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -138,7 +138,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
{
|
||||
Mate = new MateOptions(MateEdge.Left, MateEdge.Top)
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -174,7 +174,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
{
|
||||
Mate = new MateOptions(MateEdge.Left, MateEdge.Top)
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -210,7 +210,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
{
|
||||
Mate = new MateOptions(MateEdge.Left, MateEdge.Bottom)
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -249,7 +249,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
|
||||
AltMate = new MateOptions(MateEdge.Left, MateEdge.Bottom)
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -291,7 +291,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
|
||||
AltMate = new MateOptions(MateEdge.Left, MateEdge.Bottom)
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -335,7 +335,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
Mate = new MateOptions(MateEdge.Left, MateEdge.Bottom),
|
||||
AltMate = new MateOptions(MateEdge.Left, MateEdge.Top),
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -377,7 +377,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
Mate = new MateOptions(MateEdge.Left, MateEdge.Bottom),
|
||||
AltMate = new MateOptions(MateEdge.Left, MateEdge.Top),
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -424,7 +424,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
|
||||
AltMate = new MateOptions(MateEdge.Left, MateEdge.Bottom)
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -476,7 +476,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
Mate = new MateOptions(MateEdge.Left, MateEdge.Bottom),
|
||||
AltMate = new MateOptions(MateEdge.Right, MateEdge.Top),
|
||||
},
|
||||
new TextButton("Popup", systemWindow.Theme)
|
||||
new ThemedTextButton("Popup", systemWindow.Theme)
|
||||
{
|
||||
Name = "buttonA",
|
||||
VAnchor = VAnchor.Bottom,
|
||||
|
|
@ -502,7 +502,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
}
|
||||
|
||||
|
||||
private static async Task AnchorTests(PopupsTestWindow systemWindow, MatePoint anchor, MatePoint popup, TextButton button, Action<GuiWidget, GuiWidget> validator, Action<GuiWidget> rowAdjuster = null)
|
||||
private static async Task AnchorTests(PopupsTestWindow systemWindow, MatePoint anchor, MatePoint popup, ThemedTextButton button, Action<GuiWidget, GuiWidget> validator, Action<GuiWidget> rowAdjuster = null)
|
||||
{
|
||||
await systemWindow.RunTest(testRunner =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue