B2017-059 only turn on the spellchecking if the RTB is visible

This commit is contained in:
John Jenko 2017-04-17 15:42:31 +00:00
parent f5c4d24cf7
commit 9a52e89fd5
3 changed files with 50 additions and 5 deletions

View File

@ -1796,6 +1796,18 @@ namespace Volian.Controls.Library
} }
//static bool _ShowChanges=false; //static bool _ShowChanges=false;
int _LastTop = 0; int _LastTop = 0;
// Bug Fix: B2017-059 only turn on the spellchecking if the RTB is visible. This controls the number of windows handles created durning spellchecking
private void TurnOnSpellCheckIfVisible()
{
if (MyStepRTB != null)
{
if (this.Top + this.Height > 0 && this.Top < MyStepPanel.Height)
MyStepRTB.SpellCheckStatus = true;
else
MyStepRTB.SpellCheckStatus = false;
}
}
/// <summary> /// <summary>
/// Handles movement of the EditItems /// Handles movement of the EditItems
/// </summary> /// </summary>
@ -1803,6 +1815,7 @@ namespace Volian.Controls.Library
/// <param name="e"></param> /// <param name="e"></param>
private void EditItem_Move(object sender, EventArgs e) private void EditItem_Move(object sender, EventArgs e)
{ {
TurnOnSpellCheckIfVisible();
int newTop = Top - MyStepPanel.TopMostEditItem.Top; int newTop = Top - MyStepPanel.TopMostEditItem.Top;
//if(_ShowChanges && _LastTop != newTop && MyItemInfo.InList(134786)) //if(_ShowChanges && _LastTop != newTop && MyItemInfo.InList(134786))
//Volian.Base.Library.vlnStackTrace.ShowStackLocal(2,10,"\"EditItem_Move\"\t\"\"\t\"{0}\"\t{1}\t{2}\t{3}",MyItemInfo.ShortPath, MyID, Top, _LastTop); //Volian.Base.Library.vlnStackTrace.ShowStackLocal(2,10,"\"EditItem_Move\"\t\"\"\t\"{0}\"\t{1}\t{2}\t{3}",MyItemInfo.ShortPath, MyID, Top, _LastTop);

View File

@ -805,11 +805,30 @@ namespace Volian.Controls.Library
Console.WriteLine("StepRTB_ContextMenuStripChanged {0} - {1} [{2}]", ex.GetType().Name, ex.Message, sublocation); Console.WriteLine("StepRTB_ContextMenuStripChanged {0} - {1} [{2}]", ex.GetType().Name, ex.Message, sublocation);
} }
} }
// Bug fix B2017-059, toggle the spellchecking status on only when being used - to control how many window handles are created by the spellchecker
// This fixed the issue of the spell checker closing PROMS - Callaway SAMG Background TSG-1, also reproduced on long procedure in calvert EOPs
private bool _SpellCheckStatus = false;
public bool SpellCheckStatus
{
get { return _SpellCheckStatus; }
set
{
if (_SpellCheckStatus != value)
{
_SpellCheckStatus = value;
if (DoSpellCheck)
C1SpellChecker2.SetActiveSpellChecking(this, value);
}
}
}
private void SetUpStepRTB() private void SetUpStepRTB()
{ {
DetectUrls = false; DetectUrls = false;
if (DoSpellCheck) SpellCheckStatus = false;
C1SpellChecker2.SetActiveSpellChecking(this, true);
this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables
BorderStyle = System.Windows.Forms.BorderStyle.None; BorderStyle = System.Windows.Forms.BorderStyle.None;
this.ScrollBars = RichTextBoxScrollBars.None; this.ScrollBars = RichTextBoxScrollBars.None;
@ -3494,8 +3513,8 @@ namespace Volian.Controls.Library
public bool SpellCheckNext() public bool SpellCheckNext()
{ {
int nBad = C1SpellChecker2.CheckControl(this, false, MySpellCheckDlg); int nBad = C1SpellChecker2.CheckControl(this, false, MySpellCheckDlg);
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck) if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck)
DidEditorialSpellCheck = MySpellCheckDlg.DidCorrectSpelling; // B2015-024 spell checker in editoral mode DidEditorialSpellCheck = MySpellCheckDlg.DidCorrectSpelling; // B2015-024 spell checker in editoral mode
return (nBad >= 0); // nBad = -1 means user pressed Cancel button return (nBad >= 0); // nBad = -1 means user pressed Cancel button
} }

View File

@ -105,10 +105,22 @@ namespace Volian.Controls.Library
{ {
// fire load event // fire load event
base.OnLoad(e); base.OnLoad(e);
//AddHandle();
// show first error (after firing load event) // show first error (after firing load event)
ErrorIndex = 0; ErrorIndex = 0;
} }
// added for debugging - comment out when not using
//public void AddHandle()
//{
// if (!Handles.Contains(this.Handle))
// {
// GC.Collect();
// Handles.Add(this.Handle);
// Console.WriteLine("Handles {0}, RTB Count Created {1}, RTB Count Not Disposed = {2} ", Handles.Count,StepRTB.CountCreated,StepRTB.CountNotDisposed);
// }
//}
//private static List<IntPtr> Handles = new List<IntPtr>();
private bool _Initializing = false; private bool _Initializing = false;
private string _OrgWord; private string _OrgWord;
@ -257,6 +269,7 @@ namespace Volian.Controls.Library
private void btnIgnoreAll_Click(object sender, EventArgs e) private void btnIgnoreAll_Click(object sender, EventArgs e)
{ {
//Console.WriteLine("handle: {0}", this.Handle);
_Spell.IgnoreList.Add(CurrentError.Text); _Spell.IgnoreList.Add(CurrentError.Text);
_Errors = _Spell.CheckText(_Editor.Text, CurrentError.Start); _Errors = _Spell.CheckText(_Editor.Text, CurrentError.Start);
UpdateCurrentError(); UpdateCurrentError();