From 49f1ce4fd5fbafffaa02da8a8d00d1466a17cdb9 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Mon, 29 Oct 2018 16:52:19 -0700 Subject: [PATCH] Add General section to Settings page, revise dialog theme styles --- .../ApplicationSettingsPage.cs | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/MatterControlLib/SettingsManagement/ApplicationSettingsPage.cs b/MatterControlLib/SettingsManagement/ApplicationSettingsPage.cs index bdf5766cc..f0e423916 100644 --- a/MatterControlLib/SettingsManagement/ApplicationSettingsPage.cs +++ b/MatterControlLib/SettingsManagement/ApplicationSettingsPage.cs @@ -40,9 +40,6 @@ using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.VectorMath; -using Newtonsoft.Json; -using static MatterHackers.MatterControl.AppContext; - namespace MatterHackers.MatterControl { public partial class ApplicationSettingsPage : DialogPage @@ -58,17 +55,27 @@ namespace MatterHackers.MatterControl this.SetCancelButtonText("Close".Localize()); contentRow.Padding = theme.DefaultContainerPadding; - contentRow.Padding = contentRow.Padding.Clone(top: 0); + contentRow.Padding = 0; + contentRow.BackgroundColor = Color.Transparent; var generalPanel = new FlowLayoutWidget(FlowDirection.TopToBottom) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit, }; - contentRow.AddChild(generalPanel); var configureIcon = AggContext.StaticData.LoadIcon("fa-cog_16.png", 16, 16, theme.InvertIcons); + var generalSection = new SectionWidget("General".Localize(), generalPanel, theme, expandingContent: false) + { + Name = "General Section", + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Fit, + }; + contentRow.AddChild(generalSection); + + theme.ApplyBoxStyle(generalSection); + #if __ANDROID__ // Camera Monitoring bool hasCamera = true || ApplicationSettings.Instance.get(ApplicationSettingsKey.HardwareHasCamera) == "true"; @@ -276,15 +283,15 @@ namespace MatterHackers.MatterControl textSizeApplyButton.Visible = textSizeNew != currentTextSize; }; - var section = new SettingsItem( + var textSizeRow = new SettingsItem( "Text Size".Localize() + $" : {currentTextSize:0.0}", textSizeSlider, theme, optionalContainer); - sectionLabel = section.Children().FirstOrDefault(); + sectionLabel = textSizeRow.Children().FirstOrDefault(); - this.AddSettingsRow(section, generalPanel); + this.AddSettingsRow(textSizeRow, generalPanel); var accentButtons = new ThemeColorPanel.AccentColorsWidget(AppContext.ThemeSet, 16) { @@ -315,25 +322,27 @@ namespace MatterHackers.MatterControl var imageWidget = themeSection.Children.First().Descendants().FirstOrDefault(); imageWidget.Image = AggContext.StaticData.LoadIcon("theme.png", 16, 16, theme.InvertIcons); - themeSection.Margin = new BorderDouble(0, 10); - var advancedPanel = new FlowLayoutWidget(FlowDirection.TopToBottom) { Margin = new BorderDouble(2, 0) }; - var sectionWidget = new SectionWidget("Advanced".Localize(), advancedPanel, theme, serializationKey: "ApplicationSettings-Advanced", expanded: false) + var advancedSection = new SectionWidget("Advanced".Localize(), advancedPanel, theme, serializationKey: "ApplicationSettings-Advanced", expanded: false) { Name = "Advanced Section", HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit, Margin = 0 }; - contentRow.AddChild(sectionWidget); + contentRow.AddChild(advancedSection); - theme.ApplyBoxStyle(sectionWidget); + theme.ApplyBoxStyle(advancedSection); - sectionWidget.Margin = new BorderDouble(0, 10); + // Enforce consistent SectionWidget spacing + foreach (var section in contentRow.Children()) + { + section.Margin = new BorderDouble(0, 10, 0, 0); + } // Touch Screen Mode this.AddSettingsRow(