Merge pull request 'C2024-004' (#339) from C2024-004 into Development
code changes look good. ready for testing phase.
This commit is contained in:
@@ -688,8 +688,14 @@ namespace Volian.Controls.Library
|
||||
edtitm.PasteSiblingAfter(copyStartID);
|
||||
break;
|
||||
case ItemInfo.EAddpingPart.Replace:
|
||||
|
||||
EditItem ei = edtitm.PasteReplace(copyStartID);
|
||||
if (ei == null) return false; //B2017-179 PasteReplace will return null if was aborted
|
||||
if (ei == null)
|
||||
{
|
||||
CloseTabItem(_MyDisplayTabItems["Item - " + myItemInfo.ItemID.ToString()]); //Grab itemID and set to close open tab.
|
||||
return false; //B2017-179 PasteReplace will return null if was aborted
|
||||
}
|
||||
|
||||
if (ei.MyItemInfo.ItemID != edtitm.MyItemInfo.ItemID)
|
||||
{
|
||||
edtitm.Dispose();
|
||||
|
@@ -1825,6 +1825,7 @@ namespace Volian.Controls.Library
|
||||
EditItem newFocus = null;
|
||||
EditItem nextEditItem = MyNextEditItem;
|
||||
EditItem prevEditItem = MyPreviousEditItem;
|
||||
if (MyStepPanel?.SelectedEditItem?.ActiveParent == null) return null; //Was causing an error when active parent was null and the replaced proc was opened in the editor.
|
||||
EditItem parentEditItem = ActiveParent;
|
||||
|
||||
StepConfig savOrigPasteConfig = MyItemInfo.MyConfig as StepConfig;
|
||||
@@ -1835,7 +1836,8 @@ namespace Volian.Controls.Library
|
||||
bool gotoFirstTrans = false;
|
||||
try
|
||||
{
|
||||
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), ref gotoFirstTrans);
|
||||
TreeNode treeNodeReplace = null;
|
||||
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), treeNodeReplace, ref gotoFirstTrans);
|
||||
if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved
|
||||
{
|
||||
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo);
|
||||
|
@@ -2018,7 +2018,6 @@ namespace Volian.Controls.Library
|
||||
// lots of paste options:
|
||||
case "Paste Procedure":
|
||||
case "Paste Procedure Before":
|
||||
case "Replace Existing Procedure":
|
||||
case "Paste Procedure After":
|
||||
case "Paste Section":
|
||||
case "Paste Section Before":
|
||||
@@ -2031,6 +2030,18 @@ namespace Volian.Controls.Library
|
||||
case "Paste Subsection":
|
||||
tv_NodePaste(mi.Text);
|
||||
break;
|
||||
case "Replace Existing Procedure":
|
||||
DialogResult ovewriteEx = FlexibleMessageBox.Show("This will overwrite the selected procedure with then one you copied, would you like to overwrite it?\r\n\r\nSelecting 'Cancel' will cancel the paste action.", "Overwrite the procedure?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);// == DialogResult.Yes;
|
||||
|
||||
if (ovewriteEx == DialogResult.Cancel) break;
|
||||
else
|
||||
{
|
||||
TreeNode treenodeDirectory = SelectedNode.Parent;
|
||||
tv_NodePaste(mi.Text);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case "Delete":
|
||||
if (tv_NodeDelete())
|
||||
{
|
||||
@@ -2397,6 +2408,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
VETreeNode tn = SelectedNode as VETreeNode;
|
||||
TreeNode treeNodeReplace = SelectedNode.Parent; //Get Tree Node of Parent we are proc we are placing into.
|
||||
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
||||
// Check for paste into a docversion - queries/code is different than paste related to an item (into a proc or section)
|
||||
if (dvi != null)
|
||||
@@ -2432,13 +2444,17 @@ namespace Volian.Controls.Library
|
||||
else if (p.IndexOf("After") > -1)
|
||||
PasteBeforeOrAfter(MenuSelections.StepAfter, tn, iiClipboard.ItemID);
|
||||
else if (p.IndexOf("Replace") > -1)
|
||||
PasteReplace(tn, iiClipboard.ItemID);
|
||||
{
|
||||
PasteReplace(tn, iiClipboard.ItemID, treeNodeReplace);
|
||||
}
|
||||
else // paste as child
|
||||
PasteAsChild(tn, iiClipboard.ItemID);
|
||||
this.Cursor = Cursors.Default;
|
||||
|
||||
//if (p.IndexOf("Replace") <= -1)
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
private void PasteAsDocVersionChild(VETreeNode tn, int copyStartID)
|
||||
public void PasteAsDocVersionChild(VETreeNode tn, int copyStartID)
|
||||
{
|
||||
// Only need to handle paste in tree since this will create a new procedure.
|
||||
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
||||
@@ -2525,7 +2541,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
SelectedNode = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode);
|
||||
}
|
||||
private void PasteReplace(VETreeNode tn, int copyStartID)
|
||||
private void PasteReplace(VETreeNode tn, int copyStartID, TreeNode treeNodeReplace)
|
||||
{
|
||||
VETreeNode prevtn = (VETreeNode) tn.PrevNode;
|
||||
VETreeNode partn = (VETreeNode) tn.Parent;
|
||||
@@ -2536,23 +2552,43 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
// first, check if a changeid is required.
|
||||
string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii));
|
||||
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId);
|
||||
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId, treeNodeReplace);
|
||||
|
||||
StepConfig replItemConfig = ii.MyConfig as StepConfig;
|
||||
if (replItemInfo != null)
|
||||
{
|
||||
OnOpenItem(this, new vlnTreeItemInfoEventArgs(replItemInfo));
|
||||
ItemInfo newEnhStep = replItemInfo.PasteEnhancedItems(copyStartID, ii, ItemInfo.EAddpingPart.Replace, chgId);
|
||||
}
|
||||
}
|
||||
// B2018-047: was crashing on the following line (before change it was casting the result to a VETreeNote when the partn.FirstNode was just a TreeNode)
|
||||
SelectedNode = prevtn != null ? prevtn.NextNode : partn.FirstNode;
|
||||
|
||||
|
||||
}
|
||||
private void tv_NodeCopy()
|
||||
public void PasteRepalceEmpty(VETreeNode tn, int copyStartID)
|
||||
{
|
||||
if (SelectedNode==null)return;
|
||||
VETreeNode tn = SelectedNode as VETreeNode;
|
||||
OnNodeCopy(this, new vlnTreeEventArgs(tn));
|
||||
// Only need to handle paste in tree since this will create a new procedure.
|
||||
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
||||
if (dvi.DocVersionAssociationCount == 0)
|
||||
{
|
||||
// Set docversionassociation to the copied docversion association
|
||||
// so that the rofst for ro's can be found. (if there is no association set)
|
||||
ROFstInfo rfi = GetAssociationRofstId(copyStartID);
|
||||
Association myAs = Association.MakeAssociation(dvi.Get(), rfi.GetJustROFst(), "");
|
||||
dvi.RefreshDocVersionAssociations();
|
||||
}
|
||||
ItemInfo newProc = dvi.PasteChild(copyStartID);
|
||||
VETreeNode tn1 = new VETreeNode(newProc);
|
||||
SelectedNode.Nodes.Add(tn1); // add tree node to end of list.
|
||||
SelectedNode = tn1;
|
||||
}
|
||||
private void tv_NodeCopy()
|
||||
{
|
||||
if (SelectedNode == null) return;
|
||||
VETreeNode tn = SelectedNode as VETreeNode;
|
||||
OnNodeCopy(this, new vlnTreeEventArgs(tn));
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region PropertyPagesInterface
|
||||
private void SetupNodeProperties()
|
||||
|
Reference in New Issue
Block a user