Changed logic so that for first secttion we use ItemInfo.InsertChild (this handles lots of things)

This commit is contained in:
Rich 2012-03-28 19:53:26 +00:00
parent 7dbc0ddfe5
commit 396cada699

View File

@ -730,7 +730,9 @@ namespace Volian.Controls.Library
void mi_Click(object sender, EventArgs e)
{
MenuItem mi = (MenuItem)sender;
MenuItem mi = sender as MenuItem;
if (mi == null)
return;
switch (mi.Text)
{
case "Open":
@ -1163,7 +1165,7 @@ namespace Volian.Controls.Library
if (!hasMetaSubs) doPseudo = true;
}
}
using (Section section = Section.MakeSection(_LastItemInfo, _LastItemInfo.LastChild(E_FromType.Section), null, "New Section", 10000))
using(Section section = CreateNewSection())
{
ShowBrokenRules(section.BrokenRulesCollection);
SetLastValues(SectionInfo.Get(section.ItemID));
@ -1262,7 +1264,13 @@ namespace Volian.Controls.Library
OnNodeInsert(this, new vlnTreeEventArgs(SelectedNode));
}
}
private Section CreateNewSection()
{
if(_LastItemInfo.LastChild(E_FromType.Section) != null)
return Section.MakeSection(_LastItemInfo, _LastItemInfo.LastChild(E_FromType.Section), null, "New Section", 10000);
ItemInfo iii = _LastItemInfo.InsertChild(E_FromType.Section, 10000, "New Section", null);
return Section.Get(iii.ItemID);
}
private VETreeNode InsertChildStep(VETreeNode tn)
{
// If parent step is open in editor, use the OnInsertItemInfo to insert step & add RTBItems to step editor panel