From 6ae9eb965303356bded15b37d7ddb4a351096cad Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 27 Apr 2011 11:20:02 +0000 Subject: [PATCH] --- PROMS/Volian.Controls.Library/DSOTabPanel.cs | 16 +++++++++++++++- .../Volian.Controls.Library/DisplayTransition.cs | 10 +++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DSOTabPanel.cs b/PROMS/Volian.Controls.Library/DSOTabPanel.cs index e9cb636b..1ca3b890 100644 --- a/PROMS/Volian.Controls.Library/DSOTabPanel.cs +++ b/PROMS/Volian.Controls.Library/DSOTabPanel.cs @@ -325,7 +325,21 @@ namespace Volian.Controls.Library } LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument); MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName"); - MyDSOFile.SaveFile(doc.Length,doc.Ascii,MyDisplayTabItem.MyItemInfo); + // if this was a library document, ask user if it should be saved for all usages. + bool cvtLibDoc = false; + EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry; + if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "") + { + DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo); + if (ans == DialogResult.No) cvtLibDoc = true; + } + MyDSOFile.SaveFile(doc.Length,doc.Ascii,MyDisplayTabItem.MyItemInfo, cvtLibDoc); + if (cvtLibDoc) + { + MyDisplayTabItem.Text = MyDisplayTabItem.MyItemInfo.TabTitle; + MyDisplayTabItem.Tooltip = MyDisplayTabItem.MyItemInfo.TabToolTip; + MyDisplayTabItem.SetPrivateTooltip(MyDisplayTabItem.MyItemInfo.TabToolTip); + } } /// /// Before a document closes check to see if it's contents should be saved. diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs index 764bd491..54593742 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs @@ -194,6 +194,7 @@ namespace Volian.Controls.Library // figure out whether at same level, have same parent and have same HLS: ItemInfo itm1 = _CurTrans.MyItemToID; ItemInfo itm2 = _CurTrans.MyItemRangeID; + if (_CurTrans.TranType == 2 && itm1.ItemID == itm2.ItemID) itm2 = itm1.LastSibling; bool samHLS = itm1.MyHLS.ItemID == itm2.MyHLS.ItemID; int lev1 = 0; int lev2 = 0; @@ -212,6 +213,7 @@ namespace Volian.Controls.Library int cnt = lev1+1; ItemInfo sameParent1 = _CurTrans.MyItemToID; ItemInfo sameParent2 = _CurTrans.MyItemRangeID; + if (_CurTrans.TranType == 2 && sameParent1.ItemID == sameParent2.ItemID) sameParent2 = sameParent1.LastSibling; while (cnt != 0) { if (sameParent1.IsHigh) break; @@ -228,8 +230,14 @@ namespace Volian.Controls.Library // now add nodes for the subtrees so that highlighting can be done. Do 'to' item // first. If 'range' item is at same level, won't need to do anymore processing. ItemInfo toItem = sameParent1.Ordinal<=sameParent2.Ordinal?_CurTrans.MyItemToID:_CurTrans.MyItemRangeID; - ItemInfo rngItem = sameParent1.Ordinal<=sameParent2.Ordinal?_CurTrans.MyItemRangeID:_CurTrans.MyItemToID; + ItemInfo rngItem = null; + if (_CurTrans.TranType == 2 && _CurTrans.MyItemToID == _CurTrans.MyItemRangeID) + { + rngItem = sameParent1.Ordinal <= sameParent2.Ordinal ? _CurTrans.MyItemToID.LastSibling : _CurTrans.MyItemToID; + } + else + rngItem = sameParent1.Ordinal <= sameParent2.Ordinal ? _CurTrans.MyItemRangeID : _CurTrans.MyItemToID; List path = new List(); ItemInfo parRng = toItem; for (int i = 0; i < lev1+1; i++)