Browse Source

Fixed editing of raw MSBuild properties in project options (where the user can use $(..) in the text box).

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2446 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
08c138311d
  1. 9
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BuildOptions.cs
  2. 3
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.cs
  3. 3
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptions.cs
  4. 9
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/ApplicationSettingsPanel.cs
  5. 24
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/CompilerParametersPanel.cs
  6. 56
      src/Main/Base/Project/Src/Gui/Dialogs/AbstractOptionPanel.cs
  7. 22
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AbstractBuildOptions.cs
  8. 18
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.cs
  9. 10
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildEvents.cs
  10. 15
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.cs
  11. 4
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.cs
  12. 4
      src/Main/Base/Project/Src/Project/ConfigurationGuiBinding.cs
  13. 43
      src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs

9
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BuildOptions.cs

@ -7,6 +7,7 @@
using System; using System;
using ICSharpCode.SharpDevelop.Gui.OptionPanels; using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace Grunwald.BooBinding namespace Grunwald.BooBinding
{ {
@ -31,15 +32,13 @@ namespace Grunwald.BooBinding
helper.BindBoolean("noCorlibCheckBox", "NoStdLib", false).CreateLocationButton("noCorlibCheckBox"); helper.BindBoolean("noCorlibCheckBox", "NoStdLib", false).CreateLocationButton("noCorlibCheckBox");
helper.BindBoolean("duckyCheckBox", "Ducky", false).CreateLocationButton("duckyCheckBox"); helper.BindBoolean("duckyCheckBox", "Ducky", false).CreateLocationButton("duckyCheckBox");
helper.BindString("pipelineTextBox", "Pipeline").CreateLocationButton("pipelineLabel"); helper.BindString("pipelineTextBox", "Pipeline", TextBoxEditMode.EditEvaluatedProperty).CreateLocationButton("pipelineLabel");
//InitWarnings(); //InitWarnings();
// //
helper.BindString("baseIntermediateOutputPathTextBox", "BaseIntermediateOutputPath").CreateLocationButton("baseIntermediateOutputPathTextBox"); InitBaseIntermediateOutputPath();
ConnectBrowseFolder("baseIntermediateOutputPathBrowseButton", "baseIntermediateOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); InitIntermediateOutputPath();
helper.BindString("intermediateOutputPathTextBox", "IntermediateOutputPath").CreateLocationButton("intermediateOutputPathTextBox");
ConnectBrowseFolder("intermediateOutputPathBrowseButton", "intermediateOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}");
// //
helper.AddConfigurationSelector(this); helper.AddConfigurationSelector(this);

3
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.cs

@ -28,8 +28,7 @@ namespace CSharpBinding.OptionPanels
ConfigurationGuiBinding b; ConfigurationGuiBinding b;
b = helper.BindString("conditionalSymbolsTextBox", "DefineConstants"); b = helper.BindString("conditionalSymbolsTextBox", "DefineConstants", TextBoxEditMode.EditRawProperty);
b.TreatPropertyValueAsLiteral = false;
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
b.CreateLocationButton("conditionalSymbolsTextBox"); b.CreateLocationButton("conditionalSymbolsTextBox");

3
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptions.cs

@ -21,8 +21,7 @@ namespace VBNetBinding.OptionPanels
ConfigurationGuiBinding b; ConfigurationGuiBinding b;
b = helper.BindString("conditionalSymbolsTextBox", "DefineConstants"); b = helper.BindString("conditionalSymbolsTextBox", "DefineConstants", TextBoxEditMode.EditRawProperty);
b.TreatPropertyValueAsLiteral = false;
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
b.CreateLocationButton("conditionalSymbolsTextBox"); b.CreateLocationButton("conditionalSymbolsTextBox");

9
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/ApplicationSettingsPanel.cs

@ -20,15 +20,14 @@ namespace ICSharpCode.WixBinding
{ {
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.WixBinding.Resources.ApplicationSettingsPanel.xfrm")); SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.WixBinding.Resources.ApplicationSettingsPanel.xfrm"));
InitializeHelper(); InitializeHelper();
ConfigurationGuiBinding b; ConfigurationGuiBinding b;
b = helper.BindString("outputNameTextBox", "OutputName"); b = helper.BindString("outputNameTextBox", "OutputName", TextBoxEditMode.EditEvaluatedProperty);
b.CreateLocationButton("outputNameTextBox"); b.CreateLocationButton("outputNameTextBox");
Get<TextBox>("outputName").TextChanged += RefreshOutputFileNameTextBox; Get<TextBox>("outputName").TextChanged += RefreshOutputFileNameTextBox;
ConnectBrowseButton("localizedStringFileBrowseButton", "localizedStringFileTextBox", "${res:ICSharpCode.WixBinding.WixLocalizationFileFilterName} (*.wxl)|*.wxl|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); ConnectBrowseButton("localizedStringFileBrowseButton", "localizedStringFileTextBox", "${res:ICSharpCode.WixBinding.WixLocalizationFileFilterName} (*.wxl)|*.wxl|${res:SharpDevelop.FileFilter.AllFiles}|*.*", TextBoxEditMode.EditEvaluatedProperty);
b = helper.BindString("localizedStringFileTextBox", "LocalizedStringFile"); b = helper.BindString("localizedStringFileTextBox", "LocalizedStringFile", TextBoxEditMode.EditRawProperty);
b.TreatPropertyValueAsLiteral = false;
b.CreateLocationButton("localizedStringFileTextBox"); b.CreateLocationButton("localizedStringFileTextBox");
b = helper.BindEnum<WixOutputType>("outputTypeComboBox", "OutputType"); b = helper.BindEnum<WixOutputType>("outputTypeComboBox", "OutputType");

24
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/CompilerParametersPanel.cs

@ -21,25 +21,23 @@ namespace ICSharpCode.WixBinding
InitializeHelper(); InitializeHelper();
ConfigurationGuiBinding b; ConfigurationGuiBinding b;
b = helper.BindString("outputPathTextBox", "OutputPath"); b = helper.BindString("outputPathTextBox", "OutputPath", TextBoxEditMode.EditRawProperty);
b.CreateLocationButton("outputPathTextBox"); b.CreateLocationButton("outputPathTextBox");
ConnectBrowseFolder("outputPathBrowseButton", "outputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); ConnectBrowseFolder("outputPathBrowseButton", "outputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", TextBoxEditMode.EditRawProperty);
b = helper.BindString("baseOutputPathTextBox", "BaseOutputPath"); b = helper.BindString("baseOutputPathTextBox", "BaseOutputPath", TextBoxEditMode.EditRawProperty);
b.CreateLocationButton("baseOutputPathTextBox"); b.CreateLocationButton("baseOutputPathTextBox");
ConnectBrowseFolder("baseOutputPathBrowseButton", "baseOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); ConnectBrowseFolder("baseOutputPathBrowseButton", "baseOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", TextBoxEditMode.EditRawProperty);
b = helper.BindString("intermediateOutputPathTextBox", "IntermediateOutputPath"); b = helper.BindString("intermediateOutputPathTextBox", "IntermediateOutputPath", TextBoxEditMode.EditRawProperty);
b.CreateLocationButton("intermediateOutputPathTextBox"); b.CreateLocationButton("intermediateOutputPathTextBox");
ConnectBrowseFolder("intermediateOutputPathBrowseButton", "intermediateOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); ConnectBrowseFolder("intermediateOutputPathBrowseButton", "intermediateOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", TextBoxEditMode.EditRawProperty);
b = helper.BindString("wixToolPathTextBox", "WixToolPath"); b = helper.BindString("wixToolPathTextBox", "WixToolPath", TextBoxEditMode.EditRawProperty);
b.TreatPropertyValueAsLiteral = false; ConnectBrowseFolder("wixToolPathBrowseButton", "wixToolPathTextBox", String.Empty, TextBoxEditMode.EditRawProperty);
ConnectBrowseFolder("wixToolPathBrowseButton", "wixToolPathTextBox", String.Empty);
b = helper.BindString("wixMSBuildExtensionsPathTextBox", "WixMSBuildExtensionsPath"); b = helper.BindString("wixMSBuildExtensionsPathTextBox", "WixMSBuildExtensionsPath", TextBoxEditMode.EditRawProperty);
b.TreatPropertyValueAsLiteral = false; ConnectBrowseFolder("wixMSBuildExtensionsPathBrowseButton", "wixMSBuildExtensionsPathTextBox", String.Empty, TextBoxEditMode.EditRawProperty);
ConnectBrowseFolder("wixMSBuildExtensionsPathBrowseButton", "wixMSBuildExtensionsPathTextBox", String.Empty);
// Add the extension picker in manually since the anchoring does not // Add the extension picker in manually since the anchoring does not
// work if we add the picker into the XML of the CompilerParametersPanel.xfrm file. // work if we add the picker into the XML of the CompilerParametersPanel.xfrm file.
@ -66,7 +64,7 @@ namespace ICSharpCode.WixBinding
new StringPair("2", "2"), new StringPair("2", "2"),
new StringPair("3", "3")); new StringPair("3", "3"));
ChooseStorageLocationButton locationButton = b.CreateLocationButtonInPanel("errorsAndWarningsGroupBox"); ChooseStorageLocationButton locationButton = b.CreateLocationButtonInPanel("errorsAndWarningsGroupBox");
b = helper.BindString("suppressWarningsTextBox", "NoWarn"); b = helper.BindString("suppressWarningsTextBox", "NoWarn", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton); b.RegisterLocationButton(locationButton);
b = helper.BindBoolean("treatWarningsAsErrorsCheckBox", "TreatWarningsAsErrors", false); b = helper.BindBoolean("treatWarningsAsErrorsCheckBox", "TreatWarningsAsErrors", false);

56
src/Main/Base/Project/Src/Gui/Dialogs/AbstractOptionPanel.cs

@ -10,6 +10,7 @@ using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui.XmlForms; using ICSharpCode.SharpDevelop.Gui.XmlForms;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Gui namespace ICSharpCode.SharpDevelop.Gui
{ {
@ -94,11 +95,17 @@ namespace ICSharpCode.SharpDevelop.Gui
protected string baseDirectory; protected string baseDirectory;
[Obsolete("Please specify fileFilter and targetNeedsMSBuildEncoding")]
protected void ConnectBrowseButton(string browseButton, string target) protected void ConnectBrowseButton(string browseButton, string target)
{ {
ConnectBrowseButton(browseButton, target, "${res:SharpDevelop.FileFilter.AllFiles}|*.*"); ConnectBrowseButton(browseButton, target, "${res:SharpDevelop.FileFilter.AllFiles}|*.*");
} }
[Obsolete("Please specify targetNeedsMSBuildEncoding")]
protected void ConnectBrowseButton(string browseButton, string target, string fileFilter) protected void ConnectBrowseButton(string browseButton, string target, string fileFilter)
{
ConnectBrowseButton(browseButton, target, fileFilter, TextBoxEditMode.EditEvaluatedProperty);
}
protected void ConnectBrowseButton(string browseButton, string target, string fileFilter, TextBoxEditMode textBoxEditMode)
{ {
if (ControlDictionary[browseButton] == null) { if (ControlDictionary[browseButton] == null) {
@ -110,14 +117,24 @@ namespace ICSharpCode.SharpDevelop.Gui
MessageService.ShowError(target + " not found!"); MessageService.ShowError(target + " not found!");
return; return;
} }
ControlDictionary[browseButton].Click += new EventHandler(new BrowseButtonEvent(this, target, fileFilter).Event); ControlDictionary[browseButton].Click += new EventHandler(new BrowseButtonEvent(this, target, fileFilter, textBoxEditMode).Event);
} }
[Obsolete("Please specify textBoxEditMode")]
protected void ConnectBrowseFolder(string browseButton, string target) protected void ConnectBrowseFolder(string browseButton, string target)
{ {
ConnectBrowseFolder(browseButton, target, "${res:Dialog.ProjectOptions.SelectFolderTitle}"); ConnectBrowseFolder(browseButton, target, TextBoxEditMode.EditEvaluatedProperty);
} }
[Obsolete("Please specify textBoxEditMode")]
protected void ConnectBrowseFolder(string browseButton, string target, string description) protected void ConnectBrowseFolder(string browseButton, string target, string description)
{
ConnectBrowseFolder(browseButton, target, description, TextBoxEditMode.EditEvaluatedProperty);
}
protected void ConnectBrowseFolder(string browseButton, string target, TextBoxEditMode textBoxEditMode)
{
ConnectBrowseFolder(browseButton, target, "${res:Dialog.ProjectOptions.SelectFolderTitle}", textBoxEditMode);
}
protected void ConnectBrowseFolder(string browseButton, string target, string description, TextBoxEditMode textBoxEditMode)
{ {
if (ControlDictionary[browseButton] == null) { if (ControlDictionary[browseButton] == null) {
MessageService.ShowError(browseButton + " not found!"); MessageService.ShowError(browseButton + " not found!");
@ -128,7 +145,7 @@ namespace ICSharpCode.SharpDevelop.Gui
return; return;
} }
ControlDictionary[browseButton].Click += new EventHandler(new BrowseFolderEvent(this, target, description).Event); ControlDictionary[browseButton].Click += new EventHandler(new BrowseFolderEvent(this, target, description, textBoxEditMode).Event);
} }
protected class BrowseButtonEvent protected class BrowseButtonEvent
@ -136,12 +153,20 @@ namespace ICSharpCode.SharpDevelop.Gui
AbstractOptionPanel panel; AbstractOptionPanel panel;
string target; string target;
string filter; string filter;
TextBoxEditMode textBoxEditMode;
[Obsolete("specify textBoxEditMode")]
public BrowseButtonEvent(AbstractOptionPanel panel, string target, string filter) public BrowseButtonEvent(AbstractOptionPanel panel, string target, string filter)
: this(panel, target, filter, TextBoxEditMode.EditEvaluatedProperty)
{
}
public BrowseButtonEvent(AbstractOptionPanel panel, string target, string filter, TextBoxEditMode textBoxEditMode)
{ {
this.panel = panel; this.panel = panel;
this.filter = filter; this.filter = filter;
this.target = target; this.target = target;
this.textBoxEditMode = textBoxEditMode;
} }
public void Event(object sender, EventArgs e) public void Event(object sender, EventArgs e)
@ -155,7 +180,11 @@ namespace ICSharpCode.SharpDevelop.Gui
if (panel.baseDirectory != null) { if (panel.baseDirectory != null) {
file = FileUtility.GetRelativePath(panel.baseDirectory, file); file = FileUtility.GetRelativePath(panel.baseDirectory, file);
} }
panel.ControlDictionary[target].Text = file; if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
panel.ControlDictionary[target].Text = file;
} else {
panel.ControlDictionary[target].Text = MSBuildInternals.Escape(file);
}
} }
} }
} }
@ -166,19 +195,30 @@ namespace ICSharpCode.SharpDevelop.Gui
AbstractOptionPanel panel; AbstractOptionPanel panel;
string target; string target;
string description; string description;
TextBoxEditMode textBoxEditMode;
[Obsolete("Do not use BrowseFolderEvent directly")]
public BrowseFolderEvent(AbstractOptionPanel panel, string target, string description) public BrowseFolderEvent(AbstractOptionPanel panel, string target, string description)
: this(panel, target, description, TextBoxEditMode.EditEvaluatedProperty)
{
}
internal BrowseFolderEvent(AbstractOptionPanel panel, string target, string description, TextBoxEditMode textBoxEditMode)
{ {
this.panel = panel; this.panel = panel;
this.description = description; this.description = description;
this.target = target; this.target = target;
this.textBoxEditMode = textBoxEditMode;
} }
public void Event(object sender, EventArgs e) public void Event(object sender, EventArgs e)
{ {
string startLocation = panel.baseDirectory; string startLocation = panel.baseDirectory;
if (startLocation != null) { if (startLocation != null) {
startLocation = FileUtility.GetAbsolutePath(startLocation, panel.ControlDictionary[target].Text); string text = panel.ControlDictionary[target].Text;
if (textBoxEditMode == TextBoxEditMode.EditRawProperty)
text = MSBuildInternals.Unescape(text);
startLocation = FileUtility.GetAbsolutePath(startLocation, text);
} }
using (FolderBrowserDialog fdiag = FileService.CreateFolderBrowserDialog(description, startLocation)) { using (FolderBrowserDialog fdiag = FileService.CreateFolderBrowserDialog(description, startLocation)) {
@ -189,7 +229,11 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
if (!path.EndsWith("\\") && !path.EndsWith("/")) if (!path.EndsWith("\\") && !path.EndsWith("/"))
path += "\\"; path += "\\";
panel.ControlDictionary[target].Text = path; if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
panel.ControlDictionary[target].Text = path;
} else {
panel.ControlDictionary[target].Text = MSBuildInternals.Escape(path);
}
} }
} }
} }

22
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AbstractBuildOptions.cs

@ -22,9 +22,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{ {
helper.BindString(Get<TextBox>("baseIntermediateOutputPath"), helper.BindString(Get<TextBox>("baseIntermediateOutputPath"),
"BaseIntermediateOutputPath", "BaseIntermediateOutputPath",
TextBoxEditMode.EditRawProperty,
delegate { return @"obj\"; } delegate { return @"obj\"; }
).CreateLocationButton("baseIntermediateOutputPathTextBox"); ).CreateLocationButton("baseIntermediateOutputPathTextBox");
ConnectBrowseFolder("baseIntermediateOutputPathBrowseButton", "baseIntermediateOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); ConnectBrowseFolder("baseIntermediateOutputPathBrowseButton", "baseIntermediateOutputPathTextBox",
"${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
TextBoxEditMode.EditRawProperty);
} }
protected void InitIntermediateOutputPath() protected void InitIntermediateOutputPath()
@ -32,6 +35,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
ConfigurationGuiBinding binding = helper.BindString( ConfigurationGuiBinding binding = helper.BindString(
Get<TextBox>("intermediateOutputPath"), Get<TextBox>("intermediateOutputPath"),
"IntermediateOutputPath", "IntermediateOutputPath",
TextBoxEditMode.EditRawProperty,
delegate { delegate {
return Path.Combine(helper.GetProperty("BaseIntermediateOutputPath", @"obj\", true), return Path.Combine(helper.GetProperty("BaseIntermediateOutputPath", @"obj\", true),
helper.Configuration); helper.Configuration);
@ -39,19 +43,23 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
); );
binding.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; binding.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
binding.CreateLocationButton("intermediateOutputPathTextBox"); binding.CreateLocationButton("intermediateOutputPathTextBox");
ConnectBrowseFolder("intermediateOutputPathBrowseButton", "intermediateOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); ConnectBrowseFolder("intermediateOutputPathBrowseButton",
"intermediateOutputPathTextBox",
"${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
TextBoxEditMode.EditRawProperty);
} }
protected void InitOutputPath() protected void InitOutputPath()
{ {
helper.BindString("outputPathTextBox", "OutputPath").CreateLocationButton("outputPathTextBox"); helper.BindString("outputPathTextBox", "OutputPath", TextBoxEditMode.EditRawProperty)
ConnectBrowseFolder("outputPathBrowseButton", "outputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); .CreateLocationButton("outputPathTextBox");
ConnectBrowseFolder("outputPathBrowseButton", "outputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", TextBoxEditMode.EditRawProperty);
} }
protected void InitXmlDoc() protected void InitXmlDoc()
{ {
ConfigurationGuiBinding b; ConfigurationGuiBinding b;
b = helper.BindString("xmlDocumentationTextBox", "DocumentationFile"); b = helper.BindString("xmlDocumentationTextBox", "DocumentationFile", TextBoxEditMode.EditRawProperty);
b.CreateLocationButton("xmlDocumentationCheckBox"); b.CreateLocationButton("xmlDocumentationCheckBox");
helper.Loaded += XmlDocHelperLoaded; helper.Loaded += XmlDocHelperLoaded;
XmlDocHelperLoaded(null, null); XmlDocHelperLoaded(null, null);
@ -88,13 +96,13 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
new StringPair("3", "3"), new StringPair("3", "3"),
new StringPair("4", "4")); new StringPair("4", "4"));
ChooseStorageLocationButton locationButton = b.CreateLocationButtonInPanel("warningsGroupBox"); ChooseStorageLocationButton locationButton = b.CreateLocationButtonInPanel("warningsGroupBox");
b = helper.BindString("suppressWarningsTextBox", "NoWarn"); b = helper.BindString("suppressWarningsTextBox", "NoWarn", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton); b.RegisterLocationButton(locationButton);
b = new WarningsAsErrorsBinding(this); b = new WarningsAsErrorsBinding(this);
helper.AddBinding("TreatWarningsAsErrors", b); helper.AddBinding("TreatWarningsAsErrors", b);
locationButton = b.CreateLocationButtonInPanel("treatWarningsAsErrorsGroupBox"); locationButton = b.CreateLocationButtonInPanel("treatWarningsAsErrorsGroupBox");
b = helper.BindString("specificWarningsTextBox", "WarningsAsErrors"); // must be saved AFTER TreatWarningsAsErrors b = helper.BindString("specificWarningsTextBox", "WarningsAsErrors", TextBoxEditMode.EditEvaluatedProperty); // must be saved AFTER TreatWarningsAsErrors
b.RegisterLocationButton(locationButton); b.RegisterLocationButton(locationButton);
EventHandler setDirty = delegate { EventHandler setDirty = delegate {

18
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.cs

@ -23,32 +23,36 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
InitializeHelper(); InitializeHelper();
ConnectBrowseButton("applicationIconBrowseButton", "applicationIconComboBox", "${res:SharpDevelop.FileFilter.Icons}|*.ico|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); ConnectBrowseButton("applicationIconBrowseButton", "applicationIconComboBox",
"${res:SharpDevelop.FileFilter.Icons}|*.ico|${res:SharpDevelop.FileFilter.AllFiles}|*.*",
TextBoxEditMode.EditEvaluatedProperty);
// TODO: Suitable file filter. // TODO: Suitable file filter.
ConnectBrowseButton("win32ResourceFileBrowseButton", "win32ResourceFileComboBox"); ConnectBrowseButton("win32ResourceFileBrowseButton", "win32ResourceFileComboBox",
"${res:SharpDevelop.FileFilter.AllFiles}|*.*",
TextBoxEditMode.EditEvaluatedProperty);
ConfigurationGuiBinding b; ConfigurationGuiBinding b;
ChooseStorageLocationButton locationButton; ChooseStorageLocationButton locationButton;
b = helper.BindString("assemblyNameTextBox", "AssemblyName"); b = helper.BindString("assemblyNameTextBox", "AssemblyName", TextBoxEditMode.EditEvaluatedProperty);
b.CreateLocationButton("assemblyNameTextBox"); b.CreateLocationButton("assemblyNameTextBox");
Get<TextBox>("assemblyName").TextChanged += new EventHandler(RefreshOutputNameTextBox); Get<TextBox>("assemblyName").TextChanged += new EventHandler(RefreshOutputNameTextBox);
b = helper.BindString("rootNamespaceTextBox", "RootNamespace"); b = helper.BindString("rootNamespaceTextBox", "RootNamespace", TextBoxEditMode.EditEvaluatedProperty);
b.CreateLocationButton("rootNamespaceTextBox"); b.CreateLocationButton("rootNamespaceTextBox");
b = helper.BindEnum<OutputType>("outputTypeComboBox", "OutputType"); b = helper.BindEnum<OutputType>("outputTypeComboBox", "OutputType");
locationButton = b.CreateLocationButton("outputTypeComboBox"); locationButton = b.CreateLocationButton("outputTypeComboBox");
Get<ComboBox>("outputType").SelectedIndexChanged += new EventHandler(RefreshOutputNameTextBox); Get<ComboBox>("outputType").SelectedIndexChanged += new EventHandler(RefreshOutputNameTextBox);
b = helper.BindString("startupObjectComboBox", "StartupObject"); b = helper.BindString("startupObjectComboBox", "StartupObject", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton); b.RegisterLocationButton(locationButton);
b = helper.BindString("applicationIconComboBox", "ApplicationIcon"); b = helper.BindString("applicationIconComboBox", "ApplicationIcon", TextBoxEditMode.EditEvaluatedProperty);
Get<ComboBox>("applicationIcon").TextChanged += new EventHandler(ApplicationIconComboBoxTextChanged); Get<ComboBox>("applicationIcon").TextChanged += new EventHandler(ApplicationIconComboBoxTextChanged);
b.CreateLocationButton("applicationIconComboBox"); b.CreateLocationButton("applicationIconComboBox");
b = helper.BindString("win32ResourceFileComboBox", "Win32Resource"); b = helper.BindString("win32ResourceFileComboBox", "Win32Resource", TextBoxEditMode.EditEvaluatedProperty);
b.CreateLocationButton("win32ResourceFileComboBox"); b.CreateLocationButton("win32ResourceFileComboBox");
Get<TextBox>("projectFolder").Text = project.Directory; Get<TextBox>("projectFolder").Text = project.Directory;

10
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildEvents.cs

@ -22,17 +22,19 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
ConnectBrowseButton("preBuildEventBrowseButton", ConnectBrowseButton("preBuildEventBrowseButton",
"preBuildEventTextBox", "preBuildEventTextBox",
"${res:SharpDevelop.FileFilter.AllFiles}|*.*"); "${res:SharpDevelop.FileFilter.AllFiles}|*.*",
TextBoxEditMode.EditRawProperty);
ConnectBrowseButton("postBuildEventBrowseButton", ConnectBrowseButton("postBuildEventBrowseButton",
"postBuildEventTextBox", "postBuildEventTextBox",
"${res:SharpDevelop.FileFilter.AllFiles}|*.*"); "${res:SharpDevelop.FileFilter.AllFiles}|*.*",
TextBoxEditMode.EditRawProperty);
ConfigurationGuiBinding b; ConfigurationGuiBinding b;
b = helper.BindString("preBuildEventTextBox", "PreBuildEvent"); b = helper.BindString("preBuildEventTextBox", "PreBuildEvent", TextBoxEditMode.EditRawProperty);
b.CreateLocationButton("preBuildEventTextBox"); b.CreateLocationButton("preBuildEventTextBox");
b = helper.BindString("postBuildEventTextBox", "PostBuildEvent"); b = helper.BindString("postBuildEventTextBox", "PostBuildEvent", TextBoxEditMode.EditRawProperty);
b.CreateLocationButton("postBuildEventTextBox"); b.CreateLocationButton("postBuildEventTextBox");
b = helper.BindEnum<RunPostBuildEvent>("runPostBuildEventComboBox", "RunPostBuildEvent"); b = helper.BindEnum<RunPostBuildEvent>("runPostBuildEventComboBox", "RunPostBuildEvent");

15
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.cs

@ -17,8 +17,11 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public override void LoadPanelContents() public override void LoadPanelContents()
{ {
SetupFromXmlResource("ProjectOptions.DebugOptions.xfrm"); SetupFromXmlResource("ProjectOptions.DebugOptions.xfrm");
ConnectBrowseButton("startExternalProgramBrowseButton", "startExternalProgramTextBox", "${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;*.com;*.pif;*.bat;*.cmd"); ConnectBrowseButton("startExternalProgramBrowseButton", "startExternalProgramTextBox",
ConnectBrowseFolder("workingDirectoryBrowseButton", "workingDirectoryTextBox"); "${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;*.com;*.pif;*.bat;*.cmd",
TextBoxEditMode.EditEvaluatedProperty);
ConnectBrowseFolder("workingDirectoryBrowseButton", "workingDirectoryTextBox",
TextBoxEditMode.EditEvaluatedProperty);
InitializeHelper(); InitializeHelper();
@ -32,20 +35,20 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
locationButton = b.CreateLocationButtonInPanel("startActionGroupBox"); locationButton = b.CreateLocationButtonInPanel("startActionGroupBox");
b = helper.BindString("startExternalProgramTextBox", "StartProgram"); b = helper.BindString("startExternalProgramTextBox", "StartProgram", TextBoxEditMode.EditEvaluatedProperty);
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
b.RegisterLocationButton(locationButton); b.RegisterLocationButton(locationButton);
b = helper.BindString("startBrowserInURLTextBox", "StartURL"); b = helper.BindString("startBrowserInURLTextBox", "StartURL", TextBoxEditMode.EditEvaluatedProperty);
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
b.RegisterLocationButton(locationButton); b.RegisterLocationButton(locationButton);
Get<RadioButton>("startExternalProgram").CheckedChanged += UpdateEnabledStates; Get<RadioButton>("startExternalProgram").CheckedChanged += UpdateEnabledStates;
Get<RadioButton>("startBrowserInURL").CheckedChanged += UpdateEnabledStates; Get<RadioButton>("startBrowserInURL").CheckedChanged += UpdateEnabledStates;
b = helper.BindString("commandLineArgumentsTextBox", "StartArguments"); b = helper.BindString("commandLineArgumentsTextBox", "StartArguments", TextBoxEditMode.EditEvaluatedProperty);
locationButton = b.CreateLocationButtonInPanel("startOptionsGroupBox"); locationButton = b.CreateLocationButtonInPanel("startOptionsGroupBox");
b = helper.BindString("workingDirectoryTextBox", "StartWorkingDirectory"); b = helper.BindString("workingDirectoryTextBox", "StartWorkingDirectory", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton); b.RegisterLocationButton(locationButton);
UpdateEnabledStates(this, EventArgs.Empty); UpdateEnabledStates(this, EventArgs.Empty);

4
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.cs

@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
keyFile = Get<ComboBox>("keyFile"); keyFile = Get<ComboBox>("keyFile");
b = helper.BindString(keyFile, "AssemblyOriginatorKeyFile"); b = helper.BindString(keyFile, "AssemblyOriginatorKeyFile", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton); b.RegisterLocationButton(locationButton);
FindKeys(baseDirectory); FindKeys(baseDirectory);
if (keyFile.Text.Length > 0) { if (keyFile.Text.Length > 0) {
@ -96,7 +96,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void BrowseKeyFile() void BrowseKeyFile()
{ {
keyFile.SelectedIndex = -1; keyFile.SelectedIndex = -1;
new BrowseButtonEvent(this, "keyFileComboBox", "${res:SharpDevelop.FileFilter.KeyFiles} (" + KeyFileExtensions + ")|" + KeyFileExtensions + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*").Event(this, EventArgs.Empty); new BrowseButtonEvent(this, "keyFileComboBox", "${res:SharpDevelop.FileFilter.KeyFiles} (" + KeyFileExtensions + ")|" + KeyFileExtensions + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*", TextBoxEditMode.EditEvaluatedProperty).Event(this, EventArgs.Empty);
} }
void CreateKeyFile() void CreateKeyFile()

4
src/Main/Base/Project/Src/Project/ConfigurationGuiBinding.cs

@ -41,6 +41,10 @@ namespace ICSharpCode.SharpDevelop.Project
} }
} }
/// <summary>
/// Gets if the value should be evaluated when loading the property and escaped
/// when saving. The default value is true.
/// </summary>
public bool TreatPropertyValueAsLiteral { public bool TreatPropertyValueAsLiteral {
get { return treatPropertyValueAsLiteral; } get { return treatPropertyValueAsLiteral; }
set { treatPropertyValueAsLiteral = value; } set { treatPropertyValueAsLiteral = value; }

43
src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs

@ -17,6 +17,26 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.Project namespace ICSharpCode.SharpDevelop.Project
{ {
/// <summary>
/// Specifies whether the user enters the property value or the MSBuild code for
/// the property value.
/// </summary>
public enum TextBoxEditMode
{
/// <summary>
/// The user edits the MSBuild property value. It is not evaluated on loading,
/// and not escaped when saving.
/// The user can use MSBuild properties with $() in the text box.
/// </summary>
EditRawProperty,
/// <summary>
/// The user edits the property. When loading the value, it is evaluated;
/// when saving the value, it is escaped.
/// The user cannot use MSBuild properties with $() because the $ will be escaped.
/// </summary>
EditEvaluatedProperty
}
/// <summary> /// <summary>
/// Class that helps connecting configuration GUI controls to MsBuild properties. /// Class that helps connecting configuration GUI controls to MsBuild properties.
/// </summary> /// </summary>
@ -232,20 +252,37 @@ namespace ICSharpCode.SharpDevelop.Project
#region Bind string to TextBox or ComboBox #region Bind string to TextBox or ComboBox
static Func<string> GetEmptyString = delegate { return ""; }; static Func<string> GetEmptyString = delegate { return ""; };
[Obsolete("Please explicitly specify textBoxEditMode")]
public ConfigurationGuiBinding BindString(string control, string property) public ConfigurationGuiBinding BindString(string control, string property)
{ {
return BindString(controlDictionary[control], property, GetEmptyString); return BindString(controlDictionary[control], property, TextBoxEditMode.EditEvaluatedProperty, GetEmptyString);
} }
[Obsolete("Please explicitly specify textBoxEditMode")]
public ConfigurationGuiBinding BindString(Control control, string property) public ConfigurationGuiBinding BindString(Control control, string property)
{ {
return BindString(control, property, GetEmptyString); return BindString(control, property, TextBoxEditMode.EditEvaluatedProperty, GetEmptyString);
} }
public ConfigurationGuiBinding BindString(Control control, string property, Func<string> defaultValueProvider) public ConfigurationGuiBinding BindString(string control, string property, TextBoxEditMode textBoxEditMode)
{
return BindString(controlDictionary[control], property, textBoxEditMode, GetEmptyString);
}
public ConfigurationGuiBinding BindString(Control control, string property, TextBoxEditMode textBoxEditMode)
{
return BindString(control, property, textBoxEditMode, GetEmptyString);
}
public ConfigurationGuiBinding BindString(Control control, string property, TextBoxEditMode textBoxEditMode, Func<string> defaultValueProvider)
{ {
if (control is TextBoxBase || control is ComboBox) { if (control is TextBoxBase || control is ComboBox) {
SimpleTextBinding binding = new SimpleTextBinding(control, defaultValueProvider); SimpleTextBinding binding = new SimpleTextBinding(control, defaultValueProvider);
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
binding.TreatPropertyValueAsLiteral = true;
} else {
binding.TreatPropertyValueAsLiteral = false;
}
AddBinding(property, binding); AddBinding(property, binding);
control.TextChanged += ControlValueChanged; control.TextChanged += ControlValueChanged;
if (control is ComboBox) { if (control is ComboBox) {

Loading…
Cancel
Save