5 changed files with 346 additions and 4 deletions
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CppBinding.Project.LinkerOptions" |
||||
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: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" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core"> |
||||
|
||||
<GroupBox Header="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker}"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="50"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="40"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
<RowDefinition Height="30"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition Width="50"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
<CheckBox x:Name="debugInfoCheckBox" Margin="5,15,0,0" |
||||
IsChecked="{Binding CheckBoxChecked}" |
||||
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.GenerateDebugInfo}"> |
||||
</CheckBox> |
||||
|
||||
<Label Grid.Row="1" Margin="5,5,0,0" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.Library}"></Label> |
||||
<TextBox x:Name="libraryPathTextBox" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="2" |
||||
Text="{Binding LibraryPath.Value, UpdateSourceTrigger=PropertyChanged}"> |
||||
</TextBox> |
||||
|
||||
<Button x:Name="libraryPathButton" Click="LibraryPathButton_Click" |
||||
Margin="5" Grid.Row="2" |
||||
Height="20" |
||||
Grid.Column="1" Content="...."></Button> |
||||
|
||||
<Label Grid.Row="3" Margin="5,5,0,0" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.AdditionalLibs}"></Label> |
||||
<TextBox x:Name="additionalLibsTextBox" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="4"> |
||||
</TextBox> |
||||
<Button x:Name="additionalLibsButton" Click="AdditionalLibsButton_Click" Grid.Row="4" Grid.Column="1" Margin="5" Content="...." ></Button> |
||||
|
||||
<Label Grid.Row="5" Margin="5,5,0,0" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.AddModule}"></Label> |
||||
<TextBox x:Name="addModuleTextBox" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="6"> |
||||
</TextBox> |
||||
<Button x:Name="addModuleButton" Click="AddModuleButton_Click" Grid.Row="6" Grid.Column="1" Margin="5" Content="...."></Button> |
||||
|
||||
<Label Grid.Row="7" Margin="5,5,0,0" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.ManagedResourceFile}" ></Label> |
||||
<TextBox x:Name="resourceFileTextBox" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="8"></TextBox> |
||||
<Button x:Name="resourceFileButton" Click="ResourceFileButton_Click" Grid.Row="8" Grid.Column="1" Margin="5" Content="...."></Button> |
||||
|
||||
<Label Grid.Row="9" Margin="5,5,0,0" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.AdditionalOptions}"></Label> |
||||
<TextBox x:Name="additionalOptionsTextBox" |
||||
TextChanged="TextBox_TextChanged" Grid.Row="10" Grid.ColumnSpan="2"> |
||||
</TextBox> |
||||
|
||||
</Grid> |
||||
</GroupBox> |
||||
</optionpanels:ProjectOptionPanel> |
@ -0,0 +1,191 @@
@@ -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 |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for LinkerOptionsXaml.xaml
|
||||
/// </summary>
|
||||
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<string> 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; |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Window |
||||
x:Class="ICSharpCode.CppBinding.Project.StringListEditorDialog" 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:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
Width="400" Height="400" |
||||
Title="ICSharpCode.CppBinding.Project"> |
||||
|
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"></RowDefinition> |
||||
<RowDefinition Height="40"></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
|
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition Width="70"></ColumnDefinition> |
||||
<ColumnDefinition Width="70"></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
<gui:StringListEditorXaml x:Name="stringListEditor" Grid.ColumnSpan="3"></gui:StringListEditorXaml> |
||||
|
||||
<Button Grid.Row="1" Grid.Column="1" IsCancel="True" Margin="5" Content="{core:Localize Global.CancelButtonText}"></Button> |
||||
<Button Grid.Row="1" Grid.Column="2" IsDefault="True" Margin="5" Click="Button_Click" Content="{core:Localize Global.OKButtonText}"></Button> |
||||
|
||||
</Grid> |
||||
</Window> |
@ -0,0 +1,60 @@
@@ -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 |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for StringListEditorDialog.xaml
|
||||
/// </summary>
|
||||
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<string> list) { |
||||
stringListEditor.LoadList(list); |
||||
} |
||||
|
||||
void Button_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
DialogResult = true; |
||||
} |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue