Browse Source

CppBinding PreprocessorOptionsXaml.xaml

pull/30/head
PeterForstmeier 13 years ago
parent
commit
9760202023
  1. 5
      src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.addin
  2. 10
      src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.csproj
  3. 58
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptionsXaml.xaml
  4. 187
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptionsXaml.xaml.cs
  5. 26
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialogXaml.xaml
  6. 60
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialogXaml.xaml.cs
  7. 6
      src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml
  8. 2
      src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml.cs

5
src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.addin

@ -22,6 +22,11 @@ @@ -22,6 +22,11 @@
<OptionPanel id = "Preprocessor"
label = "${res:ICSharpCode.CppBinding.ProjectOptions.Preprocessor}"
class = "ICSharpCode.CppBinding.Project.PreprocessorOptions" />
<OptionPanel id = "Preprocessor1"
label = "${res:ICSharpCode.CppBinding.ProjectOptions.Preprocessor}"
class = "ICSharpCode.CppBinding.Project.PreprocessorOptionsXaml" />
<OptionPanel id = "Linker"
label = "${res:ICSharpCode.CppBinding.ProjectOptions.Linker}"
class = "ICSharpCode.CppBinding.Project.LinkerOptions" />

10
src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.csproj

@ -99,6 +99,10 @@ @@ -99,6 +99,10 @@
<Compile Include="Project\PreprocessorOptions.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Project\PreprocessorOptionsXaml.xaml.cs">
<DependentUpon>PreprocessorOptionsXaml.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Project\ProjectConfigurationProjectItem.cs" />
<Compile Include="Project\ResourceScript.cs" />
<Compile Include="Project\SpecifyCliRuntimeLibraryCommand.cs" />
@ -109,6 +113,10 @@ @@ -109,6 +113,10 @@
<Compile Include="Project\StringListEditorDialog.Designer.cs">
<DependentUpon>StringListEditorDialog.cs</DependentUpon>
</Compile>
<Compile Include="Project\StringListEditorDialogXaml.xaml.cs">
<DependentUpon>StringListEditorDialogXaml.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<None Include="CppBinding.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@ -171,5 +179,7 @@ @@ -171,5 +179,7 @@
</ItemGroup>
<ItemGroup>
<Page Include="Project\ApplicationOptions.xaml" />
<Page Include="Project\PreprocessorOptionsXaml.xaml" />
<Page Include="Project\StringListEditorDialogXaml.xaml" />
</ItemGroup>
</Project>

58
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptionsXaml.xaml

@ -0,0 +1,58 @@ @@ -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>

187
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptionsXaml.xaml.cs

@ -0,0 +1,187 @@ @@ -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;
}
}

26
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialogXaml.xaml

@ -0,0 +1,26 @@ @@ -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>

60
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialogXaml.xaml.cs

@ -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 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;
}
}
}

6
src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml

@ -1,6 +1,10 @@ @@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<UserControl
x:Class="ICSharpCode.SharpDevelop.Gui.StringListEditorXaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" xmlns:core="http://icsharpcode.net/sharpdevelop/core">
x:Class="ICSharpCode.SharpDevelop.Gui.StringListEditorXaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<Grid>
<Grid.RowDefinitions>
<RowDefinition

2
src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml.cs

@ -155,9 +155,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -155,9 +155,9 @@ namespace ICSharpCode.SharpDevelop.Gui
moveDownButton.IsEnabled = listBox.SelectedIndex >= 0 && listBox.SelectedIndex < listBox.Items.Count - 1;
removeButton.IsEnabled = deleteButton.IsEnabled = listBox.SelectedIndex >= 0;
updateButton.IsEnabled = listBox.SelectedIndex >= 0 && editTextBox.Text.Length > 0;
Console.WriteLine("{0} - {1} - {2} - {3}",moveUpButton.IsEnabled,moveDownButton.IsEnabled,removeButton.IsEnabled,updateButton.IsEnabled);
}
#region MoveUp-MoveDow-DeleteButton
void MoveUpButtonClick(object sender, RoutedEventArgs e)

Loading…
Cancel
Save