Browse Source

Showing appropriate selections for option values now functional.

pull/403/head
Andreas Weizel 12 years ago
parent
commit
0cbabd92ee
  1. 1
      src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj
  2. 70
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsContainer.cs
  3. 164
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/FormattingOptionBinding.cs
  4. 25
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingEditor.xaml
  5. 109
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingEditor.xaml.cs
  6. 5
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingOptionPanel.xaml
  7. 3
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingOptionPanel.xaml.cs

1
src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj

@ -82,6 +82,7 @@ @@ -82,6 +82,7 @@
<Compile Include="Src\Completion\XmlDocCompletionData.cs" />
<Compile Include="Src\FormattingStrategy\CSharpFormattingOptionsContainer.cs" />
<Compile Include="Src\FormattingStrategy\CSharpFormatter.cs" />
<Compile Include="Src\FormattingStrategy\FormattingOptionBinding.cs" />
<Compile Include="Src\FormsDesigner\CSharpDesignerGenerator.cs" />
<Compile Include="Src\FormsDesigner\CSharpDesignerLoader.cs" />
<Compile Include="Src\FormsDesigner\CSharpDesignerLoaderProvider.cs" />

70
src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsContainer.cs

@ -97,12 +97,31 @@ namespace CSharpBinding.FormattingStrategy @@ -97,12 +97,31 @@ namespace CSharpBinding.FormattingStrategy
// We rely on property value from some of the parents and have to update it from there
PropertyInfo propertyInfo = typeof(CSharpFormattingOptions).GetProperty(e.PropertyName);
if (propertyInfo != null) {
propertyInfo.SetValue(cachedOptions, GetOption<object>(e.PropertyName));
var val = GetOption(e.PropertyName);
propertyInfo.SetValue(cachedOptions, val);
}
}
}
}
/// <summary>
/// Retrieves the value of a formatting option or null, if none is set.
/// </summary>
/// <param name="option">Name of option</param>
/// <returns>True, if option with given type could be found in hierarchy. False otherwise.</returns>
public object GetOption(string option)
{
// Run up the hierarchy until we find a defined value for property
if (activeOptions.Contains(option)) {
PropertyInfo propertyInfo = typeof(CSharpFormattingOptions).GetProperty(option);
if (propertyInfo != null) {
return propertyInfo.GetValue(cachedOptions);
}
}
return null;
}
/// <summary>
/// Retrieves the value of a formatting option where desired type and option name are defined by a
/// property getter on <see cref="ICSharpCode.NRefactory.CSharp.CSharpFormattingOptions"/>.
@ -113,7 +132,7 @@ namespace CSharpBinding.FormattingStrategy @@ -113,7 +132,7 @@ namespace CSharpBinding.FormattingStrategy
/// (example: o =&gt; o.IndentStructBody)
/// </param>
/// <returns>True, if option with given type could be found in hierarchy. False otherwise.</returns>
public T GetOption<T>(Expression<Func<CSharpFormattingOptions, T>> propertyGetter)
public T GetEffectiveOption<T>(Expression<Func<CSharpFormattingOptions, T>> propertyGetter)
where T : struct
{
// Get name of property (to look for in dictionary)
@ -121,7 +140,10 @@ namespace CSharpBinding.FormattingStrategy @@ -121,7 +140,10 @@ namespace CSharpBinding.FormattingStrategy
MemberExpression memberExpression = propertyGetter.Body as MemberExpression;
if (memberExpression != null) {
optionName = memberExpression.Member.Name;
return GetOption<T>(optionName);
var val = GetEffectiveOption(optionName);
if (val is T) {
return (T) val;
}
}
return default(T);
@ -133,20 +155,24 @@ namespace CSharpBinding.FormattingStrategy @@ -133,20 +155,24 @@ namespace CSharpBinding.FormattingStrategy
/// </summary>
/// <param name="option">Name of option</param>
/// <returns>True, if option with given type could be found in hierarchy. False otherwise.</returns>
public T GetOption<T>(string option)
public object GetEffectiveOption(string option)
{
// Run up the hierarchy until we find a defined value for property
CSharpFormattingOptionsContainer container = this;
do
{
object val = null;
PropertyInfo propertyInfo = typeof(CSharpFormattingOptions).GetProperty(option);
if ((propertyInfo != null) && (propertyInfo.PropertyType == typeof(T))) {
return (T) propertyInfo.GetValue(container.cachedOptions);
if (propertyInfo != null) {
val = propertyInfo.GetValue(container.cachedOptions);
}
if (val != null) {
return val;
}
container = container.parent;
} while (container != null);
return default(T);
return null;
}
/// <summary>
@ -154,27 +180,41 @@ namespace CSharpBinding.FormattingStrategy @@ -154,27 +180,41 @@ namespace CSharpBinding.FormattingStrategy
/// </summary>
/// <param name="option">Option name.</param>
/// <param name="value">Option value, <c>null</c> to reset.</param>
public void SetOption<T>(string option, T? value)
where T : struct
public void SetOption(string option, object value)
{
if (value.HasValue) {
if (value != null) {
// Save value in option values and cached options
activeOptions.Add(option);
PropertyInfo propertyInfo = typeof(CSharpFormattingOptions).GetProperty(option);
if ((propertyInfo != null) && (propertyInfo.PropertyType == typeof(T))) {
propertyInfo.SetValue(cachedOptions, value.Value);
if ((propertyInfo != null) && (propertyInfo.PropertyType == value.GetType())) {
propertyInfo.SetValue(cachedOptions, value);
}
} else {
// Reset this option
activeOptions.Remove(option);
// Update formatting options object from parents
PropertyInfo propertyInfo = typeof(CSharpFormattingOptions).GetProperty(option);
if ((propertyInfo != null) && (propertyInfo.PropertyType == typeof(T))) {
propertyInfo.SetValue(cachedOptions, GetOption<T>(option));
if ((propertyInfo != null) && (propertyInfo.PropertyType == value.GetType())) {
propertyInfo.SetValue(cachedOptions, GetOption(option));
}
}
}
/// <summary>
/// Retrieves the type of a given option.
/// </summary>
/// <param name="option">Option name</param>
/// <returns>Option's type.</returns>
public Type GetOptionType(string option)
{
PropertyInfo propertyInfo = typeof(CSharpFormattingOptions).GetProperty(option);
if (propertyInfo != null) {
return propertyInfo.PropertyType;
}
return null;
}
/// <summary>
/// Retrieves a <see cref="ICSharpCode.NRefactory.CSharp.CSharpFormattingOptions"/> instance from current
/// container, resolving all options throughout container hierarchy.
@ -197,7 +237,7 @@ namespace CSharpBinding.FormattingStrategy @@ -197,7 +237,7 @@ namespace CSharpBinding.FormattingStrategy
// Look at all container options and try to set identically named properties of CSharpFormattingOptions
foreach (PropertyInfo propertyInfo in typeof(CSharpFormattingOptions).GetProperties()) {
object val = GetOption<object>(propertyInfo.Name);
object val = GetEffectiveOption(propertyInfo.Name);
if ((val != null) && (val.GetType() == propertyInfo.PropertyType)) {
propertyInfo.SetValue(outputOptions, val);
}

164
src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/FormattingOptionBinding.cs

@ -0,0 +1,164 @@ @@ -0,0 +1,164 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using ICSharpCode.NRefactory.CSharp;
namespace CSharpBinding.FormattingStrategy
{
/// <summary>
/// Offers an attached property to bind a formatting option to a ComboBox.
/// </summary>
public static class FormattingOptionBinding
{
public static readonly DependencyProperty ContainerProperty =
DependencyProperty.RegisterAttached("Container", typeof(CSharpFormattingOptionsContainer),
typeof(FormattingOptionBinding),
new FrameworkPropertyMetadata(OnContainerPropertyChanged));
public static readonly DependencyProperty OptionProperty =
DependencyProperty.RegisterAttached("Option", typeof(string), typeof(FormattingOptionBinding),
new FrameworkPropertyMetadata(OnOptionPropertyChanged));
public static CSharpFormattingOptionsContainer GetContainer(Selector element)
{
return (CSharpFormattingOptionsContainer) element.GetValue(ContainerProperty);
}
public static void SetContainer(Selector element, CSharpFormattingOptionsContainer enumType)
{
element.SetValue(ContainerProperty, enumType);
}
public static string GetOption(Selector element)
{
return (string) element.GetValue(OptionProperty);
}
public static void SetOption(Selector element, string enumType)
{
element.SetValue(OptionProperty, enumType);
}
static void OnContainerPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
// No op?
}
static void OnOptionPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
string option = e.NewValue as string;
ComboBox comboBox = o as ComboBox;
if ((option != null) && (comboBox != null)) {
// Add "default" entry in ComboBox
// TODO Add located resource!
comboBox.Items.Add(new ComboBoxItem { Content = "(default)", Tag = null });
comboBox.SelectedIndex = 0;
CSharpFormattingOptionsContainer container = GetContainer(comboBox);
if (container != null) {
Type optionType = container.GetOptionType(option);
FillComboValues(comboBox, optionType);
object currentValue = container.GetOption(option);
comboBox.SelectedItem = comboBox.Items.OfType<ComboBoxItem>().FirstOrDefault(item => currentValue.Equals(item.Tag));
}
}
}
static void FillComboValues(ComboBox comboBox, Type type)
{
if (type == typeof(bool)) {
FillBoolComboValues(comboBox);
} else if (type == typeof(BraceStyle)) {
FillBraceStyleComboValues(comboBox);
} else if (type == typeof(PropertyFormatting)) {
FillPropertyFormattingComboValues(comboBox);
} else if (type == typeof(Wrapping)) {
FillWrappingComboValues(comboBox);
} else if (type == typeof(NewLinePlacement)) {
FillNewLinePlacementComboValues(comboBox);
} else if (type == typeof(UsingPlacement)) {
FillUsingPlacementComboValues(comboBox);
} else if (type == typeof(EmptyLineFormatting)) {
FillEmptyLineFormattingComboValues(comboBox);
}
}
static void FillBoolComboValues(ComboBox comboBox)
{
// TODO Add located resources!
comboBox.Items.Add(new ComboBoxItem { Content = "Yes", Tag = true });
comboBox.Items.Add(new ComboBoxItem { Content = "No", Tag = false });
}
static void FillBraceStyleComboValues(ComboBox comboBox)
{
// TODO Add located resources!
comboBox.Items.Add(new ComboBoxItem { Content = "Do not change", Tag = BraceStyle.DoNotChange });
comboBox.Items.Add(new ComboBoxItem { Content = "End of line", Tag = BraceStyle.EndOfLine });
comboBox.Items.Add(new ComboBoxItem { Content = "End of line without space", Tag = BraceStyle.EndOfLineWithoutSpace });
comboBox.Items.Add(new ComboBoxItem { Content = "Next line", Tag = BraceStyle.NextLine });
comboBox.Items.Add(new ComboBoxItem { Content = "Next line shifted", Tag = BraceStyle.NextLineShifted });
comboBox.Items.Add(new ComboBoxItem { Content = "Next line shifted 2", Tag = BraceStyle.NextLineShifted2 });
comboBox.Items.Add(new ComboBoxItem { Content = "Banner style", Tag = BraceStyle.BannerStyle });
}
static void FillPropertyFormattingComboValues(ComboBox comboBox)
{
// TODO Add located resources!
comboBox.Items.Add(new ComboBoxItem { Content = "Allow one line", Tag = PropertyFormatting.AllowOneLine });
comboBox.Items.Add(new ComboBoxItem { Content = "Force one line", Tag = PropertyFormatting.ForceOneLine });
comboBox.Items.Add(new ComboBoxItem { Content = "Force new line", Tag = PropertyFormatting.ForceNewLine });
}
static void FillWrappingComboValues(ComboBox comboBox)
{
// TODO Add located resources!
comboBox.Items.Add(new ComboBoxItem { Content = "Do not change", Tag = Wrapping.DoNotChange });
comboBox.Items.Add(new ComboBoxItem { Content = "Do not wrap", Tag = Wrapping.DoNotWrap });
comboBox.Items.Add(new ComboBoxItem { Content = "Wrap always", Tag = Wrapping.WrapAlways });
comboBox.Items.Add(new ComboBoxItem { Content = "Wrap if too long", Tag = Wrapping.WrapIfTooLong });
}
static void FillNewLinePlacementComboValues(ComboBox comboBox)
{
// TODO Add located resources!
comboBox.Items.Add(new ComboBoxItem { Content = "Do not care", Tag = NewLinePlacement.DoNotCare });
comboBox.Items.Add(new ComboBoxItem { Content = "New line", Tag = NewLinePlacement.NewLine });
comboBox.Items.Add(new ComboBoxItem { Content = "Same line", Tag = NewLinePlacement.SameLine });
}
static void FillUsingPlacementComboValues(ComboBox comboBox)
{
// TODO Add located resources!
comboBox.Items.Add(new ComboBoxItem { Content = "Top of file", Tag = UsingPlacement.TopOfFile });
comboBox.Items.Add(new ComboBoxItem { Content = "Inside namespace", Tag = UsingPlacement.InsideNamespace });
}
static void FillEmptyLineFormattingComboValues(ComboBox comboBox)
{
// TODO Add located resources!
comboBox.Items.Add(new ComboBoxItem { Content = "Do not change", Tag = EmptyLineFormatting.DoNotChange });
comboBox.Items.Add(new ComboBoxItem { Content = "Indent", Tag = EmptyLineFormatting.Indent });
comboBox.Items.Add(new ComboBoxItem { Content = "Do not indent", Tag = EmptyLineFormatting.DoNotIndent });
}
}
}

25
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingEditor.xaml

@ -1,8 +1,11 @@ @@ -1,8 +1,11 @@
<UserControl
x:Class="CSharpBinding.OptionPanels.CSharpFormattingEditor"
x:Name="CSharpFormattingEditor_Self"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CSharpBinding.OptionPanels">
xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
xmlns:local="clr-namespace:CSharpBinding.OptionPanels"
xmlns:format="clr-namespace:CSharpBinding.FormattingStrategy">
<UserControl.Resources>
@ -25,12 +28,28 @@ @@ -25,12 +28,28 @@
<ListBox
ItemsSource="{Binding Children}"
BorderThickness="0"
HorizontalContentAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Hidden">
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel Margin="0,0,0,0">
<ComboBox DockPanel.Dock="Right" Margin="0,0,0,0" MinWidth="100"
VerticalAlignment="Center"
format:FormattingOptionBinding.Container="{Binding ElementName=CSharpFormattingEditor_Self, Path=OptionsContainer}"
format:FormattingOptionBinding.Option="{Binding Option}" />
<sd:RestrictDesiredSize RestrictHeight="False" MinWidth="150">
<TextBlock Text="{Binding Text}" TextTrimming="CharacterEllipsis" ToolTip="{Binding Text}" VerticalAlignment="Center" />
</sd:RestrictDesiredSize>
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DataTemplate>
</UserControl.Resources>
<ItemsControl ItemsSource="{Binding}" Margin="0,0,0,0" Background="{x:Static SystemColors.WindowBrush}">
</ItemsControl>
<sd:RestrictDesiredSize Margin="0,4,0,0">
<ItemsControl ItemsSource="{Binding}" Background="{x:Static SystemColors.WindowBrush}">
</ItemsControl>
</sd:RestrictDesiredSize>
</UserControl>

109
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingEditor.xaml.cs

@ -18,7 +18,9 @@ @@ -18,7 +18,9 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using CSharpBinding.FormattingStrategy;
namespace CSharpBinding.OptionPanels
{
@ -68,7 +70,18 @@ namespace CSharpBinding.OptionPanels @@ -68,7 +70,18 @@ namespace CSharpBinding.OptionPanels
/// </summary>
internal class FormattingOption
{
public string OptionName
public FormattingOption(CSharpFormattingOptionsContainer container)
{
OptionsContainer = container;
}
public CSharpFormattingOptionsContainer OptionsContainer
{
get;
set;
}
public string Option
{
get;
set;
@ -90,53 +103,69 @@ namespace CSharpBinding.OptionPanels @@ -90,53 +103,69 @@ namespace CSharpBinding.OptionPanels
public CSharpFormattingEditor()
{
rootEntries = new List<IFormattingItemContainer>();
InitializeComponent();
BuildOptionItems();
this.DataContext = rootEntries;
}
public static readonly DependencyProperty OptionsContainerProperty =
DependencyProperty.Register("OptionsContainer", typeof(CSharpFormattingOptionsContainer), typeof(CSharpFormattingEditor),
new FrameworkPropertyMetadata(OnOptionsContainerPropertyChanged));
public CSharpFormattingOptionsContainer OptionsContainer {
get { return (CSharpFormattingOptionsContainer)GetValue(OptionsContainerProperty); }
set { SetValue(OptionsContainerProperty, value); }
}
static void OnOptionsContainerPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
var editor = o as CSharpFormattingEditor;
if (editor != null) {
editor.BuildOptionItems();
editor.DataContext = editor.rootEntries;
}
}
void BuildOptionItems()
{
rootEntries.Clear();
rootEntries.AddRange(
new IFormattingItemContainer[]
{
new FormattingGroupContainer { Text = "Indentation", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "Indent namespace body" },
new FormattingOption { Text = "Indent class body" },
new FormattingOption { Text = "Indent interface body" },
new FormattingOption { Text = "Indent struct body" },
new FormattingOption { Text = "Indent enum body" },
new FormattingOption { Text = "Indent method body" },
new FormattingOption { Text = "Indent property body" },
new FormattingOption { Text = "Indent event body" },
new FormattingOption { Text = "Indent blocks" },
new FormattingOption { Text = "Indent switch body" },
new FormattingOption { Text = "Indent case body" },
new FormattingOption { Text = "Indent break statements" },
new FormattingOption { Text = "Align embedded using statements" },
new FormattingOption { Text = "Align embedded if statements" },
new FormattingOption { Text = "Align else in if statements" },
new FormattingOption { Text = "Auto property formatting" },
new FormattingOption { Text = "Simple property formatting" },
new FormattingOption { Text = "Empty line formatting" },
new FormattingOption { Text = "Indent preprocessor directives" },
new FormattingOption { Text = "Align to member reference dot" },
new FormattingOption(OptionsContainer) { Option = "IndentNamespaceBody", Text = "Indent namespace body" },
new FormattingOption(OptionsContainer) { Option = "IndentClassBody", Text = "Indent class body" },
new FormattingOption(OptionsContainer) { Option = "IndentInterfaceBody", Text = "Indent interface body" },
new FormattingOption(OptionsContainer) { Option = "IndentStructBody", Text = "Indent struct body" },
new FormattingOption(OptionsContainer) { Option = "IndentEnumBody", Text = "Indent enum body" },
new FormattingOption(OptionsContainer) { Option = "IndentMethodBody", Text = "Indent method body" },
new FormattingOption(OptionsContainer) { Option = "IndentPropertyBody", Text = "Indent property body" },
new FormattingOption(OptionsContainer) { Option = "IndentEventBody", Text = "Indent event body" },
new FormattingOption(OptionsContainer) { Option = "IndentBlocks", Text = "Indent blocks" },
new FormattingOption(OptionsContainer) { Option = "IndentSwitchBody", Text = "Indent switch body" },
new FormattingOption(OptionsContainer) { Option = "IndentCaseBody", Text = "Indent case body" },
new FormattingOption(OptionsContainer) { Option = "IndentBreakStatements", Text = "Indent break statements" },
new FormattingOption(OptionsContainer) { Option = "AlignEmbeddedUsingStatements", Text = "Align embedded using statements" },
new FormattingOption(OptionsContainer) { Option = "AlignEmbeddedIfStatements", Text = "Align embedded if statements" },
new FormattingOption(OptionsContainer) { Option = "AlignElseInIfStatements", Text = "Align else in if statements" },
new FormattingOption(OptionsContainer) { Option = "AutoPropertyFormatting", Text = "Auto property formatting" },
new FormattingOption(OptionsContainer) { Option = "SimplePropertyFormatting", Text = "Simple property formatting" },
new FormattingOption(OptionsContainer) { Option = "EmptyLineFormatting", Text = "Empty line formatting" },
new FormattingOption(OptionsContainer) { Option = "IndentPreprocessorDirectives", Text = "Indent preprocessor directives" },
new FormattingOption(OptionsContainer) { Option = "AlignToMemberReferenceDot", Text = "Align to member reference dot" },
}
}
}
},
new FormattingGroupContainer { Text = "Braces", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "New lines", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
@ -145,70 +174,70 @@ namespace CSharpBinding.OptionPanels @@ -145,70 +174,70 @@ namespace CSharpBinding.OptionPanels
Children = new [] {
new FormattingGroupContainer { Text = "Methods", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Method calls", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Fields", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Local variables", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Constructors", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Indexers", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Delegates", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Statements", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Operators", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Brackets", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
@ -217,28 +246,28 @@ namespace CSharpBinding.OptionPanels @@ -217,28 +246,28 @@ namespace CSharpBinding.OptionPanels
},
new FormattingGroupContainer { Text = "Blank lines", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Keep formatting", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Wrapping", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}
},
new FormattingGroupContainer { Text = "Using declarations", Children = new [] { new FormattingOptionContainer {
Children = new [] {
new FormattingOption { Text = "-" }
new FormattingOption(OptionsContainer) { Text = "-" }
}
}
}

5
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingOptionPanel.xaml

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<gui:OptionPanel
<gui:OptionPanel
x:Class="CSharpBinding.OptionPanels.CSharpFormattingOptionPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -11,6 +10,6 @@ @@ -11,6 +10,6 @@
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets">
<Grid>
<local:CSharpFormattingEditor Margin="0,0,0,0" />
<local:CSharpFormattingEditor x:Name="formattingEditor" Margin="0,0,0,0" />
</Grid>
</gui:OptionPanel>

3
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingOptionPanel.xaml.cs

@ -25,7 +25,9 @@ using System.Windows.Data; @@ -25,7 +25,9 @@ using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.SharpDevelop.Gui;
using CSharpBinding.FormattingStrategy;
namespace CSharpBinding.OptionPanels
{
@ -37,6 +39,7 @@ namespace CSharpBinding.OptionPanels @@ -37,6 +39,7 @@ namespace CSharpBinding.OptionPanels
public CSharpFormattingOptionPanel()
{
InitializeComponent();
formattingEditor.OptionsContainer = new CSharpFormattingOptionsContainer(FormattingOptionsFactory.CreateSharpDevelop());
}
}
}
Loading…
Cancel
Save