From b39def38f9da8cddc08735d9298098ad8977b7d6 Mon Sep 17 00:00:00 2001 From: PeterForstmeier Date: Wed, 25 Apr 2012 20:38:23 +0200 Subject: [PATCH] Add missing files --- .../CppBinding/CppBinding/CppBinding.csproj | 4 - .../CppBinding/Project/LinkerOptions.xaml | 69 +++++++ .../CppBinding/Project/LinkerOptions.xaml.cs | 191 ++++++++++++++++++ .../Project/StringListEditorDialog.xaml | 26 +++ .../Project/StringListEditorDialog.xaml.cs | 60 ++++++ 5 files changed, 346 insertions(+), 4 deletions(-) create mode 100644 src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml create mode 100644 src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs create mode 100644 src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.xaml create mode 100644 src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.xaml.cs diff --git a/src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.csproj b/src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.csproj index 077d6677ed..07a7f81e3f 100644 --- a/src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.csproj +++ b/src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.csproj @@ -150,10 +150,6 @@ {8035765F-D51F-4A0C-A746-2FD100E19419} ICSharpCode.SharpDevelop.Widgets - - {B7823AE9-4B43-4859-8796-2EBDC116FBB8} - ICSharpCode.Data.Core - diff --git a/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml new file mode 100644 index 0000000000..b30c19441d --- /dev/null +++ b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs new file mode 100644 index 0000000000..83be8b1cc9 --- /dev/null +++ b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs @@ -0,0 +1,191 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 21.04.2012 + * Time: 20:14 + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.ComponentModel; +using System.Windows; +using System.Windows.Controls; + +using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Gui.OptionPanels; +using ICSharpCode.SharpDevelop.Project; + +namespace ICSharpCode.CppBinding.Project +{ + /// + /// Interaction logic for LinkerOptionsXaml.xaml + /// + public partial class LinkerOptions : ProjectOptionPanel,INotifyPropertyChanged + { + private const string metaElement ="Link"; + private MSBuildBasedProject project; + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + public LinkerOptions() + { + InitializeComponent(); + } + + + private void Initialize() + { + var msDefGroup = new MSBuildItemDefinitionGroup(project, project.ActiveConfiguration, project.ActivePlatform); + + + this.additionalLibsTextBox.Text = GetElementMetaData(msDefGroup,"AdditionalDependencies"); + + this.addModuleTextBox.Text = GetElementMetaData(msDefGroup,"AddModuleNamesToAssembly"); + + this.resourceFileTextBox.Text = GetElementMetaData(msDefGroup,"EmbedManagedResourceFile"); + + this.additionalOptionsTextBox.Text = GetElementMetaData(msDefGroup,"AdditionalOptions"); + + var def = GetElementMetaData(msDefGroup,"GenerateDebugInformation"); + + bool check; + if (bool.TryParse(def, out check)) + { + this.CheckBoxChecked = check; + this.debugInfoCheckBox.IsChecked = check; + } + + IsDirty = false; + } + + #region Properties + + public ProjectProperty LibraryPath { + get { return GetProperty("LibraryPath", "", TextBoxEditMode.EditRawProperty); } + } + + + private bool checkBoxChecked; + + public bool CheckBoxChecked { + get {return checkBoxChecked;} + set + { + checkBoxChecked = value; + if (PropertyChanged != null) + PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("UnCheck")); + IsDirty = true; + } + } + + #endregion + + #region Save/Load + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + HideHeader(); + } + + protected override void Load(MSBuildBasedProject project, string configuration, string platform) + { + base.Load(project, configuration, platform); + this.project = project; + Initialize(); + } + + protected override bool Save(MSBuildBasedProject project, string configuration, string platform) + { + MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project, + project.ActiveConfiguration, project.ActivePlatform); + + SetElementMetaData(group,"AdditionalDependencies",this.additionalLibsTextBox.Text); + SetElementMetaData(group,"AddModuleNamesToAssembly",this.addModuleTextBox.Text); + SetElementMetaData(group,"EmbedManagedResourceFile",this.resourceFileTextBox.Text); + SetElementMetaData(group,"AdditionalOptions",this.additionalOptionsTextBox.Text); + + string check = "false"; + if ((bool)this.debugInfoCheckBox.IsChecked) { + check = "true"; + } + + SetElementMetaData(group,"GenerateDebugInformation",check); + + return base.Save(project, configuration, platform); + } + + #endregion + + #region MSBuildItemDefinitionGroup Set-Get + + private static string GetElementMetaData (MSBuildItemDefinitionGroup group,string name) + { + return group.GetElementMetadata(metaElement,name); + } + + + private static void SetElementMetaData (MSBuildItemDefinitionGroup group,string name,string value) + { + group.SetElementMetadata(metaElement,name,value); + } + + #endregion + + private void LibraryPathButton_Click(object sender, RoutedEventArgs e) + { + PopulateStringListEditor(StringParser.Parse("${res:Global.Folder}:"), + StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.Library}:"), + this.libraryPathTextBox, + true); + } + + + private void AdditionalLibsButton_Click(object sender, RoutedEventArgs e) + { + PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"), + StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.AdditionalLibs}:"), + this.additionalLibsTextBox, + false); + } + + + private void AddModuleButton_Click(object sender, RoutedEventArgs e) + { + PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"), + StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.AddModule}"), + this.addModuleTextBox, + false); + } + + + private void ResourceFileButton_Click(object sender, RoutedEventArgs e) + { + PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"), + StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.ManagedResourceFile}"), + this.resourceFileTextBox, + false); + } + + + public static void PopulateStringListEditor(string title, string listCaption,TextBox textBox,bool browseForDirectoty) + { + var stringListDialog = new StringListEditorDialog(); + stringListDialog.TitleText = title; + stringListDialog.ListCaption = listCaption; + stringListDialog.BrowseForDirectory = browseForDirectoty; + string[] strings = textBox.Text.Split(';'); + stringListDialog.LoadList (strings); + stringListDialog.ShowDialog(); + if (stringListDialog.DialogResult.HasValue && stringListDialog.DialogResult.Value) + { + textBox.Text = String.Join(";",stringListDialog.GetList()); + } + } + + + private void TextBox_TextChanged(object sender, TextChangedEventArgs e) + { + IsDirty = true; + } + + } +} \ No newline at end of file diff --git a/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.xaml b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.xaml new file mode 100644 index 0000000000..19ade56c68 --- /dev/null +++ b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.xaml.cs b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.xaml.cs new file mode 100644 index 0000000000..8a35b67fb2 --- /dev/null +++ b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.xaml.cs @@ -0,0 +1,60 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 15.04.2012 + * Time: 18:35 + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +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; + +namespace ICSharpCode.CppBinding.Project +{ + /// + /// Interaction logic for StringListEditorDialog.xaml + /// + public partial class StringListEditorDialog : Window + { + public StringListEditorDialog() + { + InitializeComponent(); + } + + + public bool BrowseForDirectory { + get {return stringListEditor.BrowseForDirectory;} + set {stringListEditor.BrowseForDirectory = value;} + } + + public string ListCaption { + get {return stringListEditor.ListCaption; } + set {stringListEditor.ListCaption = value;} + } + + public string TitleText { + get {return stringListEditor.TitleText;} + set {stringListEditor.TitleText = value;} + } + + public string[] GetList() { + return stringListEditor.GetList(); + } + + public void LoadList(IEnumerable list) { + stringListEditor.LoadList(list); + } + + void Button_Click(object sender, RoutedEventArgs e) + { + DialogResult = true; + } + + } +} \ No newline at end of file