8 changed files with 352 additions and 2 deletions
@ -0,0 +1,58 @@ |
|||||||
|
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CppBinding.Project.PreprocessorOptionsXaml" |
||||||
|
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.Preprocessor}"> |
||||||
|
<Grid > |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="30"></RowDefinition> |
||||||
|
<RowDefinition Height="50"></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="30"></ColumnDefinition> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
|
||||||
|
<Label Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Includes}"></Label> |
||||||
|
|
||||||
|
<TextBox x:Name="includePathTextBox" Grid.Row="1" |
||||||
|
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> |
||||||
|
|
||||||
|
<Label Grid.Row="2" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Definitions}"></Label> |
||||||
|
|
||||||
|
<TextBox x:Name="defineTextBox" TextChanged="TextBox_TextChanged" Grid.Row="3"></TextBox> |
||||||
|
|
||||||
|
|
||||||
|
<Button x:Name="definePathButton" Click="DefinePathButton_Click" Grid.Row="3" Grid.Column="1" Margin="5" Content="...."></Button> |
||||||
|
|
||||||
|
|
||||||
|
<Label Grid.Row="4" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Undefinitions}"></Label> |
||||||
|
|
||||||
|
|
||||||
|
<TextBox x:Name="undefineTextBox" TextChanged="TextBox_TextChanged" Grid.Row="5"></TextBox> |
||||||
|
|
||||||
|
<Button x:Name="undefineButton" Click="UndefineButton_Click" Grid.Row="5" Grid.Column="1" Margin="5" Content="...."></Button> |
||||||
|
|
||||||
|
|
||||||
|
<CheckBox x:Name="undefineAllCheckBox" Grid.Row="6" Margin="5" |
||||||
|
IsChecked="{Binding UnCheck}" |
||||||
|
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.UndefineAll}"></CheckBox> |
||||||
|
|
||||||
|
</Grid> |
||||||
|
|
||||||
|
</GroupBox> |
||||||
|
|
||||||
|
</optionpanels:ProjectOptionPanel> |
||||||
@ -0,0 +1,187 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 14.04.2012 |
||||||
|
* Time: 17:53 |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.ComponentModel; |
||||||
|
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.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.SharpDevelop.Editor; |
||||||
|
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.CppBinding.Project |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for PreprocessorOptionsXaml.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PreprocessorOptionsXaml : ProjectOptionPanel,INotifyPropertyChanged |
||||||
|
{ |
||||||
|
private const string metaElement ="ClCompile"; |
||||||
|
|
||||||
|
MSBuildBasedProject project; |
||||||
|
|
||||||
|
public PreprocessorOptionsXaml() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void Initialize() |
||||||
|
{ |
||||||
|
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project, |
||||||
|
project.ActiveConfiguration, project.ActivePlatform); |
||||||
|
|
||||||
|
this.defineTextBox.Text = group.GetElementMetadata(metaElement,"PreprocessorDefinitions"); |
||||||
|
|
||||||
|
this.undefineTextBox.Text = group.GetElementMetadata(metaElement,"UndefinePreprocessorDefinitions" ); |
||||||
|
|
||||||
|
var defs = group.GetElementMetadata(metaElement,"UndefineAllPreprocessorDefinitions"); |
||||||
|
|
||||||
|
bool check; |
||||||
|
if (bool.TryParse(defs, out check)) |
||||||
|
// this.undefineAllCheckBox.IsChecked = check;
|
||||||
|
this.UnCheck = 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); }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// public ProjectProperty<string> UndefineAllPreprocessorDefinitions {
|
||||||
|
// get { return GetProperty("UndefineAllPreprocessorDefinitions", "", TextBoxEditMode.EditRawProperty); }
|
||||||
|
// }
|
||||||
|
|
||||||
|
bool unCheck; |
||||||
|
|
||||||
|
public bool UnCheck { |
||||||
|
get {return unCheck;} |
||||||
|
set |
||||||
|
{ |
||||||
|
unCheck = 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,"PreprocessorDefinitions",this.defineTextBox.Text); |
||||||
|
|
||||||
|
group.SetElementMetadata(metaElement,"UndefinePreprocessorDefinitions",this.undefineTextBox.Text); |
||||||
|
|
||||||
|
string check = "false"; |
||||||
|
if ((bool)this.undefineAllCheckBox.IsChecked) { |
||||||
|
check = "true"; |
||||||
|
} |
||||||
|
group.SetElementMetadata(metaElement,"UndefineAllPreprocessorDefinitions",check); |
||||||
|
|
||||||
|
return base.Save(project, configuration, platform); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
void IncludePathButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
StringListEditorDialogXaml dlg = new StringListEditorDialogXaml(); |
||||||
|
dlg.TitleText = StringParser.Parse("${res:Global.Folder}:"); |
||||||
|
dlg.ListCaption = StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Includes}:"); |
||||||
|
dlg.BrowseForDirectory = true; |
||||||
|
string[] strings = this.includePathTextBox.Text.Split(';'); |
||||||
|
dlg.LoadList (strings); |
||||||
|
dlg.ShowDialog(); |
||||||
|
|
||||||
|
if (dlg.DialogResult.HasValue && dlg.DialogResult.Value) |
||||||
|
{ |
||||||
|
this.includePathTextBox.Text = String.Join(";", dlg.GetList()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
void DefinePathButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
StringListEditorDialogXaml dlg = new StringListEditorDialogXaml(); |
||||||
|
dlg.TitleText = StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"); |
||||||
|
dlg.ListCaption = StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Definitions}:"); |
||||||
|
|
||||||
|
string[] strings = this.defineTextBox.Text.Split(';'); |
||||||
|
dlg.LoadList (strings); |
||||||
|
dlg.ShowDialog(); |
||||||
|
|
||||||
|
if (dlg.DialogResult.HasValue && dlg.DialogResult.Value) |
||||||
|
{ |
||||||
|
this.defineTextBox.Text = String.Join(";",dlg.GetList()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void UndefineButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
StringListEditorDialogXaml dlg = new StringListEditorDialogXaml(); |
||||||
|
dlg.TitleText = StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"); |
||||||
|
dlg.ListCaption = StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"); |
||||||
|
string[] strings = this.undefineTextBox.Text.Split(';'); |
||||||
|
dlg.LoadList (strings); |
||||||
|
dlg.BrowseForDirectory = false; |
||||||
|
dlg.ShowDialog(); |
||||||
|
|
||||||
|
if (dlg.DialogResult.HasValue && dlg.DialogResult.Value) |
||||||
|
{ |
||||||
|
this.undefineTextBox.Text = String.Join(";",dlg.GetList()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void TextBox_TextChanged(object sender, TextChangedEventArgs e) |
||||||
|
{ |
||||||
|
IsDirty = true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Window |
||||||
|
x:Class="ICSharpCode.CppBinding.Project.StringListEditorDialogXaml" 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 @@ |
|||||||
|
/* |
||||||
|
* 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 StringListEditorDialogXaml : Window |
||||||
|
{ |
||||||
|
public StringListEditorDialogXaml() |
||||||
|
{ |
||||||
|
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