B2020-076: Create template steps when insert step from treeview with editor not open (made 2 methods public)
This commit is contained in:
parent
26d500a939
commit
834febf196
@ -358,7 +358,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
((ItemInfo)ActiveParent).MyContent.RefreshContentParts();
|
((ItemInfo)ActiveParent).MyContent.RefreshContentParts();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
private ItemInfo InsertSmartTemplateSubStep(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type, E_FromType fromTypeTop)
|
public ItemInfo InsertSmartTemplateSubStep(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type, E_FromType fromTypeTop)
|
||||||
{
|
{
|
||||||
int newItemID = 0;
|
int newItemID = 0;
|
||||||
int topType = GetSmartTemplateTopLevelIndxOfThisType(type);
|
int topType = GetSmartTemplateTopLevelIndxOfThisType(type);
|
||||||
@ -414,7 +414,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemInfo InsertSmartTemplateSteps(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type)
|
public ItemInfo InsertSmartTemplateSteps(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type)
|
||||||
{
|
{
|
||||||
int newItemID = 0;
|
int newItemID = 0;
|
||||||
int topType = GetSmartTemplateTopLevelIndx();
|
int topType = GetSmartTemplateTopLevelIndx();
|
||||||
@ -686,7 +686,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public ItemInfo InsertSiblingAfter(string text, string number, int? type)
|
public ItemInfo InsertSiblingAfter(string text, string number, int? type)
|
||||||
{
|
{
|
||||||
ItemInfo tmp = null;
|
ItemInfo tmp = null; // KBR need template code in tree view?
|
||||||
if (!IsSection && (FormatStepData.UseSmartTemplate || (MyHLS != null && MyHLS.FormatStepData.UseSmartTemplate) || FormatStepData.UseOldTemplate))
|
if (!IsSection && (FormatStepData.UseSmartTemplate || (MyHLS != null && MyHLS.FormatStepData.UseSmartTemplate) || FormatStepData.UseOldTemplate))
|
||||||
tmp = InsertSmartTemplateSteps(text, number, tmp, EAddpingPart.After, (int)((type == null)? MyContent.Type : type)); // B2018-051 use the type passed in instead of current step type
|
tmp = InsertSmartTemplateSteps(text, number, tmp, EAddpingPart.After, (int)((type == null)? MyContent.Type : type)); // B2018-051 use the type passed in instead of current step type
|
||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
|
@ -2803,20 +2803,32 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The parent step was not open in the step editor, just create new step and add treenode.
|
// The parent step was not open in the step editor, just create new step(s) 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
|
int newId = -1;
|
||||||
//using (Step step = Step.MakeStep(_LastItemInfo, _LastItemInfo.LastChild(E_FromType.Step), null, "New Step", 20002, E_FromType.Step))
|
// B2020-076: if this step has a template, insert template steps.
|
||||||
using (Step step = Step.MakeStep(_LastItemInfo, null , null, "New Step", 20002, E_FromType.Step))
|
int topType = ii.GetSmartTemplateTopLevelIndxOfThisType(20002);
|
||||||
|
if (topType != -1)
|
||||||
{
|
{
|
||||||
ShowBrokenRules(step.BrokenRulesCollection);
|
ItemInfo tmp = null;
|
||||||
SetLastValues(StepInfo.Get(step.ItemID));
|
tmp = ii.InsertSmartTemplateSubStep("New Step", null, null, ItemInfo.EAddpingPart.Child, 20002, E_FromType.Step);
|
||||||
tn = new VETreeNode(_LastStepInfo);
|
newId = tmp.ItemID;
|
||||||
//SelectedNode.Nodes.Add(tn); // add tree node to end of list.
|
|
||||||
_LastStepInfo.UpdateTransitionText();
|
|
||||||
_LastStepInfo.UpdateROText();
|
|
||||||
TreeNode par = SelectedNode;
|
|
||||||
par.Nodes.Insert(0, tn);
|
|
||||||
}
|
}
|
||||||
|
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:
|
// 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.
|
// The parent step was not open in the step editor, just create new step and add treenode.
|
||||||
int tvindex = SelectedNode.Index;
|
int tvindex = SelectedNode.Index;
|
||||||
// if inserting before, the parent is set in case previous is null, i.e. beginning of the list.
|
// B2020-076: if this step has a template, insert template steps.
|
||||||
ItemInfo parent = (newtype == MenuSelections.StepAfter) ? null : _LastStepInfo.MyParent;
|
int newid = -1;
|
||||||
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))
|
if (ii.FormatStepData.UseSmartTemplate || ii.FormatStepData.UseOldTemplate)
|
||||||
{
|
{
|
||||||
ShowBrokenRules(step.BrokenRulesCollection);
|
ItemInfo tmp = ii.InsertSmartTemplateSteps("New Step", null, null, newtype == MenuSelections.StepAfter ? ItemInfo.EAddpingPart.After : ItemInfo.EAddpingPart.Before, (int)ii.MyContent.Type);
|
||||||
SetLastValues(StepInfo.Get(step.ItemID));
|
newid = tmp.ItemID;
|
||||||
tn = new VETreeNode(_LastStepInfo);
|
|
||||||
_LastStepInfo.UpdateTransitionText();
|
|
||||||
_LastStepInfo.UpdateROText();
|
|
||||||
TreeNode par = SelectedNode.Parent;
|
|
||||||
par.Nodes.Insert(tvindex + ((newtype == MenuSelections.StepBefore) ? 0 : 1), tn);
|
|
||||||
}
|
}
|
||||||
|
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)
|
if (tn != null)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user