Change Manager

This commit is contained in:
Rich
2011-08-01 20:20:39 +00:00
parent 1d910db31a
commit 792351c922
14 changed files with 2329 additions and 42 deletions

View File

@@ -66,6 +66,11 @@ namespace Volian.Controls.Library
}
protected static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected ChildRelation _MyChildRelation;
public ChildRelation MyChildRelation
{
get { return _MyChildRelation; }
set { _MyChildRelation = value; }
}
protected bool _Loading = true;
protected EditItem _MyParentEditItem = null;
protected EditItem _MySectionRTBItem;
@@ -556,6 +561,7 @@ namespace Volian.Controls.Library
}
public EditItem DeleteItem()
{
MyStepPanel._LookupEditItems.Remove(MyID);
EditItem newFocus = null;
int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top));
int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top));
@@ -731,7 +737,8 @@ namespace Volian.Controls.Library
public EditItem AddChildAfter(ItemInfo MyItemInfo, bool expand)
{
EditItem child = null;
if (MyItemInfo.MyContent.ContentGridCount != 0)
//if (MyItemInfo.MyContent.ContentGridCount != 0)
if (MyItemInfo.MyContent.MyGrid != null)
child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, expand);
else
child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, expand);
@@ -740,7 +747,8 @@ namespace Volian.Controls.Library
public EditItem AddChildAfter(ItemInfo MyItemInfo, EditItem nextEditItem)
{
EditItem child = null;
if (MyItemInfo.MyContent.ContentGridCount != 0)
//if (MyItemInfo.MyContent.ContentGridCount != 0)
if (MyItemInfo.MyContent.MyGrid != null)
child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem);
else
child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem);
@@ -760,7 +768,8 @@ namespace Volian.Controls.Library
{
// not sure about this, i.e. whether a grid can be added here.
EditItem child = null;
if (MyItemInfo.MyContent.ContentGridCount != 0)
//if (MyItemInfo.MyContent.ContentGridCount != 0)
if (MyItemInfo.MyContent.MyGrid != null)
child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.RNO, true, nextEditItem);
else
child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.RNO, true, nextEditItem);
@@ -865,15 +874,7 @@ namespace Volian.Controls.Library
}
}
// TODO: We need to determine where this will go in the stack of children
EditItem nextItem = null;
if (newItemInfo.NextItem != null)
nextItem = MyStepPanel.FindItem(newItemInfo.NextItem);
else if (fromType == E_FromType.Table && MyAfterEditItems != null)
nextItem = MyAfterEditItems[0];
// Cautions come before notes, so if this is a Caution and there are Notes, put this first
else if (fromType == E_FromType.Caution && ((ItemInfo)newItemInfo.ActiveParent).Notes != null
&& ((ItemInfo)newItemInfo.ActiveParent).Notes.Count > 0)
nextItem = MyStepPanel.FindItem(((ItemInfo)newItemInfo.ActiveParent).Notes[0]);
EditItem nextItem = GetNextItem(fromType, newItemInfo);
// TODO: May need similar logic if a Table is being added to a step that has substeps
// else if (fromType == E_FromType.Table && ((ItemInfo)newItemInfo.ActiveParent).Steps != null
//&& ((ItemInfo)newItemInfo.ActiveParent).Steps.Count > 0)
@@ -908,6 +909,19 @@ namespace Volian.Controls.Library
}
MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
}
public EditItem GetNextItem(E_FromType fromType, ItemInfo newItemInfo)
{
EditItem nextItem = null;
if (newItemInfo.NextItem != null)
nextItem = MyStepPanel.FindItem(newItemInfo.NextItem);
else if (fromType == E_FromType.Table && MyAfterEditItems != null)
nextItem = MyAfterEditItems[0];
// Cautions come before notes, so if this is a Caution and there are Notes, put this first
else if (fromType == E_FromType.Caution && ((ItemInfo)newItemInfo.ActiveParent).Notes != null
&& ((ItemInfo)newItemInfo.ActiveParent).Notes.Count > 0)
nextItem = MyStepPanel.FindItem(((ItemInfo)newItemInfo.ActiveParent).Notes[0]);
return nextItem;
}
/// <summary>
/// Add a list of children after
/// </summary>
@@ -1970,7 +1984,7 @@ namespace Volian.Controls.Library
}
if (expand) ShowExpanded();
MyStepPanel = myStepPanel;
if (itemInfo != null) myStepPanel._LookupEditItems.Add(itemInfo.ItemID, this);
if (itemInfo != null && !myStepPanel._LookupEditItems.ContainsKey(itemInfo.ItemID)) myStepPanel._LookupEditItems.Add(itemInfo.ItemID, this);
_MyChildRelation = myChildRelation;
if (myParentEditItem != null) RNOLevel = myParentEditItem.RNOLevel;
if (itemInfo != null)