support paste into parent if steps are open in step editor

implement functionality behind the Paste menu items when pasting from a parent (proc pasted into docversion, section into proc, etc)
This commit is contained in:
2015-01-29 13:47:27 +00:00
parent 90b46d6873
commit dbcca8a8b9
3 changed files with 161 additions and 26 deletions

View File

@@ -1233,6 +1233,55 @@ namespace Volian.Controls.Library
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.After, newItemInfo.MyContent.Type));
}
public void PasteChild(int copyStartID)
{
ItemInfo newItemInfo = MyItemInfo.PasteChild(copyStartID, GetChangeId(MyItemInfo));
E_FromType fromType = E_FromType.Step;
if (MyItemInfo.MyContent.Type < 10000)
fromType = E_FromType.Procedure;
else if (MyItemInfo.MyContent.Type < 20000)
fromType = E_FromType.Section;
else if (MyItemInfo.MyContent.Type > 19999)
{
int tmptype = (int)MyItemInfo.MyContent.Type - 20000;
if (MyItemInfo.IsCaution) fromType = E_FromType.Caution;
else if (MyItemInfo.IsNote) fromType = E_FromType.Note;
else if (MyItemInfo.IsTable) fromType = E_FromType.Table;
else if (MyItemInfo.IsRNOPart) fromType = E_FromType.RNO;
}
EditItem nextItem = GetNextItem(fromType, newItemInfo);
EditItem newEditItem;
switch (fromType)
{
case E_FromType.Caution:
newEditItem = this.AddChildBefore(newItemInfo, nextItem);
break;
case E_FromType.Note:
newEditItem = this.AddChildBefore(newItemInfo, nextItem);
break;
case E_FromType.Procedure:
newEditItem = this.AddChildAfter(newItemInfo, nextItem);
break;
case E_FromType.RNO:
newEditItem = this.AddChildRNO(newItemInfo, nextItem);
break;
case E_FromType.Section:
newEditItem = this.AddChildAfter(newItemInfo, nextItem);
break;
case E_FromType.Step:
newEditItem = this.AddChildAfter(newItemInfo, nextItem);
break;
case E_FromType.Table:
newEditItem = this.AddChildAfter(newItemInfo, nextItem);
break;
default:
newEditItem = this.AddChildAfter(newItemInfo, nextItem);
break;
}
MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
}
public EditItem PasteReplace(int copyStartID)
{
// To allow a Paste Step into an empty (new) step/substep, we need to add a character to the the Text field