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

@@ -1099,7 +1099,7 @@ namespace VEPROMS.CSLA.Library
case 2: // step types
int typindx = type - 20000; // what to do for other types rather than steps
font = format.PlantFormat.FormatData.StepDataList[typindx].Font;
if (IsParagraph) font = AdjustForTextSubFollowsTextStyle(font);
if (typindx == _ParagraphType) font = AdjustForTextSubFollowsTextStyle(format,typindx,font);
break;
}
}
@@ -1109,14 +1109,20 @@ namespace VEPROMS.CSLA.Library
}
return font;
}
private const int _ParagraphType=24;
protected VE_Font AdjustForTextSubFollowsTextStyle(VE_Font font)
{
if (FormatStepData.TextSubFollowsTextStyle && ParentNoteOrCaution != null)
return AdjustForTextSubFollowsTextStyle(ActiveFormat, this.FormatStepType, font);
}
private VE_Font AdjustForTextSubFollowsTextStyle(FormatInfo format, int typindx, VE_Font font)
{
StepData myFormatStepData = format.PlantFormat.FormatData.StepDataList[typindx];
if (myFormatStepData.TextSubFollowsTextStyle && ParentNoteOrCaution != null)
{
bool isBold = (FormatStepData.Font.Style & E_Style.Bold) > 0;
bool isMmBold = (FormatStepData.Font.Style & E_Style.MmBold) > 0;
font = ParentNoteOrCaution.FormatStepData.Font;
bool isBold = (myFormatStepData.Font.Style & E_Style.Bold) > 0;
bool isMmBold = (myFormatStepData.Font.Style & E_Style.MmBold) > 0;
myFormatStepData = format.PlantFormat.FormatData.StepDataList[ParentNoteOrCaution.FormatStepType];
font = myFormatStepData.Font;
E_Style myStyle = (E_Style) font.Style;
myStyle ^= (myStyle & E_Style.Bold);
myStyle ^= (myStyle & E_Style.MmBold);
@@ -1947,7 +1953,7 @@ namespace VEPROMS.CSLA.Library
{
if (parent.IsCautionPart || parent.IsNotePart)
_ParentNoteOrCaution = parent;
else
else if(!parent.IsHigh)
{
_ParentNoteOrCaution = parent.ParentNoteOrCaution;
}

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;

View File

@@ -3699,7 +3699,16 @@ namespace VEPROMS.CSLA.Library
return null;
}
}
public StepDataList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
public StepData this[int index]
{
get
{
foreach (StepData stepData in this)
if (stepData.Index == index) return stepData;
return null;
}
}
public StepDataList(XmlNodeList xmlNodeList, IFormatOrFormatInfo myFormat) : base(xmlNodeList, myFormat) { }
private StepData _HLS;
public StepData HLS
{