From 3bae38ab21d7e6b2fcbf5e42372b0a74a0ad2447 Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 19 Jan 2011 16:21:33 +0000 Subject: [PATCH] --- PROMS/Volian.Controls.Library/StepRTB.cs | 106 +++++++++++------------ 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 82ef388a..8f8d74d5 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -106,11 +106,11 @@ namespace Volian.Controls.Library return _RtfPrefix + @"\f1\fs" + this.Font.SizeInPoints * 2 + " "; } } - private StepItem _MyStepItem; - public StepItem MyStepItem + private RTBItem _MyRTBItem; + public RTBItem MyRTBItem { - get { return _MyStepItem; } - set { _MyStepItem = value; } + get { return _MyRTBItem; } + set { _MyRTBItem = value; } } // August 5, 2009 - KBR & RHM: // Insert/Overwrite will be developed later if needed. various issues @@ -165,39 +165,39 @@ namespace Volian.Controls.Library { RTBFillIn(!ViewRTB); SetBackColor(); - //ViewRTB = MyStepItem.MyStepPanel.PanelViewEditMode == E_ViewMode.View; + //ViewRTB = MyRTBItem.MyStepPanel.PanelViewEditMode == E_ViewMode.View; } } } 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 - BackColor = MyStepItem.MyStepPanel.ActiveColor; + BackColor = MyRTBItem.MyStepPanel.ActiveColor; 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() { // 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; } private string _origRTF; public void RTBFillIn(bool edit) { - if (edit && _MyStepItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) + if (edit && _MyRTBItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) { // 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 - int widS = /* _WidthAdjust + borderWidth + */ MyStepItem.MyStepPanel.ToDisplay(MyStepItem.MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); - //int wNew = _MyStepItem.MyStepPanel.ToDisplay(_MyStepItem.MyStepSectionLayoutData.WidT); + int widS = /* _WidthAdjust + borderWidth + */ MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); + //int wNew = _MyRTBItem.MyStepPanel.ToDisplay(_MyRTBItem.MyStepSectionLayoutData.WidT); int wNew = 70 + widS + colR * MyItemInfo.ColumnMode; - if (wNew > _MyStepItem.ItemWidth) + if (wNew > _MyRTBItem.ItemWidth) { - _MyStepItem.ItemWidth = wNew; - _MyStepItem.ItemLocation = _MyStepItem.TableLocation(_MyStepItem.MyParentStepItem, _MyStepItem.MyStepSectionLayoutData, wNew); + _MyRTBItem.ItemWidth = wNew; + _MyRTBItem.ItemLocation = _MyRTBItem.TableLocation(_MyRTBItem.MyParentRTBItem, _MyRTBItem.MyStepSectionLayoutData, wNew); } } _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 // the text within the RichTextBox. - RightMargin = Width - 1; + RightMargin = Width > 0 ? Width - 1 : 0; // figure out if needs outlined, depends on table/figure type if (!edit) { RemoveEventHandlers(); if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) { - int newwidth = (int)_MyStepItem.TableWidth(Font, Text, false); - if (_MyStepItem.ItemWidth != newwidth) + int newwidth = (int)_MyRTBItem.TableWidth(Font, Text, false); + if (_MyRTBItem.ItemWidth != newwidth) { - _MyStepItem.ItemWidth = newwidth; - _MyStepItem.ItemLocation = _MyStepItem.TableLocation(_MyStepItem.MyParentStepItem, _MyStepItem.MyStepSectionLayoutData, newwidth); + _MyRTBItem.ItemWidth = newwidth; + _MyRTBItem.ItemLocation = _MyRTBItem.TableLocation(_MyRTBItem.MyParentRTBItem, _MyRTBItem.MyStepSectionLayoutData, newwidth); } } @@ -280,17 +280,17 @@ namespace Volian.Controls.Library } //else //{ - // if (_MyStepItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) + // if (_MyRTBItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) // { - // //_MyStepItem.ItemWidth = (int)_MyStepItem.TableWidth(Font, Text,false); - // _MyStepItem.ItemWidth = _MyStepItem.MyStepPanel.ToDisplay(_MyStepItem.MyStepSectionLayoutData.WidT); + // //_MyRTBItem.ItemWidth = (int)_MyRTBItem.TableWidth(Font, Text,false); + // _MyRTBItem.ItemWidth = _MyRTBItem.MyStepPanel.ToDisplay(_MyRTBItem.MyStepSectionLayoutData.WidT); // } //} _origRTF = Rtf; _InitializingRTB = false; _MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged); 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; public bool ProcessKeystrokes @@ -365,7 +365,7 @@ namespace Volian.Controls.Library // updates to the info panel were not always occurring when the previous two // lines were active _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) { - _MyStepItem.MyStepPanel.MouseWheel(e); + _MyRTBItem.MyStepPanel.MouseWheel(e); //base.OnMouseWheel(e); } private void RemoveEventHandlers() @@ -435,7 +435,7 @@ namespace Volian.Controls.Library try { //Console.WriteLine("{0}", ContextMenuStrip.GetType().FullName); - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu(); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu(); sublocation = 1; _ContextMenuStripChanged = true; sublocation = 2; @@ -486,8 +486,8 @@ namespace Volian.Controls.Library { _MouseDown = true; //Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID); - if (!_ContextMenuStripChanged && this.MyStepItem != null) - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu(); + if (!_ContextMenuStripChanged && this.MyRTBItem != null) + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu(); _ContextMenuStripChanged = false; CorrectSelectionAtEndOfLine(); } @@ -1093,7 +1093,7 @@ namespace Volian.Controls.Library private bool _HandlingCtrlA = false; private void HandleLocalSelectionChange() { - if (MyStepItem != null && MyStepItem.MyStepPanel.SelectedStepRTB != this) + if (MyRTBItem != null && MyRTBItem.MyStepPanel.SelectedStepRTB != this) return; HandleSelectionChange(); @@ -1418,14 +1418,14 @@ namespace Volian.Controls.Library { if (e.Control) { - if (this.MyStepItem != null) + if (this.MyRTBItem != null) { if (e.Alt) { switch (e.KeyCode) { case Keys.M: - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnAnnots_Click(sender, e); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnAnnots_Click(sender, e); e.Handled = true; break; default: @@ -1437,31 +1437,31 @@ namespace Volian.Controls.Library switch (e.KeyCode) { case Keys.F: - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsFigure"); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsFigure"); e.Handled = true; break; case Keys.T: - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsTable"); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsTable"); e.Handled = true; break; case Keys.N: - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsNote"); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsNote"); e.Handled = true; break; case Keys.C: - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsCaution"); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsCaution"); e.Handled = true; break; case Keys.S: - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsSubStps"); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsSubStps"); e.Handled = true; break; case Keys.H: - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsHLS"); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsHLS"); e.Handled = true; break; case Keys.R: - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsRNO"); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsRNO"); e.Handled = true; break; } @@ -1567,9 +1567,9 @@ namespace Volian.Controls.Library e.Handled = true; break; 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; } break; @@ -1735,18 +1735,18 @@ namespace Volian.Controls.Library e.Handled = true; break; case Keys.F5: - if (this.MyStepItem != null) + if (this.MyRTBItem != null) { if (e.Shift) { e.Handled = true; - if (MyStepItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep == null) return; - MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("StepPaste"); + if (MyRTBItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep == null) return; + MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("StepPaste"); } else if (!e.Control && !e.Alt) { e.Handled = true; - this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.DoCopyStep(); + this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.DoCopyStep(); } } break; @@ -1757,7 +1757,7 @@ namespace Volian.Controls.Library case Keys.Tab: e.SuppressKeyPress = true; e.Handled = true; - if (MyStepItem == null) + if (MyRTBItem == null) { Form frm = ParentForm(this); if (frm != null) @@ -1768,10 +1768,10 @@ namespace Volian.Controls.Library case Keys.Enter: if (!e.Control && !e.Shift && !e.Alt) { - if (MyStepItem != null && !MyStepItem.MyItemInfo.IsTablePart) + if (MyRTBItem != null && !MyRTBItem.MyItemInfo.IsTablePart) { e.Handled = true; - MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey(); + MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey(); } } break; @@ -1788,19 +1788,19 @@ namespace Volian.Controls.Library if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return; // Cursor moves out of box only if control is pressed too - otherwise key is // 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); } private void StepRTB_PageKeyPressed(KeyEventArgs keyargs) { 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); } public void StepRTB_ArrowPressed(E_ArrowKeys key) { 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)); } 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) { 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