This commit is contained in:
Kathy Ruffing 2012-09-27 11:16:26 +00:00
parent 4b94a8669e
commit 77cfb0bed2

View File

@ -133,8 +133,12 @@ namespace Volian.Controls.Library
bool ROsShouldBeAdjusted = wordsShouldBeReplaced; // same logical value
if (epMode == E_EditPrintMode.Print && _MyItemInfo.IsStep)
{
// Add 3 spaces before if there is prefix so that wrapping in RTB accounts for vertical lines
// (the three spaces after the first "\par " command). Note that tried adding a single
// space at beginning and a single space at end, this wasn't enough, and when added two
// spaces at beginning and end, there was an extra line after hls text.
if (_MyItemInfo.FormatStepData.Prefix != null && _MyItemInfo.FormatStepData.Prefix != "")
text = ReplaceLinesWithUnicode(_MyItemInfo.FormatStepData.Prefix) + @"\par " + text + @"\par ";
text = ReplaceLinesWithUnicode(_MyItemInfo.FormatStepData.Prefix) + @"\par " + text + @"\par ";
if (_MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "")
text = text + ReplaceLinesWithUnicode(_MyItemInfo.FormatStepData.Suffix);
}
@ -156,6 +160,7 @@ namespace Volian.Controls.Library
text = text.Replace("\x253c", @"\u9532?"); // Plus
return text;
}
public DisplayText(string text, VE_Font vFont, bool colorLinks)
{
TextFont = vFont;
@ -400,7 +405,10 @@ namespace Volian.Controls.Library
string newvalue = g.ToString();
int indexLastSpace = newvalue.LastIndexOf(' ');
if (indexLastSpace >= 0)
retstr = beforeTran + newvalue.Substring(0, indexLastSpace) + @"\u160?" + newvalue.Substring(indexLastSpace + 1) + afterTran;
// Use a "\x1" as a token to replace later. Insert the unicode char, whose length is
// more than 1 character was throwing of the regexp Matches index, so that the resulting
// string may have been incorrect.
retstr = beforeTran + newvalue.Substring(0, indexLastSpace) + "\x1" + newvalue.Substring(indexLastSpace + 1) + afterTran;
else
if (beforeTran.EndsWith(" ") )
retstr = ReplaceLastSpaceWithHardSpace(beforeTran) + newvalue + afterTran;
@ -409,7 +417,7 @@ namespace Volian.Controls.Library
}
}
}
return retstr;
return retstr.Replace("\x1", @"\u160?");
}
private string ReplaceLastSpaceWithHardSpace(string str)
{
@ -424,7 +432,11 @@ namespace Volian.Controls.Library
// If the previous character is a comma or a space then don't add a Hard Space
if (ind > 1 && (str[ind - 2] == ',' || str[ind - 2] == ' ')) return str;
if (ind <= 0) return str;
return str.Substring(0,ind - 1) + @"\u160?" + str.Substring(ind);
// replace with a 'token' "\x1" instead of a hardspace unicode char. When using a hardspace unicode
// char the string length/contents was thrown off so that the calling method's processing was off
// in terms of regexp matches in string.
return str.Substring(0, ind - 1) + "\x1" + str.Substring(ind);
}
private bool StepTransition(int TransId)
{