This commit is contained in:
Kathy Ruffing 2011-04-27 11:20:02 +00:00
parent 385bfc09e0
commit 6ae9eb9653
2 changed files with 24 additions and 2 deletions

View File

@ -325,7 +325,21 @@ namespace Volian.Controls.Library
} }
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument); LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName"); 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);
}
} }
/// <summary> /// <summary>
/// Before a document closes check to see if it's contents should be saved. /// Before a document closes check to see if it's contents should be saved.

View File

@ -194,6 +194,7 @@ namespace Volian.Controls.Library
// figure out whether at same level, have same parent and have same HLS: // figure out whether at same level, have same parent and have same HLS:
ItemInfo itm1 = _CurTrans.MyItemToID; ItemInfo itm1 = _CurTrans.MyItemToID;
ItemInfo itm2 = _CurTrans.MyItemRangeID; ItemInfo itm2 = _CurTrans.MyItemRangeID;
if (_CurTrans.TranType == 2 && itm1.ItemID == itm2.ItemID) itm2 = itm1.LastSibling;
bool samHLS = itm1.MyHLS.ItemID == itm2.MyHLS.ItemID; bool samHLS = itm1.MyHLS.ItemID == itm2.MyHLS.ItemID;
int lev1 = 0; int lev1 = 0;
int lev2 = 0; int lev2 = 0;
@ -212,6 +213,7 @@ namespace Volian.Controls.Library
int cnt = lev1+1; int cnt = lev1+1;
ItemInfo sameParent1 = _CurTrans.MyItemToID; ItemInfo sameParent1 = _CurTrans.MyItemToID;
ItemInfo sameParent2 = _CurTrans.MyItemRangeID; ItemInfo sameParent2 = _CurTrans.MyItemRangeID;
if (_CurTrans.TranType == 2 && sameParent1.ItemID == sameParent2.ItemID) sameParent2 = sameParent1.LastSibling;
while (cnt != 0) while (cnt != 0)
{ {
if (sameParent1.IsHigh) break; 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 // 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. // 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 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<ItemInfo> path = new List<ItemInfo>(); List<ItemInfo> path = new List<ItemInfo>();
ItemInfo parRng = toItem; ItemInfo parRng = toItem;
for (int i = 0; i < lev1+1; i++) for (int i = 0; i < lev1+1; i++)