Skip to content

Commit

Permalink
marklagendijk#27 Add setting to allow custom output file name
Browse files Browse the repository at this point in the history
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 marklagendijk#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
marklagendijk#9).
  • Loading branch information
Jacob McLocklin committed Dec 18, 2012
1 parent 4f3098c commit e54504d
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 132 deletions.
2 changes: 2 additions & 0 deletions WinLess/Forms/mainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 23 additions & 7 deletions WinLess/Forms/mainForm.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -299,13 +299,29 @@ private void fileSelectOutputToolStripMenuItem_Click(object sender, EventArgs e)
DataGridViewCell cell = filesDataGridView.SelectedCells[0]; DataGridViewCell cell = filesDataGridView.SelectedCells[0];
Models.File file = (Models.File)cell.OwningRow.DataBoundItem; Models.File file = (Models.File)cell.OwningRow.DataBoundItem;
FileInfo fileInfo = new FileInfo(file.OutputPath); FileInfo fileInfo = new FileInfo(file.OutputPath);
outputFolderBrowserDialog.SelectedPath = fileInfo.DirectoryName;
if (outputFolderBrowserDialog.ShowDialog() == DialogResult.OK) if (!Program.Settings.UseAdvancedOutputFileSelector)
{ {
file.OutputPath = string.Format("{0}\\{1}", outputFolderBrowserDialog.SelectedPath, fileInfo.Name); outputFolderBrowserDialog.SelectedPath = fileInfo.DirectoryName;
filesDataGridView_DataChanged(); if (outputFolderBrowserDialog.ShowDialog() == DialogResult.OK)
Program.Settings.SaveSettings(); {
} 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 #endregion
Expand Down
263 changes: 138 additions & 125 deletions WinLess/Forms/settingsForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions WinLess/Forms/settingsForm.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private void loadSettings()
defaultMinifyCheckBox.Checked = Program.Settings.DefaultMinify; defaultMinifyCheckBox.Checked = Program.Settings.DefaultMinify;
compileOnSaveCheckBox.Checked = Program.Settings.CompileOnSave; compileOnSaveCheckBox.Checked = Program.Settings.CompileOnSave;
showSuccessMessagesCheckbox.Checked = Program.Settings.ShowSuccessMessages; showSuccessMessagesCheckbox.Checked = Program.Settings.ShowSuccessMessages;
useAdvancedOutputFileSelector.Checked = Program.Settings.UseAdvancedOutputFileSelector;
} }


private void saveSettings() private void saveSettings()
Expand All @@ -32,6 +33,7 @@ private void saveSettings()
Program.Settings.DefaultMinify = defaultMinifyCheckBox.Checked; Program.Settings.DefaultMinify = defaultMinifyCheckBox.Checked;
Program.Settings.CompileOnSave = compileOnSaveCheckBox.Checked; Program.Settings.CompileOnSave = compileOnSaveCheckBox.Checked;
Program.Settings.ShowSuccessMessages = showSuccessMessagesCheckbox.Checked; Program.Settings.ShowSuccessMessages = showSuccessMessagesCheckbox.Checked;
Program.Settings.UseAdvancedOutputFileSelector = useAdvancedOutputFileSelector.Checked;
Program.Settings.SaveSettings(); Program.Settings.SaveSettings();
} }


Expand Down
2 changes: 2 additions & 0 deletions WinLess/Settings.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public Settings()
ShowSuccessMessages = false; ShowSuccessMessages = false;
StartWithWindows = true; StartWithWindows = true;
StartMinified = false; StartMinified = false;
UseAdvancedOutputFileSelector = false;
ApplyStartWithWindows(); ApplyStartWithWindows();
} }


Expand All @@ -27,6 +28,7 @@ public Settings()
public bool CompileOnSave { get; set; } public bool CompileOnSave { get; set; }
public bool ShowSuccessMessages { get; set; } public bool ShowSuccessMessages { get; set; }
public bool StartMinified { get; set; } public bool StartMinified { get; set; }
public bool UseAdvancedOutputFileSelector { get; set; }


private bool startWithWindows; private bool startWithWindows;
public bool StartWithWindows public bool StartWithWindows
Expand Down

0 comments on commit e54504d

Please sign in to comment.