Removed Debug Print

Moved code to add sections to Procedure parts
Moved code to add steps to Section parts
Moved code to add steps to Step parts
Changed Debug Print
Fixed a Format Flag conversion DontBreakOptEquipmentList
Changed GetItemFont so that parent items would not be left in the cache
Changed AddIncludedStepNumber to allow for ranges to sub levels.
Added a array reference to StepDataList by index.
This commit is contained in:
Rich
2010-06-17 18:42:06 +00:00
parent 332e35c484
commit 5af2c31559
9 changed files with 108 additions and 44 deletions

View File

@@ -31,6 +31,11 @@ namespace VEPROMS.CSLA.Library
public string ResolvePathTo()
{
ItemInfo item = MyContent.ContentItems[0];
//Console.WriteLine("Format = {0}", item.ActiveFormat);
//Console.WriteLine("item = {0}", item.ItemID);
//Console.WriteLine("TranType = {0}", TranType);
//Console.WriteLine("MyItemToID = {0}", MyItemToID);
//Console.WriteLine("MyItemRangeID = {0}", MyItemRangeID);
return ResolvePathTo(item.ActiveFormat, item, TranType, MyItemToID, MyItemRangeID);
}
}
@@ -290,6 +295,7 @@ namespace VEPROMS.CSLA.Library
public int _TranType;
public ItemInfo _ToItem;
public ItemInfo _RangeItem;
public bool _UsedRangeAncestor;
}
private static Dictionary<string, TransitionAppendFunction> _AppendMethods;
private static void SetupMethods()
@@ -321,13 +327,14 @@ namespace VEPROMS.CSLA.Library
}
private static TransitionBuilder SetupTransitionBuilder(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem)
{
TransitionBuilder tb;
TransitionBuilder tb = new TransitionBuilder();
tb._Results = new StringBuilder();
tb._FormatData = formatInfo.PlantFormat.FormatData;
// get the format of the transition string based on this transition's index into the TransData part of
// format....
if (tranType > tb._FormatData.TransData.TransTypeList.Count)
tranType = 0;
// Replace 3 tokens ", {.}, {.}, {.}" with a single token "{.}"
tb._TransFormat = tb._FormatData.TransData.TransTypeList[tranType].TransFormat.Replace(", {.}, {.}, {.}", "{.}");
tb._TransUI = (E_TransUI)tb._FormatData.TransData.TransTypeList[tranType].TransUI;
tb._FromItem = fromInfo;
@@ -498,18 +505,34 @@ namespace VEPROMS.CSLA.Library
}
private static bool AddIncludedStepNumber(bool textAdded, TransitionBuilder tb, string token, string nonToken)
{
Dictionary<int, ItemInfo> rangeAncestors = GetAncestors(tb._RangeItem);
if (textAdded) Append(tb, nonToken, false);
ItemInfo next = GetNextItem(tb._ToItem);
bool usedRangeAncestor = false;
ItemInfo next = GetNextItem(tb._ToItem, rangeAncestors, ref usedRangeAncestor);
while (next.ItemID != tb._RangeItem.ItemID)
{
Append(tb, ", " + Tab(next), true); // TODO: Intermediate Range.
next = GetNextItem(next);
next = GetNextItem(next, rangeAncestors, ref usedRangeAncestor);
}
textAdded = true;
tb._UsedRangeAncestor = usedRangeAncestor;
return textAdded;
}
private static ItemInfo GetNextItem(ItemInfo next)
private static Dictionary<int, ItemInfo> GetAncestors(ItemInfo itemInfo)
{
Dictionary<int, ItemInfo> retval = new Dictionary<int,ItemInfo>();
while (!itemInfo.IsHigh)
{
ItemInfo parent = itemInfo.MyActiveParent as ItemInfo;
retval.Add(parent.ItemID, itemInfo.FirstSibling);
itemInfo = parent;
}
return retval;
}
private static ItemInfo GetNextItem(ItemInfo next, Dictionary<int, ItemInfo> rangeAncestors, ref bool usedRangeAncestor)
{
if (rangeAncestors.ContainsKey(next.ItemID))
return rangeAncestors[next.ItemID];
while (next.NextItem == null)
next = next.ActiveParent as ItemInfo;
return next.NextItem;