
Saving state in SettingsDialog
When playing with settings, it is little annoying to select the same plugin every time ProgramSettings has opened.
Especially if it is needed to scroll down the plugin list.
This patch restores previous selected item on opening SettingsDialog.
http://dl.dropbox.com/u/1674435/fd/settings-patch.patchI just added few lines of code, but VS makes a lot of changes in a generated part of the modified file.
Code:
+ this.Shown += new System.EventHandler(this.SettingDialog_Shown);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SettingDialog_FormClosing);
+ private static int lastItemIndex = 0;
+
+ private void SettingDialog_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ lastItemIndex = itemListView.SelectedIndices.Count > 0 ? itemListView.SelectedIndices[0] : 0;
+ }
+
+ private void SettingDialog_Shown(object sender, EventArgs e)
+ {
+ itemListView.SelectedIndices.Add(lastItemIndex);
+ itemListView.EnsureVisible(lastItemIndex);
+ }
+