Browse Source

CppBinding convert LinkerOptions to xaml

pull/30/head
PeterForstmeier 14 years ago
parent
commit
b3a6d5a3cb
  1. 33
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptionsXaml.xaml
  2. 159
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptionsXaml.xaml.cs
  3. 4
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml
  4. 32
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml.cs

33
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptionsXaml.xaml

@ -8,11 +8,11 @@ @@ -8,11 +8,11 @@
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<GroupBox Header="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker}">
<Grid ShowGridLines="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
@ -26,7 +26,34 @@ @@ -26,7 +26,34 @@
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="50"></ColumnDefinition>
</Grid.ColumnDefinitions>
<CheckBox x:Name="debugInfoCheckBox" Margin="0,15,0,0"
IsChecked="{Binding CheckBoxChecked}"
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.GenerateDebugInfo}"></CheckBox>
<Label Grid.Row="1" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.Library}"></Label>
<TextBox x:Name="libraryPathTextBox" 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" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.AdditionalLibs}"></Label>
<TextBox x:Name="additionalLibsTextBox" 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" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.AddModule}"></Label>
<TextBox x:Name="addModuleTextBox" 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" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.ManagedResourceFile}" ></Label>
<TextBox x:Name="resourceFileTextBox" 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" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.AdditionalOptions}"></Label>
<TextBox x:Name="additionalOptionsTextBox" Grid.Row="10" Grid.ColumnSpan="2"></TextBox>
</Grid>
</GroupBox>
</optionpanels:ProjectOptionPanel>

159
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptionsXaml.xaml.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -24,11 +25,167 @@ namespace ICSharpCode.CppBinding.Project @@ -24,11 +25,167 @@ namespace ICSharpCode.CppBinding.Project
/// <summary>
/// Interaction logic for LinkerOptionsXaml.xaml
/// </summary>
public partial class LinkerOptionsXaml : ProjectOptionPanel
public partial class LinkerOptionsXaml : ProjectOptionPanel,INotifyPropertyChanged
{
private const string metaElement ="Link";
private MSBuildBasedProject project;
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
public LinkerOptionsXaml()
{
InitializeComponent();
}
void Initialize()
{
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project,
project.ActiveConfiguration, project.ActivePlatform);
this.additionalLibsTextBox.Text = group.GetElementMetadata(metaElement,"AdditionalDependencies");
this.addModuleTextBox.Text = group.GetElementMetadata(metaElement,"AddModuleNamesToAssembly");
this.resourceFileTextBox.Text = group.GetElementMetadata(metaElement,"EmbedManagedResourceFile");
this.additionalOptionsTextBox.Text = group.GetElementMetadata(metaElement,"AdditionalOptions");
var def = group.GetElementMetadata(metaElement,"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); }
}
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
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);
group.SetElementMetadata(metaElement,"AdditionalDependencies",this.additionalLibsTextBox.Text);
group.SetElementMetadata(metaElement,"AddModuleNamesToAssembly",this.addModuleTextBox.Text);
group.SetElementMetadata(metaElement,"EmbedManagedResourceFile",this.resourceFileTextBox.Text);
group.SetElementMetadata(metaElement,"AdditionalOptions",this.additionalOptionsTextBox.Text);
string check = "false";
if ((bool)this.debugInfoCheckBox.IsChecked) {
check = "true";
}
group.SetElementMetadata(metaElement,"GenerateDebugInformation",check);
return base.Save(project, configuration, platform);
}
#endregion
void LibraryPathButton_Click(object sender, RoutedEventArgs e)
{
var dlg = InitStringListEditor(StringParser.Parse("${res:Global.Folder}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.Library}:"),true);
string[] strings = this.libraryPathTextBox.Text.Split(';');
dlg.LoadList (strings);
dlg.ShowDialog();
if (dlg.DialogResult.HasValue && dlg.DialogResult.Value)
{
this.libraryPathTextBox.Text = String.Join(";", dlg.GetList());
}
}
void AdditionalLibsButton_Click(object sender, RoutedEventArgs e)
{
var dlg = InitStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.AdditionalLibs}:"),false);
string[] strings = this.additionalLibsTextBox.Text.Split(';');
dlg.LoadList (strings);
dlg.ShowDialog();
if (dlg.DialogResult.HasValue && dlg.DialogResult.Value)
{
this.additionalLibsTextBox.Text = String.Join(";",dlg.GetList());
}
}
void AddModuleButton_Click(object sender, RoutedEventArgs e)
{
var dlg = InitStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.AddModule}"),false);
string[] strings = this.addModuleTextBox.Text.Split(';');
dlg.LoadList (strings);
dlg.ShowDialog();
if (dlg.DialogResult.HasValue && dlg.DialogResult.Value)
{
this.addModuleTextBox.Text = String.Join(";",dlg.GetList());
}
}
void ResourceFileButton_Click(object sender, RoutedEventArgs e)
{
var dlg = InitStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.ManagedResourceFile}"),false);
string[] strings = this.resourceFileTextBox.Text.Split(';');
dlg.LoadList (strings);
dlg.ShowDialog();
if (dlg.DialogResult.HasValue && dlg.DialogResult.Value)
{
this.resourceFileTextBox.Text = String.Join(";",dlg.GetList());
}
}
static StringListEditorDialogXaml InitStringListEditor(string title, string listCaption,bool browseForDirectoty)
{
StringListEditorDialogXaml dlg = new StringListEditorDialogXaml();
dlg.TitleText = title;
dlg.ListCaption = listCaption;
dlg.BrowseForDirectory = browseForDirectoty;
return dlg;
}
}
}

4
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml

@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
Text="{Binding IncludePath.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button x:Name="includePathButton"
Grid.Row="1" Height="25" Click="IncludePathButton_Click" Margin="5" Grid.Column="1" Content="...."></Button>
Grid.Row="1" Height="20" Click="IncludePathButton_Click" Margin="5" Grid.Column="1" Content="...."></Button>
<Label Grid.Row="2" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Definitions}"></Label>
@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
<CheckBox x:Name="undefineAllCheckBox" Grid.Row="6" Margin="5"
IsChecked="{Binding UnCheck}"
IsChecked="{Binding CheckBoxChecked, UpdateSourceTrigger=PropertyChanged}"
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.UndefineAll}"></CheckBox>
</Grid>

32
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml.cs

@ -23,7 +23,7 @@ namespace ICSharpCode.CppBinding.Project @@ -23,7 +23,7 @@ namespace ICSharpCode.CppBinding.Project
{
private const string metaElement ="ClCompile";
MSBuildBasedProject project;
private MSBuildBasedProject project;
public PreprocessorOptions()
{
@ -44,39 +44,27 @@ namespace ICSharpCode.CppBinding.Project @@ -44,39 +44,27 @@ namespace ICSharpCode.CppBinding.Project
bool check;
if (bool.TryParse(defs, out check))
// this.undefineAllCheckBox.IsChecked = check;
this.UnCheck = check;
{
this.CheckBoxChecked = check;
this.undefineAllCheckBox.IsChecked = check;
}
IsDirty = false;
}
#region Properties
// public ProjectProperty<string> PreprocessorDefinitions {
// get { return GetProperty("PreprocessorDefinition", "", TextBoxEditMode.EditRawProperty); }
// }
public ProjectProperty<string> IncludePath {
get { return GetProperty("IncludePath", "", TextBoxEditMode.EditRawProperty); }
}
// public ProjectProperty<string> UndefinePreprocessorDefinitions {
// get { return GetProperty("UndefinePreprocessorDefinitions", "", TextBoxEditMode.EditRawProperty); }
// }
bool checkBoxChecked;
// public ProjectProperty<string> UndefineAllPreprocessorDefinitions {
// get { return GetProperty("UndefineAllPreprocessorDefinitions", "", TextBoxEditMode.EditRawProperty); }
// }
bool unCheck;
public bool UnCheck {
get {return unCheck;}
public bool CheckBoxChecked {
get {return checkBoxChecked;}
set
{
unCheck = value;
checkBoxChecked = value;
if (PropertyChanged != null)
PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("UnCheck"));
IsDirty = true;
@ -171,8 +159,6 @@ namespace ICSharpCode.CppBinding.Project @@ -171,8 +159,6 @@ namespace ICSharpCode.CppBinding.Project
IsDirty = true;
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
}
}
Loading…
Cancel
Save