C2019-043 convert “->” to the right arrow symbol and “<-“ to the left arrow symbol in RO return values if the UseDashGreaterLessThenForArrowsInROValue format flag is set

This commit is contained in:
John Jenko 2019-11-07 15:56:38 +00:00
parent 5bac79bf8e
commit 8aad90ad87

View File

@ -967,9 +967,21 @@ namespace Volian.Controls.Library
// SelectionLength = 0; // SelectionLength = 0;
// //OnModeChange(this, new StepRTBModeChangeEventArgs(ViewRTB?E_ViewMode.View:E_ViewMode.Edit)); // //OnModeChange(this, new StepRTBModeChangeEventArgs(ViewRTB?E_ViewMode.View:E_ViewMode.Edit));
//} //}
public string InsertSymbolInRO(string val)
{
string retval = val;
// C2019-043 convert a "->" to the Right Arrow symbol and a "<-" to the Left Arrow Symbol
// note that at the dash character gets convert to a non-breaking hyphen "\u8209?"
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue)
{
retval = retval.Replace("\\u8209?>", GetAddSymbolTextForROs(@"\u8594?")); // Right Arrow
retval = retval.Replace("<\\u8209?", GetAddSymbolTextForROs(@"\u8592?")); // Left Arrow
}
return retval;
}
public void InsertRO(string value, string link) public void InsertRO(string value, string link)
{ {
AddRtfLink(value, link); AddRtfLink(InsertSymbolInRO(value), link);
} }
public void InsertTran(string value, string link) public void InsertTran(string value, string link)
{ {
@ -1318,6 +1330,10 @@ namespace Volian.Controls.Library
{ {
return (@"{\f1\fs" + this.Font.SizeInPoints * 2 + @" " + symtxt + @"}"); // B2016-281 fixed font selection when inserting a symbol character return (@"{\f1\fs" + this.Font.SizeInPoints * 2 + @" " + symtxt + @"}"); // B2016-281 fixed font selection when inserting a symbol character
} }
private string GetAddSymbolTextForROs(string symtxt)
{
return (@"\f1\fs" + this.Font.SizeInPoints * 2 + @" " + symtxt); //C2019-043 Don't need curly braces when used in RO return value
}
public void AddRtfLink(string linkUrl, string linkValue) public void AddRtfLink(string linkUrl, string linkValue)
{ {
if (CreateParams.ClassName == "RICHEDIT50W") if (CreateParams.ClassName == "RICHEDIT50W")
@ -1361,7 +1377,7 @@ namespace Volian.Controls.Library
linkValue = linkValue.Replace("\\u916?", "\\f1\\u916?\\f0 "); linkValue = linkValue.Replace("\\u916?", "\\f1\\u916?\\f0 ");
linkValue = linkValue.Replace(@"{", @"\{"); linkValue = linkValue.Replace(@"{", @"\{");
linkValue = linkValue.Replace(@"}", @"\}"); linkValue = linkValue.Replace(@"}", @"\}");
SelectedRtf = @"{\rtf1\ansi"+FontTable+@"{\colortbl ;\red255\green0\blue0;}\v"+FontSize+@" <START]\v0\cf1 " + linkValue + @"\cf0\v " + linkUrl + @"[END>\v0 }"; SelectedRtf = @"{\rtf1\ansi" + FontTable + @"{\colortbl ;\red255\green0\blue0;}\v" + FontSize + @" <START]\v0\cf1 " + linkValue + @"\cf0\v " + linkUrl + @"[END>\v0 }";
this.SelectionLength = 0; this.SelectionLength = 0;
this.SelectionStart = position; this.SelectionStart = position;
FindAllLinks(); FindAllLinks();