2018-11-03 10:12:27 -07:00
|
|
|
|
/*
|
2019-07-07 19:49:50 -07:00
|
|
|
|
Copyright (c) 2019, Lars Brubaker, John Lewin
|
2017-06-19 09:17:57 -07:00
|
|
|
|
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;
|
2020-06-24 18:38:41 -07:00
|
|
|
|
using System.Collections.Generic;
|
2017-06-19 09:17:57 -07:00
|
|
|
|
using MatterHackers.Agg;
|
2020-06-24 18:38:41 -07:00
|
|
|
|
using MatterHackers.Agg.Image;
|
|
|
|
|
|
using MatterHackers.Agg.Platform;
|
2017-06-19 09:17:57 -07:00
|
|
|
|
using MatterHackers.Agg.UI;
|
2021-05-21 15:23:25 -07:00
|
|
|
|
using MatterHackers.ImageProcessing;
|
2020-06-24 18:38:41 -07:00
|
|
|
|
using MatterHackers.Localizations;
|
|
|
|
|
|
using MatterHackers.MatterControl.CustomWidgets;
|
|
|
|
|
|
using MatterHackers.MatterControl.PartPreviewWindow;
|
|
|
|
|
|
using MatterHackers.MatterControl.PrinterCommunication;
|
|
|
|
|
|
using MatterHackers.VectorMath;
|
2017-06-19 09:17:57 -07:00
|
|
|
|
|
|
|
|
|
|
namespace MatterHackers.MatterControl
|
|
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public class ThemeConfig3
|
2017-06-19 09:17:57 -07:00
|
|
|
|
{
|
2017-10-22 19:53:48 -07:00
|
|
|
|
public int FontSize7 { get; } = 7;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-04-14 13:01:16 -07:00
|
|
|
|
public int FontSize8 { get; } = 8;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2017-10-22 19:53:48 -07:00
|
|
|
|
public int FontSize9 { get; } = 9;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2017-10-22 19:53:48 -07:00
|
|
|
|
public int FontSize10 { get; } = 10;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2017-10-22 19:53:48 -07:00
|
|
|
|
public int FontSize11 { get; } = 11;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2017-10-22 19:53:48 -07:00
|
|
|
|
public int FontSize12 { get; } = 12;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2017-10-22 19:53:48 -07:00
|
|
|
|
public int FontSize14 { get; } = 14;
|
2017-06-19 09:17:57 -07:00
|
|
|
|
|
2018-07-12 08:17:50 -07:00
|
|
|
|
public int DefaultFontSize { get; set; } = 11;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2021-06-12 07:59:52 -07:00
|
|
|
|
public int DefaultContainerPadding { get; } = 5;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-07-12 08:17:50 -07:00
|
|
|
|
public int H1PointSize { get; } = 11;
|
2018-04-26 07:56:29 -07:00
|
|
|
|
|
|
|
|
|
|
public double ButtonHeight => 32 * GuiWidget.DeviceScale;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-04-26 07:56:29 -07:00
|
|
|
|
public double TabButtonHeight => 30 * GuiWidget.DeviceScale;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-04-26 07:56:29 -07:00
|
|
|
|
public double MenuGutterWidth => 35 * GuiWidget.DeviceScale;
|
2017-08-06 20:55:00 -07:00
|
|
|
|
|
2018-07-12 08:17:50 -07:00
|
|
|
|
private readonly int defaultScrollBarWidth = 120;
|
|
|
|
|
|
|
2021-02-25 18:13:49 -08:00
|
|
|
|
public void MakeRoundedButton(GuiWidget button, Color? boarderColor = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (button is TextButton textButton)
|
|
|
|
|
|
{
|
|
|
|
|
|
textButton.VAnchor |= VAnchor.Fit;
|
|
|
|
|
|
textButton.HAnchor |= HAnchor.Fit;
|
|
|
|
|
|
textButton.HoverColor = this.AccentMimimalOverlay;
|
|
|
|
|
|
textButton.Padding = new BorderDouble(7, 5);
|
|
|
|
|
|
if (boarderColor != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
textButton.BorderColor = boarderColor.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
textButton.BorderColor = this.TextColor;
|
|
|
|
|
|
}
|
2021-02-26 10:54:33 -08:00
|
|
|
|
textButton.BackgroundOutlineWidth = 1;
|
|
|
|
|
|
textButton.BackgroundRadius = textButton.Height / 2;
|
2021-02-25 18:13:49 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-25 08:16:17 -07:00
|
|
|
|
public BorderDouble TextButtonPadding { get; } = new BorderDouble(14, 0);
|
|
|
|
|
|
|
2018-07-12 08:17:50 -07:00
|
|
|
|
public BorderDouble ButtonSpacing { get; } = new BorderDouble(right: 3);
|
2018-05-17 12:41:32 -07:00
|
|
|
|
|
2018-07-12 08:17:50 -07:00
|
|
|
|
public BorderDouble ToolbarPadding { get; } = 3;
|
2017-06-19 18:52:10 -07:00
|
|
|
|
|
2018-07-12 08:17:50 -07:00
|
|
|
|
public BorderDouble TabbarPadding { get; } = new BorderDouble(3, 1);
|
2018-05-17 17:12:12 -07:00
|
|
|
|
|
2018-05-21 16:43:13 -07:00
|
|
|
|
/// <summary>
|
2019-07-07 19:49:50 -07:00
|
|
|
|
/// Gets the height or width of a given vertical or horizontal splitter bar
|
2018-05-21 16:43:13 -07:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int SplitterWidth
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
double splitterSize = 6 * GuiWidget.DeviceScale;
|
|
|
|
|
|
|
|
|
|
|
|
if (GuiWidget.TouchScreenMode)
|
|
|
|
|
|
{
|
|
|
|
|
|
splitterSize *= 1.4;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (int)splitterSize;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-06-19 09:17:57 -07:00
|
|
|
|
|
2018-04-16 20:31:46 -07:00
|
|
|
|
public PresetColors PresetColors { get; set; } = new PresetColors();
|
2018-01-10 13:03:12 -08:00
|
|
|
|
|
2018-10-15 08:02:30 -07:00
|
|
|
|
public bool IsDarkTheme { get; set; }
|
|
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color SlightShade { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color MinimalShade { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color Shade { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color DarkShade { get; set; }
|
2018-09-08 10:53:51 -07:00
|
|
|
|
|
2018-11-03 09:50:09 -07:00
|
|
|
|
public Color BackgroundColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-11-03 09:50:09 -07:00
|
|
|
|
public Color TextColor { get; set; } = Color.Black;
|
|
|
|
|
|
|
2018-05-08 17:23:55 -07:00
|
|
|
|
public Color TabBarBackground { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-04-10 07:35:22 -07:00
|
|
|
|
public Color InactiveTabColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2020-09-14 07:36:32 -07:00
|
|
|
|
public Color InteractionLayerOverlayColor { get; set; }
|
2018-04-17 17:13:18 -07:00
|
|
|
|
|
|
|
|
|
|
public TextWidget CreateHeading(string text)
|
|
|
|
|
|
{
|
2018-11-03 09:13:07 -07:00
|
|
|
|
return new TextWidget(text, pointSize: this.H1PointSize, textColor: this.TextColor, bold: true)
|
2018-04-17 17:13:18 -07:00
|
|
|
|
{
|
|
|
|
|
|
Margin = new BorderDouble(0, 5)
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color SplitterBackground { get; set; } = new Color(0, 0, 0, 60);
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color TabBodyBackground { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-04-10 07:35:22 -07:00
|
|
|
|
public Color ToolbarButtonBackground { get; set; } = Color.Transparent;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-04-10 07:35:22 -07:00
|
|
|
|
public Color ToolbarButtonHover => this.SlightShade;
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-04-10 07:35:22 -07:00
|
|
|
|
public Color ToolbarButtonDown => this.MinimalShade;
|
2017-10-19 09:01:07 -07:00
|
|
|
|
|
2018-04-17 09:04:56 -07:00
|
|
|
|
public Color ThumbnailBackground { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-04-17 09:04:56 -07:00
|
|
|
|
public Color AccentMimimalOverlay { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-05-17 12:41:32 -07:00
|
|
|
|
public BorderDouble SeparatorMargin { get; }
|
2018-04-17 09:04:56 -07:00
|
|
|
|
|
2018-10-14 20:05:37 -07:00
|
|
|
|
public class StateColor
|
|
|
|
|
|
{
|
2018-10-20 08:57:39 -07:00
|
|
|
|
public Color BackgroundColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-14 20:05:37 -07:00
|
|
|
|
public Color ForegroundColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-14 20:05:37 -07:00
|
|
|
|
public Color BorderColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-17 09:01:25 -07:00
|
|
|
|
public Color TextColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-11-23 18:45:29 -08:00
|
|
|
|
public Color LightTextColor { get; set; }
|
2018-10-14 20:05:37 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class ThreeStateColor
|
|
|
|
|
|
{
|
|
|
|
|
|
public StateColor Focused { get; set; } = new StateColor();
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-14 20:05:37 -07:00
|
|
|
|
public StateColor Hovered { get; set; } = new StateColor();
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-14 20:05:37 -07:00
|
|
|
|
public StateColor Inactive { get; set; } = new StateColor();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-10-20 08:57:39 -07:00
|
|
|
|
public class DropListStyle : ThreeStateColor
|
|
|
|
|
|
{
|
|
|
|
|
|
public StateColor Open { get; set; } = new StateColor();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-10-14 20:05:37 -07:00
|
|
|
|
public ThreeStateColor EditFieldColors { get; set; } = new ThreeStateColor();
|
|
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color LightTextColor { get; set; }
|
2018-10-16 21:21:42 -07:00
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color BorderColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-16 21:21:42 -07:00
|
|
|
|
public Color BorderColor40 { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-16 21:21:42 -07:00
|
|
|
|
public Color BorderColor20 { get; set; }
|
2019-04-13 01:54:01 -07:00
|
|
|
|
|
2018-10-17 20:31:58 -07:00
|
|
|
|
public Color RowBorder { get; set; }
|
2018-10-20 08:57:39 -07:00
|
|
|
|
|
|
|
|
|
|
public DropListStyle DropList { get; set; } = new DropListStyle();
|
2018-10-16 21:21:42 -07:00
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color DisabledColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-13 17:58:54 -07:00
|
|
|
|
public Color SplashAccentColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-17 14:41:32 -07:00
|
|
|
|
public Color BedBackgroundColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-15 18:25:53 -07:00
|
|
|
|
public Color PrimaryAccentColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2018-10-17 20:34:10 -07:00
|
|
|
|
public Color SectionBackgroundColor { get; set; }
|
2019-07-07 19:49:50 -07:00
|
|
|
|
|
2019-03-09 13:32:55 -08:00
|
|
|
|
public Color PopupBorderColor { get; set; }
|
2018-10-13 17:58:54 -07:00
|
|
|
|
|
2019-04-13 01:54:01 -07:00
|
|
|
|
public Color BedColor { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Color UnderBedColor { get; set; }
|
|
|
|
|
|
|
2019-04-13 14:49:13 -07:00
|
|
|
|
public Color PrinterBedTextColor { get; set; }
|
2019-04-13 01:54:01 -07:00
|
|
|
|
|
2019-06-06 13:28:10 -07:00
|
|
|
|
public GridColors BedGridColors { get; set; } = new GridColors();
|
2021-03-03 17:38:09 -08:00
|
|
|
|
public double ButtonRadius { get; set; } = 3;
|
2019-04-13 01:54:01 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public void SetDefaults()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.DisabledColor = new Color(this.LightTextColor, 50);
|
|
|
|
|
|
this.SplashAccentColor = new Color(this.PrimaryAccentColor, 185).OverlayOn(Color.White).ToColor();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Color GetBorderColor(int alpha)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new Color(this.BorderColor, alpha);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Compute an opaque color from a source and a target with alpha
|
|
|
|
|
|
public Color ResolveColor(Color background, Color overlay)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ResolveColor2(background, overlay);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Compute an opaque color from a source and a target with alpha
|
|
|
|
|
|
public static Color ResolveColor2(Color background, Color overlay)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new BlenderBGRA().Blend(background, overlay);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public SolidSlider CreateSolidSlider(GuiWidget wordOptionContainer, string header, ThemeConfig theme, double min = 0, double max = .5)
|
2018-01-10 23:21:46 -08:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
double scrollBarWidth = 10;
|
|
|
|
|
|
|
|
|
|
|
|
wordOptionContainer.AddChild(new TextWidget(header, textColor: this.TextColor)
|
2018-01-10 23:21:46 -08:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
Margin = new BorderDouble(10, 3, 3, 5),
|
|
|
|
|
|
HAnchor = HAnchor.Left
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var namedSlider = new SolidSlider(new Vector2(), scrollBarWidth, theme, 0, 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
TotalWidthInPixels = defaultScrollBarWidth,
|
|
|
|
|
|
Minimum = min,
|
|
|
|
|
|
Maximum = max,
|
|
|
|
|
|
Margin = new BorderDouble(12, 4),
|
|
|
|
|
|
HAnchor = HAnchor.Stretch,
|
2018-01-10 23:21:46 -08:00
|
|
|
|
};
|
2022-07-15 17:28:39 -07:00
|
|
|
|
|
|
|
|
|
|
wordOptionContainer.AddChild(namedSlider);
|
|
|
|
|
|
|
|
|
|
|
|
return namedSlider;
|
2018-01-10 23:21:46 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public MenuItem CreateCheckboxMenuItem(string text, string itemValue, bool itemChecked, BorderDouble padding, EventHandler eventHandler)
|
2018-04-26 07:56:29 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
var checkbox = new CheckBox(text)
|
|
|
|
|
|
{
|
|
|
|
|
|
Checked = itemChecked
|
|
|
|
|
|
};
|
|
|
|
|
|
checkbox.CheckedStateChanged += eventHandler;
|
|
|
|
|
|
|
|
|
|
|
|
return new MenuItem(checkbox, itemValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
Padding = padding,
|
|
|
|
|
|
};
|
2018-04-26 07:56:29 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public void ApplyBottomBorder(GuiWidget widget, bool shadedBorder = false)
|
2017-06-19 09:17:57 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
widget.BorderColor = shadedBorder ? this.MinimalShade : this.BorderColor20;
|
|
|
|
|
|
|
|
|
|
|
|
this.ApplyBorder(widget, new BorderDouble(bottom: 1), shadedBorder);
|
2018-10-13 17:58:54 -07:00
|
|
|
|
}
|
2017-06-19 09:17:57 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public void ApplyBorder(GuiWidget widget, BorderDouble border, bool shadedBorder = false)
|
2018-10-13 17:58:54 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
widget.BorderColor = shadedBorder ? this.MinimalShade : this.BorderColor20;
|
|
|
|
|
|
widget.Border = border;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-04-26 07:56:29 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public class PresetColors
|
|
|
|
|
|
{
|
|
|
|
|
|
public Color MaterialPreset { get; set; } = Color.Orange;
|
2017-06-19 09:17:57 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public Color ScenePreset { get; set; } = Color.Green;
|
2018-06-26 08:40:28 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public Color QualityPreset { get; set; } = Color.Yellow;
|
|
|
|
|
|
|
|
|
|
|
|
public Color UserOverride { get; set; } = new Color(68, 95, 220, 150);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class GridColors
|
|
|
|
|
|
{
|
|
|
|
|
|
public Color Red { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Color Green { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Color Blue { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Color Line { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class SplitButtonParams
|
|
|
|
|
|
{
|
|
|
|
|
|
public ImageBuffer Icon { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool ButtonEnabled { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
|
|
public string ButtonName { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Action<GuiWidget> ButtonAction { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public string ButtonTooltip { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Action MenuAction { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Action<PopupMenu> ExtendPopupMenu { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public string ButtonText { get; set; }
|
2017-11-21 11:11:07 -08:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public Color BackgroundColor { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class MatterHackersThemeConfigExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
public static JogControls.MoveButton CreateMoveButton(this ThemeConfig config, PrinterConfig printer, string label, PrinterConnection.Axis axis, double movementFeedRate, bool levelingButtons = false)
|
2018-04-15 11:30:03 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
return new JogControls.MoveButton(label, printer, axis, movementFeedRate, config)
|
2018-04-15 11:30:03 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
BackgroundColor = config.MinimalShade,
|
|
|
|
|
|
BorderColor = config.BorderColor40,
|
2021-02-26 11:38:24 -08:00
|
|
|
|
BackgroundOutlineWidth = 1,
|
2018-04-15 11:30:03 -07:00
|
|
|
|
VAnchor = VAnchor.Absolute,
|
|
|
|
|
|
HAnchor = HAnchor.Absolute,
|
|
|
|
|
|
Margin = 0,
|
|
|
|
|
|
Padding = 0,
|
|
|
|
|
|
Height = (levelingButtons ? 45 : 40) * GuiWidget.DeviceScale,
|
|
|
|
|
|
Width = (levelingButtons ? 90 : 40) * GuiWidget.DeviceScale,
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static JogControls.ExtrudeButton CreateExtrudeButton(this ThemeConfig config, PrinterConfig printer, string label, double movementFeedRate, int extruderNumber, bool levelingButtons = false)
|
2018-04-15 11:30:03 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
return new JogControls.ExtrudeButton(printer, label, movementFeedRate, extruderNumber, config)
|
2018-04-15 11:30:03 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
BackgroundColor = config.MinimalShade,
|
|
|
|
|
|
BorderColor = config.BorderColor40,
|
2021-02-26 11:38:24 -08:00
|
|
|
|
BackgroundOutlineWidth = 1,
|
2018-04-15 11:30:03 -07:00
|
|
|
|
VAnchor = VAnchor.Absolute,
|
|
|
|
|
|
HAnchor = HAnchor.Absolute,
|
|
|
|
|
|
Margin = 0,
|
|
|
|
|
|
Padding = 0,
|
|
|
|
|
|
Height = (levelingButtons ? 45 : 40) * GuiWidget.DeviceScale,
|
|
|
|
|
|
Width = (levelingButtons ? 90 : 40) * GuiWidget.DeviceScale,
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static PopupMenuButton CreateSplitButton(this ThemeConfig config, SplitButtonParams buttonParams, OperationGroup operationGroup = null)
|
2018-04-14 13:01:16 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
PopupMenuButton menuButton = null;
|
|
|
|
|
|
|
|
|
|
|
|
GuiWidget innerButton;
|
|
|
|
|
|
if (buttonParams.ButtonText == null)
|
2018-04-14 13:01:16 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
innerButton = new IconButton(buttonParams.Icon, config)
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = buttonParams.ButtonName + " Inner SplitButton",
|
|
|
|
|
|
Enabled = buttonParams.ButtonEnabled,
|
|
|
|
|
|
ToolTipText = buttonParams.ButtonTooltip,
|
|
|
|
|
|
};
|
2018-04-14 13:01:16 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
// Remove right Padding for drop style
|
|
|
|
|
|
innerButton.Padding = innerButton.Padding.Clone(right: 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (buttonParams.Icon == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
innerButton = new TextButton(buttonParams.ButtonText, config)
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = buttonParams.ButtonName,
|
|
|
|
|
|
Enabled = buttonParams.ButtonEnabled,
|
|
|
|
|
|
ToolTipText = buttonParams.ButtonTooltip,
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
innerButton = new TextIconButton(buttonParams.ButtonText, buttonParams.Icon, config)
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = buttonParams.ButtonName,
|
|
|
|
|
|
Enabled = buttonParams.ButtonEnabled,
|
|
|
|
|
|
ToolTipText = buttonParams.ButtonTooltip,
|
|
|
|
|
|
Padding = new BorderDouble(5, 0, 5, 0)
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-04-14 13:01:16 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
innerButton.Click += (s, e) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
buttonParams.ButtonAction.Invoke(menuButton);
|
|
|
|
|
|
};
|
2018-04-14 13:01:16 -07:00
|
|
|
|
|
2018-07-11 15:08:07 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
if (operationGroup == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
menuButton = new PopupMenuButton(innerButton, config);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
menuButton = new OperationGroupButton(operationGroup, innerButton, config);
|
|
|
|
|
|
}
|
2018-07-11 15:08:07 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
var theme = ApplicationController.Instance.MenuTheme;
|
|
|
|
|
|
menuButton.DynamicPopupContent = () =>
|
2018-04-14 22:01:29 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
var popupMenu = new PopupMenu(theme);
|
|
|
|
|
|
buttonParams.ExtendPopupMenu?.Invoke(popupMenu);
|
|
|
|
|
|
|
|
|
|
|
|
return popupMenu;
|
2018-04-14 22:01:29 -07:00
|
|
|
|
};
|
2022-07-15 17:28:39 -07:00
|
|
|
|
|
|
|
|
|
|
menuButton.Name = buttonParams.ButtonName + " Menu SplitButton";
|
|
|
|
|
|
menuButton.BackgroundColor = buttonParams.BackgroundColor;
|
|
|
|
|
|
if (menuButton.BackgroundColor == Color.Transparent)
|
2018-04-14 20:51:01 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
menuButton.BackgroundColor = config.ToolbarButtonBackground;
|
|
|
|
|
|
}
|
2018-04-14 20:51:01 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
menuButton.HoverColor = config.ToolbarButtonHover;
|
|
|
|
|
|
menuButton.MouseDownColor = config.ToolbarButtonDown;
|
|
|
|
|
|
menuButton.DrawArrow = true;
|
|
|
|
|
|
menuButton.Margin = config.ButtonSpacing;
|
|
|
|
|
|
menuButton.DistinctPopupButton = true;
|
|
|
|
|
|
menuButton.BackgroundRadius = new RadiusCorners(theme.ButtonRadius * GuiWidget.DeviceScale, theme.ButtonRadius * GuiWidget.DeviceScale, 0, 0);
|
2018-04-14 20:51:01 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
innerButton.Selectable = true;
|
|
|
|
|
|
return menuButton;
|
2018-04-01 09:26:39 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static GuiWidget CreateSearchButton(this ThemeConfig config)
|
2018-10-17 14:41:32 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
return new IconButton(StaticData.Instance.LoadIcon("icon_search_24x24.png", 16, 16).SetToColor(config.TextColor), config)
|
|
|
|
|
|
{
|
|
|
|
|
|
ToolTipText = "Search".Localize(),
|
|
|
|
|
|
};
|
2018-10-17 14:41:32 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static double MicroButtonHeight => 20 * GuiWidget.DeviceScale;
|
|
|
|
|
|
private static double MicroButtonWidth => 30 * GuiWidget.DeviceScale;
|
|
|
|
|
|
|
|
|
|
|
|
public static RadioTextButton CreateMicroRadioButton(this ThemeConfig config, string text, IList<GuiWidget> siblingRadioButtonList = null)
|
2017-11-21 11:11:07 -08:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
var radioButton = new RadioTextButton(text, config, config.FontSize8)
|
|
|
|
|
|
{
|
|
|
|
|
|
SiblingRadioButtonList = siblingRadioButtonList,
|
|
|
|
|
|
Padding = new BorderDouble(5, 0),
|
|
|
|
|
|
SelectedBackgroundColor = config.SlightShade,
|
|
|
|
|
|
UnselectedBackgroundColor = config.SlightShade,
|
|
|
|
|
|
HoverColor = config.AccentMimimalOverlay,
|
|
|
|
|
|
Margin = new BorderDouble(right: 1),
|
|
|
|
|
|
HAnchor = HAnchor.Absolute,
|
|
|
|
|
|
Height = config.MicroButtonHeight,
|
|
|
|
|
|
Width = MicroButtonWidth
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Add to sibling list if supplied
|
|
|
|
|
|
siblingRadioButtonList?.Add(radioButton);
|
|
|
|
|
|
|
|
|
|
|
|
return radioButton;
|
2017-06-19 09:17:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static FlowLayoutWidget CreateMenuItems(this ThemeConfig config, PopupMenu popupMenu, IEnumerable<NamedAction> menuActions)
|
2017-08-12 00:23:26 -07:00
|
|
|
|
{
|
|
|
|
|
|
// Create menu items in the DropList for each element in this.menuActions
|
|
|
|
|
|
foreach (var menuAction in menuActions)
|
|
|
|
|
|
{
|
2018-08-08 07:03:37 -07:00
|
|
|
|
if (menuAction is ActionSeparator)
|
2017-08-12 00:23:26 -07:00
|
|
|
|
{
|
2018-10-24 21:13:10 -07:00
|
|
|
|
popupMenu.CreateSeparator();
|
2017-08-12 00:23:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-05-29 19:08:41 -07:00
|
|
|
|
if (menuAction is NamedActionGroup namedActionButtons)
|
2018-01-03 15:24:55 -08:00
|
|
|
|
{
|
2020-05-29 19:08:41 -07:00
|
|
|
|
var content = new FlowLayoutWidget()
|
|
|
|
|
|
{
|
|
|
|
|
|
HAnchor = HAnchor.Fit | HAnchor.Stretch
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
var textWidget = new TextWidget(menuAction.Title, pointSize: config.DefaultFontSize, textColor: config.TextColor)
|
2020-05-29 19:08:41 -07:00
|
|
|
|
{
|
|
|
|
|
|
// Padding = MenuPadding,
|
|
|
|
|
|
VAnchor = VAnchor.Center
|
|
|
|
|
|
};
|
|
|
|
|
|
content.AddChild(textWidget);
|
|
|
|
|
|
|
|
|
|
|
|
content.AddChild(new HorizontalSpacer());
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var actionButton in namedActionButtons.Group)
|
|
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
var button = new TextButton(actionButton.Title, config)
|
2020-05-29 19:08:41 -07:00
|
|
|
|
{
|
|
|
|
|
|
Border = new BorderDouble(1, 0, 0, 0),
|
2022-07-15 17:28:39 -07:00
|
|
|
|
BorderColor = config.MinimalShade,
|
|
|
|
|
|
HoverColor = config.AccentMimimalOverlay,
|
2020-05-30 08:59:52 -07:00
|
|
|
|
Enabled = actionButton.IsEnabled()
|
2020-05-29 19:08:41 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
content.AddChild(button);
|
|
|
|
|
|
|
|
|
|
|
|
if (actionButton.IsEnabled())
|
|
|
|
|
|
{
|
|
|
|
|
|
button.Click += (s, e) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
actionButton.Action();
|
|
|
|
|
|
popupMenu.Unfocus();
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
var menuItem = new PopupMenu.MenuItem(content, config)
|
2020-05-29 19:08:41 -07:00
|
|
|
|
{
|
|
|
|
|
|
HAnchor = HAnchor.Fit | HAnchor.Stretch,
|
|
|
|
|
|
VAnchor = VAnchor.Fit,
|
|
|
|
|
|
HoverColor = Color.Transparent,
|
|
|
|
|
|
};
|
|
|
|
|
|
popupMenu.AddChild(menuItem);
|
|
|
|
|
|
menuItem.Padding = new BorderDouble(menuItem.Padding.Left,
|
|
|
|
|
|
menuItem.Padding.Bottom,
|
|
|
|
|
|
0,
|
|
|
|
|
|
menuItem.Padding.Top);
|
2018-01-03 15:24:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-05-29 19:08:41 -07:00
|
|
|
|
PopupMenu.MenuItem menuItem;
|
|
|
|
|
|
|
|
|
|
|
|
if (menuAction is NamedBoolAction boolAction)
|
|
|
|
|
|
{
|
|
|
|
|
|
menuItem = popupMenu.CreateBoolMenuItem(menuAction.Title, boolAction.GetIsActive, boolAction.SetIsActive);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
menuItem = popupMenu.CreateMenuItem(menuAction.Title, menuAction.Icon, menuAction.Shortcut);
|
|
|
|
|
|
}
|
2018-01-03 15:24:55 -08:00
|
|
|
|
|
2020-05-29 19:08:41 -07:00
|
|
|
|
menuItem.Name = $"{menuAction.Title} Menu Item";
|
2017-08-12 00:23:26 -07:00
|
|
|
|
|
2020-05-29 19:08:41 -07:00
|
|
|
|
menuItem.Enabled = menuAction is NamedActionGroup
|
|
|
|
|
|
|| (menuAction.Action != null && menuAction.IsEnabled?.Invoke() != false);
|
2017-11-29 13:50:25 -08:00
|
|
|
|
|
2020-05-29 19:08:41 -07:00
|
|
|
|
menuItem.ClearRemovedFlag();
|
2017-08-12 00:23:26 -07:00
|
|
|
|
|
2020-05-29 19:08:41 -07:00
|
|
|
|
if (menuItem.Enabled)
|
2017-11-10 13:12:02 -08:00
|
|
|
|
{
|
2020-05-29 19:08:41 -07:00
|
|
|
|
menuItem.Click += (s, e) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
menuAction.Action();
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2017-11-10 13:12:02 -08:00
|
|
|
|
}
|
2017-08-12 00:23:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-11-09 18:26:32 -08:00
|
|
|
|
return popupMenu;
|
2017-08-12 00:23:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static void ApplyPrimaryActionStyle(this ThemeConfig config, GuiWidget guiWidget)
|
2019-06-13 08:16:50 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
guiWidget.BackgroundColor = new Color(config.AccentMimimalOverlay, 50);
|
2019-06-13 08:16:50 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
Color hoverColor = config.AccentMimimalOverlay;
|
2017-11-11 17:28:03 -08:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
switch (guiWidget)
|
2017-11-11 17:28:03 -08:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
case PopupMenuButton menuButton:
|
|
|
|
|
|
menuButton.HoverColor = hoverColor;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case SimpleFlowButton flowButton:
|
|
|
|
|
|
flowButton.HoverColor = hoverColor;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case SimpleButton button:
|
|
|
|
|
|
button.HoverColor = hoverColor;
|
|
|
|
|
|
break;
|
2017-11-11 17:28:03 -08:00
|
|
|
|
}
|
2017-06-19 09:17:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static void RemovePrimaryActionStyle(this ThemeConfig config, GuiWidget guiWidget)
|
2017-06-19 09:17:57 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
guiWidget.BackgroundColor = Color.Transparent;
|
2017-07-05 14:38:36 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
// Buttons in toolbars should revert to ToolbarButtonHover when reset
|
|
|
|
|
|
bool parentIsToolbar = guiWidget.Parent?.Parent is Toolbar;
|
2017-07-05 14:38:36 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
switch (guiWidget)
|
2017-07-05 14:38:36 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
case SimpleFlowButton flowButton:
|
|
|
|
|
|
flowButton.HoverColor = parentIsToolbar ? config.ToolbarButtonHover : Color.Transparent;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case SimpleButton button:
|
|
|
|
|
|
button.HoverColor = parentIsToolbar ? config.ToolbarButtonHover : Color.Transparent;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2018-07-15 10:07:30 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static SolidSlider ApplySliderStyle(this ThemeConfig config, SolidSlider solidSlider)
|
2018-07-15 10:07:30 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
solidSlider.View.TrackColor = config.SlightShade;
|
|
|
|
|
|
solidSlider.View.TrackRadius = 4;
|
2018-07-15 10:07:30 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
return solidSlider;
|
2018-01-14 10:13:42 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static DoubleSolidSlider ApplySliderStyle(this ThemeConfig config, DoubleSolidSlider solidSlider)
|
2018-10-21 11:29:59 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
solidSlider.View.TrackColor = config.SlightShade;
|
2018-10-21 11:29:59 -07:00
|
|
|
|
solidSlider.View.TrackRadius = 4;
|
|
|
|
|
|
|
|
|
|
|
|
return solidSlider;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static SectionWidget ApplyBoxStyle(this ThemeConfig config, SectionWidget sectionWidget)
|
2018-10-21 11:29:59 -07:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
return config.ApplyBoxStyle(
|
|
|
|
|
|
sectionWidget,
|
|
|
|
|
|
config.SectionBackgroundColor,
|
|
|
|
|
|
margin: new BorderDouble(config.DefaultContainerPadding, 0, config.DefaultContainerPadding, config.DefaultContainerPadding));
|
2018-10-21 11:29:59 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-05-24 09:17:02 -07:00
|
|
|
|
// ApplySquareBoxStyle
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static SectionWidget ApplyBoxStyle(this ThemeConfig config, SectionWidget sectionWidget, BorderDouble margin)
|
2018-02-09 22:51:18 -08:00
|
|
|
|
{
|
2022-07-15 17:28:39 -07:00
|
|
|
|
sectionWidget.BackgroundColor = config.SectionBackgroundColor;
|
2019-05-24 09:17:02 -07:00
|
|
|
|
sectionWidget.Margin = 0;
|
|
|
|
|
|
sectionWidget.Border = new BorderDouble(bottom: 1);
|
2022-07-15 17:28:39 -07:00
|
|
|
|
sectionWidget.BorderColor = config.RowBorder;
|
2019-05-24 09:17:02 -07:00
|
|
|
|
|
|
|
|
|
|
return sectionWidget;
|
2018-02-09 22:51:18 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static SectionWidget ApplyBoxStyle(this ThemeConfig config, SectionWidget sectionWidget, Color backgroundColor, BorderDouble margin)
|
2018-01-14 10:13:42 -08:00
|
|
|
|
{
|
|
|
|
|
|
// Enforce panel padding
|
|
|
|
|
|
// sectionWidget.ContentPanel.Padding = new BorderDouble(10, 0, 10, 2);
|
2019-07-07 19:49:50 -07:00
|
|
|
|
// sectionWidget.ContentPanel.Padding = 0;
|
2018-01-14 10:13:42 -08:00
|
|
|
|
|
2018-04-12 21:20:31 -07:00
|
|
|
|
sectionWidget.BorderColor = Color.Transparent;
|
2018-01-14 10:13:42 -08:00
|
|
|
|
sectionWidget.BorderRadius = 5;
|
2018-02-10 00:11:20 -08:00
|
|
|
|
sectionWidget.Margin = margin;
|
2018-01-14 10:13:42 -08:00
|
|
|
|
sectionWidget.BackgroundColor = backgroundColor;
|
|
|
|
|
|
|
|
|
|
|
|
return sectionWidget;
|
|
|
|
|
|
}
|
2019-06-13 08:16:50 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static GuiWidget CreateSmallResetButton(this ThemeConfig config)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new HoverImageWidget(config.RestoreNormal, config.RestoreHover)
|
|
|
|
|
|
{
|
|
|
|
|
|
VAnchor = VAnchor.Center,
|
|
|
|
|
|
Margin = new BorderDouble(0, 0, 5, 0)
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2021-09-13 17:47:24 -07:00
|
|
|
|
|
2022-07-15 17:28:39 -07:00
|
|
|
|
public static void RebuildTheme(this ThemeConfig config)
|
|
|
|
|
|
{
|
|
|
|
|
|
config.GeneratingThumbnailIcon = StaticData.Instance.LoadIcon("building_thumbnail_40x40.png", 40, 40).SetToColor(config.TextColor);
|
|
|
|
|
|
}
|
2019-06-13 08:16:50 -07:00
|
|
|
|
}
|
2017-06-19 09:17:57 -07:00
|
|
|
|
}
|