GSDumpGUI: Replace directory tree dialog.

Also fix refresh on manual label change.
This commit is contained in:
KrossX 2019-07-29 19:52:03 -03:00 committed by lightningterror
parent bd6261e3de
commit 9dd92c1cb5
2 changed files with 70 additions and 28 deletions

View File

@ -95,6 +95,7 @@
this.txtGSDXDirectory.Size = new System.Drawing.Size(243, 20);
this.txtGSDXDirectory.TabIndex = 0;
this.txtGSDXDirectory.TabStop = false;
this.txtGSDXDirectory.Enter += new System.EventHandler(this.txtGSDXDirectory_Enter);
this.txtGSDXDirectory.Leave += new System.EventHandler(this.txtGSDXDirectory_Leave);
//
// lblDirectory
@ -144,6 +145,7 @@
this.txtDumpsDirectory.Size = new System.Drawing.Size(243, 20);
this.txtDumpsDirectory.TabIndex = 3;
this.txtDumpsDirectory.TabStop = false;
this.txtDumpsDirectory.Enter += new System.EventHandler(this.txtDumpsDirectory_Enter);
this.txtDumpsDirectory.Leave += new System.EventHandler(this.txtDumpsDirectory_Leave);
//
// lstGSDX

View File

@ -99,6 +99,8 @@ namespace GSDumpGUI
private ConcurrentQueue<int> watcher_events;
private string gsdx_path_old, dump_path_old;
public GSDumpGUI()
{
PortableXmlSettingsProvider.ApplyProvider(Settings);
@ -114,8 +116,8 @@ namespace GSDumpGUI
_availableGsDumps.OnIndexUpdatedEvent += UpdatePreviewImage;
txtGSDXDirectory.DataBindings.Add(nameof(TextBox.Text), Settings, nameof(Settings.GSDXDir));
txtDumpsDirectory.DataBindings.Add(nameof(TextBox.Text), Settings, nameof(Settings.DumpDir));
txtGSDXDirectory.Text = Settings.GSDXDir;
txtDumpsDirectory.Text = Settings.DumpDir;
BindListControl(lstDumps, _availableGsDumps, g => g.Files, f => f.DisplayText, g => g.SelectedFileIndex);
BindListControl(lstGSDX, _availableGsDlls, g => g.Files, f => f.DisplayText, g => g.SelectedFileIndex);
@ -277,30 +279,46 @@ namespace GSDumpGUI
private void cmdBrowseGSDX_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "Select the GSdx DLL Directory";
fbd.SelectedPath = AppDomain.CurrentDomain.BaseDirectory;
if (fbd.ShowDialog() == DialogResult.OK)
Settings.GSDXDir = fbd.SelectedPath;
Settings.Save();
ReloadGsdxDlls();
OpenFileDialog ofd = new OpenFileDialog();
ofd.ValidateNames = false;
ofd.CheckFileExists = false;
ofd.CheckPathExists = true;
ofd.InitialDirectory = Settings.GSDXDir;
ofd.FileName = "Select Folder";
// Auto select GSdx dll
_availableGsDlls.Selected = _availableGsDlls.Files.FirstOrDefault();
if(ofd.ShowDialog() == DialogResult.OK)
{
string newpath = Path.GetDirectoryName(ofd.FileName);
if (!Settings.GSDXDir.ToLower().Equals(newpath.ToLower()))
{
Settings.GSDXDir = newpath;
Settings.Save();
ReloadGsdxDlls();
_availableGsDlls.Selected = _availableGsDlls.Files.FirstOrDefault();
}
}
}
private void cmdBrowseDumps_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "Select the GSdx Dumps Directory";
fbd.SelectedPath = AppDomain.CurrentDomain.BaseDirectory;
if (fbd.ShowDialog() == DialogResult.OK)
Settings.DumpDir = fbd.SelectedPath;
Settings.Save();
ReloadGsdxDumps();
OpenFileDialog ofd = new OpenFileDialog();
ofd.ValidateNames = false;
ofd.CheckFileExists = false;
ofd.CheckPathExists = true;
ofd.InitialDirectory = Settings.DumpDir;
ofd.FileName = "Select Folder";
// Auto select GS dump
_availableGsDumps.Selected = _availableGsDumps.Files.FirstOrDefault();
if (ofd.ShowDialog() == DialogResult.OK)
{
string newpath = Path.GetDirectoryName(ofd.FileName);
if (!Settings.DumpDir.ToLower().Equals(newpath.ToLower()))
{
Settings.DumpDir = newpath;
Settings.Save();
ReloadGsdxDumps();
_availableGsDumps.Selected = _availableGsDumps.Files.FirstOrDefault();
}
}
}
private void cmdRun_Click(object sender, EventArgs e)
@ -479,22 +497,44 @@ namespace GSDumpGUI
SelectedRad = Convert.ToInt32(itm.Tag);
}
private void txtGSDXDirectory_Enter(object sender, EventArgs e)
{
gsdx_path_old = txtGSDXDirectory.Text;
}
private void txtDumpsDirectory_Enter(object sender, EventArgs e)
{
dump_path_old = txtDumpsDirectory.Text;
}
private void txtGSDXDirectory_Leave(object sender, EventArgs e)
{
Settings.Save();
ReloadGsdxDlls();
string newpath = txtGSDXDirectory.Text;
// Auto select GSdx dll
_availableGsDlls.Selected = _availableGsDlls.Files.FirstOrDefault();
if (!String.IsNullOrEmpty(newpath) &&
!gsdx_path_old.ToLower().Equals(newpath.ToLower()) &&
Directory.Exists(newpath))
{
Settings.GSDXDir = newpath;
Settings.Save();
ReloadGsdxDlls();
_availableGsDlls.Selected = _availableGsDlls.Files.FirstOrDefault();
}
}
private void txtDumpsDirectory_Leave(object sender, EventArgs e)
{
Settings.Save();
ReloadGsdxDumps();
string newpath = txtDumpsDirectory.Text;
// Auto select GS dump
_availableGsDumps.Selected = _availableGsDumps.Files.FirstOrDefault();
if (!String.IsNullOrEmpty(newpath) &&
!dump_path_old.ToLower().Equals(newpath.ToLower()) &&
Directory.Exists(newpath))
{
Settings.DumpDir = newpath;
Settings.Save();
ReloadGsdxDumps();
_availableGsDumps.Selected = _availableGsDumps.Files.FirstOrDefault();
}
}
private void lstProcesses_SelectedIndexChanged(object sender, EventArgs e)