Fixed logic for printing using the UnderlineAfterDashSpace format flag

This commit is contained in:
John Jenko 2015-08-07 14:31:50 +00:00
parent dfd6dd4f3a
commit 1c07d2d503

View File

@ -174,7 +174,7 @@ namespace Volian.Controls.Library
text = text.Replace(@"\u8209?", "-"); text = text.Replace(@"\u8209?", "-");
} }
_MyStaticItemInfo = _MyItemInfo; _MyStaticItemInfo = _MyItemInfo;
text = CreateRtf(colorLinks, text, tableShouldBeOutlined, wordsShouldBeReplaced, numbersShouldBeFormated, tableHasBorder, ROsShouldBeAdjusted, underlineAfterDashSpace); text = CreateRtf(colorLinks, text, tableShouldBeOutlined, wordsShouldBeReplaced, numbersShouldBeFormated, tableHasBorder, ROsShouldBeAdjusted, underlineAfterDashSpace, epMode);
_MyStaticItemInfo = null; _MyStaticItemInfo = null;
StartText = text; StartText = text;
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
@ -199,7 +199,7 @@ namespace Volian.Controls.Library
public DisplayText(string text, VE_Font vFont, bool colorLinks) public DisplayText(string text, VE_Font vFont, bool colorLinks)
{ {
TextFont = vFont; TextFont = vFont;
StartText = CreateRtf(colorLinks, text, false, false, false, false, false, false); StartText = CreateRtf(colorLinks, text, false, false, false, false, false, false, E_EditPrintMode.Edit);
} }
public DisplayText(ItemInfo itemInfo, string text, bool colorLinks) public DisplayText(ItemInfo itemInfo, string text, bool colorLinks)
{ {
@ -215,7 +215,7 @@ namespace Volian.Controls.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); 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)
@ -235,7 +235,7 @@ namespace Volian.Controls.Library
if (m.Index < idx && m.Index + m.Length > idx) return true; if (m.Index < idx && m.Index + m.Length > idx) return true;
return (false); return (false);
} }
private string CreateRtf(bool colorLinks, string text, bool tableShouldBeOutlined, bool wordsShouldBeReplaced, bool numbersShouldBeFormated, bool tableHasBorder, bool ROsShouldBeAdjusted, bool underlineAfterDashSpace) private string CreateRtf(bool colorLinks, string text, bool tableShouldBeOutlined, bool wordsShouldBeReplaced, bool numbersShouldBeFormated, bool tableHasBorder, bool ROsShouldBeAdjusted, bool underlineAfterDashSpace, E_EditPrintMode epMode)
{ {
int profileDepth = ProfileTimer.Push(">>>> CreateRtf"); int profileDepth = ProfileTimer.Push(">>>> CreateRtf");
// Adjust RO display // Adjust RO display
@ -337,7 +337,10 @@ namespace Volian.Controls.Library
} }
if (underlineAfterDashSpace) if (underlineAfterDashSpace)
{ {
MatchCollection mc = Regex.Matches(text, @"\\u8209\?\\f[0-9]+ "); // Bug fix: B2015-110 - currently used in Byron and Braidwood formats
// for the screen we need to look for the unicode dash
// for printing we need to look for the keyboard dash character
MatchCollection mc = Regex.Matches(text,((epMode == E_EditPrintMode.Edit)? @"\\u8209\?\\f[0-9]+ " : "- "));
if (mc.Count > 0) if (mc.Count > 0)
{ {
Match m = mc[0]; Match m = mc[0];