F2021-053: BNPP Alarm – need ability to have super/sub scripts in the text of Alarm Tables (ROs)
This commit is contained in:
parent
6a10408a94
commit
2b25136036
@ -302,7 +302,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Plackeep = 0x20000, // Do replace in PlaceKeepers
|
Plackeep = 0x20000, // Do replace in PlaceKeepers
|
||||||
InSecTitle = 0x40000,
|
InSecTitle = 0x40000,
|
||||||
BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
|
BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
|
||||||
BeforeList = 0x100000 // C2021-045 Only if the text ends with a colon ":"
|
BeforeList = 0x100000, // C2021-045 Only if the text ends with a colon ":"
|
||||||
|
PageList = 0x200000 // F2021-053 Do replace words for PageList items that are ROs
|
||||||
}
|
}
|
||||||
[Serializable]
|
[Serializable]
|
||||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||||
|
@ -258,6 +258,28 @@ namespace VEPROMS.CSLA.Library
|
|||||||
TextFont = vFont;
|
TextFont = vFont;
|
||||||
StartText = CreateRtf(colorLinks, text, false, false, false, false, false, false, E_EditPrintMode.Edit);
|
StartText = CreateRtf(colorLinks, text, false, false, false, false, false, false, E_EditPrintMode.Edit);
|
||||||
}
|
}
|
||||||
|
// F2021-053: BNPP Alarm - need ability to have super/sub scripts in the text of Alarm Tables (ROs). Added a
|
||||||
|
// constructor that allows for passing in a flag to set whether replace words should be done on page list. If doing
|
||||||
|
// on page list, the object has a section not a step associated with it.
|
||||||
|
private bool _DoReplWordInPageList = false;
|
||||||
|
public DisplayText(ItemInfo itemInfo, string text, bool colorLinks, bool dorepl)
|
||||||
|
{
|
||||||
|
_DoReplWordInPageList = dorepl;
|
||||||
|
_FieldToEdit = E_FieldToEdit.Text;
|
||||||
|
_MyItemInfo = itemInfo;
|
||||||
|
OriginalText = text;
|
||||||
|
TextFont = itemInfo.GetItemFont();
|
||||||
|
_MyFormat = itemInfo.ActiveFormat;
|
||||||
|
|
||||||
|
bool wordsShouldBeReplaced = true;
|
||||||
|
bool numbersShouldBeFormated = !_MyFormat.PlantFormat.FormatData.SectData.StepSectionData.FortranFormatNumbers;
|
||||||
|
int typ = ((int)itemInfo.MyContent.Type) % 10000;
|
||||||
|
bool ROsShouldBeAdjusted = wordsShouldBeReplaced; // same logical value
|
||||||
|
bool underlineAfterDashSpace = (itemInfo.FormatStepData == null) ? false : itemInfo.FormatStepData.UnderlineAfterDashSpace;
|
||||||
|
|
||||||
|
text = CreateRtf(colorLinks, text, false, wordsShouldBeReplaced, numbersShouldBeFormated, false, ROsShouldBeAdjusted, underlineAfterDashSpace, E_EditPrintMode.Edit);
|
||||||
|
StartText = text;
|
||||||
|
}
|
||||||
public DisplayText(ItemInfo itemInfo, string text, bool colorLinks)
|
public DisplayText(ItemInfo itemInfo, string text, bool colorLinks)
|
||||||
{
|
{
|
||||||
_FieldToEdit = E_FieldToEdit.Text;
|
_FieldToEdit = E_FieldToEdit.Text;
|
||||||
@ -272,7 +294,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
bool ROsShouldBeAdjusted = wordsShouldBeReplaced; // same logical value
|
bool ROsShouldBeAdjusted = wordsShouldBeReplaced; // same logical value
|
||||||
bool underlineAfterDashSpace = (itemInfo.FormatStepData == null) ? false : itemInfo.FormatStepData.UnderlineAfterDashSpace;
|
bool underlineAfterDashSpace = (itemInfo.FormatStepData == null) ? false : itemInfo.FormatStepData.UnderlineAfterDashSpace;
|
||||||
|
|
||||||
text = CreateRtf(colorLinks, text, false, wordsShouldBeReplaced, numbersShouldBeFormated, false, ROsShouldBeAdjusted, underlineAfterDashSpace,E_EditPrintMode.Edit);
|
text = CreateRtf(colorLinks, text, false, wordsShouldBeReplaced, numbersShouldBeFormated, false, ROsShouldBeAdjusted, underlineAfterDashSpace, E_EditPrintMode.Edit);
|
||||||
StartText = text;
|
StartText = text;
|
||||||
// Shearon Harris Tables are Bold
|
// Shearon Harris Tables are Bold
|
||||||
if (itemInfo.IsTable && (TextFont.Style & E_Style.Bold) == E_Style.Bold)
|
if (itemInfo.IsTable && (TextFont.Style & E_Style.Bold) == E_Style.Bold)
|
||||||
@ -2036,8 +2058,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private string DoReplaceWords2(string Text)
|
private string DoReplaceWords2(string Text)
|
||||||
{
|
{
|
||||||
if(!ProcessReplaceWords) return Text;
|
if(!ProcessReplaceWords) return Text;
|
||||||
if (_MyItemInfo.MyContent.Type < 20000) return Text; // for now only replace in steps.
|
// F2021-053: BNPP Alarm - need ability to have super/sub scripts in the text of Alarm Tables (ROs).
|
||||||
FoundMatches myMatches = new FoundMatches(Text,_MyItemInfo.FormatStepData.Font,_MyItemInfo);
|
// if doing replace words for Page List items, the current item is not a step, use _DoReplWordInPageList flags this
|
||||||
|
if (_MyItemInfo.MyContent.Type < 20000 && !_DoReplWordInPageList) return Text; // for now only replace in steps.
|
||||||
|
VE_Font vf = _MyItemInfo.MyContent.Type >= 20000 ? _MyItemInfo.FormatStepData.Font : _MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font;
|
||||||
|
FoundMatches myMatches = new FoundMatches(Text,vf,_MyItemInfo);
|
||||||
// Exclude Link Text from Replace Word process
|
// Exclude Link Text from Replace Word process
|
||||||
myMatches.AddLink(regFindLink, _MyFormat.PlantFormat.FormatData.SectData.ReplaceWordsInROs, _MyItemInfo.MyProcedure.MyDocVersion);
|
myMatches.AddLink(regFindLink, _MyFormat.PlantFormat.FormatData.SectData.ReplaceWordsInROs, _MyItemInfo.MyProcedure.MyDocVersion);
|
||||||
FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.UCFandOrigReplaceStrData;
|
FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.UCFandOrigReplaceStrData;
|
||||||
@ -2066,7 +2091,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// C2021-045 if the BeforeList ReplaceWords flag is set, only do the replace word if the text ends with a colon
|
// C2021-045 if the BeforeList ReplaceWords flag is set, only do the replace word if the text ends with a colon
|
||||||
if (replaceit && onlyDoList && !Text.EndsWith(":"))
|
if (replaceit && onlyDoList && !Text.EndsWith(":"))
|
||||||
replaceit = false; // text does not end with a colon so don't replace this word
|
replaceit = false; // text does not end with a colon so don't replace this word
|
||||||
|
if (!replaceit && _DoReplWordInPageList) replaceit = true; // F2021-053: Do replace words in page list
|
||||||
if (replaceit)
|
if (replaceit)
|
||||||
{
|
{
|
||||||
if (!dicReplaceRegex.ContainsKey(rs))
|
if (!dicReplaceRegex.ContainsKey(rs))
|
||||||
|
@ -228,7 +228,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Plackeep = 0x20000, // Do replace in PlaceKeepers
|
Plackeep = 0x20000, // Do replace in PlaceKeepers
|
||||||
InSecTitle = 0x40000,
|
InSecTitle = 0x40000,
|
||||||
BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
|
BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
|
||||||
BeforeList = 0x100000 // C2021-045 Only if the text ends with a colon ":"
|
BeforeList = 0x100000, // C2021-045 Only if the text ends with a colon ":"
|
||||||
|
PageList = 0x200000 // F2021-053: Do replace words in page list
|
||||||
}
|
}
|
||||||
public enum E_ArrowKeys : uint
|
public enum E_ArrowKeys : uint
|
||||||
{
|
{
|
||||||
|
@ -133,6 +133,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return LazyLoad<E_Justify>(ref _Justify, "@Justify");
|
return LazyLoad<E_Justify>(ref _Justify, "@Justify");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private LazyLoad<bool> _RepWords; // F2021-053: Do replace words in page list
|
||||||
|
public bool RepWords
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return LazyLoad(ref _RepWords, "@RepWords");
|
||||||
|
}
|
||||||
|
}
|
||||||
private LazyLoad<int?> _MaxWidth;
|
private LazyLoad<int?> _MaxWidth;
|
||||||
public int? MaxWidth
|
public int? MaxWidth
|
||||||
{
|
{
|
||||||
|
@ -1393,6 +1393,14 @@ i = 0;
|
|||||||
// parts[1] - Which of the multiple return value from the RO to return
|
// parts[1] - Which of the multiple return value from the RO to return
|
||||||
// parts[2] - the value to use if not found in ROs - usually defined in a PSI field for that Alarm procedure
|
// parts[2] - the value to use if not found in ROs - usually defined in a PSI field for that Alarm procedure
|
||||||
string ROLookupVal = ROLookup(parts[0], parts[1], parts[2]);
|
string ROLookupVal = ROLookup(parts[0], parts[1], parts[2]);
|
||||||
|
|
||||||
|
// F2021-053: Do replace words for Page List items. This uses a DisplayText constructor that flags this case
|
||||||
|
// and gets the resulting replaced words
|
||||||
|
if (pageItem.RepWords)
|
||||||
|
{
|
||||||
|
DisplayText dt1 = new DisplayText(MyPromsPrinter.MyItem, ROLookupVal, false, true);
|
||||||
|
ROLookupVal = dt1.StartText;
|
||||||
|
}
|
||||||
pltok = pltok.Substring(0, idxstart) + ROLookupVal + ((idxstart + idxend < pltok.Length) ? pltok.Substring(idxstart + idxend + 1) : "");
|
pltok = pltok.Substring(0, idxstart) + ROLookupVal + ((idxstart + idxend < pltok.Length) ? pltok.Substring(idxstart + idxend + 1) : "");
|
||||||
}
|
}
|
||||||
MatchCollection matches = regexFindToken.Matches(pltok);//(pageItem.Token);
|
MatchCollection matches = regexFindToken.Matches(pltok);//(pageItem.Token);
|
||||||
@ -2629,6 +2637,10 @@ i = 0;
|
|||||||
private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, SectionInfo mySection)
|
private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, SectionInfo mySection)
|
||||||
{
|
{
|
||||||
SvgText svgText = new SvgText();
|
SvgText svgText = new SvgText();
|
||||||
|
// F2021-053: Do replace words for Page List items. Send format items down to svgtext.
|
||||||
|
SvgText.CompressSuper = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper;
|
||||||
|
SvgText.CompressSub = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub;
|
||||||
|
SvgText.CompressPropSubSup = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressPropSubSup;
|
||||||
svgText.Text = text;
|
svgText.Text = text;
|
||||||
VEPROMS.CSLA.Library.E_Justify justify = pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft;
|
VEPROMS.CSLA.Library.E_Justify justify = pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft;
|
||||||
float colAdj16bit = 0;
|
float colAdj16bit = 0;
|
||||||
@ -2752,6 +2764,10 @@ i = 0;
|
|||||||
int dotsPerChar = (int)(2400 / (MySection.MyDocStyle.Layout.PageWidth / 6));
|
int dotsPerChar = (int)(2400 / (MySection.MyDocStyle.Layout.PageWidth / 6));
|
||||||
lcol = (lcol * 25) / dotsPerChar;
|
lcol = (lcol * 25) / dotsPerChar;
|
||||||
}
|
}
|
||||||
|
// F2021-053: Do replace words for Page List items. Send format items down to svgtext.
|
||||||
|
SvgText.CompressSuper = MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper;
|
||||||
|
SvgText.CompressSub = MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub;
|
||||||
|
SvgText.CompressPropSubSup = MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressPropSubSup;
|
||||||
svgText.Font = font.WindowsFont;
|
svgText.Font = font.WindowsFont;
|
||||||
svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT);
|
svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT);
|
||||||
svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT);
|
svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT);
|
||||||
|
@ -681,7 +681,10 @@ namespace Volian.Svg.Library
|
|||||||
ct.Go();
|
ct.Go();
|
||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
}
|
}
|
||||||
|
// F2021-053: Do replace words for Page List items. Format flags to use for compressing and locating sub/super scripts
|
||||||
|
public static bool CompressSuper = false;
|
||||||
|
public static bool CompressSub = false;
|
||||||
|
public static bool CompressPropSubSup = false;
|
||||||
private Phrase BuildPhrase(string text, float fontSize, int fontStyle, iTextSharp.text.Font font)
|
private Phrase BuildPhrase(string text, float fontSize, int fontStyle, iTextSharp.text.Font font)
|
||||||
{
|
{
|
||||||
//if (text == "Caution")
|
//if (text == "Caution")
|
||||||
@ -747,8 +750,23 @@ namespace Volian.Svg.Library
|
|||||||
else if (m.Value.Contains(@"\ul"))
|
else if (m.Value.Contains(@"\ul"))
|
||||||
fontUnderline = true;
|
fontUnderline = true;
|
||||||
if (m.Value.Contains(@"\up0") || m.Value.Contains(@"\dn0")) fontTextRise = 0;
|
if (m.Value.Contains(@"\up0") || m.Value.Contains(@"\dn0")) fontTextRise = 0;
|
||||||
else if (m.Value.Contains(@"\up")) fontTextRise = .25F;
|
else if (m.Value.Contains(@"\up"))
|
||||||
else if (m.Value.Contains(@"\dn")) fontTextRise = -.25F;
|
{
|
||||||
|
fontTextRise = .25F;
|
||||||
|
// F2021-053: Do replace words for Page List items. size and locate superscript
|
||||||
|
if (CompressSuper || CompressPropSubSup)
|
||||||
|
{
|
||||||
|
font = FontFactory.GetFont(font.Familyname, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize * .75f, fontStyle, new Color(FillColor)); ;
|
||||||
|
fontTextRise = .33F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m.Value.Contains(@"\dn"))
|
||||||
|
{
|
||||||
|
fontTextRise = -.25F;
|
||||||
|
// F2021-053: Do replace words for Page List items. size subscript
|
||||||
|
if (CompressSub || CompressPropSubSup)
|
||||||
|
font = FontFactory.GetFont(font.Familyname, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize * .75f, fontStyle, new Color(FillColor)); ;
|
||||||
|
}
|
||||||
if (m.Value.Contains(@"\b0"))
|
if (m.Value.Contains(@"\b0"))
|
||||||
{
|
{
|
||||||
fontStyle ^= iTextSharp.text.Font.BOLD;
|
fontStyle ^= iTextSharp.text.Font.BOLD;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user