From e278a2ca37cb9ae09387b4b152ae8c3cfd1fc24e Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 12 Oct 2010 15:01:09 +0000 Subject: [PATCH] Fixed Invalid message for DSOPanel (MSWord) Comment-out unused varaible Calculate Table Width and Location Fixed Arrow-Up and Arrow-Down to account for Tables Adjust Table location based upon the width of the Table --- PROMS/Volian.Controls.Library/DSOTabPanel.cs | 18 +-- .../DisplayTabControl.cs | 47 ++++++-- .../Volian.Controls.Library/DisplayTabItem.cs | 12 +- .../OutlineRTFTable.cs | 2 +- PROMS/Volian.Controls.Library/StepItem.cs | 113 ++++++++++-------- PROMS/Volian.Controls.Library/StepPanel.cs | 16 ++- PROMS/Volian.Controls.Library/StepRTB.cs | 21 ++-- PROMS/Volian.Controls.Library/StepTabPanel.cs | 6 + 8 files changed, 150 insertions(+), 85 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DSOTabPanel.cs b/PROMS/Volian.Controls.Library/DSOTabPanel.cs index af44d5e3..ad8a9c01 100644 --- a/PROMS/Volian.Controls.Library/DSOTabPanel.cs +++ b/PROMS/Volian.Controls.Library/DSOTabPanel.cs @@ -136,7 +136,7 @@ namespace Volian.Controls.Library //this._MyDSOFramer.Leave += new EventHandler(_MyDSOFramer_Leave); //this._MyDSOFramer.OnActivationChange += new AxDSOFramer._DFramerCtlEvents_OnActivationChangeEventHandler(_MyDSOFramer_OnActivationChange); this.Enter += new EventHandler(DSOTabPanel_Enter); - this.Leave += new EventHandler(DSOTabPanel_Leave); + //this.Leave += new EventHandler(DSOTabPanel_Leave); //this.GotFocus += new EventHandler(DSOTabPanel_GotFocus); //this.LostFocus += new EventHandler(DSOTabPanel_LostFocus); Application.DoEvents(); @@ -236,17 +236,16 @@ namespace Volian.Controls.Library #endregion #region Event Handlers /// - /// When the user leaves a Word document, place the transparent frame on top with the words "InActive" in the upper right + /// Display MyTransparentPanel over the DSOPanel so that the Word "Inactive" appears in the upper right hand corner. /// - /// - /// - void DSOTabPanel_Leave(object sender, EventArgs e) + public void InActive() { - //vlnStackTrace.ShowStack("DSOTabPanel_Leave {0} DocID {1} Index {2} {3}", _In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName); _MyTransparentPanel.BringToFront(); } /// /// Force this item to be selected when the transparent window is clicked. + /// This will in-turn send the Transparent Panel to back and make the DSO Panel + /// editable. /// /// /// @@ -281,7 +280,7 @@ namespace Volian.Controls.Library try { this.Enter -= new EventHandler(DSOTabPanel_Enter); - this.Leave -= new EventHandler(DSOTabPanel_Leave); + // this.Leave -= new EventHandler(DSOTabPanel_Leave); // SaveDirty(); // SaveDirty happens in CloseDSO(bool) } catch (Exception ex) @@ -330,6 +329,7 @@ namespace Volian.Controls.Library _MyDisplayTabControl.OnItemSelectedChanged(this,new ItemSelectedChangedEventArgs(MyDisplayTabItem.MyItemInfo)); _MyDSOFramer.Focus(); _In_DSOTabPanel_Enter = false; + _MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem; } #endregion #region Public Methods @@ -459,5 +459,9 @@ namespace Volian.Controls.Library return null; } #endregion + public override string ToString() + { + return string.Format("DSOTabPanel Document {0}", MyDocumentInfo.DocID); + } } } diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs index 6d65ebd2..dd20ca99 100644 --- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs +++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs @@ -468,18 +468,41 @@ namespace Volian.Controls.Library } #endregion #region Private Methods - /// - /// Gets and sets the SelectedDisplayTabItem (Active Tab) - /// + ///// + ///// Gets and sets the SelectedDisplayTabItem (Active Tab) + ///// + //public DisplayTabItem SelectedDisplayTabItem1 + //{ + // get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; } + // set + // { + // //Volian.Base.Library.vlnStackTrace.ShowStackLocal("SelectedDisplayTabItem"); + // if (value != null) + // { + // value.Focus(); + // value.Selected = true; + // } + // } + //} + public void SelectDisplayTabItem(DisplayTabItem myDisplayTabItem) + { + if (myDisplayTabItem != null) + { + myDisplayTabItem.Focus(); + myDisplayTabItem.Selected = true; + } + } + private DisplayTabItem _SelectedDisplayTabItem=null; public DisplayTabItem SelectedDisplayTabItem { - get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; } - set + get { return _SelectedDisplayTabItem; } + set { - if (value != null) + if (_SelectedDisplayTabItem != value) { - value.Focus(); - value.Selected = true; + if (_SelectedDisplayTabItem != null && _SelectedDisplayTabItem.MyDSOTabPanel != null) + _SelectedDisplayTabItem.MyDSOTabPanel.InActive(); + _SelectedDisplayTabItem = value; } } } @@ -553,14 +576,14 @@ namespace Volian.Controls.Library pg = _MyDisplayTabItems[key]; pg.Selected = true; if (SelectedDisplayTabItem != pg) // If the selected page doesn't match - SelectedDisplayTabItem = pg; // Set the selected page + SelectDisplayTabItem(pg); // Set the selected page } else // If not already open, create a new Page { pg = new DisplayTabItem(this.components, this, proc, key); // Open a new Procedure Tab _MyDisplayTabItems.Add(key, pg); pg.Selected = true; - SelectedDisplayTabItem = pg; + SelectDisplayTabItem(pg); pg.MyStepTabPanel.MyProcedureItemInfo = proc; // When more than one procedure is openned, the ribbon control cuts off the bottom of the buttons. @@ -608,7 +631,7 @@ namespace Volian.Controls.Library pg = new DisplayTabItem(this.components, this, myItemInfo, key); // Open a new document page _MyDisplayTabItems.Add(key, pg); } - SelectedDisplayTabItem = pg; + SelectDisplayTabItem(pg); pg.MyDSOTabPanel.EnterPanel(); return pg; } @@ -629,7 +652,7 @@ namespace Volian.Controls.Library pg = new DisplayTabItem(this.components, this, myDocumentInfo, key); // Open a new document page _MyDisplayTabItems.Add(key, pg); } - SelectedDisplayTabItem = pg; + SelectDisplayTabItem(pg); pg.MyDSOTabPanel.EnterPanel(); return pg; } diff --git a/PROMS/Volian.Controls.Library/DisplayTabItem.cs b/PROMS/Volian.Controls.Library/DisplayTabItem.cs index dc34ab46..f5215339 100644 --- a/PROMS/Volian.Controls.Library/DisplayTabItem.cs +++ b/PROMS/Volian.Controls.Library/DisplayTabItem.cs @@ -204,7 +204,7 @@ namespace Volian.Controls.Library // // tabPanel // - _MyDisplayTabControl.SelectedDisplayTabItem = this; + _MyDisplayTabControl.SelectDisplayTabItem(this); _MyDSOTabPanel.MyDisplayTabItem = this; DSOTabPanel.IgnoreEnter = false; } @@ -226,10 +226,18 @@ namespace Volian.Controls.Library // // tabPanel // - _MyDisplayTabControl.SelectedDisplayTabItem = this; + _MyDisplayTabControl.SelectDisplayTabItem(this); _MyDSOTabPanel.MyDisplayTabItem = this; DSOTabPanel.IgnoreEnter = false; } #endregion + public override string ToString() + { + if (MyDSOTabPanel != null) + return MyDSOTabPanel.ToString(); + if (MyStepTabPanel != null) + return MyStepTabPanel.ToString(); + return "NULL"; + } } } diff --git a/PROMS/Volian.Controls.Library/OutlineRTFTable.cs b/PROMS/Volian.Controls.Library/OutlineRTFTable.cs index 5e293270..1d8d7e02 100644 --- a/PROMS/Volian.Controls.Library/OutlineRTFTable.cs +++ b/PROMS/Volian.Controls.Library/OutlineRTFTable.cs @@ -58,7 +58,7 @@ namespace Volian.Controls.Library // split text into lines string[] breaks = { "\r\n" }; string[] lines = txt.Split(breaks, StringSplitOptions.None); - string lastLine = lines[lines.Length - 1]; + //string lastLine = lines[lines.Length - 1]; foreach (string line in lines) Add(new RtfLine(line)); } diff --git a/PROMS/Volian.Controls.Library/StepItem.cs b/PROMS/Volian.Controls.Library/StepItem.cs index e9f23b3b..4b9d6ceb 100644 --- a/PROMS/Volian.Controls.Library/StepItem.cs +++ b/PROMS/Volian.Controls.Library/StepItem.cs @@ -97,6 +97,11 @@ namespace Volian.Controls.Library } private bool _Loading = true; private StepData _MyStepData; + public StepData MyStepData + { + get { return _MyStepData; } + set { _MyStepData = value; } + } private ItemInfo _MyItemInfo; private static int _WidthAdjust = 3; @@ -224,7 +229,7 @@ namespace Volian.Controls.Library { _MyStepRTB.Font = _MyStepData.Font.WindowsFont; ItemWidth = (int)TableWidth(_MyStepRTB.Font, _MyItemInfo.MyContent.Text, true); - ItemLocation = new Point(50, _MyParentStepItem.Bottom); + ItemLocation = new Point(50, _MyParentStepItem.Bottom); ItemLocation = TableLocation(_MyParentStepItem, _MyStepSectionLayoutData, ItemWidth); } else @@ -487,12 +492,21 @@ namespace Volian.Controls.Library if (_MyPreviousStepItem != null) { _IgnoreResize=true; - if (_MyStepData != null && (_MyStepData.Type == "Table" || _MyStepData.ParentType == "Table")) + if (_MyStepData != null && (_MyStepData.Type.ToLower().Contains("table") || _MyStepData.ParentType.ToLower().Contains("table"))) { ItemWidth = (int)TableWidth(_MyStepRTB.Font, _MyItemInfo.MyContent.Text, true); + Location = new Point(_MyPreviousStepItem.Left, FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom)); + } + else if (value.MyItemInfo.IsTablePart) + { + ItemLocation = new Point(value.MyParentStepItem.TextLeft, value.MyParentStepItem.Bottom); + ItemWidth = value.MyParentStepItem.TextWidth; } else + { Width = MyPreviousStepItem.Width; + Location = new Point(_MyPreviousStepItem.Left, FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom)); + } _IgnoreResize=false; //ShowMe(""); //if (MyID > _StartingID) @@ -503,7 +517,6 @@ namespace Volian.Controls.Library // , FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom) // , _MyPreviousStepItem.Bottom); //Location = new Point(_MyPreviousStepItem.Left, _MyPreviousStepItem.BottomMostStepItem.Bottom); - Location = new Point(_MyPreviousStepItem.Left, FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom)); switch (_MyChildRelation) { case ChildRelation.None: @@ -1615,28 +1628,11 @@ namespace Volian.Controls.Library /// private void StepItem_Resize(object sender, EventArgs e) { - //if (_MyItemInfo != null && _MyItemInfo.MyContent.Type == 20008) - //{ - // vlnStackTrace.ShowStackLocal(string.Format("{0},{1}", _MyItemInfo.ItemID, _MyStepRTB.Width), 3); - // Console.WriteLine("asd"); - //} //ShowMe("Resize"); if (MyStepRTB.Text.EndsWith("\n")) if (!_LookForID.Contains(MyID)) - { - //Console.WriteLine("{0} Added a CR",MyID); _LookForID.Add(MyID); - } - //if ((_WatchThis > 0 && MyID > 2100) || MyID == _LookForID) - //{ - // Console.WriteLine("{0}Resize {1},{2}",WatchThisIndent, MyID, this); - // if (MyID == _LookForID) - // Console.WriteLine("{0}------------------------",WatchThisIndent); - //} if (_MyItemInfo == null) return; - //Console.WriteLine("{0} Resize - {1}, BottomMost {2}", MyID, MyPath,BottomMostStepItem.MyPath); - //if (_lookForID == MyID) - // _lookForID = MyID; if (_IgnoreResize) return; AdjustLocation(); if (lblHeader != null) lblHeader.Width = this.Width; @@ -1848,7 +1844,7 @@ namespace Volian.Controls.Library return childStepItems[childStepItems.Count - 1]; } /// - /// Calculate the width of the table + /// Calculate TableWidth based upon the the contents /// /// /// @@ -1858,35 +1854,29 @@ namespace Volian.Controls.Library { string[] lines = txt.Split("\n".ToCharArray()); float max = 0; - //string lineMax = ""; - SizeF siz10 = new SizeF(); using (Graphics g = this.CreateGraphics()) { PointF pnt = new PointF(0, 0); - siz10 = g.MeasureString("MMMMMMMMMM", myFont, pnt, StringFormat.GenericTypographic); - } - foreach (string line in lines) - { - //string line2 = (addBorder ? "--" : "") + Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any - string line2 = Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any - //line2 = line2.Replace(@"\u8209?", "-"); - //line2 = line2.Replace("",""); - line2 = StepRTB.RemoveLinkComments(line2); - // MeasureString doesn't work properly if the line include graphics characters. - //SizeF siz = g.MeasureString(line2, myFont, pnt, StringFormat.GenericTypographic); - float wid = line2.Length * siz10.Width / 10; - //Console.WriteLine("'LineWidth'\t'{0}'\t{1}\t{2:0.}\t{3:0.}\t{4:0.}", - // line2.Length, wid, max, _MyStepPanel.MyStepPanelSettings.TableWidthAdjust, line2); - if (wid + _MyStepPanel.MyStepPanelSettings.TableWidthAdjust > max) + foreach (string line in lines) { - max = wid + _MyStepPanel.MyStepPanelSettings.TableWidthAdjust; - //lineMax = line2; + string lineAdj = Regex.Replace(line, @"\\u....\?", "X"); // Replace Special characters + //line2 = Regex.Replace(line2, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any + lineAdj = StepRTB.RemoveLinkComments(lineAdj); + // MeasureString doesn't work properly if the line include graphics characters. + // So, Measure a string of the same length with 'M's. + SizeF siz = g.MeasureString("".PadLeft(lineAdj.Length + (addBorder ? 2 : 0), 'M'), myFont, pnt, StringFormat.GenericTypographic); + float wid = siz.Width; + if (wid > max) + { + max = wid; + } } } - //vlnStackTrace.ShowStackLocal("TableWidth", 1, 10); - //Console.WriteLine("TableWidth = {0}, lineMax = '{1}', myFont = {2}", max, lineMax, myFont); - return max; + float widLimit = (float) _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); + widLimit += (float)_MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColS); + widLimit += (float) _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); + max += _MyStepPanel.MyStepPanelSettings.TableWidthAdjust; + return Math.Min(max,widLimit); } /// /// Calculates the table location @@ -1895,11 +1885,25 @@ namespace Volian.Controls.Library /// /// /// - private Point TableLocation(StepItem myParentStepItem, StepSectionLayoutData myStepSectionLayoutData, int width) + public Point TableLocation(StepItem myParentStepItem, StepSectionLayoutData myStepSectionLayoutData, int width) { - int x = myParentStepItem.TextLeft; - int y = myParentStepItem.Bottom; - if (x + width > myParentStepItem.Right) x = myParentStepItem.Right - width; + // Should center on parent unless it is a centered table in the AER column + int center = myParentStepItem.TextLeft + myParentStepItem.TextWidth / 2; + int rightLimit = myParentStepItem.Right; + // Then should center on the wid Limit + if (MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0) + { + int colR = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); + rightLimit += colR * MyItemInfo.ColumnMode; + center += (colR * MyItemInfo.ColumnMode) / 2; + center -= (myParentStepItem.TextLeft - (int)MyItemInfo.MyDocStyle.Layout.LeftMargin) / 2; + } + + // Calulate the x location + //int x = myParentStepItem.TextLeft; + int x = center - width / 2; + int y = FindTop(myParentStepItem.Bottom); + if (x + width > rightLimit) x = rightLimit - width; int colT = _MyStepPanel.ToDisplay(myStepSectionLayoutData.ColT); if (x < colT) x = colT; return new Point(x, y); @@ -2194,8 +2198,8 @@ namespace Volian.Controls.Library AddChildAfter(MyItemInfo.Sections, expand); if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel < MyItemInfo.ColumnMode) AddChildRNO(MyItemInfo.RNOs, expand); - AddChildAfter(MyItemInfo.Steps, expand); AddChildAfter(MyItemInfo.Tables, expand); + AddChildAfter(MyItemInfo.Steps, expand); if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel >= MyItemInfo.ColumnMode) AddChildRNO(MyItemInfo.RNOs, expand); if (!_MyvlnExpander.Expanded) @@ -2255,10 +2259,13 @@ namespace Volian.Controls.Library // Console.WriteLine("Ooops!!!"); int? bottom = null; StepItem stepItem = this; - if (stepItem._MyChildRelation == ChildRelation.None) - return null; - if (stepItem._MyChildRelation == ChildRelation.After && !RNORight) - return null; + if (!MyItemInfo.IsTablePart) + { + if (stepItem._MyChildRelation == ChildRelation.None) + return null; + if (stepItem._MyChildRelation == ChildRelation.After && !RNORight) + return null; + } while (stepItem != null && stepItem._MyChildRelation != ChildRelation.None && stepItem._MyChildRelation != ChildRelation.After) stepItem = stepItem.UpOneStepItem; if (stepItem == null || stepItem._MyChildRelation == ChildRelation.None) diff --git a/PROMS/Volian.Controls.Library/StepPanel.cs b/PROMS/Volian.Controls.Library/StepPanel.cs index 0e5ddf17..e8341044 100644 --- a/PROMS/Volian.Controls.Library/StepPanel.cs +++ b/PROMS/Volian.Controls.Library/StepPanel.cs @@ -690,16 +690,24 @@ namespace Volian.Controls.Library public void CursorMovement(StepRTB rtb, Point position, E_ArrowKeys arrow) { ItemInfo ii = null; + // The following lines are debug to check that the results of moving down and moving up are the same + //ItemInfo ix = null; switch (arrow) { case E_ArrowKeys.Up: case E_ArrowKeys.CtrlUp: ii = ArrowUp(rtb.MyItemInfo); + // The following lines are debug to check that the results of moving down and moving up are the same + //ix = ArrowDown(ii); + //Console.WriteLine("'Up',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence); if (ii != null) SelectedStepRTB = _LookupStepItems[ii.ItemID].MyStepRTB; break; case E_ArrowKeys.Down: case E_ArrowKeys.CtrlDown: ii = ArrowDown(rtb.MyItemInfo); + // The following lines are debug to check that the results of moving down and moving up are the same + //ix = ArrowUp(ii); + //Console.WriteLine("'Down',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence); if (ii != null) SelectedStepRTB = _LookupStepItems[ii.ItemID].MyStepRTB; break; case E_ArrowKeys.Right: @@ -718,6 +726,9 @@ namespace Volian.Controls.Library } private ItemInfo ArrowUp(ItemInfo ii) { + // Arrow-Up from a Substep should look for a Table. + if (ii.IsStepPart && (ii.ActiveParent as ItemInfo).Tables != null) + return BottomPart((ii.ActiveParent as ItemInfo).Tables[0]); // if on RNO, check display mode (1 column/2 column, etc) and how deep RNO is before going to // parents substeps. if (ii.IsRNOPart && ii.MyParent.Steps != null && ii.RNOLevel >= ii.ColumnMode) return BottomPart(ii.MyParent.Steps[0].LastSibling); @@ -756,8 +767,11 @@ namespace Volian.Controls.Library { // Subitems - go to top part of subitem // (the lookAtSub prevented looping within a substep group at same level) - if (lookAtSub && ii.Steps != null) return TopPart(ii.Steps[0]); + // Arrow down from a Table should look for a Substep + if(ii.IsTablePart && (ii.ActiveParent as ItemInfo).Steps != null) + return TopPart((ii.ActiveParent as ItemInfo).Steps[0]); if (lookAtSub && ii.Tables != null) return TopPart(ii.Tables[0]); + if (lookAtSub && ii.Steps != null) return TopPart(ii.Steps[0]); // RNOs: Use PMode (column) if (lookAtRNO && ii.RNOs != null && ii.RNOLevel >= ii.ColumnMode) return TopPart(ii.RNOs[0]); // Nextsibling - go to top part of sibling diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 9a6b3761..e8d1a5fa 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -191,8 +191,11 @@ namespace Volian.Controls.Library int widS = /* _WidthAdjust + borderWidth + */ MyStepItem.MyStepPanel.ToDisplay(MyStepItem.MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); //int wNew = _MyStepItem.MyStepPanel.ToDisplay(_MyStepItem.MyStepSectionLayoutData.WidT); int wNew = 70 + widS + colR * MyItemInfo.ColumnMode; - if(wNew > _MyStepItem.ItemWidth) - _MyStepItem.ItemWidth= wNew; + if (wNew > _MyStepItem.ItemWidth) + { + _MyStepItem.ItemWidth = wNew; + _MyStepItem.ItemLocation = _MyStepItem.TableLocation(_MyStepItem.MyParentStepItem, _MyStepItem.MyStepSectionLayoutData, wNew); + } } _InitializingRTB = true; _SelectedRtfSB.Remove(0, _SelectedRtfSB.Length); @@ -234,14 +237,13 @@ namespace Volian.Controls.Library RemoveEventHandlers(); if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) { - int newwidth = (int)_MyStepItem.TableWidth(Font, Text, true); + int newwidth = (int)_MyStepItem.TableWidth(Font, Text, false); if (_MyStepItem.ItemWidth != newwidth) { _MyStepItem.ItemWidth = newwidth; + _MyStepItem.ItemLocation = _MyStepItem.TableLocation(_MyStepItem.MyParentStepItem, _MyStepItem.MyStepSectionLayoutData, newwidth); + } - // int typ = ((int)_MyItemInfo.MyContent.Type) % 10000; - // OutlineTable(_MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[typ].Type.IndexOf(@"Borderless")<0); - // FindAllLinks(); } SelectAll(); if (SelectionHangingIndent !=0) SelectionHangingIndent = 0; @@ -268,7 +270,7 @@ namespace Volian.Controls.Library _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 (MyStepItem != null) MyStepItem.ChangeBar = MyStepItem.MyItemInfo.HasChangeBar(); } private bool _ProcessKeystrokes = true; public bool ProcessKeystrokes @@ -380,9 +382,12 @@ namespace Volian.Controls.Library this.MouseDown -= new MouseEventHandler(StepRTB_MouseDown); this.MouseLeave -= new EventHandler(StepRTB_MouseLeave); this.SelectionChanged -= new EventHandler(StepRTB_SelectionChanged); + this.ContextMenuStripChanged -= new EventHandler(StepRTB_ContextMenuStripChanged); + this.RTBSelectionChanged -= new StepRTBEvent(StepRTB_RTBSelectionChanged); } private void AddEventHandlers() { + // Always be sure to add the same event handlers to RemoveEventHandlers BorderStyle = System.Windows.Forms.BorderStyle.None; this.DetectUrls = true; ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized); @@ -398,13 +403,11 @@ namespace Volian.Controls.Library this.ContextMenuStripChanged += new EventHandler(StepRTB_ContextMenuStripChanged); this.RTBSelectionChanged += new StepRTBEvent(StepRTB_RTBSelectionChanged); } - void StepRTB_RTBSelectionChanged(object sender, EventArgs args) { //Console.WriteLine("RTBSelectionChanged id= {0}", MyItemInfo.ItemID); if (!Focused) Focus(); } - void StepRTB_ContextMenuStripChanged(object sender, EventArgs e) { //Console.WriteLine("********** StepRTB_ContextMenuStripChanged"); diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.cs b/PROMS/Volian.Controls.Library/StepTabPanel.cs index ee77b754..1ee8587d 100644 --- a/PROMS/Volian.Controls.Library/StepTabPanel.cs +++ b/PROMS/Volian.Controls.Library/StepTabPanel.cs @@ -167,6 +167,7 @@ namespace Volian.Controls.Library _MyStepPanel.ItemShow(); _MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetUpdRoValBtn(_MyStepPanel.MyStepTabPanel.MyStepTabRibbon.NewerRoFst()); _ShowingItem = false; + _MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem; } /// /// Occurs when the cursor moves onto or off of a link @@ -284,6 +285,11 @@ namespace Volian.Controls.Library { _MyDisplayTabControl.OnItemPaste(sender, args); } + public override string ToString() + { + return string.Format("StepTabPanel Procedure Item {0} {1}", + MyDisplayTabItem.MyItemInfo.ItemID, MyDisplayTabItem.MyItemInfo.DisplayNumber); + } #endregion } }