B2020-076: Create template steps when insert step from treeview with editor not open (made 2 methods public)
This commit is contained in:
@@ -2803,20 +2803,32 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
// The parent step was not open in the step editor, just create new step and add treenode.
|
||||
// this line (below) adds the new step to the bottom of the section, the other line (not commented) adds it to the top. Bug fix B2016-002
|
||||
//using (Step step = Step.MakeStep(_LastItemInfo, _LastItemInfo.LastChild(E_FromType.Step), null, "New Step", 20002, E_FromType.Step))
|
||||
using (Step step = Step.MakeStep(_LastItemInfo, null , null, "New Step", 20002, E_FromType.Step))
|
||||
// The parent step was not open in the step editor, just create new step(s) and add treenode.
|
||||
int newId = -1;
|
||||
// B2020-076: if this step has a template, insert template steps.
|
||||
int topType = ii.GetSmartTemplateTopLevelIndxOfThisType(20002);
|
||||
if (topType != -1)
|
||||
{
|
||||
ShowBrokenRules(step.BrokenRulesCollection);
|
||||
SetLastValues(StepInfo.Get(step.ItemID));
|
||||
tn = new VETreeNode(_LastStepInfo);
|
||||
//SelectedNode.Nodes.Add(tn); // add tree node to end of list.
|
||||
_LastStepInfo.UpdateTransitionText();
|
||||
_LastStepInfo.UpdateROText();
|
||||
TreeNode par = SelectedNode;
|
||||
par.Nodes.Insert(0, tn);
|
||||
ItemInfo tmp = null;
|
||||
tmp = ii.InsertSmartTemplateSubStep("New Step", null, null, ItemInfo.EAddpingPart.Child, 20002, E_FromType.Step);
|
||||
newId = tmp.ItemID;
|
||||
}
|
||||
else
|
||||
{
|
||||
// this line (below) adds the new step to the bottom of the section, the other line (not commented) adds it to the top. Bug fix B2016-002
|
||||
//using (Step step = Step.MakeStep(_LastItemInfo, _LastItemInfo.LastChild(E_FromType.Step), null, "New Step", 20002, E_FromType.Step))
|
||||
using (Step step = Step.MakeStep(_LastItemInfo, null, null, "New Step", 20002, E_FromType.Step))
|
||||
{
|
||||
ShowBrokenRules(step.BrokenRulesCollection);
|
||||
newId = step.ItemID;
|
||||
}
|
||||
}
|
||||
SetLastValues(StepInfo.Get(newId));
|
||||
tn = new VETreeNode(_LastStepInfo);
|
||||
_LastStepInfo.UpdateTransitionText();
|
||||
_LastStepInfo.UpdateROText();
|
||||
TreeNode par = SelectedNode;
|
||||
par.Nodes.Insert(0, tn);
|
||||
}
|
||||
|
||||
// see if enhanced related steps need created:
|
||||
@@ -2861,18 +2873,29 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
// The parent step was not open in the step editor, just create new step and add treenode.
|
||||
int tvindex = SelectedNode.Index;
|
||||
// if inserting before, the parent is set in case previous is null, i.e. beginning of the list.
|
||||
ItemInfo parent = (newtype == MenuSelections.StepAfter) ? null : _LastStepInfo.MyParent;
|
||||
using (Step step = Step.MakeStep(parent, (newtype == MenuSelections.StepAfter) ? _LastStepInfo : _LastStepInfo.MyPrevious, null, "New Step", (int)_LastStepInfo.MyContent.Type, (E_FromType)_LastStepInfo.FirstSibling.ItemParts[0].FromType))
|
||||
// B2020-076: if this step has a template, insert template steps.
|
||||
int newid = -1;
|
||||
if (ii.FormatStepData.UseSmartTemplate || ii.FormatStepData.UseOldTemplate)
|
||||
{
|
||||
ShowBrokenRules(step.BrokenRulesCollection);
|
||||
SetLastValues(StepInfo.Get(step.ItemID));
|
||||
tn = new VETreeNode(_LastStepInfo);
|
||||
_LastStepInfo.UpdateTransitionText();
|
||||
_LastStepInfo.UpdateROText();
|
||||
TreeNode par = SelectedNode.Parent;
|
||||
par.Nodes.Insert(tvindex + ((newtype == MenuSelections.StepBefore) ? 0 : 1), tn);
|
||||
ItemInfo tmp = ii.InsertSmartTemplateSteps("New Step", null, null, newtype == MenuSelections.StepAfter ? ItemInfo.EAddpingPart.After : ItemInfo.EAddpingPart.Before, (int)ii.MyContent.Type);
|
||||
newid = tmp.ItemID;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if inserting before, the parent is set in case previous is null, i.e. beginning of the list.
|
||||
ItemInfo parent = (newtype == MenuSelections.StepAfter) ? null : _LastStepInfo.MyParent;
|
||||
using (Step step = Step.MakeStep(parent, (newtype == MenuSelections.StepAfter) ? _LastStepInfo : _LastStepInfo.MyPrevious, null, "New Step", (int)_LastStepInfo.MyContent.Type, (E_FromType)_LastStepInfo.FirstSibling.ItemParts[0].FromType))
|
||||
{
|
||||
ShowBrokenRules(step.BrokenRulesCollection);
|
||||
newid = step.ItemID;
|
||||
}
|
||||
}
|
||||
SetLastValues(StepInfo.Get(newid));
|
||||
tn = new VETreeNode(_LastStepInfo);
|
||||
_LastStepInfo.UpdateTransitionText();
|
||||
_LastStepInfo.UpdateROText();
|
||||
TreeNode par = SelectedNode.Parent;
|
||||
par.Nodes.Insert(tvindex + ((newtype == MenuSelections.StepBefore) ? 0 : 1), tn);
|
||||
}
|
||||
if (tn != null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user