B2017-023 fixed null reference errors when text boxes on Working Draft Specific Information dialog are empty. B2017-024 Added a context menu with windows clipboard options

This commit is contained in:
John Jenko 2017-02-13 19:26:35 +00:00
parent f933b59e5f
commit dea491a3d9

View File

@ -389,7 +389,7 @@ namespace Volian.Controls.Library
{
get
{
if (_MyStyleFont == null) _MyStyleFont = MyItemInfo.GetItemFont();
if (_MyStyleFont == null && MyItemInfo != null) _MyStyleFont = MyItemInfo.GetItemFont(); // B2017-023 null reference check for empty workdraft set information dialog
return _MyStyleFont;
}
}
@ -843,12 +843,13 @@ namespace Volian.Controls.Library
//The following line fixes bugs B2016-121 and B2016-146
if(!Focused)this.Focus();// If it doesn't have focus, set focus to the selected item
//Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID);
bool inPsi = this.Parent.FindForm().Name.Contains("frmPSI");
bool inPsi = this.Parent.FindForm().Name.Contains("frmPSI") || this.Parent.FindForm().Name.Contains("frmSI");
if (!_ContextMenuStripChanged)
OnSetMenu(this, new StepRTBMenuEventArgs(inPsi?"PSI":"OpenContextMenu"));
_ContextMenuStripChanged = false;
CorrectSelectionAtEndOfLine();
if (e.Button == System.Windows.Forms.MouseButtons.Right && MyItemInfo.IsRtfRaw) OnSetMenu(this, new StepRTBMenuEventArgs("OpenRtfRawContextMenu"));
// B2017-023 null reference check for empty workdraft set information dialog
if (e.Button == System.Windows.Forms.MouseButtons.Right && (MyItemInfo == null || MyItemInfo.IsRtfRaw)) OnSetMenu(this, new StepRTBMenuEventArgs((MyItemInfo != null && MyItemInfo.IsRtfRaw)?"OpenRtfRawContextMenu":"PSI"));
_MouseDown = true;
}
void StepRTB_MouseUp(object sender, MouseEventArgs e)
@ -1536,7 +1537,7 @@ namespace Volian.Controls.Library
private bool _HandlingCtrlA = false;
private void HandleLocalSelectionChange()
{
if (this.MyItemInfo.IsRtfRaw) return;
if (this.MyItemInfo != null && this.MyItemInfo.IsRtfRaw) return; // B2017-023 null reference check for empty workdraft set information dialog
//if (MyRTBItem != null && MyRTBItem.MyStepPanel.SelectedStepRTB != this)
if (OnIsNotCurrentSelection(this, new EventArgs()))
return;
@ -1929,7 +1930,7 @@ namespace Volian.Controls.Library
}
}
}
if (MyItemInfo.IsRtfRaw)
if (MyItemInfo == null || MyItemInfo.IsRtfRaw) // B2017-023 null reference check for empty workdraft set information dialog
{
e.Handled = true;
return;
@ -2142,7 +2143,7 @@ namespace Volian.Controls.Library
{
// if contains bad rtf (from Word), paste as text, otherwise, do the paste here.
if (!PasteRtfAsText(true)) Paste();
if (SelectionLength == 0) SelectionFont = MyStyleFont.WindowsFont;
if (SelectionLength == 0 && MyStyleFont != null) SelectionFont = MyStyleFont.WindowsFont; // B2017-023 null reference check for empty workdraft set information dialog
}
}
e.Handled = true;
@ -3429,6 +3430,10 @@ namespace Volian.Controls.Library
tsi2.Click += new EventHandler(tsi2_Click);
e.Menu.Items.Insert(i, tsi2); // add our spell check dialog item
}
else if (tsi1 is ToolStripMenuItem && tsi1.Text == "Clip Board") // B2017-024 added the Clip Board context menu in FrmSi design
{
e.Menu.Items.RemoveAt(i + 1); // if Clip Board menu item is there, then remove o ur Edit Menu
}
else
{
// B2016-242: check for editorial change on spell check word click.