Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Src/Common/Controls/DetailControls/DataTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ public virtual void ShowObject(ICmObject root, string layoutName, string layoutC
// Initialize our internal state with the state of the PropertyTable
m_fShowAllFields = m_propertyTable.GetBoolProperty("ShowHiddenFields-" + toolName, false, PropertyTable.SettingsGroup.LocalSettings);
m_propertyTable.SetPropertyPersistence("ShowHiddenFields-" + toolName, true, PropertyTable.SettingsGroup.LocalSettings);
m_propertyTable.SetDefault("ShowHiddenFields", m_fShowAllFields, PropertyTable.SettingsGroup.LocalSettings, false);
m_propertyTable.SetDefault("ShowHiddenFields", m_fShowAllFields, PropertyTable.SettingsGroup.LocalSettings);
SetCurrentSlicePropertyNames();
m_currentSlicePartName = m_propertyTable.GetStringProperty(m_sPartNameProperty, null, PropertyTable.SettingsGroup.LocalSettings);
m_currentSliceObjGuid = m_propertyTable.GetValue(m_sObjGuidProperty, PropertyTable.SettingsGroup.LocalSettings, Guid.Empty);
Expand Down
4 changes: 2 additions & 2 deletions Src/Common/Controls/XMLViews/BrowseViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -995,10 +995,10 @@ internal void ContructorSurrogate(XmlNode nodeSpec, int hvoRoot, int fakeFlid,
}
// set default property, so it doesn't accidentally get set
// in OnPropertyChanged() when user right clicks for the first time (cf. LT-2789).
m_propertyTable.SetDefault("SortedFromEnd", false, PropertyTable.SettingsGroup.LocalSettings, false);
m_propertyTable.SetDefault("SortedFromEnd", false, PropertyTable.SettingsGroup.LocalSettings);
// set default property, so it doesn't accidentally get set
// in OnPropertyChanged() when user right clicks for the first time (cf. LT-2789).
m_propertyTable.SetDefault("SortedByLength", false, PropertyTable.SettingsGroup.LocalSettings, false);
m_propertyTable.SetDefault("SortedByLength", false, PropertyTable.SettingsGroup.LocalSettings);

//
// FilterBar
Expand Down
42 changes: 12 additions & 30 deletions Src/XCore/xCoreInterfaces/PropertyTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,14 @@ private T GetValueInternal<T>(string key, T defaultValue)
if (prop == null)
{
result = defaultValue;
SetDefaultInternal(key, defaultValue, true);
SetDefaultInternal(key, defaultValue);
}
else
{
if (prop.value == null)
{
prop.value = defaultValue;
result = defaultValue;
SetDefaultInternal(key, defaultValue, true);
}
else
{
Expand All @@ -454,52 +453,35 @@ private T GetValueInternal<T>(string key, T defaultValue)
}

/// <summary>
/// set the default; does nothing if this value is already in the PropertyTable (local or global).
/// Stores the default under the best settings group; does nothing if the property already
/// exists there.
/// </summary>
/// <param name="name"></param>
/// <param name="defaultValue"></param>
/// <param name="doBroadcastIfChanged">
/// "true" if the property should be broadcast, and then, only if it has changed.
/// "false" to not broadcast it at all.
/// </param>
public void SetDefault(string name, object defaultValue, bool doBroadcastIfChanged)
public void SetDefault(string name, object defaultValue)
{
CheckDisposed();
SetDefault(name, defaultValue, SettingsGroup.BestSettings, doBroadcastIfChanged);
SetDefault(name, defaultValue, SettingsGroup.BestSettings);
}

/// <summary>
/// set the default; does nothing if this value is already in the specified settingsGroup.
/// Stores the default; does nothing if the property already exists in the specified
/// settingsGroup.
/// </summary>
/// <param name="name"></param>
/// <param name="defaultValue"></param>
/// <param name="settingsGroup"></param>
/// <param name="doBroadcastIfChanged">
/// "true" if the property should be broadcast, and then, only if it has changed.
/// "false" to not broadcast it at all.
/// </param>
public void SetDefault(string name, object defaultValue, SettingsGroup settingsGroup, bool doBroadcastIfChanged)
public void SetDefault(string name, object defaultValue, SettingsGroup settingsGroup)
{
CheckDisposed();
string key;
GetBestSettingsGroupAndKey(name, settingsGroup, out key);
SetDefaultInternal(key, defaultValue, doBroadcastIfChanged);
SetDefaultInternal(key, defaultValue);
}

/// <summary>
/// set a default; does nothing if this value is already in the PropertyTable.
/// Stores the default; does nothing if the key already exists.
/// </summary>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
/// <param name="doBroadcastIfChanged">
/// "true" if the property should be broadcast, and then, only if it has changed.
/// "false" to not broadcast it at all.
/// </param>
private void SetDefaultInternal(string key, object defaultValue, bool doBroadcastIfChanged)
private void SetDefaultInternal(string key, object defaultValue)
{
if (!m_properties.ContainsKey(key))
{
SetPropertyInternal(key, defaultValue, doBroadcastIfChanged);
SetPropertyInternal(key, defaultValue, false);
}
}

Expand Down
Loading
Loading