Compare commits
No commits in common. "6bf116cbef11b7a0bfe24a9f81ce4fb4919a69a8" and "b489452bd1c39e7b59a7381d4fa2fb31445de826" have entirely different histories.
6bf116cbef
...
b489452bd1
@ -17,10 +17,10 @@ namespace Volian.Base.Library
|
|||||||
return new List<string>(text.Split(mySplit, StringSplitOptions.None));
|
return new List<string>(text.Split(mySplit, StringSplitOptions.None));
|
||||||
|
|
||||||
}
|
}
|
||||||
int width = 0; // width of text, non-rtf
|
int width = 0; // width of text, non-rtf
|
||||||
int start = 0; // start of line (index into string 'text'), includes rtf
|
int start = 0; // start of line (index into string 'text'), includes rtf
|
||||||
int lastspace = 0; // location of lastspace (index into string 'text'), includes rtf
|
int lastspace = 0; // location of lastspace (index into string 'text'), includes rtf
|
||||||
int startNonRtf = 0; // start of line, non-rtf (used for determining starting position to determine width if there was a break)
|
int startNonRtf = 0; // start of line, non-rtf (used for determining starting position to determine width if there was a break)
|
||||||
string rtfprefix = "";
|
string rtfprefix = "";
|
||||||
string nextprefix = "";
|
string nextprefix = "";
|
||||||
for (int indx = 0; indx < text.Length; indx++)
|
for (int indx = 0; indx < text.Length; indx++)
|
||||||
@ -125,9 +125,32 @@ namespace Volian.Base.Library
|
|||||||
// converting the unicode \u8482? to \'99, but once this is done, PROMS StepRTB (edit windows) does not show it
|
// converting the unicode \u8482? to \'99, but once this is done, PROMS StepRTB (edit windows) does not show it
|
||||||
rtnStr = rtnStr.Replace(@"\'99", @"\u8482?");
|
rtnStr = rtnStr.Replace(@"\'99", @"\u8482?");
|
||||||
// convert \'ae to \u174? this is for the registered symbol. RTF converts the unicode character to \'ae
|
// convert \'ae to \u174? this is for the registered symbol. RTF converts the unicode character to \'ae
|
||||||
rtnStr = rtnStr.Replace(@"\'ae", @"\u174?");
|
rtnStr = rtnStr.Replace(@"\'ae",@"\u174?");
|
||||||
// convert \'a9 to \u169? this is for the copyright symbol. RTF converts the unicode character to \'a9
|
// convert \'a9 to \u169? this is for the copyright symbol. RTF converts the unicode character to \'a9
|
||||||
rtnStr = rtnStr.Replace(@"\'a9", @"\u169?");
|
rtnStr = rtnStr.Replace(@"\'a9",@"\u169?");
|
||||||
|
// B2021-039: paste of the greek symbols was not working correctly, RTF was converting unicode, similar to above
|
||||||
|
// B2022-052: Division symbol converted to an x, caused by fix B2021-039. The code below was translating the division
|
||||||
|
// symbol but it should only be translated if the character's font is Greek or Baltic. Unfortunately this is not
|
||||||
|
// a complete solution since it converts characters it shouldn't, for example, using the following steps: all
|
||||||
|
// of Proms symbols are entered into a step; a ctrl-a/ctrl-c is used to copy these and then ctrl-v to paste
|
||||||
|
// into another new step. The paste (from the underlying richtextbox) causes some characters to be in plain
|
||||||
|
// arial font, and others to be in arial with Greek flag. Some character codes exist in each font, for example f7.
|
||||||
|
// The code below does not look into what font is used, just converts the character. Since any kind of font
|
||||||
|
// can occur during paste, if from an external program, a message will be given stating that a symbol may be incorrect
|
||||||
|
// because an unsupported font was pasted. It was felt that this was sufficient based on estimate of fix versus chance of
|
||||||
|
// occurrence. Note that the message was moved into StepRTB since this code is called by non-UI code (5/26/22)
|
||||||
|
if (str.ToUpper().Contains("GREEK") || str.ToUpper().Contains("BALTIC"))
|
||||||
|
{
|
||||||
|
//System.Windows.Forms.MessageBox.Show("Pasted text may use an unsupported font so some characters may not paste correctly and may require delete/reenter of character from within Proms.",
|
||||||
|
// "Paste Font Issue", System.Windows.Forms.MessageBoxButtons.OK);
|
||||||
|
for (int i = 0; i < 26; i++)
|
||||||
|
{
|
||||||
|
rtnStr = rtnStr.Replace(string.Format("\\'{0:x2}", 0xc0 + i) // upper case Greek
|
||||||
|
, string.Format("\\u{0}?", 912 + i));
|
||||||
|
rtnStr = rtnStr.Replace(string.Format("\\'{0:x2}", 0xe0 + i) // lower case Greek
|
||||||
|
, string.Format("\\u{0}?", 944 + i));
|
||||||
|
}
|
||||||
|
}
|
||||||
return rtnStr;
|
return rtnStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ using System.Text.RegularExpressions;
|
|||||||
using VEPROMS.CSLA.Library;
|
using VEPROMS.CSLA.Library;
|
||||||
using Volian.Base.Library;
|
using Volian.Base.Library;
|
||||||
using JR.Utils.GUI.Forms;
|
using JR.Utils.GUI.Forms;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Volian.Controls.Library
|
namespace Volian.Controls.Library
|
||||||
{
|
{
|
||||||
@ -2856,10 +2855,7 @@ namespace Volian.Controls.Library
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CSM B2023-095/U2022-004 When Copy/Pasting Symbols, some of the symbols paste in an incorrect font
|
public string GetPasteText(bool PasteNoReturnsSetting, IDataObject myDO)
|
||||||
// Changed this to put in the unicode code for any symbols outside the normal ascii range
|
|
||||||
// if supplied convertunicode flag is true
|
|
||||||
public string GetPasteText(bool PasteNoReturnsSetting, IDataObject myDO, bool convertunicode = false)
|
|
||||||
{
|
{
|
||||||
// B2021-0039: symbols not pasting correctly from ctrl-v:
|
// B2021-0039: symbols not pasting correctly from ctrl-v:
|
||||||
// get base list of valid symbols, use base format if MyItemInfo is null. Use symbols from
|
// get base list of valid symbols, use base format if MyItemInfo is null. Use symbols from
|
||||||
@ -2875,31 +2871,40 @@ namespace Volian.Controls.Library
|
|||||||
ptext = ptext.TrimEnd("\r\n\t ".ToCharArray());
|
ptext = ptext.TrimEnd("\r\n\t ".ToCharArray());
|
||||||
if (PasteNoReturnsSetting) ptext = ptext.Replace("\r\n", " ");
|
if (PasteNoReturnsSetting) ptext = ptext.Replace("\r\n", " ");
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
bool didCharReplace = false;
|
||||||
bool hasBadChar = false;
|
bool hasBadChar = false;
|
||||||
foreach (char c in ptext)
|
for (int i = 0; i < ptext.Length; i++)
|
||||||
{
|
{
|
||||||
if ((c > 0x7e))
|
didCharReplace = false;
|
||||||
|
string sym = string.Format(@"{0}", Convert.ToInt32(ptext[i]));
|
||||||
|
if ((ptext[i] > 0x7e))
|
||||||
{
|
{
|
||||||
// is this an allowable symbol/character:
|
// is this an allowable symbol/character:
|
||||||
if (allowableSymbols.Any(x => x == $@"{(short)c}"))
|
for (int j = 0; j < sl.Count; j++)
|
||||||
{
|
{
|
||||||
if (convertunicode)
|
if (sym == allowableSymbols[j])
|
||||||
sb.Append($"\\u{(short) c}?");
|
{
|
||||||
else
|
sb = sb.Append((char)(Convert.ToInt32(allowableSymbols[j])));
|
||||||
sb.Append(c);
|
didCharReplace = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
// if not allowable, put in a "?" and give a message to user (below)
|
||||||
|
if (!didCharReplace)
|
||||||
{
|
{
|
||||||
|
sb = sb.Append("?");
|
||||||
|
didCharReplace = true;
|
||||||
hasBadChar = true;
|
hasBadChar = true;
|
||||||
sb.Append("?");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
if (!didCharReplace)
|
||||||
sb.Append(c);
|
sb = sb.Append(ptext[i]);
|
||||||
}
|
}
|
||||||
ptext = sb.ToString();
|
if (!didCharReplace)
|
||||||
ptext = ptext.Replace("\u2013", "-"); // Replace EN Dash with hyphen
|
sb = sb.Append(ptext[i]);
|
||||||
|
}
|
||||||
|
ptext = sb.ToString();
|
||||||
|
ptext = ptext.Replace("\u2013", "-"); // Replace EN Dash with hyphen
|
||||||
ptext = ptext.Replace("\u2014", "-"); // Replace EM Dash with hyphen
|
ptext = ptext.Replace("\u2014", "-"); // Replace EM Dash with hyphen
|
||||||
ptext = ptext.Replace("\u2011", "-"); // Replace non-breaking hyphen with hyphen
|
ptext = ptext.Replace("\u2011", "-"); // Replace non-breaking hyphen with hyphen
|
||||||
ptext = ptext.Replace("\u2572", "\\"); // Replace backslash symbol with backslash character
|
ptext = ptext.Replace("\u2572", "\\"); // Replace backslash symbol with backslash character
|
||||||
|
@ -2888,14 +2888,7 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (myDO.GetDataPresent(DataFormats.Text))
|
else if (myDO.GetDataPresent(DataFormats.Text))
|
||||||
{
|
myRtb.SelectedText = _MyStepRTB.GetPasteText(PasteNoReturnsSetting, myDO);
|
||||||
//CSM B2023-095/U2022-004 When Copy/Pasting Symbols, some of the symbols paste in an incorrect font
|
|
||||||
// Changed this to put in the unicode code for any symbols outside the normal ascii range
|
|
||||||
// Also need to input as an RTF so that correct font is used with these
|
|
||||||
// and unicode is converted to actual text
|
|
||||||
string clipboardtext = _MyStepRTB.GetPasteText(PasteNoReturnsSetting, myDO, true);
|
|
||||||
myRtb.SelectedRtf = _MyStepRTB.RtfPrefixForSymbols + clipboardtext + @"}";
|
|
||||||
}
|
|
||||||
if (myRtb.SelectionLength == 0 && myRtb is StepRTB) myRtb.SelectionFont = (myRtb as StepRTB).MyStyleFont.WindowsFont;
|
if (myRtb.SelectionLength == 0 && myRtb is StepRTB) myRtb.SelectionFont = (myRtb as StepRTB).MyStyleFont.WindowsFont;
|
||||||
_PastePlainTextOvrRide = false;
|
_PastePlainTextOvrRide = false;
|
||||||
_PasteStepTextOvrRide = false;
|
_PasteStepTextOvrRide = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user