Browse Source

Some improvements to formatting options fix.

pull/487/head
Andreas Weizel 11 years ago
parent
commit
bedbae8b60
  1. 2
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsContainer.cs
  2. 16
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingOptionPanel.xaml.cs
  3. 2
      src/Main/Core/Project/Src/Services/PropertyService/Properties.cs

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

@ -127,7 +127,6 @@ namespace CSharpBinding.FormattingStrategy
if ((e.PropertyName == "Parent") || (e.PropertyName == null)) { if ((e.PropertyName == "Parent") || (e.PropertyName == null)) {
// All properties might have changed -> update everything // All properties might have changed -> update everything
cachedOptions = CreateCachedOptions(); cachedOptions = CreateCachedOptions();
// OnPropertyChanged(e.PropertyName);
} else { } else {
// Some other property has changed, check if we have our own value for it // Some other property has changed, check if we have our own value for it
if (!activeOptions.Contains(e.PropertyName)) { if (!activeOptions.Contains(e.PropertyName)) {
@ -136,7 +135,6 @@ namespace CSharpBinding.FormattingStrategy
if (propertyInfo != null) { if (propertyInfo != null) {
var val = GetEffectiveOption(e.PropertyName); var val = GetEffectiveOption(e.PropertyName);
propertyInfo.SetValue(cachedOptions, val); propertyInfo.SetValue(cachedOptions, val);
// OnPropertyChanged(e.PropertyName);
} }
} }
} }

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

@ -82,17 +82,19 @@ namespace CSharpBinding.OptionPanels
{ {
base.LoadOptions(); base.LoadOptions();
formattingEditor.OptionsContainer = persistenceHelper.StartEditing(); formattingEditor.OptionsContainer = persistenceHelper.StartEditing();
formattingEditor.OptionsContainer.PropertyChanged += (sender, e) => isDirty = true; formattingEditor.OptionsContainer.PropertyChanged += ContainerPropertyChanged;
}
void ContainerPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
isDirty = true;
} }
public override bool SaveOptions() public override bool SaveOptions()
{ {
if (isDirty) { // Only save container, if some option really has changed
return persistenceHelper.Save() && base.SaveOptions(); formattingEditor.OptionsContainer.PropertyChanged -= ContainerPropertyChanged;
} else { return (!isDirty || persistenceHelper.Save()) && base.SaveOptions();
// Nothing has been changed here, return without action
return true;
}
} }
} }
} }

2
src/Main/Core/Project/Src/Services/PropertyService/Properties.cs

@ -430,7 +430,7 @@ namespace ICSharpCode.Core
if (result == null) { if (result == null) {
result = new Properties(this); result = new Properties(this);
dict[key] = result; dict[key] = result;
isNewContainer = true; result.MakeDirty();
} }
} }
if (isNewContainer) if (isNewContainer)

Loading…
Cancel
Save