diff --git a/renderdocui/Windows/Dialogs/CaptureDialog.Designer.cs b/renderdocui/Windows/Dialogs/CaptureDialog.Designer.cs index 45aae1f53..4ad451228 100644 --- a/renderdocui/Windows/Dialogs/CaptureDialog.Designer.cs +++ b/renderdocui/Windows/Dialogs/CaptureDialog.Designer.cs @@ -505,6 +505,8 @@ this.workDirPath.TabIndex = 2; this.toolTip.SetToolTip(this.workDirPath, "The working directory the executable will be launched in"); this.workDirPath.TextChanged += new System.EventHandler(this.workDirPath_TextChanged); + this.workDirPath.Enter += new System.EventHandler(this.workDirPath_Enter); + this.workDirPath.Leave += new System.EventHandler(this.workDirPath_Leave); // // exeBrowse // @@ -528,6 +530,7 @@ this.exePath.Size = new System.Drawing.Size(430, 20); this.exePath.TabIndex = 0; this.toolTip.SetToolTip(this.exePath, "The executable file to launch"); + this.exePath.TextChanged += new System.EventHandler(this.exePath_TextChanged); this.exePath.DragDrop += new System.Windows.Forms.DragEventHandler(this.exePath_DragDrop); this.exePath.DragEnter += new System.Windows.Forms.DragEventHandler(this.exePath_DragEnter); // diff --git a/renderdocui/Windows/Dialogs/CaptureDialog.cs b/renderdocui/Windows/Dialogs/CaptureDialog.cs index 3de43b5cb..57e9ded45 100644 --- a/renderdocui/Windows/Dialogs/CaptureDialog.cs +++ b/renderdocui/Windows/Dialogs/CaptureDialog.cs @@ -50,6 +50,8 @@ namespace renderdocui.Windows.Dialogs public string CmdLine = ""; } + private bool workDirHint = true; + private Core m_Core; private void SetSettings(CaptureSettings settings) @@ -72,12 +74,22 @@ namespace renderdocui.Windows.Dialogs DelayForDebugger.Value = settings.Options.DelayForDebugger; AutoStart.Checked = settings.AutoStart; + UpdateWorkDirHint(); + if (settings.AutoStart) { TriggerCapture(); } } + private string RealWorkDir + { + get + { + return workDirHint ? "" : workDirPath.Text; + } + } + private CaptureSettings GetSettings() { var ret = new CaptureSettings(); @@ -87,7 +99,7 @@ namespace renderdocui.Windows.Dialogs ret.AutoStart = AutoStart.Checked; ret.Executable = exePath.Text; - ret.WorkingDir = workDirPath.Text; + ret.WorkingDir = RealWorkDir; ret.CmdLine = cmdline.Text; ret.Options.AllowFullscreen = AllowFullscreen.Checked; @@ -154,6 +166,9 @@ namespace renderdocui.Windows.Dialogs m_Core = core; + workDirHint = true; + workDirPath.ForeColor = SystemColors.GrayText; + SetSettings(defaults); } @@ -232,8 +247,8 @@ namespace renderdocui.Windows.Dialogs } string workingDir = ""; - if (Directory.Exists(workDirPath.Text)) - workingDir = workDirPath.Text; + if (Directory.Exists(RealWorkDir)) + workingDir = RealWorkDir; string cmdLine = cmdline.Text; @@ -315,6 +330,8 @@ namespace renderdocui.Windows.Dialogs { exePath.Text = exeBrowser.FileName; + UpdateWorkDirHint(); + m_Core.Config.LastCapturePath = Path.GetDirectoryName(exeBrowser.FileName); } @@ -333,6 +350,8 @@ namespace renderdocui.Windows.Dialogs { exePath.Text = fn; + UpdateWorkDirHint(); + m_Core.Config.LastCapturePath = Path.GetDirectoryName(exeBrowser.FileName); } } @@ -358,6 +377,8 @@ namespace renderdocui.Windows.Dialogs if (res == DialogResult.Yes || res == DialogResult.OK) { workDirPath.Text = workDirBrowser.SelectedPath; + workDirHint = false; + workDirPath.ForeColor = SystemColors.WindowText; } } @@ -423,5 +444,46 @@ namespace renderdocui.Windows.Dialogs { capOptsFlow.MaximumSize = new Size(capOptsGroup.ClientRectangle.Width - 8, 0); } + + private void workDirPath_Enter(object sender, EventArgs e) + { + if (workDirHint) + { + workDirPath.ForeColor = SystemColors.WindowText; + workDirPath.Text = ""; + } + + workDirHint = false; + } + + private void workDirPath_Leave(object sender, EventArgs e) + { + if (workDirPath.Text == "") + { + workDirHint = true; + workDirPath.ForeColor = SystemColors.GrayText; + + UpdateWorkDirHint(); + } + } + + private void exePath_TextChanged(object sender, EventArgs e) + { + UpdateWorkDirHint(); + } + + private void UpdateWorkDirHint() + { + if (workDirHint == false) return; + + try + { + workDirPath.Text = Path.GetDirectoryName(exePath.Text); + } + catch (ArgumentException) + { + // invalid path or similar + } + } } }