Skip to content

Commit

Permalink
disabled > hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencohn authored and weissm committed Dec 5, 2023
1 parent 5dea48f commit 940866e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
17 changes: 10 additions & 7 deletions OneMore/Commands/Settings/ColorizerSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ namespace River.OneMoreAddIn.Settings

internal partial class ColorizerSheet : SheetBase
{
public const string HiddenKey = "hidden";


public ColorizerSheet(SettingsProvider provider) : base(provider)
{
InitializeComponent();
Expand Down Expand Up @@ -68,13 +71,13 @@ public ColorizerSheet(SettingsProvider provider) : base(provider)
size = settings.Get("size2", StyleBase.DefaultCodeSize);
size2Box.SelectedIndex = size2Box.Items.IndexOf(size.ToString());

LoadLanguages(settings.Get("disabled", new XElement("disabled")));
LoadLanguages(settings.Get(HiddenKey, new XElement(HiddenKey)));

applyBox.Focus();
}


private void LoadLanguages(XElement disabled)
private void LoadLanguages(XElement hidden)
{
var languages = Colorizer.Colorizer.LoadLanguageNames();
var images = new ImageList();
Expand All @@ -85,7 +88,7 @@ private void LoadLanguages(XElement disabled)

var item = new ListViewItem(name, images.Images.Count - 1)
{
Checked = disabled.Element(tag) == null,
Checked = hidden.Element(tag) == null,
Tag = tag
};

Expand Down Expand Up @@ -163,8 +166,8 @@ public override bool CollectSettings()
}

var updated = false;
var oldset = settings.Get("disabled", new XElement("disabled"));
var newset = new XElement("disabled");
var oldset = settings.Get(HiddenKey, new XElement(HiddenKey));
var newset = new XElement(HiddenKey);

for (var i = 0; i < langView.Items.Count; i++)
{
Expand All @@ -187,11 +190,11 @@ public override bool CollectSettings()

if (newset.Elements().Any())
{
settings.Add("disabled", newset);
settings.Add(HiddenKey, newset);
}
else
{
settings.Remove("disabled");
settings.Remove(HiddenKey);
}

updated |= oldset.Elements().Any();
Expand Down
5 changes: 3 additions & 2 deletions OneMore/Ribbon/AddinRibbon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,15 @@ private void AddColorizerCommands(XElement root, SettingsCollection settings)
return;
}

var disabled = settings.Get("disabled", new XElement("disabled"));
var hidden = settings.Get(
ColorizerSheet.HiddenKey, new XElement(ColorizerSheet.HiddenKey));

var languages = Colorizer.Colorizer.LoadLanguageNames();
foreach (var name in languages.Keys)
{
var tag = languages[name];

if (disabled.Element(tag) == null)
if (hidden.Element(tag) == null)
{
menu.Add(new XElement(ns + "button",
new XAttribute("id", $"ribColorize{tag}Button"),
Expand Down

0 comments on commit 940866e

Please sign in to comment.