This commit is contained in:
Kathy Ruffing 2011-01-19 16:21:33 +00:00
parent 3214475301
commit 3bae38ab21

View File

@ -106,11 +106,11 @@ namespace Volian.Controls.Library
return _RtfPrefix + @"\f1\fs" + this.Font.SizeInPoints * 2 + " "; return _RtfPrefix + @"\f1\fs" + this.Font.SizeInPoints * 2 + " ";
} }
} }
private StepItem _MyStepItem; private RTBItem _MyRTBItem;
public StepItem MyStepItem public RTBItem MyRTBItem
{ {
get { return _MyStepItem; } get { return _MyRTBItem; }
set { _MyStepItem = value; } set { _MyRTBItem = value; }
} }
// August 5, 2009 - KBR & RHM: // August 5, 2009 - KBR & RHM:
// Insert/Overwrite will be developed later if needed. various issues // Insert/Overwrite will be developed later if needed. various issues
@ -165,39 +165,39 @@ namespace Volian.Controls.Library
{ {
RTBFillIn(!ViewRTB); RTBFillIn(!ViewRTB);
SetBackColor(); SetBackColor();
//ViewRTB = MyStepItem.MyStepPanel.PanelViewEditMode == E_ViewMode.View; //ViewRTB = MyRTBItem.MyStepPanel.PanelViewEditMode == E_ViewMode.View;
} }
} }
} }
public void SetBackColor() public void SetBackColor()
{ {
if (MyStepItem == null || MyStepItem.MyStepPanel == null) return; if (MyRTBItem == null || MyRTBItem.MyStepPanel == null) return;
if (Focused) // If active Set BackColor to the active color if (Focused) // If active Set BackColor to the active color
BackColor = MyStepItem.MyStepPanel.ActiveColor; BackColor = MyRTBItem.MyStepPanel.ActiveColor;
else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor
BackColor = _MyItemInfo.ItemAnnotationCount == 0 ? MyStepItem.MyStepPanel.InactiveColor : MyStepItem.MyStepPanel.AnnotationColor; BackColor = _MyItemInfo.ItemAnnotationCount == 0 ? MyRTBItem.MyStepPanel.InactiveColor : MyRTBItem.MyStepPanel.AnnotationColor;
} }
public void HighlightBackColor() public void HighlightBackColor()
{ {
// Don't try to highlight if this rtb is used on property pages. // Don't try to highlight if this rtb is used on property pages.
if (MyStepItem == null || MyStepItem.MyStepPanel == null) return; if (MyRTBItem == null || MyRTBItem.MyStepPanel == null) return;
BackColor = Color.Gray; BackColor = Color.Gray;
} }
private string _origRTF; private string _origRTF;
public void RTBFillIn(bool edit) public void RTBFillIn(bool edit)
{ {
if (edit && _MyStepItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) if (edit && _MyRTBItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
{ {
// First get ColR // First get ColR
int colR = MyStepItem.MyStepPanel.ToDisplay(MyStepItem.MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); int colR = MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
// Second get WidS // Second get WidS
int widS = /* _WidthAdjust + borderWidth + */ MyStepItem.MyStepPanel.ToDisplay(MyStepItem.MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); int widS = /* _WidthAdjust + borderWidth + */ MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode);
//int wNew = _MyStepItem.MyStepPanel.ToDisplay(_MyStepItem.MyStepSectionLayoutData.WidT); //int wNew = _MyRTBItem.MyStepPanel.ToDisplay(_MyRTBItem.MyStepSectionLayoutData.WidT);
int wNew = 70 + widS + colR * MyItemInfo.ColumnMode; int wNew = 70 + widS + colR * MyItemInfo.ColumnMode;
if (wNew > _MyStepItem.ItemWidth) if (wNew > _MyRTBItem.ItemWidth)
{ {
_MyStepItem.ItemWidth = wNew; _MyRTBItem.ItemWidth = wNew;
_MyStepItem.ItemLocation = _MyStepItem.TableLocation(_MyStepItem.MyParentStepItem, _MyStepItem.MyStepSectionLayoutData, wNew); _MyRTBItem.ItemLocation = _MyRTBItem.TableLocation(_MyRTBItem.MyParentRTBItem, _MyRTBItem.MyStepSectionLayoutData, wNew);
} }
} }
_InitializingRTB = true; _InitializingRTB = true;
@ -250,18 +250,18 @@ namespace Volian.Controls.Library
// //
// Setting the RightMargin to the Width minus one, accounts for the slight indent (1 pixel) of // Setting the RightMargin to the Width minus one, accounts for the slight indent (1 pixel) of
// the text within the RichTextBox. // the text within the RichTextBox.
RightMargin = Width - 1; RightMargin = Width > 0 ? Width - 1 : 0;
// figure out if needs outlined, depends on table/figure type // figure out if needs outlined, depends on table/figure type
if (!edit) if (!edit)
{ {
RemoveEventHandlers(); RemoveEventHandlers();
if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
{ {
int newwidth = (int)_MyStepItem.TableWidth(Font, Text, false); int newwidth = (int)_MyRTBItem.TableWidth(Font, Text, false);
if (_MyStepItem.ItemWidth != newwidth) if (_MyRTBItem.ItemWidth != newwidth)
{ {
_MyStepItem.ItemWidth = newwidth; _MyRTBItem.ItemWidth = newwidth;
_MyStepItem.ItemLocation = _MyStepItem.TableLocation(_MyStepItem.MyParentStepItem, _MyStepItem.MyStepSectionLayoutData, newwidth); _MyRTBItem.ItemLocation = _MyRTBItem.TableLocation(_MyRTBItem.MyParentRTBItem, _MyRTBItem.MyStepSectionLayoutData, newwidth);
} }
} }
@ -280,17 +280,17 @@ namespace Volian.Controls.Library
} }
//else //else
//{ //{
// if (_MyStepItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) // if (_MyRTBItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
// { // {
// //_MyStepItem.ItemWidth = (int)_MyStepItem.TableWidth(Font, Text,false); // //_MyRTBItem.ItemWidth = (int)_MyRTBItem.TableWidth(Font, Text,false);
// _MyStepItem.ItemWidth = _MyStepItem.MyStepPanel.ToDisplay(_MyStepItem.MyStepSectionLayoutData.WidT); // _MyRTBItem.ItemWidth = _MyRTBItem.MyStepPanel.ToDisplay(_MyRTBItem.MyStepSectionLayoutData.WidT);
// } // }
//} //}
_origRTF = Rtf; _origRTF = Rtf;
_InitializingRTB = false; _InitializingRTB = false;
_MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged); _MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged);
AdjustSizeForContents(!edit); // TODO: this is not quite right yet. AdjustSizeForContents(!edit); // TODO: this is not quite right yet.
if (MyStepItem != null) MyStepItem.ChangeBar = MyStepItem.MyItemInfo.HasChangeBar; if (MyRTBItem != null) MyRTBItem.ChangeBar = MyRTBItem.MyItemInfo.HasChangeBar;
} }
private bool _ProcessKeystrokes = true; private bool _ProcessKeystrokes = true;
public bool ProcessKeystrokes public bool ProcessKeystrokes
@ -365,7 +365,7 @@ namespace Volian.Controls.Library
// updates to the info panel were not always occurring when the previous two // updates to the info panel were not always occurring when the previous two
// lines were active // lines were active
_MyLinkText = value; _MyLinkText = value;
OnLinkChanged(this, new StepPanelLinkEventArgs(_MyStepItem, _MyLinkText)); OnLinkChanged(this, new StepPanelLinkEventArgs(_MyRTBItem, _MyLinkText));
//} //}
} }
} }
@ -387,7 +387,7 @@ namespace Volian.Controls.Library
} }
protected override void OnMouseWheel(MouseEventArgs e) protected override void OnMouseWheel(MouseEventArgs e)
{ {
_MyStepItem.MyStepPanel.MouseWheel(e); _MyRTBItem.MyStepPanel.MouseWheel(e);
//base.OnMouseWheel(e); //base.OnMouseWheel(e);
} }
private void RemoveEventHandlers() private void RemoveEventHandlers()
@ -435,7 +435,7 @@ namespace Volian.Controls.Library
try try
{ {
//Console.WriteLine("{0}", ContextMenuStrip.GetType().FullName); //Console.WriteLine("{0}", ContextMenuStrip.GetType().FullName);
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu(); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu();
sublocation = 1; sublocation = 1;
_ContextMenuStripChanged = true; _ContextMenuStripChanged = true;
sublocation = 2; sublocation = 2;
@ -486,8 +486,8 @@ namespace Volian.Controls.Library
{ {
_MouseDown = true; _MouseDown = true;
//Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID); //Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID);
if (!_ContextMenuStripChanged && this.MyStepItem != null) if (!_ContextMenuStripChanged && this.MyRTBItem != null)
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu(); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu();
_ContextMenuStripChanged = false; _ContextMenuStripChanged = false;
CorrectSelectionAtEndOfLine(); CorrectSelectionAtEndOfLine();
} }
@ -1093,7 +1093,7 @@ namespace Volian.Controls.Library
private bool _HandlingCtrlA = false; private bool _HandlingCtrlA = false;
private void HandleLocalSelectionChange() private void HandleLocalSelectionChange()
{ {
if (MyStepItem != null && MyStepItem.MyStepPanel.SelectedStepRTB != this) if (MyRTBItem != null && MyRTBItem.MyStepPanel.SelectedStepRTB != this)
return; return;
HandleSelectionChange(); HandleSelectionChange();
@ -1418,14 +1418,14 @@ namespace Volian.Controls.Library
{ {
if (e.Control) if (e.Control)
{ {
if (this.MyStepItem != null) if (this.MyRTBItem != null)
{ {
if (e.Alt) if (e.Alt)
{ {
switch (e.KeyCode) switch (e.KeyCode)
{ {
case Keys.M: case Keys.M:
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnAnnots_Click(sender, e); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnAnnots_Click(sender, e);
e.Handled = true; e.Handled = true;
break; break;
default: default:
@ -1437,31 +1437,31 @@ namespace Volian.Controls.Library
switch (e.KeyCode) switch (e.KeyCode)
{ {
case Keys.F: case Keys.F:
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsFigure"); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsFigure");
e.Handled = true; e.Handled = true;
break; break;
case Keys.T: case Keys.T:
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsTable"); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsTable");
e.Handled = true; e.Handled = true;
break; break;
case Keys.N: case Keys.N:
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsNote"); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsNote");
e.Handled = true; e.Handled = true;
break; break;
case Keys.C: case Keys.C:
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsCaution"); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsCaution");
e.Handled = true; e.Handled = true;
break; break;
case Keys.S: case Keys.S:
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsSubStps"); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsSubStps");
e.Handled = true; e.Handled = true;
break; break;
case Keys.H: case Keys.H:
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsHLS"); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsHLS");
e.Handled = true; e.Handled = true;
break; break;
case Keys.R: case Keys.R:
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsRNO"); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsRNO");
e.Handled = true; e.Handled = true;
break; break;
} }
@ -1567,9 +1567,9 @@ namespace Volian.Controls.Library
e.Handled = true; e.Handled = true;
break; break;
case Keys.Enter: case Keys.Enter:
if (this.MyStepItem != null) if (this.MyRTBItem != null)
{ {
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnInsPgBrk_Click(sender, e); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnInsPgBrk_Click(sender, e);
e.Handled = true; e.Handled = true;
} }
break; break;
@ -1735,18 +1735,18 @@ namespace Volian.Controls.Library
e.Handled = true; e.Handled = true;
break; break;
case Keys.F5: case Keys.F5:
if (this.MyStepItem != null) if (this.MyRTBItem != null)
{ {
if (e.Shift) if (e.Shift)
{ {
e.Handled = true; e.Handled = true;
if (MyStepItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep == null) return; if (MyRTBItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep == null) return;
MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("StepPaste"); MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("StepPaste");
} }
else if (!e.Control && !e.Alt) else if (!e.Control && !e.Alt)
{ {
e.Handled = true; e.Handled = true;
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.DoCopyStep(); this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.DoCopyStep();
} }
} }
break; break;
@ -1757,7 +1757,7 @@ namespace Volian.Controls.Library
case Keys.Tab: case Keys.Tab:
e.SuppressKeyPress = true; e.SuppressKeyPress = true;
e.Handled = true; e.Handled = true;
if (MyStepItem == null) if (MyRTBItem == null)
{ {
Form frm = ParentForm(this); Form frm = ParentForm(this);
if (frm != null) if (frm != null)
@ -1768,10 +1768,10 @@ namespace Volian.Controls.Library
case Keys.Enter: case Keys.Enter:
if (!e.Control && !e.Shift && !e.Alt) if (!e.Control && !e.Shift && !e.Alt)
{ {
if (MyStepItem != null && !MyStepItem.MyItemInfo.IsTablePart) if (MyRTBItem != null && !MyRTBItem.MyItemInfo.IsTablePart)
{ {
e.Handled = true; e.Handled = true;
MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey(); MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey();
} }
} }
break; break;
@ -1788,19 +1788,19 @@ namespace Volian.Controls.Library
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return; if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;
// Cursor moves out of box only if control is pressed too - otherwise key is // Cursor moves out of box only if control is pressed too - otherwise key is
// handled in rtb. // handled in rtb.
//if (keyargs.Control)_MyStepItem.MyStepPanel.StepCursorKeys(this, keyargs); // Replaced with an event //if (keyargs.Control)_MyRTBItem.MyStepPanel.StepCursorKeys(this, keyargs); // Replaced with an event
if (keyargs.Control) OnCursorKeyPress(this, keyargs); if (keyargs.Control) OnCursorKeyPress(this, keyargs);
} }
private void StepRTB_PageKeyPressed(KeyEventArgs keyargs) private void StepRTB_PageKeyPressed(KeyEventArgs keyargs)
{ {
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return; if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;
//_MyStepItem.MyStepPanel.StepCursorKeys(this, keyargs); Replaced with an event //_MyRTBItem.MyStepPanel.StepCursorKeys(this, keyargs); Replaced with an event
OnCursorKeyPress(this, keyargs); OnCursorKeyPress(this, keyargs);
} }
public void StepRTB_ArrowPressed(E_ArrowKeys key) public void StepRTB_ArrowPressed(E_ArrowKeys key)
{ {
Point cp = PointToClient(Cursor.Position); Point cp = PointToClient(Cursor.Position);
//_MyStepItem.MyStepPanel.CursorMovement(this, cp, key); Replaced with an event //_MyRTBItem.MyStepPanel.CursorMovement(this, cp, key); Replaced with an event
OnCursorMovement(this, new StepRTBCursorMovementEventArgs(cp, key)); OnCursorMovement(this, new StepRTBCursorMovementEventArgs(cp, key));
} }
private void StepRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) private void StepRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
@ -2607,7 +2607,7 @@ namespace Volian.Controls.Library
static void tsi_Click(object sender, EventArgs e) static void tsi_Click(object sender, EventArgs e)
{ {
ToolStripMenuItem tsmi = sender as ToolStripMenuItem; ToolStripMenuItem tsmi = sender as ToolStripMenuItem;
_ContextMenuStepRTB.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.OpenContextMenu(tsmi.Owner.Location); _ContextMenuStepRTB.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.OpenContextMenu(tsmi.Owner.Location);
} }
// This is our customized Spell Check dialog // This is our customized Spell Check dialog