This commit is contained in:
Kathy Ruffing 2010-06-16 14:07:19 +00:00
parent d69c2806f7
commit 59d0b105df

View File

@ -1099,6 +1099,7 @@ namespace VEPROMS.CSLA.Library
case 2: // step types case 2: // step types
int typindx = type - 20000; // what to do for other types rather than steps int typindx = type - 20000; // what to do for other types rather than steps
font = format.PlantFormat.FormatData.StepDataList[typindx].Font; font = format.PlantFormat.FormatData.StepDataList[typindx].Font;
if (IsParagraph) font = AdjustForTextSubFollowsTextStyle(font);
break; break;
} }
} }
@ -1108,6 +1109,24 @@ namespace VEPROMS.CSLA.Library
} }
return font; return font;
} }
protected VE_Font AdjustForTextSubFollowsTextStyle(VE_Font font)
{
if (FormatStepData.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;
E_Style myStyle = (E_Style) font.Style;
myStyle ^= (myStyle & E_Style.Bold);
myStyle ^= (myStyle & E_Style.MmBold);
myStyle |= isBold ? E_Style.Bold : 0;
myStyle |= isMmBold ? E_Style.MmBold : 0;
if (myStyle != font.Style)
font = new VE_Font(font.Family, (int)font.Size, myStyle);
}
return font;
}
private string RemoveToken(string str, string token) private string RemoveToken(string str, string token)
{ {
// if this token is preceeded by another token and followed by a space // if this token is preceeded by another token and followed by a space
@ -1655,7 +1674,7 @@ namespace VEPROMS.CSLA.Library
{ {
if (IsStep) if (IsStep)
{ {
MyTab = new Tab(FormatStepData.TabData.Font); MyTab = new Tab(AdjustForTextSubFollowsTextStyle(FormatStepData.TabData.Font));
MyHeader = new MetaTag(FormatStepData.TabData.Font); MyHeader = new MetaTag(FormatStepData.TabData.Font);
MyFooter = new MetaTag(FormatStepData.TabData.Font); MyFooter = new MetaTag(FormatStepData.TabData.Font);
SetTabText(); SetTabText();
@ -1808,14 +1827,14 @@ namespace VEPROMS.CSLA.Library
StepData nextStepData = null; StepData nextStepData = null;
if (MyPrevious != null) if (MyPrevious != null)
{ {
int prevStepType = ((int)MyPrevious.MyContent.Type) % 10000; // int prevStepType = ((int)MyPrevious.MyContent.Type) % 10000;
StepData prevStepData = ActiveFormat.PlantFormat.FormatData.StepDataList[prevStepType]; StepData prevStepData = MyPrevious.FormatStepData; // ActiveFormat.PlantFormat.FormatData.StepDataList[prevStepType];
prevTbFormat = MyPrevious.IsInRNO ? prevStepData.TabData.RNOIdentPrint : prevStepData.TabData.IdentPrint; prevTbFormat = MyPrevious.IsInRNO ? prevStepData.TabData.RNOIdentPrint : prevStepData.TabData.IdentPrint;
} }
if (NextItem != null) if (NextItem != null)
{ {
int nextStepType = ((int)NextItem.MyContent.Type) % 10000; //int nextStepType = ((int)NextItem.MyContent.Type) % 10000;
nextStepData = ActiveFormat.PlantFormat.FormatData.StepDataList[nextStepType]; nextStepData = NextItem.FormatStepData; // ActiveFormat.PlantFormat.FormatData.StepDataList[nextStepType];
// tried to duplicate functionality from 16-bit code. // tried to duplicate functionality from 16-bit code.
nextTbFormat = NextItem.IsInRNO ? nextStepData.TabData.RNOIdentPrint : nextStepData.TabData.IdentPrint; nextTbFormat = NextItem.IsInRNO ? nextStepData.TabData.RNOIdentPrint : nextStepData.TabData.IdentPrint;
} }
@ -1914,6 +1933,31 @@ namespace VEPROMS.CSLA.Library
} }
} }
#endregion #endregion
#region ParentNoteOrCaution
private bool _ParentNoteOrCautionLoaded = false;
private ItemInfo _ParentNoteOrCaution;
public ItemInfo ParentNoteOrCaution
{
get
{
if (!_ParentNoteOrCautionLoaded)
{
ItemInfo parent = ActiveParent as ItemInfo;
if (parent != null)
{
if (parent.IsCautionPart || parent.IsNotePart)
_ParentNoteOrCaution = parent;
else
{
_ParentNoteOrCaution = parent.ParentNoteOrCaution;
}
}
_ParentNoteOrCautionLoaded = true;
}
return _ParentNoteOrCaution;
}
}
#endregion
#region Macro List #region Macro List
[NonSerialized] [NonSerialized]
protected List<Macro> _MyMacros; protected List<Macro> _MyMacros;
@ -1932,12 +1976,15 @@ namespace VEPROMS.CSLA.Library
} }
private void SetupMacros() private void SetupMacros()
{ {
if (FormatStepData == null) return;
// see if each macro should be printed based on its attributes and the item we're on. // see if each macro should be printed based on its attributes and the item we're on.
// Attributes to check are NotInRNO, i.e. only add this macro to the result list if // Attributes to check are NotInRNO, i.e. only add this macro to the result list if
// the item is not in the RNO column. Also, Groupings is used to only have the macro if // the item is not in the RNO column. Also, Groupings is used to only have the macro if
// there are N or more of the type in the grouping. // there are N or more of the type in the grouping.
List<Macro> tmp = new List<Macro>(); List<Macro> tmp = new List<Macro>();
foreach (Macro macro in ActiveFormat.PlantFormat.FormatData.StepDataList[FormatStepType].TabData.MacroList) StepData myStepData = (FormatStepData.TextSubFollowsTextStyle && ParentNoteOrCaution != null) ? ParentNoteOrCaution.FormatStepData : FormatStepData;
// foreach (Macro macro in ActiveFormat.PlantFormat.FormatData.StepDataList[FormatStepType].TabData.MacroList)
foreach (Macro macro in myStepData.TabData.MacroList)
{ {
bool addToList = true; bool addToList = true;
if (macro.NotInRNO && IsInRNO) addToList = false; if (macro.NotInRNO && IsInRNO) addToList = false;
@ -2764,7 +2811,7 @@ namespace VEPROMS.CSLA.Library
public override void SetupTags() public override void SetupTags()
{ {
_TagsSetup = true; _TagsSetup = true;
MyTab = new Tab(FormatStepData.TabData.Font); MyTab = new Tab(AdjustForTextSubFollowsTextStyle(FormatStepData.TabData.Font));
MyHeader = new MetaTag(FormatStepData.TabData.Font); MyHeader = new MetaTag(FormatStepData.TabData.Font);
MyFooter = new MetaTag(FormatStepData.TabData.Font); MyFooter = new MetaTag(FormatStepData.TabData.Font);
SetTabText(); SetTabText();