From 1e2d93dd99d13644ede212213de3135a6f3b76c9 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 26 Oct 2008 22:19:34 +0000 Subject: WinGui: - Temporary hack to remember top level preset nodes expanded status. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1871 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/frmMain.cs | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'win/C#/frmMain.cs') diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 957fa217d..652ff22dd 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -102,6 +102,8 @@ namespace Handbrake loadUserDefaults(); else loadNormalPreset(); + // Expand the preset Nodes + treeView_presets.ExpandAll(); // Enabled GUI tooltip's if Required if (Properties.Settings.Default.tooltipEnable == "Checked") ToolTip.Active = true; @@ -319,7 +321,24 @@ namespace Handbrake if (treeView_presets.SelectedNode != null) { presetHandler.remove(treeView_presets.SelectedNode.Text); + + // Remember each nodes expanded status so we can reload it + List nodeStatus = new List(); + foreach (TreeNode node in treeView_presets.Nodes) + { + nodeStatus.Add(node.IsExpanded); + } + loadPresetPanel(); + + int i = 0; + foreach (TreeNode node in treeView_presets.Nodes) + { + if (nodeStatus[i] == true) + node.Expand(); + + i++; + } } treeView_presets.Select(); } @@ -1385,8 +1404,25 @@ namespace Handbrake // Presets private void btn_addPreset_Click(object sender, EventArgs e) { + // Remember each nodes expanded status so we can reload it + List nodeStatus = new List(); + foreach (TreeNode node in treeView_presets.Nodes) + nodeStatus.Add(node.IsExpanded); + nodeStatus.Add(true); + + // Now add the new preset Form preset = new frmAddPreset(this, queryGen.GenerateTheQuery(this), presetHandler); preset.ShowDialog(); + + // And finally, re-expand any of the nodes if required + int i = 0; + foreach (TreeNode node in treeView_presets.Nodes) + { + if (nodeStatus[i] == true) + node.Expand(); + + i++; + } } private void btn_removePreset_Click(object sender, EventArgs e) { @@ -1395,8 +1431,24 @@ namespace Handbrake { if (treeView_presets.SelectedNode != null) presetHandler.remove(treeView_presets.SelectedNode.Text); + + // Remember each nodes expanded status so we can reload it + List nodeStatus = new List(); + foreach (TreeNode node in treeView_presets.Nodes) + nodeStatus.Add(node.IsExpanded); + // Now reload the preset panel loadPresetPanel(); + + // And finally, re-expand any of the nodes if required + int i = 0; + foreach (TreeNode node in treeView_presets.Nodes) + { + if (nodeStatus[i] == true) + node.Expand(); + + i++; + } } treeView_presets.Select(); } @@ -1439,8 +1491,24 @@ namespace Handbrake { if (treeView_presets.SelectedNode != null) presetHandler.remove(treeView_presets.SelectedNode.Text); + + // Remember each nodes expanded status so we can reload it + List nodeStatus = new List(); + foreach (TreeNode node in treeView_presets.Nodes) + nodeStatus.Add(node.IsExpanded); + // Now reload the preset panel loadPresetPanel(); + + // And finally, re-expand any of the nodes if required + int i = 0; + foreach (TreeNode node in treeView_presets.Nodes) + { + if (nodeStatus[i] == true) + node.Expand(); + + i++; + } } } } -- cgit v1.2.3