Skip to content

Commit

Permalink
Merge pull request stevencohn#1195 from stevencohn/1191-disable-spell…
Browse files Browse the repository at this point in the history
…check-style

disable spellcheck style
  • Loading branch information
stevencohn committed Nov 30, 2023
2 parents 3e98ba9 + 7870eb3 commit 68eae13
Show file tree
Hide file tree
Showing 25 changed files with 520 additions and 402 deletions.
18 changes: 15 additions & 3 deletions OneMore/Commands/Styles/ApplyStyleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public override async Task Execute(params object[] args)

stylizer = new Stylizer(style);


bool success = style.StyleType == StyleType.Character
? StylizeWords()
: StylizeParagraphs();
Expand All @@ -64,6 +65,14 @@ public override async Task Execute(params object[] args)

logger.WriteTime("saved page");
}
else
{
logger.WriteTime("styles not applied");
}
}
else
{
logger.WriteTime("could not load page");
}
}

Expand All @@ -76,9 +85,8 @@ private bool StylizeWords()
var selections = page.Root.Descendants(ns + "T")
.Where(e => e.Attributes("selected").Any(a => a.Value.Equals("all")));

if (selections == null)
if (!selections.Any())
{
// shouldn't happen, but...
return false;
}

Expand All @@ -87,7 +95,6 @@ private bool StylizeWords()
if (selection.Parent.Nodes().Count() == 1)
{
// OE parent must have only this T

stylizer.ApplyStyle(selection);
}
else
Expand Down Expand Up @@ -243,6 +250,11 @@ private bool StylizeParagraphs()
ApplySpacing(element, "spaceAfter", style.SpaceAfter);
ApplySpacing(element, "spaceBetween", style.Spacing);

if (style.Ignored)
{
element.SetAttributeValue("lang", "yo");
}

ApplyToList(element, style);
}

Expand Down
47 changes: 31 additions & 16 deletions OneMore/Commands/Styles/StyleDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions OneMore/Commands/Styles/StyleDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ private void Initialize()
"defaultBlackToolStripMenuItem",
"transparentToolStripMenuItem",
// labels
"ignoredBox",
"beforeLabel",
"afterLabel",
"spacingLabel",
Expand Down Expand Up @@ -312,6 +313,7 @@ private void ShowSelection()
subButton.Checked = selection.IsSubscript;

applyColorsBox.Checked = selection.ApplyColors;
ignoredBox.Checked = selection.Ignored;

if (double.TryParse(selection.SpaceAfter, NumberStyles.Any, CultureInfo.InvariantCulture, out var sa))
{
Expand Down Expand Up @@ -673,6 +675,12 @@ private void ChangeApplyColorsOption(object sender, EventArgs e)
}


private void ChangeIgnored(object sender, EventArgs e)
{
selection.Ignored = ignoredBox.Checked;
}


private void ChangeSpaceAfter(object sender, EventArgs e)
{
selection.SpaceAfter = spaceAfterSpinner.Value.ToString("#0.0", CultureInfo.InvariantCulture);
Expand Down
Loading

0 comments on commit 68eae13

Please sign in to comment.