diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml index 2e9b2887ed..38cf38db1b 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml @@ -1,142 +1,196 @@  - + x:Class="CSharpBinding.OptionPanels.BuildOptionsXaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop" xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"> - + - - - - - + + + - - - - - - + + + + + + - - - - - + + - - - - - - + + + - - - - + - - - - + - - - + - - - - - + + + + + - - - - + + + + - - - - + + - - + Command="{Binding ChangeOutputPath}"> - - - + - - - - - - + - + - - - + gui:EnumBinding.EnumType="{x:Type project:DebugSymbolType}"> - - + Height="25"> + + + + + Height="25"> + Height="25"> - + Height="25"> + + - + + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + - - - + + + - - + + - - - - - - - - + + + + + + - - - + + - - - + + + - - - + + + - - - - - - - + + + + - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs index 06bcb12443..6346a743bb 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs @@ -7,10 +7,13 @@ */ using System.Collections.Generic; using System.ComponentModel; +using System.IO; using System.Linq; using System.Windows.Controls; using System.Windows.Input; +using Gui.Dialogs.OptionPanels.ProjectOptions; +using ICSharpCode.Core; using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Editor; @@ -18,86 +21,160 @@ using ICSharpCode.SharpDevelop.Gui.OptionPanels; using ICSharpCode.SharpDevelop.Project; using ICSharpCode.SharpDevelop.Project.Converter; using ICSharpCode.SharpDevelop.Widgets; -using StringPair = System.Collections.Generic.KeyValuePair; - namespace CSharpBinding.OptionPanels { /// /// Interaction logic for BuildOptionsXaml.xaml /// - /// + /// SYST public partial class BuildOptionsXaml : ProjectOptionPanel { -// private List fileAlignment; + + private List serializationInfo; + private List targetCPU; + private List fileAlignment; + private List warnLevel; + + private System.Windows.Input.ICommand updateProjectCommand; + private System.Windows.Input.ICommand changeOutputPath; + private System.Windows.Input.ICommand baseIntermediateOutputPathCommand; + private System.Windows.Input.ICommand intermediateOutputPathCommand; - private ICommand updateProjectCommand; - private ICommand changeOutputPath; private MSBuildBasedProject project; - + public BuildOptionsXaml() { InitializeComponent(); - - - /* - fileAlignment = new List(); - fileAlignment.Add( new StringPair("512", "512")); - fileAlignment.Add( new StringPair("1024", "1024")); - fileAlignment.Add(new StringPair("2048", "2048")); - fileAlignment.Add(new StringPair("4096", "4096")); - fileAlignment.Add(new StringPair("8192", "8192"));*/ } private void Initialize() { + 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; + + 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; + + + 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.UpdateProjectCommand = new RelayCommand(UpdateProjectExecute); this.ChangeOutputPath = new RelayCommand(ChangeOutputPathExecute); UpdateTargetFrameworkCombo(); + XmlDocHelper(); + this.BaseIntermediateOutputPathCommand = new RelayCommand(BaseIntermediateOutputPathExecute); + this.IntermediateOutputPathCommand = new RelayCommand(IntermediateOutputPathExecute); + + this.warnLevel = new List(); + this.warnLevel.Add(new KeyItemPair("0","0")); + this.warnLevel.Add(new KeyItemPair("1","1")); + this.warnLevel.Add(new KeyItemPair("2","2")); + this.warnLevel.Add(new KeyItemPair("3","3")); + this.warnLevel.Add(new KeyItemPair("4","4")); + this.WarnLevel = warnLevel; + SetTreatWarningAsErrorRadioButtons(); + LoadWarningsLevel(); + base.RaisePropertyChanged(string.Empty); } + #region properties public ProjectProperty DefineConstants { - get {return GetProperty("DefineConstants", "", TextBoxEditMode.EditRawProperty); } + get {return GetProperty("DefineConstants", "", TextBoxEditMode.EditRawProperty); } } public ProjectProperty Optimize { - get {return GetProperty("Optimize", "", TextBoxEditMode.EditRawProperty); } + get {return GetProperty("Optimize", "", TextBoxEditMode.EditRawProperty); } } public ProjectProperty AllowUnsafeBlocks { - get {return GetProperty("AllowUnsafeBlocks", "", TextBoxEditMode.EditRawProperty); } + get {return GetProperty("AllowUnsafeBlocks", "", TextBoxEditMode.EditRawProperty); } } public ProjectProperty CheckForOverflowUnderflow { - get {return GetProperty("CheckForOverflowUnderflow", "", TextBoxEditMode.EditRawProperty); } + get {return GetProperty("CheckForOverflowUnderflow", "", TextBoxEditMode.EditRawProperty); } } public ProjectProperty NoStdLib { - get {return GetProperty("NoStdLib", "", TextBoxEditMode.EditRawProperty); } + get {return GetProperty("NoStdLib", "", TextBoxEditMode.EditRawProperty); } } public ProjectProperty OutputPath { - get {return GetProperty("OutputPath", "", TextBoxEditMode.EditRawProperty); } + get {return GetProperty("OutputPath", "", TextBoxEditMode.EditRawProperty); } } - // Documentfile missing and only partial implemented public ProjectProperty DocumentationFile { - get {return GetProperty("DocumentationFile", "", TextBoxEditMode.EditRawProperty);} + get {return GetProperty("DocumentationFile", "", TextBoxEditMode.EditRawProperty);} } - // - public ProjectProperty DebugType { - get {return GetProperty("DebugType",ICSharpCode.SharpDevelop.Project.DebugSymbolType.Full ); } + get {return GetProperty("DebugType",ICSharpCode.SharpDevelop.Project.DebugSymbolType.Full ); } + } + + + public ProjectProperty RegisterForComInterop { + get {return GetProperty("RegisterForComInterop","",TextBoxEditMode.EditRawProperty ); } + } + // Fehlt noch + public ProjectProperty BaseAddress { + get {return GetProperty("BaseAddress","0x400000",TextBoxEditMode.EditRawProperty ); } + } + + + public ProjectProperty BaseIntermediateOutputPath { + get {return GetProperty("BaseIntermediateOutputPath",@"obj\",TextBoxEditMode.EditRawProperty ); } + } + + + public ProjectProperty IntermediateOutputPath { + get {return GetProperty("IntermediateOutputPath",@"obj\",TextBoxEditMode.EditRawProperty ); } + } + + + public ProjectProperty WarningLevel { + get {return GetProperty("WarningLevel","4",TextBoxEditMode.EditRawProperty ); } + } + + + public ProjectProperty NoWarn { + get {return GetProperty("NoWarn","",TextBoxEditMode.EditRawProperty ); } + } + + + public ProjectProperty WarningsAsErrors { + get {return GetProperty("WarningsAsErrors","",TextBoxEditMode.EditRawProperty ); } } + + public ProjectProperty TreatWarningsAsErrors { + get {return GetProperty("TreatWarningsAsErrors","false",TextBoxEditMode.EditRawProperty ); } + } + + #endregion #region overrides @@ -109,19 +186,50 @@ namespace CSharpBinding.OptionPanels this.Initialize(); } + + protected override bool Save(MSBuildBasedProject project, string configuration, string platform) + { + SaveTreatWarningAsErrorRadioButtons(); + return base.Save(project, configuration, platform); + } #endregion + #region Documentation File - #region Command Updateproject + private bool documentFileIsChecked; - public ICommand UpdateProjectCommand { + 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(project.Directory, 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); } } - + private void UpdateProjectExecute () { UpgradeViewContent.Show(project.ParentSolution).Select(project as IUpgradableProject); @@ -141,7 +249,7 @@ namespace CSharpBinding.OptionPanels #region ChangeOutputPathCommand - public ICommand ChangeOutputPath + public System.Windows.Input.ICommand ChangeOutputPath { get {return this.changeOutputPath;} set {this.changeOutputPath = value; @@ -151,23 +259,140 @@ namespace CSharpBinding.OptionPanels private void ChangeOutputPathExecute() { OutputPath.Value = base.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", - base.BaseDirectory,outputPathTextBox.Text); + base.BaseDirectory,outputPathTextBox.Text); base.RaisePropertyChanged(()=> OutputPath); } #endregion + #region SerializationInfo + + public List SerializationInfo { + get {return this.serializationInfo;} + set {this.serializationInfo = value; + base.RaisePropertyChanged(() => SerializationInfo); + } + } + + #endregion + + + #region TargetCPU + + public List TargetCPU { + get { return targetCPU; } + set { targetCPU = value; + base.RaisePropertyChanged(() => TargetCPU); + } + } + #endregion //Property DebugType //void DebugSymbolsLoaded(object sender, EventArgs e) #region FileAlignment - /* - public List> FileAlign { + + public List FileAlign { get { return fileAlignment; } - set { fileAlignment = value; } + set { fileAlignment = value; + base.RaisePropertyChanged(() => FileAlign); + } + } + + #endregion + + #region BaseIntermediateOutputPath + + public System.Windows.Input.ICommand BaseIntermediateOutputPathCommand { + get{return this.baseIntermediateOutputPathCommand;} + set {this.baseIntermediateOutputPathCommand = value; + base.RaisePropertyChanged(() => BaseIntermediateOutputPathCommand);} + } + + + private void BaseIntermediateOutputPathExecute () + { + BaseIntermediateOutputPath.Value = base.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", + base.BaseDirectory,baseIntermediateOutputPathTextBox.Text); + base.RaisePropertyChanged(()=> BaseIntermediateOutputPath); + } + + #endregion + + #region IntermediateOutputPath + + public System.Windows.Input.ICommand IntermediateOutputPathCommand { + get{return this.baseIntermediateOutputPathCommand;} + set {this.intermediateOutputPathCommand = value; + base.RaisePropertyChanged(() => IntermediateOutputPathCommand);} + } + + + private void IntermediateOutputPathExecute () + { + IntermediateOutputPath.Value = base.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", + base.BaseDirectory,baseIntermediateOutputPathTextBox.Text); + base.RaisePropertyChanged(()=> IntermediateOutputPath); } - */ + #endregion + + #region WarningLevel + + public List WarnLevel { + get { return warnLevel; } + set { warnLevel = value; + base.RaisePropertyChanged(() => WarnLevel); + } + } + + private void LoadWarningsLevel () + { + string val = WarningLevel.Value; + var i = WarnLevel.FindIndex( + delegate(KeyItemPair pair) + { + return pair.Key == val; + } + ); + } + + + private void SaveWarningsLevel() + { + + } + #endregion + + #region SpecificWarnings TreatWarningsAsErrors + + private void SetTreatWarningAsErrorRadioButtons() + { + if (bool.Parse(this.TreatWarningsAsErrors.Value)) { + this.allRadioButton.IsChecked = true; + } else { + if (WarningsAsErrors.Value.Length > 0) { + this.specificWarningsRadioButton.IsChecked = true; + } else { + this.noneRadioButton.IsChecked = true; + } + } + } + + + private void SaveTreatWarningAsErrorRadioButtons() + { + + if ((bool)this.noneRadioButton.IsChecked){ + this.specificWarningsTextBox.Text = string.Empty; + } + if ((bool)this.allRadioButton.IsChecked) { + this.TreatWarningsAsErrors.Value = "true"; + } else { + this.TreatWarningsAsErrors.Value = "false"; + } + } + + #endregion } } \ No newline at end of file diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index 72b5db3659..528c29bb6e 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -277,6 +277,7 @@ DebugOptions.xaml Code + ReferencePathsXAML.xaml diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/KeyValuePair.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/KeyValuePair.cs new file mode 100644 index 0000000000..301d4ebfa5 --- /dev/null +++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/KeyValuePair.cs @@ -0,0 +1,27 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 09.05.2012 + * Time: 19:54 + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; + +namespace Gui.Dialogs.OptionPanels.ProjectOptions +{ + /// + /// Description of KeyValuePair. + /// + public class KeyItemPair + { + public KeyItemPair(string key,string displayValue) + { + this.Key = key; + this.DisplayValue = displayValue; + } + + public string Key {get;private set;} + + public string DisplayValue {get; private set;} + } +} diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs index 7126c851f0..aadfa2004f 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs @@ -295,26 +295,28 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels #region INotifyPropertyChanged implementation + protected void RaisePropertyChanged(string propertyName) + { + RaiseInternal(propertyName); + } + + protected void RaisePropertyChanged(Expression> propertyExpresssion) { var propertyName = ExtractPropertyName(propertyExpresssion); - //OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - var handler = this.PropertyChanged; - if (handler != null) - { - handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } + RaiseInternal(propertyName); } - /* - protected virtual void OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) + + + private void RaiseInternal (string propertyName) { var handler = this.PropertyChanged; if (handler != null) { - handler(this, e); + handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); } } - */ + private static String ExtractPropertyName(Expression> propertyExpresssion) { if (propertyExpresssion == null) @@ -342,6 +344,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels return memberExpression.Member.Name; } + #endregion