B2023-037: Handle <=, >=, +-, -> and <- symbols in ROs.

This commit is contained in:
2023-03-30 12:59:06 +00:00
parent 3e8556bac9
commit da05241df7
8 changed files with 81 additions and 30 deletions

View File

@@ -905,7 +905,7 @@ namespace Volian.Controls.Library
string linktxt = string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", padroid, MyROFST.RODbID);
// Resolve symbols and scientific notation in the RO return value
string valtxt = MyROFSTLookup.GetTranslatedRoValue(padroid, MyRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, MyRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
string valtxt = MyROFSTLookup.GetTranslatedRoValue(padroid, MyRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, MyRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false);
MyRTB.OnRoInsert(this, new StepRTBRoEventArgs(valtxt, selectedChld.value, linktxt, padroid, MyROFST.RODbID));
}

View File

@@ -972,29 +972,31 @@ namespace Volian.Controls.Library
// SelectionLength = 0;
// //OnModeChange(this, new StepRTBModeChangeEventArgs(ViewRTB?E_ViewMode.View:E_ViewMode.Edit));
//}
public string InsertSymbolInRO(string val)
{
string retval = val;
//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
}
// C2022-021 convert a "<=" to a less than or equal symbol, a ">=" to a greather than or equal symbol and +- to a
// plus/minus symbol in ROs
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertGTELTEPMinROValue)
{
retval = retval.Replace("<=", GetAddSymbolTextForROs(@"\u8804?")); // Less than or Equal
retval = retval.Replace(">=", GetAddSymbolTextForROs(@"\u8805?")); // Greater than or Equal
retval = retval.Replace("+\\u8209?", @"\'b1"); // plus/minus - note - is stored as \u8209 and plus/minus is < 256, i.e. handled differently
}
return retval;
}
//if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue)
//{
// retval = retval.Replace("\\u8209?>", GetAddSymbolTextForROs(@"\u8594?")); // Right Arrow
// retval = retval.Replace("<\\u8209?", GetAddSymbolTextForROs(@"\u8592?")); // Left Arrow
//}
//// C2022-021 convert a "<=" to a less than or equal symbol, a ">=" to a greather than or equal symbol and +- to a
//// plus/minus symbol in ROs
//if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertGTELTEPMinROValue)
//{
// retval = retval.Replace("<=", GetAddSymbolTextForROs(@"\u8804?")); // Less than or Equal
// retval = retval.Replace(">=", GetAddSymbolTextForROs(@"\u8805?")); // Greater than or Equal
// retval = retval.Replace("+\\u8209?", @"\'b1"); // plus/minus - note - is stored as \u8209 and plus/minus is < 256, i.e. handled differently
//}
// return retval;
//}
public void InsertRO(string value, string link)
{
AddRtfLink(InsertSymbolInRO(value), link);
// B2023-037: Remove code that saves the unicode characters for <=, >=, +-, <- and -> into the link text. The characters
// now get resolved when used. InsertSymbolInRo was commented out also
AddRtfLink(value, link);
}
public void InsertTran(string value, string link)
{

View File

@@ -562,7 +562,8 @@ namespace Volian.Controls.Library
string padroid = (myroid.Length <= 12) ? myroid + "0000" : myroid;
string linktxt = string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", padroid, MyLookup.MyDocVersionInfo.DocVersionAssociations[0].MyROFst.MyRODb.RODbID);
// Resolve symbols and scientific notation in the RO return value
string valtxt = MyLookup.GetTranslatedRoValue(padroid, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues); //ConvertSymbolsAndStuff(selectedChld.value);
string valtxt = MyLookup.GetTranslatedRoValue(padroid, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues,
false); //ConvertSymbolsAndStuff(selectedChld.value);
MyStepRTB.OnRoInsert(this, new StepRTBRoEventArgs(valtxt, myvalue, linktxt, padroid, MyLookup.MyDocVersionInfo.DocVersionAssociations[0].MyROFst.MyRODb.RODbID));
}
private void SaveROWithAnnotation_Click(object sender, EventArgs e)
@@ -579,7 +580,7 @@ namespace Volian.Controls.Library
string padroid = (myroid.Length <= 12) ? myroid + "0000" : myroid;
string linktxt = string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", padroid, MyLookup.MyDocVersionInfo.DocVersionAssociations[0].MyROFst.MyRODb.RODbID);
// Resolve symbols and scientific notation in the RO return value
string valtxt = MyLookup.GetTranslatedRoValue(padroid, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues); //ConvertSymbolsAndStuff(selectedChld.value);
string valtxt = MyLookup.GetTranslatedRoValue(padroid, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false); //ConvertSymbolsAndStuff(selectedChld.value);
MyStepRTB.OnRoInsert(this, new StepRTBRoEventArgs(valtxt, myvalue, linktxt, padroid, MyLookup.MyDocVersionInfo.DocVersionAssociations[0].MyROFst.MyRODb.RODbID));
}
private void NoROFound_Click(object sender, EventArgs e)