Add ResizableSectionWidget expansion persistence

This commit is contained in:
John Lewin 2018-06-23 08:00:15 -07:00
parent 5c1a453a75
commit d5d8f000f8
4 changed files with 5 additions and 4 deletions

View file

@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public event EventHandler Resized;
public ResizableSectionWidget(string sectionTitle, double initialHeight, GuiWidget sectionContent, ThemeConfig theme, GuiWidget rightAlignedContent = null, int headingPointSize = -1, bool expandingContent = true, bool expanded = true, string serializationKey = null, bool defaultExpansion = false, bool setContentVAnchor = true)
: base(sectionTitle, new GuiWidget(), theme, rightAlignedContent, headingPointSize, expanded, expanded, serializationKey, defaultExpansion, setContentVAnchor)
: base(sectionTitle, new GuiWidget(), theme, rightAlignedContent, headingPointSize, expandingContent, expanded, serializationKey, defaultExpansion, setContentVAnchor)
{
this.VAnchor = VAnchor.Fit;
@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Fit,
Name = "editorRootContainer",
Visible = expanded
Visible = checkbox.Checked
};
resizeWrapper.AddChild(this.ResizeContainer);

View file

@ -10,7 +10,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
/// </summary>
public class SectionWidget : FlowLayoutWidget, IIgnoredPopupChild
{
private ExpandCheckboxButton checkbox;
protected ExpandCheckboxButton checkbox;
private bool setContentVAnchor;
public SectionWidget(string sectionTitle, GuiWidget sectionContent, ThemeConfig theme, GuiWidget rightAlignedContent = null, int headingPointSize = -1, bool expandingContent = true, bool expanded = true, string serializationKey = null, bool defaultExpansion = false, bool setContentVAnchor = true)

View file

@ -207,7 +207,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
};
var treeSection = new ResizableSectionWidget("Design History".Localize(), sceneContext.ViewState.SceneTreeHeight, treeView, theme, expanded: false);
var treeSection = new ResizableSectionWidget("Design History".Localize(), sceneContext.ViewState.SceneTreeHeight, treeView, theme, serializationKey: UserSettingsKey.SelectionTreeViewPanelExpanded);
treeSection.Resized += (s, e) =>
{
sceneContext.ViewState.SceneTreeHeight = treeSection.ResizeContainer.Height;

View file

@ -60,6 +60,7 @@ namespace MatterHackers.MatterControl
public const string ActiveThemeName = nameof(ActiveThemeName);
public const string SceneTreeHeight = nameof(SceneTreeHeight);
public const string SelectedObjectEditorHeight = nameof(SelectedObjectEditorHeight);
public const string SelectionTreeViewPanelExpanded = nameof(SelectionTreeViewPanelExpanded);
}
public class UserSettings