From 42bbe19852838fe8b4ee9a81fef6730aed36b80d Mon Sep 17 00:00:00 2001 From: PeterForstmeier Date: Mon, 8 Oct 2012 20:43:35 +0200 Subject: [PATCH] Cleanup BuildOutput --- .../Src/OptionPanels/BuildOptions.xaml | 58 +----- .../Src/OptionPanels/BuildOptions.xaml.cs | 167 +++++++++-------- .../Project/ICSharpCode.SharpDevelop.csproj | 5 + .../ProjectOptions/BuildAdvanced.xaml.cs | 87 ++++----- .../ProjectOptions/BuildOutput.xaml | 78 ++++++++ .../ProjectOptions/BuildOutput.xaml.cs | 174 ++++++++++++++++++ 6 files changed, 382 insertions(+), 187 deletions(-) create mode 100644 src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildOutput.xaml create mode 100644 src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildOutput.xaml.cs diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml index 8acfd27682..ce60c55ae5 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml @@ -76,6 +76,7 @@ + @@ -91,65 +92,14 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs index bc2da0eaff..fbbf6c2015 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs @@ -26,8 +26,8 @@ namespace CSharpBinding.OptionPanels public partial class BuildOptions : ProjectOptionPanel { - private System.Windows.Input.ICommand updateProjectCommand; - private System.Windows.Input.ICommand changeOutputPath; +// private System.Windows.Input.ICommand updateProjectCommand; +// private System.Windows.Input.ICommand changeOutputPath; public BuildOptions() { @@ -63,19 +63,19 @@ namespace CSharpBinding.OptionPanels } - public ProjectProperty OutputPath { - get {return GetProperty("OutputPath", "", TextBoxEditMode.EditRawProperty); } - } - - - public ProjectProperty DocumentationFile { - get {return GetProperty("DocumentationFile", "", TextBoxEditMode.EditRawProperty);} - } - - - public ProjectProperty DebugType { - get {return GetProperty("DebugType",ICSharpCode.SharpDevelop.Project.DebugSymbolType.Full ); } - } +// public ProjectProperty OutputPath { +// get {return GetProperty("OutputPath", "", TextBoxEditMode.EditRawProperty); } +// } +// +// +// public ProjectProperty DocumentationFile { +// get {return GetProperty("DocumentationFile", "", TextBoxEditMode.EditRawProperty);} +// } +// +// +// public ProjectProperty DebugType { +// get {return GetProperty("DebugType",ICSharpCode.SharpDevelop.Project.DebugSymbolType.Full ); } +// } #endregion @@ -84,19 +84,20 @@ namespace CSharpBinding.OptionPanels protected override void Initialize() { - this.UpdateProjectCommand = new RelayCommand(UpdateProjectExecute); - this.ChangeOutputPath = new RelayCommand(ChangeOutputPathExecute); - UpdateTargetFrameworkCombo(); - if (DocumentationFile.Value.Length > 0) { - documentFileIsChecked = true; - } - XmlDocHelper(); +// this.UpdateProjectCommand = new RelayCommand(UpdateProjectExecute); +// this.ChangeOutputPath = new RelayCommand(ChangeOutputPathExecute); +// UpdateTargetFrameworkCombo(); +// if (DocumentationFile.Value.Length > 0) { +// documentFileIsChecked = true; +// } +// XmlDocHelper(); } protected override void Load(MSBuildBasedProject project, string configuration, string platform) { base.Load(project, configuration, platform); + buildOutput.SetProjectOptions(this); this.buildAdvanced.SetProjectOptions(this); this.errorsAndWarnings.SetProjectOptions(this); this.treatErrorsAndWarnings.SetProjectOptions(this); @@ -106,84 +107,88 @@ namespace CSharpBinding.OptionPanels protected override bool Save(MSBuildBasedProject project, string configuration, string platform) { - if (buildAdvanced.SaveProjectOptions()) { +// if (buildAdvanced.SaveProjectOptions()) { treatErrorsAndWarnings.SaveProjectOptions(); return base.Save(project, configuration, platform); - } - return false; +// } +// return false; } #endregion - #region Documentation File - - private bool documentFileIsChecked; - - public bool DocumentFileIsChecked { - get { return documentFileIsChecked; } - set { documentFileIsChecked = value; - XmlDocHelper(); - base.RaisePropertyChanged(() => DocumentFileIsChecked); - } - } - - private void XmlDocHelper() - { - if (DocumentFileIsChecked) { - this.xmlDocumentationTextBox.Text = MSBuildInternals.Escape( - Path.ChangeExtension(ICSharpCode.Core.FileUtility.GetRelativePath(base.Project.Directory, base.Project.OutputAssemblyFullPath), - ".xml")); - } else { - this.xmlDocumentationTextBox.Text = string.Empty; - } - } - - - #endregion +// #region Documentation File +// +// private bool documentFileIsChecked; +// +// public bool DocumentFileIsChecked { +// get { return documentFileIsChecked; } +// set { documentFileIsChecked = value; +// XmlDocHelper(); +// base.RaisePropertyChanged(() => DocumentFileIsChecked); +// } +// } +// +// private void XmlDocHelper() +// { +// /* +// if (DocumentFileIsChecked) { +// this.xmlDocumentationTextBox.Text = MSBuildInternals.Escape( +// Path.ChangeExtension(ICSharpCode.Core.FileUtility.GetRelativePath(base.Project.Directory, base.Project.OutputAssemblyFullPath), +// ".xml")); +// } else { +// this.xmlDocumentationTextBox.Text = string.Empty; +// } +// */ +// } +// +// +// #endregion #region Command Update Project - public System.Windows.Input.ICommand UpdateProjectCommand { - get { return updateProjectCommand; } - set { updateProjectCommand = value; - base.RaisePropertyChanged(() =>this.UpdateProjectCommand); - } - } +// public System.Windows.Input.ICommand UpdateProjectCommand { +// get { return updateProjectCommand; } +// set { updateProjectCommand = value; +// base.RaisePropertyChanged(() =>this.UpdateProjectCommand); +// } +// } - private void UpdateProjectExecute () - { - UpgradeViewContent.Show(base.Project.ParentSolution).Select(base.Project as IUpgradableProject); - this.UpdateTargetFrameworkCombo(); - } +// private void UpdateProjectExecute () +// { +// UpgradeViewContent.Show(base.Project.ParentSolution).Select(base.Project as IUpgradableProject); +//// this.UpdateTargetFrameworkCombo(); +// } - private void UpdateTargetFrameworkCombo() - { - TargetFramework fx = ((IUpgradableProject)base.Project).CurrentTargetFramework; - if (fx != null) { - targetFrameworkComboBox.Items.Add(fx.DisplayName); - targetFrameworkComboBox.SelectedIndex = 0; - } - } +// private void UpdateTargetFrameworkCombo() +// { +// /* +// TargetFramework fx = ((IUpgradableProject)base.Project).CurrentTargetFramework; +// if (fx != null) { +// targetFrameworkComboBox.Items.Add(fx.DisplayName); +// targetFrameworkComboBox.SelectedIndex = 0; +// } +// */ +// } #endregion #region ChangeOutputPathCommand - public System.Windows.Input.ICommand ChangeOutputPath - { - get {return this.changeOutputPath;} - set {this.changeOutputPath = value; - base.RaisePropertyChanged(() => this.ChangeOutputPath); - } - } - private void ChangeOutputPathExecute() - { - BrowseForFolder(OutputPath, "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); - } - +// public System.Windows.Input.ICommand ChangeOutputPath +// { +// get {return this.changeOutputPath;} +// set {this.changeOutputPath = value; +// base.RaisePropertyChanged(() => this.ChangeOutputPath); +// } +// } +// private void ChangeOutputPathExecute() +// { +//// BrowseForFolder(OutputPath, "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); +// } +// #endregion diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index a0142a893a..2fce75d1ef 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -279,6 +279,10 @@ BuildAdvanced.xaml Code + + BuildOutput.xaml + Code + DebugOptions.xaml Code @@ -924,6 +928,7 @@ + diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildAdvanced.xaml.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildAdvanced.xaml.cs index 274e75f4f4..0b035540cc 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildAdvanced.xaml.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildAdvanced.xaml.cs @@ -28,10 +28,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels /// public partial class BuildAdvanced : UserControl,IProjectUserControl, INotifyPropertyChanged { - private List serializationInfo; - private List targetCPU; + private string dllBaseAdress; - private List fileAlignment; private System.Windows.Input.ICommand baseIntermediateOutputPathCommand; private System.Windows.Input.ICommand intermediateOutputPathCommand; private ProjectOptionPanel projectOptions; @@ -39,28 +37,32 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels public BuildAdvanced() { InitializeComponent(); + InitializeCombos(); + this.BaseIntermediateOutputPathCommand = new RelayCommand(BaseIntermediateOutputPathExecute); + this.IntermediateOutputPathCommand = new RelayCommand(IntermediateOutputPathExecute); this.DataContext = this; - this.serializationInfo = new List(); - - this.serializationInfo.Add (new KeyItemPair("Off",StringParser.Parse("${res:Dialog.ProjectOptions.Build.Off}"))); - this.serializationInfo.Add (new KeyItemPair("On",StringParser.Parse("${res:Dialog.ProjectOptions.Build.On}"))); - this.serializationInfo.Add (new KeyItemPair("Auto",StringParser.Parse( "${res:Dialog.ProjectOptions.Build.Auto}"))); - this.SerializationInfo = this.serializationInfo; + } + + void InitializeCombos() + { + + this.SerializationInfo = new List(); + this.SerializationInfo.Add(new KeyItemPair("Off", StringParser.Parse("${res:Dialog.ProjectOptions.Build.Off}"))); + this.SerializationInfo.Add(new KeyItemPair("On", StringParser.Parse("${res:Dialog.ProjectOptions.Build.On}"))); + this.SerializationInfo.Add(new KeyItemPair("Auto", StringParser.Parse("${res:Dialog.ProjectOptions.Build.Auto}"))); - this.targetCPU = new List(); - this.targetCPU.Add(new KeyItemPair( "AnyCPU",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any}"))); - this.targetCPU.Add(new KeyItemPair( "x86",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x86}"))); - this.targetCPU.Add(new KeyItemPair( "x64",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x64}"))); - this.targetCPU.Add(new KeyItemPair( "Itanium",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Itanium}"))); - this.TargetCPU = targetCPU; + this.TargetCPU = new List(); + this.TargetCPU.Add(new KeyItemPair("AnyCPU", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any}"))); + this.TargetCPU.Add(new KeyItemPair("x86", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x86}"))); + this.TargetCPU.Add(new KeyItemPair("x64", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x64}"))); + this.TargetCPU.Add(new KeyItemPair("Itanium", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Itanium}"))); - fileAlignment = new List(); - fileAlignment.Add( new KeyItemPair("512", "512")); - fileAlignment.Add( new KeyItemPair("1024", "1024")); - fileAlignment.Add(new KeyItemPair("2048", "2048")); - fileAlignment.Add(new KeyItemPair("4096", "4096")); - fileAlignment.Add(new KeyItemPair("8192", "8192")); - FileAlign = fileAlignment; + this.FileAlign = new List(); + this.FileAlign.Add(new KeyItemPair("512", "512")); + this.FileAlign.Add(new KeyItemPair("1024", "1024")); + this.FileAlign.Add(new KeyItemPair("2048", "2048")); + this.FileAlign.Add(new KeyItemPair("4096", "4096")); + this.FileAlign.Add(new KeyItemPair("8192", "8192")); } #region IProjectUserControl @@ -73,14 +75,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels } this.projectOptions = projectOptions; - this.BaseIntermediateOutputPathCommand = new RelayCommand(BaseIntermediateOutputPathExecute); - this.IntermediateOutputPathCommand = new RelayCommand(IntermediateOutputPathExecute); - int val; if (!int.TryParse(BaseAddress.Value, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out val)) { val = 0x400000; } DllBaseAdress = "0x" + val.ToString("x", NumberFormatInfo.InvariantInfo); + projectOptions.IsDirty = true; } @@ -108,34 +108,34 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels #region Properies public ProjectOptionPanel.ProjectProperty RegisterForComInterop { - get {return projectOptions.GetProperty("RegisterForComInterop", false, PropertyStorageLocations.PlatformSpecific ); } + get {return projectOptions.GetProperty("RegisterForComInterop", false, PropertyStorageLocations.PlatformSpecific ); } } public ProjectOptionPanel.ProjectProperty GenerateSerializationAssemblies { get {return projectOptions.GetProperty("GenerateSerializationAssemblies","Auto", - TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); } + TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); } } public ProjectOptionPanel.ProjectProperty PlatformTarget { get {return projectOptions.GetProperty("PlatformTarget","AnyCPU", - TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); } + TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); } } public ProjectOptionPanel.ProjectProperty FileAlignment { get {return projectOptions.GetProperty("FileAlignment","4096", - TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); } + TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); } } public ProjectOptionPanel.ProjectProperty BaseAddress { get {return projectOptions.GetProperty("BaseAddress","1000", - TextBoxEditMode.EditEvaluatedProperty,PropertyStorageLocations.PlatformSpecific ); } + TextBoxEditMode.EditEvaluatedProperty,PropertyStorageLocations.PlatformSpecific ); } } public ProjectOptionPanel.ProjectProperty BaseIntermediateOutputPath { get {return projectOptions.GetProperty("BaseIntermediateOutputPath",@"obj\", - TextBoxEditMode.EditRawProperty,PropertyStorageLocations.ConfigurationSpecific ); } + TextBoxEditMode.EditRawProperty,PropertyStorageLocations.ConfigurationSpecific ); } } @@ -143,31 +143,14 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels get {return projectOptions.GetProperty("IntermediateOutputPath",@"obj\$(Configuration)\",TextBoxEditMode.EditRawProperty ); } } - #endregion - public List SerializationInfo { - get {return this.serializationInfo;} - set {this.serializationInfo = value; - RaisePropertyChanged("SerializationInfo"); - } - } - - - public List TargetCPU { - get { return targetCPU; } - set { targetCPU = value; - RaisePropertyChanged("TargetCPU"); - } - } + + public List SerializationInfo {get;set;} + public List TargetCPU {get;set;} - public List FileAlign { - get { return fileAlignment; } - set { fileAlignment = value; - RaisePropertyChanged("FileAlign"); - } - } + public List FileAlign {get;set;} public string DllBaseAdress { diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildOutput.xaml b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildOutput.xaml new file mode 100644 index 0000000000..d508cca557 --- /dev/null +++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildOutput.xaml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildOutput.xaml.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildOutput.xaml.cs new file mode 100644 index 0000000000..0e2a4de9d4 --- /dev/null +++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildOutput.xaml.cs @@ -0,0 +1,174 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 30.09.2012 + * Time: 17:46 + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; + +using ICSharpCode.SharpDevelop.Project; +using ICSharpCode.SharpDevelop.Project.Converter; +using ICSharpCode.SharpDevelop.Widgets; + +namespace ICSharpCode.SharpDevelop.Gui.OptionPanels +{ + /// + /// Interaction logic for BuildOutput.xaml + /// + public partial class BuildOutput : UserControl,IProjectUserControl, INotifyPropertyChanged + { + private ProjectOptionPanel projectOptions; + private System.Windows.Input.ICommand updateProjectCommand; + private System.Windows.Input.ICommand changeOutputPath; + + public BuildOutput() + { + InitializeComponent(); + this.UpdateProjectCommand = new RelayCommand(UpdateProjectExecute); + this.ChangeOutputPath = new RelayCommand(ChangeOutputPathExecute); + DataContext = this; + } + + + #region Properties + + public ProjectOptionPanel.ProjectProperty OutputPath { + get {return projectOptions.GetProperty("OutputPath", "", TextBoxEditMode.EditRawProperty); } + } + + + public ProjectOptionPanel.ProjectProperty DocumentationFile { + get {return projectOptions.GetProperty("DocumentationFile", "", TextBoxEditMode.EditRawProperty);} + } + + + public ProjectOptionPanel.ProjectProperty DebugType { + get {return projectOptions.GetProperty("DebugType",ICSharpCode.SharpDevelop.Project.DebugSymbolType.Full ); } + } + + #endregion + + #region IProjectUserControl + + + public void SetProjectOptions(ProjectOptionPanel projectOptions) + { + if (projectOptions == null) { + throw new ArgumentNullException("projectOptions"); + } + this.projectOptions = projectOptions; + + UpdateTargetFrameworkCombo(); + if (DocumentationFile.Value.Length > 0) { + documentFileIsChecked = true; + } + XmlDocHelper(); + } + + public bool SaveProjectOptions() + { + throw new NotImplementedException(); + } + + #endregion + + + #region Documentation File + + private bool documentFileIsChecked; + + public bool DocumentFileIsChecked { + get { return documentFileIsChecked; } + set { documentFileIsChecked = value; + XmlDocHelper(); + RaisePropertyChanged("DocumentFileIsChecked"); + } + } + + private void XmlDocHelper() + { + if (DocumentFileIsChecked) { + this.xmlDocumentationTextBox.Text = MSBuildInternals.Escape( + Path.ChangeExtension(ICSharpCode.Core.FileUtility.GetRelativePath(projectOptions.Project.Directory,projectOptions. + Project.OutputAssemblyFullPath), + ".xml")); + } else { + this.xmlDocumentationTextBox.Text = string.Empty; + } + } + + #endregion + + + #region Command Update Project + + public System.Windows.Input.ICommand UpdateProjectCommand { + get { return updateProjectCommand; } + set { updateProjectCommand = value; + RaisePropertyChanged("UpdateProjectCommand"); + } + } + + + private void UpdateProjectExecute () + { + UpgradeViewContent.Show(projectOptions.Project.ParentSolution).Select(projectOptions.Project as IUpgradableProject); + this.UpdateTargetFrameworkCombo(); + } + + + private void UpdateTargetFrameworkCombo() + { + TargetFramework fx = ((IUpgradableProject)projectOptions.Project).CurrentTargetFramework; + if (fx != null) { + targetFrameworkComboBox.Items.Add(fx.DisplayName); + targetFrameworkComboBox.SelectedIndex = 0; + } + } + + #endregion + + #region ChangeOutputPathCommand + + public System.Windows.Input.ICommand ChangeOutputPath + { + get {return this.changeOutputPath;} + set {this.changeOutputPath = value; + RaisePropertyChanged("ChangeOutputPath"); + } + } + private void ChangeOutputPathExecute() + { + projectOptions.BrowseForFolder(OutputPath, "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); + } + + #endregion + + + #region INotifyPropertyChanged + + public event PropertyChangedEventHandler PropertyChanged; + + private void RaisePropertyChanged (string propertyName) + { + var handler = this.PropertyChanged; + if (handler != null) + { + handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + + #endregion + } +} \ No newline at end of file