diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index 7c155f71..b20041f9 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -72,14 +72,14 @@ namespace Volian.Controls.Library if (!Visible) return; if (_MyRTB != null) { - _MyRTB.LinkChanged -= new StepRTBLinkEvent(_MyRTB_LinkChanged); - _MyRTB.SelectionChanged -= new EventHandler(_MyRTB_SelectionChanged); + _MyRTB.LinkChanged -= new StepRTBLinkEvent(MyRTB_LinkChanged); + _MyRTB.SelectionChanged -= new EventHandler(MyRTB_SelectionChanged); } if (value == null) return; _MyRTB = value; - _MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged); - _MyRTB.SelectionChanged+=new EventHandler(_MyRTB_SelectionChanged); - if (_MyRTB.MyLinkText == null) + MyRTB.LinkChanged += new StepRTBLinkEvent(MyRTB_LinkChanged); + MyRTB.SelectionChanged+=new EventHandler(MyRTB_SelectionChanged); + if (MyRTB.MyLinkText == null) { CurROLink = null; _SavCurROLink = null; @@ -87,14 +87,14 @@ namespace Volian.Controls.Library } } - void _MyRTB_SelectionChanged(object sender, EventArgs e) + void MyRTB_SelectionChanged(object sender, EventArgs e) { lbFound.SelectionMode = SelectionMode.None; lbFound.DataSource = null; //Spin through ROs looking for the selected text - if (_MyRTB.SelectedText != "") + if (MyRTB.SelectedText != "") { - string lookFor = _MyRTB.SelectedText; + string lookFor = MyRTB.SelectedText; List children = _MyROFST.ROFSTLookup.GetRosByValue(lookFor); if (children != null) { @@ -110,9 +110,9 @@ namespace Volian.Controls.Library lbFound.Visible = false; } - void _MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args) + void MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args) { - if (_MyRTB.MyLinkText == null) + if (MyRTB.MyLinkText == null) CurROLink = null; else { @@ -292,7 +292,7 @@ namespace Volian.Controls.Library } //else if (chld[i].type == 2 && chld[i].value == null) // table //{ - // if ((_MyRTB.MyItemInfo.MyContent.Type % 10000) == (int)E_FromType.Table) + // if ((MyRTB.MyItemInfo.MyContent.Type % 10000) == (int)E_FromType.Table) // { // tmp = new TreeNode(chld[i].title); // tmp.Tag = chld[i]; @@ -492,31 +492,35 @@ namespace Volian.Controls.Library if (dti.MyDSOTabPanel != null) dti.MyDSOTabPanel.InsertText(AccPageID); } - else if (_MyRTB != null) // a Procedure Steps section tab is active + else if (MyRTB != null) // a Procedure Steps section tab is active { - _MyRTB.inRoAdd = true; + MyRTB.inRoAdd = true; if (CheckROSelection(roch)) // check for RO type is valid for this type of step/substep { - //int ss = _MyRTB.SelectionStart; + //int ss = MyRTB.SelectionStart; // the roid may be 12 or 16 chars long, with the last 4 set if there is unit specific // menuing. Pad to 12 to store in the rousage table. string padroid = (roch.roid.Length <= 12) ? roch.roid + "0000" : roch.roid; string linktxt = string.Format(@"#Link:ReferencedObject: {0} {1}", padroid, _MyROFST.MyRODb.RODbID); // Resolve symbols and scientific notation in the RO return value string valtxt = ConvertSymbolsAndStuff(selectedChld.value); - int ss = _MyRTB.SelectionStart; // Remember where the link is being added - _MyRTB.InsertRO(valtxt, linktxt); // Insert the LINK - _MyRTB.SaveText(); // Save the text with the LINK - This also moves the cursor to the end of the text + int ss = MyRTB.SelectionStart; // Remember where the link is being added + int sl = MyRTB.SelectionLength; + MyRTB.OnReturnToEditor(this, new EventArgs()); + MyRTB.Select(ss, sl); + MyRTB.InsertRO(valtxt, linktxt); // Insert the LINK + MyRTB.OnDoSaveContents(this, new EventArgs()); // .SaveText(); // Save the text with the LINK - This also moves the cursor to the end of the text // By selecting a starting position within a link, StepRTB (HandleSelectionChange) will select the link - _MyRTB.Select(ss + 7 + valtxt.Length , 0);// Select the link, Try 7 for " private int _UniqueBarCount; private ItemInfo _MyItemInfo = null; - private RTBItem _MyRTBItem = null; + private EditItem _MyEditItem = null; private bool _RibbonExpanded=true; public bool RibbonExpanded { @@ -154,12 +154,12 @@ namespace Volian.Controls.Library if (args != null) { _MyItemInfo = args.MyItemInfo; - _MyRTBItem = args.MyRTBItem; + _MyEditItem = args.MyEditItem; } else { _MyItemInfo = null; - _MyRTBItem = null; + _MyEditItem = null; } if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args); } @@ -213,8 +213,8 @@ namespace Volian.Controls.Library void DisplayTabControl_Resize(object sender, EventArgs e) { // If the currently selected Item is in a Step, then adjust the scroll as necessary to keep it visible - if (_MyRTBItem != null) - _MyRTBItem.ItemShow(); + if (_MyEditItem != null) + _MyEditItem.ItemShow(); } private void SetupBar(Bar myBar) { @@ -313,20 +313,20 @@ namespace Volian.Controls.Library if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it { DisplayTabItem pg = _MyDisplayTabItems[key]; - if (pg.MyStepTabPanel.MyStepPanel._LookupRTBItems.ContainsKey(myItemInfo.ItemID)) + if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID)) { - RTBItem stpitm = pg.MyStepTabPanel.MyStepPanel._LookupRTBItems[myItemInfo.ItemID]; + EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID]; switch (pasteType) { case ItemInfo.EAddpingPart.Before: - stpitm.PasteSiblingBefore(copyStartID); + edtitm.PasteSiblingBefore(copyStartID); break; case ItemInfo.EAddpingPart.After: - stpitm.PasteSiblingAfter(copyStartID); + edtitm.PasteSiblingAfter(copyStartID); break; case ItemInfo.EAddpingPart.Replace: - stpitm.PasteReplace(copyStartID); - stpitm.Dispose(); + edtitm.PasteReplace(copyStartID); + edtitm.Dispose(); break; default: return false; ; @@ -354,10 +354,10 @@ namespace Volian.Controls.Library CloseTabItem(pg); return false; } - if (pg.MyStepTabPanel.MyStepPanel._LookupRTBItems.ContainsKey(myItemInfo.ItemID)) + if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID)) { - RTBItem stpitm = pg.MyStepTabPanel.MyStepPanel._LookupRTBItems[myItemInfo.ItemID]; - stpitm.RemoveItem(); + EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID]; + edtitm.RemoveItem(); return true; } } @@ -372,19 +372,19 @@ namespace Volian.Controls.Library if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it { DisplayTabItem pg = _MyDisplayTabItems[key]; - if (pg.MyStepTabPanel.MyStepPanel._LookupRTBItems.ContainsKey(myItemInfo.ItemID)) + if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID)) { - RTBItem stpitm = pg.MyStepTabPanel.MyStepPanel._LookupRTBItems[myItemInfo.ItemID]; + EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID]; switch (insertType) { case E_InsertType.Before: - stpitm.AddSiblingBefore(text,updateSelection); + edtitm.AddSiblingBefore(text,updateSelection); break; case E_InsertType.After: - stpitm.AddSiblingAfter(text,updateSelection); + edtitm.AddSiblingAfter(text,updateSelection); break; case E_InsertType.Child: - stpitm.AddChild(text, fromType, type); + edtitm.AddChild(text, fromType, type); break; default: return false; ;