Added supporting logic to SaveText and SaveContents for Editorial Spell Checker

Added supporting logic to SpellCheckNext for Editorial Spell Checker
Save text changes before starting up the spell checker
Added supporting logic to UpdateEditor for Editorial Spell Checker
This commit is contained in:
John Jenko 2016-10-25 18:48:14 +00:00
parent 2342de91bd
commit 91da0b995f
4 changed files with 26 additions and 3 deletions

View File

@ -754,9 +754,13 @@ namespace Volian.Controls.Library
else
SaveText();
SaveConfig(); // This may be redundant
StepRTB.DidEditorialSpellCheck = false;
if (StepRTB.MySpellCheckDlg != null)
StepRTB.MySpellCheckDlg.DidCorrectSpelling = false;
}
public void SaveText()
{
bool existingChangeBar = MyStepRTB.MyItemInfo.HasChangeBar;
if (MyStepRTB.ReadOnly) return;
if (!MyStepRTB.ActiveMode) return;
if (MyStepRTB.IsExperimenting) return;
@ -777,6 +781,18 @@ namespace Volian.Controls.Library
sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId;
//if (MyStepRTB.MyItemInfo.MyConfig == null) itm.MyContent.Config = sc.ToString();
}
// B2015-024 Have Spell Checker text changes be an editorial change (not assign a change bar but keep existing change bar)
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck)
{
if (StepRTB.DidEditorialSpellCheck)
{
if (sc == null) sc = new StepConfig();
sc.Step_SpellCheckerChangedText = (existingChangeBar) ? "KeepChangeBar" : "NoChangeBar";
}
else if (sc != null)
sc.Step_SpellCheckerChangedText = null; // clear spell checker changed text flag B2015-024
}
// We saved changes made to some step text. Reset the change bar override.
// IF there is a step config remove the change bar override by setting the CBOverride value to null
// This fixes a problem reported by Farly where if the change bar or overridden to be off, the next

View File

@ -3252,7 +3252,7 @@ namespace Volian.Controls.Library
get { return StepRTB._DoSpellCheck; }
set { StepRTB._DoSpellCheck = value; }
}
// We made the Spell Checker method a static so that all of the StepRTB boxes will bare the same instance of the dictionary.
// We made the Spell Checker method a static so that all of the StepRTB boxes will share the same instance of the dictionary.
// This allow all the StepRTB's to automatically update when a new word is added.
private static C1.Win.C1SpellChecker.C1SpellChecker _C1SpellChecker2;
@ -3337,7 +3337,6 @@ namespace Volian.Controls.Library
//_ContextMenuStepRTB.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.OpenContextMenu(tsmi.Owner.Location);
_ContextMenuStepRTB.OnOpenContextMenu(sender, new StepRTBLocationEventArgs(tsmi.Owner.Location));
}
// This is our customized Spell Check dialog
// This is display when the use clicks the Spell button from the Ribbon
// or when the "Spell" item is selected from the context menu when on a mis-spelled word
@ -3352,15 +3351,20 @@ namespace Volian.Controls.Library
}
}
// B2015-024 have Spell Checker text changes be in editorial mode (not assign a change bar but keep existing change bar)
public static bool DidEditorialSpellCheck = false;
// This is used when walking through the section doing a spell check
// (from the Spell button on the ribbon)
public bool SpellCheckNext()
{
int nBad = C1SpellChecker2.CheckControl(this, false, MySpellCheckDlg);
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck)
DidEditorialSpellCheck = MySpellCheckDlg.DidCorrectSpelling; // B2015-024 spell checker in editoral mode
return (nBad >= 0); // nBad = -1 means user pressed Cancel button
}
// This allows us to turn off/on the specll check context menu when we toggle in and out of View Mode.
// This allows us to turn off/on the spell check context menu when we toggle in and out of View Mode.
// see btnToggleEditView_Click() in StepTabRibbon.cs
public void SpellCheckContextMenuOn(bool turnOnMenu)
{

View File

@ -2873,6 +2873,7 @@ namespace Volian.Controls.Library
private void btnSpell_Click(object sender, EventArgs e)
{
//MessageBox.Show("Functionality not available.", "Spell Check");
MyEditItem.SaveContents();
StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("SpellChecker");
MyEditItem.MyStepPanel.OnTabDisplay(sender, args);
}

View File

@ -31,6 +31,7 @@ namespace Volian.Controls.Library
{
get { return _Errors[_ErrorIndex]; }
}
public bool DidCorrectSpelling = false; // B2015-024 have Spell Checker text changes be in editorial mode (not assign a change bar but keep existing change bar)
public VlnSpellCheckDlg()
{
@ -77,6 +78,7 @@ namespace Volian.Controls.Library
private void UpdateEditor(string replacement)
{
DidCorrectSpelling = true;
// save starting point to continue checking from here
int start = CurrentError.Start;