Remove AppSettings wrap widgets, convert to concise white settings menu

This commit is contained in:
John Lewin 2017-06-15 23:55:01 -07:00
parent d080613eab
commit 8cccf19323
7 changed files with 50 additions and 101 deletions

View file

@ -44,7 +44,7 @@ using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.ConfigurationPage
{
public class ApplicationSettingsWidget : FlowLayoutWidget
public class ApplicationSettingsWidget : FlowLayoutWidget, IIgnoredPopupChild
{
public static Action OpenPrintNotification = null;
@ -52,6 +52,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage
private string cannotRestartWhileActive = "Unable to restart".Localize();
private TextImageButtonFactory buttonFactory;
private RGBA_Bytes menuTextColor = RGBA_Bytes.Black;
public ApplicationSettingsWidget(TextImageButtonFactory buttonFactory)
: base(FlowDirection.TopToBottom)
{
@ -103,13 +106,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage
notificationSettingsContainer.Margin = new BorderDouble(0, 0, 0, 0);
notificationSettingsContainer.Padding = new BorderDouble(0);
ImageBuffer notifiImage = StaticData.Instance.LoadIcon("notify-24x24.png").InvertLightness();
ImageBuffer notifiImage = StaticData.Instance.LoadIcon("notify-24x24.png");
notifiImage.SetRecieveBlender(new BlenderPreMultBGRA());
int iconSize = (int)(24 * GuiWidget.DeviceScale);
if (!ActiveTheme.Instance.IsDarkTheme)
{
notifiImage.InvertLightness();
}
ImageWidget notificationSettingsIcon = new ImageWidget(notifiImage);
notificationSettingsIcon.VAnchor = VAnchor.ParentCenter;
@ -129,14 +127,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage
var notificationSettingsLabel = new TextWidget("Notifications".Localize());
notificationSettingsLabel.AutoExpandBoundsToText = true;
notificationSettingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
notificationSettingsLabel.TextColor = menuTextColor;
notificationSettingsLabel.VAnchor = VAnchor.ParentCenter;
GuiWidget printNotificationsSwitchContainer = new FlowLayoutWidget();
printNotificationsSwitchContainer.VAnchor = VAnchor.ParentCenter;
printNotificationsSwitchContainer.Margin = new BorderDouble(left: 16);
CheckBox enablePrintNotificationsSwitch = ImageButtonFactory.CreateToggleSwitch(UserSettings.Instance.get("PrintNotificationsEnabled") == "true");
CheckBox enablePrintNotificationsSwitch = ImageButtonFactory.CreateToggleSwitch(UserSettings.Instance.get("PrintNotificationsEnabled") == "true", menuTextColor);
enablePrintNotificationsSwitch.VAnchor = VAnchor.ParentCenter;
enablePrintNotificationsSwitch.CheckedStateChanged += (sender, e) =>
{
@ -161,17 +159,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage
var settingsRow = new FlowLayoutWidget()
{
HAnchor = HAnchor.ParentLeftRight,
Margin = new BorderDouble(0, 4),
Margin = new BorderDouble(bottom: 4),
};
ImageBuffer cameraIconImage = StaticData.Instance.LoadIcon("camera-24x24.png", 24, 24).InvertLightness();
ImageBuffer cameraIconImage = StaticData.Instance.LoadIcon("camera-24x24.png", 24, 24);
cameraIconImage.SetRecieveBlender(new BlenderPreMultBGRA());
if (!ActiveTheme.Instance.IsDarkTheme)
{
cameraIconImage.InvertLightness();
}
var openCameraButton = buttonFactory.Generate("Preview".Localize().ToUpper());
openCameraButton.Click += (s, e) =>
{
@ -186,7 +179,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
settingsRow.AddChild(new TextWidget("Camera Monitoring".Localize())
{
AutoExpandBoundsToText = true,
TextColor = ActiveTheme.Instance.PrimaryTextColor,
TextColor = menuTextColor,
VAnchor = VAnchor.ParentCenter
});
settingsRow.AddChild(new HorizontalSpacer());
@ -200,7 +193,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage
Margin = new BorderDouble(left: 16)
};
CheckBox toggleSwitch = ImageButtonFactory.CreateToggleSwitch(ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.publish_bed_image));
CheckBox toggleSwitch = ImageButtonFactory.CreateToggleSwitch(ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.publish_bed_image), menuTextColor);
toggleSwitch.CheckedStateChanged += (sender, e) =>
{
ActiveSliceSettings.Instance.SetValue(SettingsKey.publish_bed_image, toggleSwitch.Checked ? "1" : "0");
@ -223,7 +217,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
TextWidget settingLabel = new TextWidget("Theme".Localize());
settingLabel.AutoExpandBoundsToText = true;
settingLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
settingLabel.TextColor = menuTextColor;
settingLabel.HAnchor = HAnchor.ParentLeft;
FlowLayoutWidget colorSelectorContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
@ -235,7 +229,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
currentColorThemeBorder.VAnchor = VAnchor.ParentBottomTop;
currentColorThemeBorder.Padding = new BorderDouble(5);
currentColorThemeBorder.Width = 80;
currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White;
currentColorThemeBorder.BackgroundColor = RGBA_Bytes.LightGray;
GuiWidget currentColorTheme = new GuiWidget();
currentColorTheme.HAnchor = HAnchor.ParentLeftRight;
@ -273,7 +267,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
AutoExpandBoundsToText = true
};
settingsLabel.AutoExpandBoundsToText = true;
settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
settingsLabel.TextColor = menuTextColor;
settingsLabel.VAnchor = VAnchor.ParentTop;
double sliderThumbWidth = 10 * GuiWidget.DeviceScale;
@ -329,7 +323,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
TextWidget settingsLabel = new TextWidget("Touch Screen Mode".Localize());
settingsLabel.AutoExpandBoundsToText = true;
settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
settingsLabel.TextColor = menuTextColor;
settingsLabel.VAnchor = VAnchor.ParentTop;
FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
@ -344,7 +338,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
List<string> acceptableUpdateFeedTypeValues = new List<string>() { "responsive", "touchscreen" };
string currentDisplayModeType = UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode);
CheckBox touchScreenModeSwitch = ImageButtonFactory.CreateToggleSwitch(currentDisplayModeType == acceptableUpdateFeedTypeValues[1]);
CheckBox touchScreenModeSwitch = ImageButtonFactory.CreateToggleSwitch(currentDisplayModeType == acceptableUpdateFeedTypeValues[1], menuTextColor);
touchScreenModeSwitch.VAnchor = VAnchor.ParentCenter;
touchScreenModeSwitch.CheckedStateChanged += (sender, e) =>
{
@ -375,7 +369,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
TextWidget settingsLabel = new TextWidget("Interface Mode".Localize());
settingsLabel.AutoExpandBoundsToText = true;
settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
settingsLabel.TextColor = menuTextColor;
settingsLabel.VAnchor = VAnchor.ParentTop;
FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
@ -423,7 +417,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
TextWidget settingsLabel = new TextWidget("Update Notification Feed".Localize());
settingsLabel.AutoExpandBoundsToText = true;
settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
settingsLabel.TextColor = menuTextColor;
settingsLabel.VAnchor = VAnchor.ParentTop;
FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
@ -476,7 +470,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
TextWidget settingsLabel = new TextWidget("Language".Localize());
settingsLabel.AutoExpandBoundsToText = true;
settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
settingsLabel.TextColor = menuTextColor;
settingsLabel.VAnchor = VAnchor.ParentTop;
FlowLayoutWidget controlsContainer = new FlowLayoutWidget();
@ -487,6 +481,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
LanguageSelector languageSelector = new LanguageSelector();
languageSelector.TextColor = menuTextColor;
languageSelector.SelectionChanged += (s, e) =>
{
UiThread.RunOnIdle(() =>
@ -526,13 +521,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage
TextWidget settingsLabel = new TextWidget("Thumbnail Rendering".Localize());
settingsLabel.AutoExpandBoundsToText = true;
settingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
settingsLabel.TextColor = menuTextColor;
settingsLabel.VAnchor = VAnchor.ParentTop;
FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
optionsContainer.Margin = new BorderDouble(bottom: 6);
DropDownList interfaceOptionsDropList = new DropDownList("Development", maxHeight: 200);
interfaceOptionsDropList.TextColor = menuTextColor;
interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;
optionsContainer.AddChild(interfaceOptionsDropList);

View file

@ -1,66 +0,0 @@
/*
Copyright (c) 2017, Kevin Pope, 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 MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.ConfigurationPage;
using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl
{
public class PrinterConfigurationScrollWidget : ScrollableWidget, IIgnoredPopupChild
{
public PrinterConfigurationScrollWidget()
: base(true)
{
this.ScrollArea.HAnchor |= HAnchor.ParentLeftRight;
this.BackgroundColor = ApplicationController.Instance.Theme.TabBodyBackground;
this.AnchorAll();
this.AddChild(new PrinterConfigurationWidget(ApplicationController.Instance.Theme.BreadCrumbButtonFactorySmallMargins));
}
}
public class PrinterConfigurationWidget : FlowLayoutWidget
{
public PrinterConfigurationWidget(TextImageButtonFactory buttonFactory)
: base(FlowDirection.TopToBottom)
{
this.HAnchor = HAnchor.ParentLeftRight;
this.VAnchor = VAnchor.FitToChildren;
this.Padding = new BorderDouble(top: 10);
if (!ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_hardware_leveling))
{
this.AddChild(new CalibrationSettingsWidget(buttonFactory));
}
this.AddChild(new ApplicationSettingsWidget(buttonFactory));
}
}
}