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

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

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

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

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

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

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

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

@ -21,25 +21,23 @@ namespace ICSharpCode.WixBinding @@ -21,25 +21,23 @@ namespace ICSharpCode.WixBinding
InitializeHelper();
ConfigurationGuiBinding b;
b = helper.BindString("outputPathTextBox", "OutputPath");
b = helper.BindString("outputPathTextBox", "OutputPath", TextBoxEditMode.EditRawProperty);
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");
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");
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.TreatPropertyValueAsLiteral = false;
ConnectBrowseFolder("wixToolPathBrowseButton", "wixToolPathTextBox", String.Empty);
b = helper.BindString("wixToolPathTextBox", "WixToolPath", TextBoxEditMode.EditRawProperty);
ConnectBrowseFolder("wixToolPathBrowseButton", "wixToolPathTextBox", String.Empty, TextBoxEditMode.EditRawProperty);
b = helper.BindString("wixMSBuildExtensionsPathTextBox", "WixMSBuildExtensionsPath");
b.TreatPropertyValueAsLiteral = false;
ConnectBrowseFolder("wixMSBuildExtensionsPathBrowseButton", "wixMSBuildExtensionsPathTextBox", String.Empty);
b = helper.BindString("wixMSBuildExtensionsPathTextBox", "WixMSBuildExtensionsPath", TextBoxEditMode.EditRawProperty);
ConnectBrowseFolder("wixMSBuildExtensionsPathBrowseButton", "wixMSBuildExtensionsPathTextBox", String.Empty, TextBoxEditMode.EditRawProperty);
// 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.
@ -66,7 +64,7 @@ namespace ICSharpCode.WixBinding @@ -66,7 +64,7 @@ namespace ICSharpCode.WixBinding
new StringPair("2", "2"),
new StringPair("3", "3"));
ChooseStorageLocationButton locationButton = b.CreateLocationButtonInPanel("errorsAndWarningsGroupBox");
b = helper.BindString("suppressWarningsTextBox", "NoWarn");
b = helper.BindString("suppressWarningsTextBox", "NoWarn", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton);
b = helper.BindBoolean("treatWarningsAsErrorsCheckBox", "TreatWarningsAsErrors", false);

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

@ -10,6 +10,7 @@ using System.Windows.Forms; @@ -10,6 +10,7 @@ using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Gui
{
@ -94,11 +95,17 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -94,11 +95,17 @@ namespace ICSharpCode.SharpDevelop.Gui
protected string baseDirectory;
[Obsolete("Please specify fileFilter and targetNeedsMSBuildEncoding")]
protected void ConnectBrowseButton(string browseButton, string target)
{
ConnectBrowseButton(browseButton, target, "${res:SharpDevelop.FileFilter.AllFiles}|*.*");
}
[Obsolete("Please specify targetNeedsMSBuildEncoding")]
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) {
@ -110,14 +117,24 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -110,14 +117,24 @@ namespace ICSharpCode.SharpDevelop.Gui
MessageService.ShowError(target + " not found!");
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)
{
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)
{
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) {
MessageService.ShowError(browseButton + " not found!");
@ -128,7 +145,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -128,7 +145,7 @@ namespace ICSharpCode.SharpDevelop.Gui
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
@ -136,12 +153,20 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -136,12 +153,20 @@ namespace ICSharpCode.SharpDevelop.Gui
AbstractOptionPanel panel;
string target;
string filter;
TextBoxEditMode textBoxEditMode;
[Obsolete("specify textBoxEditMode")]
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.filter = filter;
this.target = target;
this.textBoxEditMode = textBoxEditMode;
}
public void Event(object sender, EventArgs e)
@ -155,7 +180,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -155,7 +180,11 @@ namespace ICSharpCode.SharpDevelop.Gui
if (panel.baseDirectory != null) {
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 @@ -166,19 +195,30 @@ namespace ICSharpCode.SharpDevelop.Gui
AbstractOptionPanel panel;
string target;
string description;
TextBoxEditMode textBoxEditMode;
[Obsolete("Do not use BrowseFolderEvent directly")]
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.description = description;
this.target = target;
this.textBoxEditMode = textBoxEditMode;
}
public void Event(object sender, EventArgs e)
{
string startLocation = panel.baseDirectory;
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)) {
@ -189,7 +229,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -189,7 +229,11 @@ namespace ICSharpCode.SharpDevelop.Gui
}
if (!path.EndsWith("\\") && !path.EndsWith("/"))
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 @@ -22,9 +22,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{
helper.BindString(Get<TextBox>("baseIntermediateOutputPath"),
"BaseIntermediateOutputPath",
TextBoxEditMode.EditRawProperty,
delegate { return @"obj\"; }
).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()
@ -32,6 +35,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -32,6 +35,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
ConfigurationGuiBinding binding = helper.BindString(
Get<TextBox>("intermediateOutputPath"),
"IntermediateOutputPath",
TextBoxEditMode.EditRawProperty,
delegate {
return Path.Combine(helper.GetProperty("BaseIntermediateOutputPath", @"obj\", true),
helper.Configuration);
@ -39,19 +43,23 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -39,19 +43,23 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
);
binding.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
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()
{
helper.BindString("outputPathTextBox", "OutputPath").CreateLocationButton("outputPathTextBox");
ConnectBrowseFolder("outputPathBrowseButton", "outputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}");
helper.BindString("outputPathTextBox", "OutputPath", TextBoxEditMode.EditRawProperty)
.CreateLocationButton("outputPathTextBox");
ConnectBrowseFolder("outputPathBrowseButton", "outputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", TextBoxEditMode.EditRawProperty);
}
protected void InitXmlDoc()
{
ConfigurationGuiBinding b;
b = helper.BindString("xmlDocumentationTextBox", "DocumentationFile");
b = helper.BindString("xmlDocumentationTextBox", "DocumentationFile", TextBoxEditMode.EditRawProperty);
b.CreateLocationButton("xmlDocumentationCheckBox");
helper.Loaded += XmlDocHelperLoaded;
XmlDocHelperLoaded(null, null);
@ -88,13 +96,13 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -88,13 +96,13 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
new StringPair("3", "3"),
new StringPair("4", "4"));
ChooseStorageLocationButton locationButton = b.CreateLocationButtonInPanel("warningsGroupBox");
b = helper.BindString("suppressWarningsTextBox", "NoWarn");
b = helper.BindString("suppressWarningsTextBox", "NoWarn", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton);
b = new WarningsAsErrorsBinding(this);
helper.AddBinding("TreatWarningsAsErrors", b);
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);
EventHandler setDirty = delegate {

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

@ -23,32 +23,36 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -23,32 +23,36 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
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.
ConnectBrowseButton("win32ResourceFileBrowseButton", "win32ResourceFileComboBox");
ConnectBrowseButton("win32ResourceFileBrowseButton", "win32ResourceFileComboBox",
"${res:SharpDevelop.FileFilter.AllFiles}|*.*",
TextBoxEditMode.EditEvaluatedProperty);
ConfigurationGuiBinding b;
ChooseStorageLocationButton locationButton;
b = helper.BindString("assemblyNameTextBox", "AssemblyName");
b = helper.BindString("assemblyNameTextBox", "AssemblyName", TextBoxEditMode.EditEvaluatedProperty);
b.CreateLocationButton("assemblyNameTextBox");
Get<TextBox>("assemblyName").TextChanged += new EventHandler(RefreshOutputNameTextBox);
b = helper.BindString("rootNamespaceTextBox", "RootNamespace");
b = helper.BindString("rootNamespaceTextBox", "RootNamespace", TextBoxEditMode.EditEvaluatedProperty);
b.CreateLocationButton("rootNamespaceTextBox");
b = helper.BindEnum<OutputType>("outputTypeComboBox", "OutputType");
locationButton = b.CreateLocationButton("outputTypeComboBox");
Get<ComboBox>("outputType").SelectedIndexChanged += new EventHandler(RefreshOutputNameTextBox);
b = helper.BindString("startupObjectComboBox", "StartupObject");
b = helper.BindString("startupObjectComboBox", "StartupObject", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton);
b = helper.BindString("applicationIconComboBox", "ApplicationIcon");
b = helper.BindString("applicationIconComboBox", "ApplicationIcon", TextBoxEditMode.EditEvaluatedProperty);
Get<ComboBox>("applicationIcon").TextChanged += new EventHandler(ApplicationIconComboBoxTextChanged);
b.CreateLocationButton("applicationIconComboBox");
b = helper.BindString("win32ResourceFileComboBox", "Win32Resource");
b = helper.BindString("win32ResourceFileComboBox", "Win32Resource", TextBoxEditMode.EditEvaluatedProperty);
b.CreateLocationButton("win32ResourceFileComboBox");
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 @@ -22,17 +22,19 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
ConnectBrowseButton("preBuildEventBrowseButton",
"preBuildEventTextBox",
"${res:SharpDevelop.FileFilter.AllFiles}|*.*");
"${res:SharpDevelop.FileFilter.AllFiles}|*.*",
TextBoxEditMode.EditRawProperty);
ConnectBrowseButton("postBuildEventBrowseButton",
"postBuildEventTextBox",
"${res:SharpDevelop.FileFilter.AllFiles}|*.*");
"${res:SharpDevelop.FileFilter.AllFiles}|*.*",
TextBoxEditMode.EditRawProperty);
ConfigurationGuiBinding b;
b = helper.BindString("preBuildEventTextBox", "PreBuildEvent");
b = helper.BindString("preBuildEventTextBox", "PreBuildEvent", TextBoxEditMode.EditRawProperty);
b.CreateLocationButton("preBuildEventTextBox");
b = helper.BindString("postBuildEventTextBox", "PostBuildEvent");
b = helper.BindString("postBuildEventTextBox", "PostBuildEvent", TextBoxEditMode.EditRawProperty);
b.CreateLocationButton("postBuildEventTextBox");
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 @@ -17,8 +17,11 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public override void LoadPanelContents()
{
SetupFromXmlResource("ProjectOptions.DebugOptions.xfrm");
ConnectBrowseButton("startExternalProgramBrowseButton", "startExternalProgramTextBox", "${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;*.com;*.pif;*.bat;*.cmd");
ConnectBrowseFolder("workingDirectoryBrowseButton", "workingDirectoryTextBox");
ConnectBrowseButton("startExternalProgramBrowseButton", "startExternalProgramTextBox",
"${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;*.com;*.pif;*.bat;*.cmd",
TextBoxEditMode.EditEvaluatedProperty);
ConnectBrowseFolder("workingDirectoryBrowseButton", "workingDirectoryTextBox",
TextBoxEditMode.EditEvaluatedProperty);
InitializeHelper();
@ -32,20 +35,20 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -32,20 +35,20 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
locationButton = b.CreateLocationButtonInPanel("startActionGroupBox");
b = helper.BindString("startExternalProgramTextBox", "StartProgram");
b = helper.BindString("startExternalProgramTextBox", "StartProgram", TextBoxEditMode.EditEvaluatedProperty);
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
b.RegisterLocationButton(locationButton);
b = helper.BindString("startBrowserInURLTextBox", "StartURL");
b = helper.BindString("startBrowserInURLTextBox", "StartURL", TextBoxEditMode.EditEvaluatedProperty);
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
b.RegisterLocationButton(locationButton);
Get<RadioButton>("startExternalProgram").CheckedChanged += UpdateEnabledStates;
Get<RadioButton>("startBrowserInURL").CheckedChanged += UpdateEnabledStates;
b = helper.BindString("commandLineArgumentsTextBox", "StartArguments");
b = helper.BindString("commandLineArgumentsTextBox", "StartArguments", TextBoxEditMode.EditEvaluatedProperty);
locationButton = b.CreateLocationButtonInPanel("startOptionsGroupBox");
b = helper.BindString("workingDirectoryTextBox", "StartWorkingDirectory");
b = helper.BindString("workingDirectoryTextBox", "StartWorkingDirectory", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton);
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 @@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
keyFile = Get<ComboBox>("keyFile");
b = helper.BindString(keyFile, "AssemblyOriginatorKeyFile");
b = helper.BindString(keyFile, "AssemblyOriginatorKeyFile", TextBoxEditMode.EditEvaluatedProperty);
b.RegisterLocationButton(locationButton);
FindKeys(baseDirectory);
if (keyFile.Text.Length > 0) {
@ -96,7 +96,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -96,7 +96,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void BrowseKeyFile()
{
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()

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

@ -41,6 +41,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -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 {
get { return treatPropertyValueAsLiteral; }
set { treatPropertyValueAsLiteral = value; }

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

@ -17,6 +17,26 @@ using ICSharpCode.SharpDevelop.Gui; @@ -17,6 +17,26 @@ using ICSharpCode.SharpDevelop.Gui;
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>
/// Class that helps connecting configuration GUI controls to MsBuild properties.
/// </summary>
@ -232,20 +252,37 @@ namespace ICSharpCode.SharpDevelop.Project @@ -232,20 +252,37 @@ namespace ICSharpCode.SharpDevelop.Project
#region Bind string to TextBox or ComboBox
static Func<string> GetEmptyString = delegate { return ""; };
[Obsolete("Please explicitly specify textBoxEditMode")]
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)
{
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) {
SimpleTextBinding binding = new SimpleTextBinding(control, defaultValueProvider);
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
binding.TreatPropertyValueAsLiteral = true;
} else {
binding.TreatPropertyValueAsLiteral = false;
}
AddBinding(property, binding);
control.TextChanged += ControlValueChanged;
if (control is ComboBox) {

Loading…
Cancel
Save