BGE: Apply bold/underline next word for special cases
This commit is contained in:
parent
800adeb883
commit
091487cf7a
@ -51,6 +51,86 @@ namespace DataLoader
|
|||||||
if (tok == -1 && Textm[Textm.Length - 1] == '\x5')
|
if (tok == -1 && Textm[Textm.Length - 1] == '\x5')
|
||||||
tok = Textm.Length - 1;
|
tok = Textm.Length - 1;
|
||||||
|
|
||||||
|
// if this is bge, handle some special cases for bold/underline next that were not
|
||||||
|
// getting processed from regular expression, as defined in comments for each case below:
|
||||||
|
if (fmt.PlantFormat.FormatData.PrintData.SpecialCaseCalvert)
|
||||||
|
{
|
||||||
|
// get step type, and check its format for bold. BGE had data that was high5 (bolded step)
|
||||||
|
// with the bold of the next word character, but it was redundant
|
||||||
|
int stptype = Convert.ToInt32(StepType) + 1;
|
||||||
|
bool isbold = (stptype == 41); // This is hardcoded for BGE only
|
||||||
|
if (isbold && Textm.Contains("\x13")) Textm = Textm.Replace("\x13", "");
|
||||||
|
|
||||||
|
// BGE was not migrating a few styles on next word correctly because of the other
|
||||||
|
// characters after the hex, i.e. '[', '(', etc (see comments on specific cases).
|
||||||
|
// The regular expression that handled replacing the 'style next word' hex flag was
|
||||||
|
// not working with those. Handle those special cases here.
|
||||||
|
|
||||||
|
int indxH = -1;
|
||||||
|
int indxHE = -1;
|
||||||
|
if (Textm.Contains("\x13"))
|
||||||
|
{
|
||||||
|
if (Textm.Contains("\x13[")) // bold before '['
|
||||||
|
{
|
||||||
|
indxH = Textm.IndexOf("\x13[");
|
||||||
|
indxHE = Textm.IndexOf("]", indxH);
|
||||||
|
Textm = Textm.Insert(indxHE+1, @"\b0 ");
|
||||||
|
Textm = Textm.Replace("\x13[", @"\b [");
|
||||||
|
}
|
||||||
|
if (Textm.Contains("\x13(")) // bold before '('
|
||||||
|
{
|
||||||
|
indxH = Textm.IndexOf("\x13(");
|
||||||
|
indxHE = Textm.IndexOf(")", indxH);
|
||||||
|
Textm = Textm.Insert(indxHE+1, @"\b0 ");
|
||||||
|
Textm = Textm.Replace("\x13(", @"\b (");
|
||||||
|
}
|
||||||
|
if (Textm.Contains("\x13{")) // bold before '{'
|
||||||
|
{
|
||||||
|
indxH = Textm.IndexOf("\x13{");
|
||||||
|
indxHE = Textm.IndexOf(" ", indxH);
|
||||||
|
Textm = Textm.Insert(indxHE + 1, @"\b0 ");
|
||||||
|
Textm = Textm.Replace("\x13{", @"\b {");
|
||||||
|
}
|
||||||
|
if (Textm.Contains("\x13}")) // bold before '}'
|
||||||
|
{
|
||||||
|
indxH = Textm.IndexOf("\x13}");
|
||||||
|
indxHE = Textm.IndexOf(" ", indxH);
|
||||||
|
if (indxHE == -1) // add the bold off to end of string (no space needed at end)
|
||||||
|
Textm = Textm + @"\b0";
|
||||||
|
else
|
||||||
|
Textm = Textm.Insert(indxHE + 1, @"\b0 ");
|
||||||
|
Textm = Textm.Replace("\x13}", @"\b }");
|
||||||
|
}
|
||||||
|
if (Textm.Contains("\x13\xa0")) // bold before hardspace
|
||||||
|
{
|
||||||
|
indxH = Textm.IndexOf("\x13\xa0");
|
||||||
|
indxHE = Textm.IndexOf(" ", indxH);
|
||||||
|
if (indxHE == -1) // add the bold off to end of string (no space needed at end)
|
||||||
|
Textm = Textm + @"\b0";
|
||||||
|
else
|
||||||
|
Textm = Textm.Insert(indxHE + 1, @"\b0 ");
|
||||||
|
Textm = Textm.Replace("\x13\xa0", "\\b \xa0");
|
||||||
|
}
|
||||||
|
if (Textm.Contains("\x13 ")) // bold before a space, switch bold & space
|
||||||
|
Textm = Textm.Replace("\x13 ", " \x13");
|
||||||
|
}
|
||||||
|
|
||||||
|
// BGE also had special cases for underline next word \x17
|
||||||
|
if (Textm.Contains("\x17\\b")) // before bold on
|
||||||
|
{
|
||||||
|
indxH = Textm.IndexOf("\x17\\b");
|
||||||
|
indxHE = Textm.IndexOf(@"\b0", indxH);
|
||||||
|
Textm = Textm.Insert(indxHE+1, @"\ulnone ");
|
||||||
|
Textm = Textm.Replace("\x17\\b", @"\ul\b");
|
||||||
|
}
|
||||||
|
if (Textm.Contains("\x17\x13")) // before bold next word token
|
||||||
|
{
|
||||||
|
indxH = Textm.IndexOf("\x17\x13");
|
||||||
|
indxHE = Textm.IndexOf(" ", indxH);
|
||||||
|
Textm = Textm.Insert(indxHE + 1, @"\ulnone ");
|
||||||
|
Textm = Textm.Replace("\x17\x13", "\\ul\x13");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (tok < 0)
|
if (tok < 0)
|
||||||
stptext = TextConvert.ConvertText(Textm, conv_caret);
|
stptext = TextConvert.ConvertText(Textm, conv_caret);
|
||||||
else
|
else
|
||||||
@ -301,7 +381,7 @@ namespace DataLoader
|
|||||||
// ChgBarMessageFromEdit flag, the data after the Multiple change id token was not used in
|
// ChgBarMessageFromEdit flag, the data after the Multiple change id token was not used in
|
||||||
// 16bit, at least anywhere that could be found when running the program through the debugger.
|
// 16bit, at least anywhere that could be found when running the program through the debugger.
|
||||||
if (fmt.PlantFormat.FormatData.ProcData.ChangeBarData.ChgBarMessageFromEdit &&
|
if (fmt.PlantFormat.FormatData.ProcData.ChangeBarData.ChgBarMessageFromEdit &&
|
||||||
fmt.PlantFormat.FormatData.ProcData.ChangeBarData.MultipleChangeIds)
|
fmt.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds)
|
||||||
{
|
{
|
||||||
if ((nxttok = tkstring.IndexOf("\x2")) > -1) // Multiple Change Ids
|
if ((nxttok = tkstring.IndexOf("\x2")) > -1) // Multiple Change Ids
|
||||||
{
|
{
|
||||||
@ -309,7 +389,7 @@ namespace DataLoader
|
|||||||
if (tmpchgid.Length > 0)
|
if (tmpchgid.Length > 0)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("Multiple Change ID: {0}", tkstring.Substring(nxttok + 1));
|
//Console.WriteLine("Multiple Change ID: {0}", tkstring.Substring(nxttok + 1));
|
||||||
ci.AddItem("Step", "MultipleChangeID", tkstring.Substring(nxttok + 1));
|
ci.AddItem("Step", "ChangeID", tkstring.Substring(nxttok + 1));
|
||||||
recdirty = true;
|
recdirty = true;
|
||||||
//recdirty |= AddContentDetail(content, STP_MULT_CHGID, tkstring.Substring(nxttok + 1));
|
//recdirty |= AddContentDetail(content, STP_MULT_CHGID, tkstring.Substring(nxttok + 1));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user