Calvert: copied steps/sections have change ids

This commit is contained in:
2014-09-17 16:44:31 +00:00
parent 373634318b
commit e785302c9e
5 changed files with 82 additions and 18 deletions

View File

@@ -30,6 +30,7 @@ namespace Volian.Controls.Library
public delegate void vlnTreeViewSectionInfoEvent(object sender, vlnTreeSectionInfoEventArgs args);
public delegate void WordSectionDeletedEvent(object sender, WordSectionEventArgs args);
public delegate void vlnTreeViewPdfEvent(object sender, vlnTreeViewPdfArgs args);
public delegate string vlnTreeViewGetChangeIdEvent(object sender, vlnTreeItemInfoEventArgs args);
public partial class vlnTreeSectionInfoEventArgs
{
private bool _IsDeleting = false;
@@ -336,6 +337,12 @@ namespace Volian.Controls.Library
ItemInfo _LastItemInfo = null;
#endregion
#region Events
public event vlnTreeViewGetChangeIdEvent GetChangeId;
private string OnGetChangeId(object sender, vlnTreeItemInfoEventArgs args)
{
if (GetChangeId != null) return GetChangeId(sender, args);
return null;
}
public event vlnTreeViewPdfEvent ViewPDF;
private void OnViewPDF(object sender, vlnTreeViewPdfArgs args)
{
@@ -1488,11 +1495,13 @@ namespace Volian.Controls.Library
if (ii.IsProcedure || !OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, pasteOpt, ii.MyContent.Type)))
{
// The parent step was not open in the step editor, just paste step (in data) and add treenode.
// first, check if a changeid is required.
string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii));
ItemInfo newItemInfo = null;
if (newtype == MenuSelections.StepBefore)
newItemInfo = ii.PasteSiblingBefore(copyStartID);
newItemInfo = ii.PasteSiblingBefore(copyStartID, chgId);
else
newItemInfo = ii.PasteSiblingAfter(copyStartID);
newItemInfo = ii.PasteSiblingAfter(copyStartID, chgId);
}
SelectedNode = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode);
}
@@ -1503,8 +1512,9 @@ namespace Volian.Controls.Library
ItemInfo ii = tn.VEObject as ItemInfo;
if (!OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, ItemInfo.EAddpingPart.Replace, ii.MyContent.Type)))
{
//return;
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID);
// first, check if a changeid is required.
string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii));
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId);
}
SelectedNode = (VETreeNode)((prevtn != null) ? prevtn.NextNode : partn.FirstNode);
}