Permalink
Browse files

#27 Add setting to allow custom output file name

This changeset solves two problems by adding a new setting that allows
users to opt-in to use the "advanced" output file selector.  This new
selector is simply an OpenFileDialog instead of a terrible
FolderBrowserDialog.   The two problems that this new dialog solves are:
(1) A custom file name can be added as requested by issue #27, and (2)
It is much easier to edit the output folder with the OpenFileDialog
because you can type/paste a file path (which helps a bit with issue
#9).
  • Loading branch information...
1 parent 4f3098c commit e54504d537b150a4315b9912424c14796c070856 Jacob McLocklin committed Dec 18, 2012
Oops, something went wrong.
@@ -299,13 +299,29 @@ private void fileSelectOutputToolStripMenuItem_Click(object sender, EventArgs e)
DataGridViewCell cell = filesDataGridView.SelectedCells[0];
Models.File file = (Models.File)cell.OwningRow.DataBoundItem;
FileInfo fileInfo = new FileInfo(file.OutputPath);
- outputFolderBrowserDialog.SelectedPath = fileInfo.DirectoryName;
- if (outputFolderBrowserDialog.ShowDialog() == DialogResult.OK)
- {
- file.OutputPath = string.Format("{0}\\{1}", outputFolderBrowserDialog.SelectedPath, fileInfo.Name);
- filesDataGridView_DataChanged();
- Program.Settings.SaveSettings();
- }
+
+ if (!Program.Settings.UseAdvancedOutputFileSelector)
+ {
+ outputFolderBrowserDialog.SelectedPath = fileInfo.DirectoryName;
+ if (outputFolderBrowserDialog.ShowDialog() == DialogResult.OK)
+ {
+ file.OutputPath = string.Format("{0}\\{1}", outputFolderBrowserDialog.SelectedPath, fileInfo.Name);
+ filesDataGridView_DataChanged();
+ Program.Settings.SaveSettings();
+ }
+ }
+ else
+ {
+ advancedOutputFolderBrowserDialog.InitialDirectory = fileInfo.DirectoryName;
+ advancedOutputFolderBrowserDialog.FileName = fileInfo.Name;
+ if (advancedOutputFolderBrowserDialog.ShowDialog() == DialogResult.OK)
+ {
+ file.OutputPath = advancedOutputFolderBrowserDialog.FileName;
+ }
+ }
+
+ filesDataGridView_DataChanged();
+ Program.Settings.SaveSettings();
}
#endregion
Oops, something went wrong.
@@ -23,6 +23,7 @@ private void loadSettings()
defaultMinifyCheckBox.Checked = Program.Settings.DefaultMinify;
compileOnSaveCheckBox.Checked = Program.Settings.CompileOnSave;
showSuccessMessagesCheckbox.Checked = Program.Settings.ShowSuccessMessages;
+ useAdvancedOutputFileSelector.Checked = Program.Settings.UseAdvancedOutputFileSelector;
}
private void saveSettings()
@@ -32,6 +33,7 @@ private void saveSettings()
Program.Settings.DefaultMinify = defaultMinifyCheckBox.Checked;
Program.Settings.CompileOnSave = compileOnSaveCheckBox.Checked;
Program.Settings.ShowSuccessMessages = showSuccessMessagesCheckbox.Checked;
+ Program.Settings.UseAdvancedOutputFileSelector = useAdvancedOutputFileSelector.Checked;
Program.Settings.SaveSettings();
}
View
@@ -19,6 +19,7 @@ public Settings()
ShowSuccessMessages = false;
StartWithWindows = true;
StartMinified = false;
+ UseAdvancedOutputFileSelector = false;
ApplyStartWithWindows();
}
@@ -27,6 +28,7 @@ public Settings()
public bool CompileOnSave { get; set; }
public bool ShowSuccessMessages { get; set; }
public bool StartMinified { get; set; }
+ public bool UseAdvancedOutputFileSelector { get; set; }
private bool startWithWindows;
public bool StartWithWindows

0 comments on commit e54504d

Please sign in to comment.