Supporting logic to handle the use of the backslash character

Supporting logic to handle the use of the backslash character, and question marks
Supporting logic to handle the use of the backslash character, dashes, and symbols
Supporting logic to handle the use of the backslash character and dashes
This commit is contained in:
2016-06-21 15:15:01 +00:00
parent 66b9792324
commit 4c6d09803d
17 changed files with 149 additions and 31 deletions

View File

@@ -559,7 +559,7 @@ namespace Volian.Controls.Library
private static string FixPath(string path)
{
string itemTitle = Regex.Replace(path, "^..+?\\u0007", "");
itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace("\\u8209?", "-");
itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace(@"\u8209?", "-").Replace(@"\u9586?",@"\");
return itemTitle;
}
private void btnViewChronologyReport_Click(object sender, EventArgs e)

View File

@@ -119,7 +119,7 @@ namespace Volian.Controls.Library
//Spin through ROs looking for the selected text
if (MyRTB.SelectedText != "")
{
string lookFor = MyRTB.SelectedText.Replace('\u2011', '-');
string lookFor = MyRTB.SelectedText.Replace('\u2011', '-').Replace(@"\u9586?", @"\\");
List<ROFSTLookup.roChild> children = null;
if (_MyROFST != null) children = _MyROFST.GetROFSTLookup(Mydvi).GetRosByValue(lookFor);
if (children != null)

View File

@@ -1236,7 +1236,7 @@ namespace Volian.Controls.Library
Cursor = Cursors.WaitCursor;
SearchResults = null;
bool includeRTFformat = false;
bool includeSpecialChars = true;
bool includeSpecialChars = (TextSearchString != @"\?"); // true;
// Build list of selected types that were searched
string typstr = null;
foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : typstr + ", " + s;
@@ -1287,7 +1287,7 @@ namespace Volian.Controls.Library
SearchString = TextSearchString;
//TypesSelected = (typstr != null) ? "Searched Step Types: " + typstr : "Searched All Step Types";
//TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "All Step Types");
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix);
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString /*.Replace(@"\",@"\u9586?")*/, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix);
cmbResultsStyleIndex = 3; // display step text in results
//}
}

View File

@@ -241,7 +241,7 @@ namespace Volian.Controls.Library
Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItemInfo.TabTitle;
_MyItemInfo.Changed += new ItemInfoEvent(_MyItemInfo_Changed);
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-");
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\");
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus);
//
@@ -276,7 +276,7 @@ namespace Volian.Controls.Library
void _MyItemInfo_Changed(object sender)
{
Text = _MyItemInfo.TabTitle;
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-");
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\");
}
void DisplayTabItem_LostFocus(object sender, EventArgs e)
{
@@ -308,7 +308,7 @@ namespace Volian.Controls.Library
Control = _MyDSOTabPanel;
Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItemInfo.TabTitle;
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-");
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\");
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus);
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);

View File

@@ -174,16 +174,32 @@ namespace Volian.Controls.Library
doingfind = false;
this.Visible = false;
}
private string FixSymbol(string str)
{
StringBuilder sb = new StringBuilder();
foreach (char c in str)
{
if (c > 0xff)
sb.Append(string.Format(@"\u{0}?", (int)c));
else
sb.Append(c);
}
return sb.ToString();
}
private void btnFindNext_Click(object sender, EventArgs e)
{
AddToComboLists();
doingfind = true;
string fndStr = FixSymbol(cmboFindText.Text.Replace(@"\", @"\u9586?").Replace("-", @"\u8209?").Replace("\xa0", @"\u160?"));
while (!MyEditItem.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked))
{
ItemInfo next = (cbxReverse.Checked) ? MyEditItem.MyItemInfo.SearchPrev : MyEditItem.MyItemInfo.SearchNext;
while ((next != null) && !next.IsSection && !next.MyContent.Text.ToUpper().Contains(cmboFindText.Text.ToUpper()))
while ((next != null) && !next.IsSection && !next.MyContent.Text.Contains(fndStr))
{
next = (cbxReverse.Checked) ? next.SearchPrev : next.SearchNext;
}
if (next != null) Console.WriteLine("next {0} {1}", next.ItemID, next.MyContent.Text);
if ((next == null) || next.IsSection)
{
if (!findingbookmarks)

View File

@@ -1235,6 +1235,7 @@ namespace Volian.Controls.Library
int position = SelectionStart;
SelectionLength = 0;
linkValue = linkValue.Replace("\\u8209?", "\\f1\\u8209?\\f0 ");
linkValue = linkValue.Replace("\\u9586?", "\\f1\\u9586?\\f0 "); // backslash symbol
linkValue = linkValue.Replace("\\u916?", "\\f1\\u916?\\f0 ");
linkValue = linkValue.Replace(@"{", @"\{");
linkValue = linkValue.Replace(@"}", @"\}");
@@ -1939,6 +1940,7 @@ namespace Volian.Controls.Library
using (StepRTB srtb = new StepRTB())
{
srtb.Rtf = this.SelectedRtf.Replace(@"\u8209?", "-");
srtb.Rtf = srtb.Rtf.Replace(@"\u9586?", @"\\");
string rtnstr = "";
string ctxt = srtb.Text;//this.SelectedText;
if (ctxt.EndsWith("<START]"))
@@ -2416,6 +2418,8 @@ namespace Volian.Controls.Library
string strpressed = null;
if (e.KeyChar == '-')
strpressed = GetAddSymbolText(@"\u8209?");
else if (e.KeyChar == '\\')
strpressed = GetAddSymbolText(@"\u9586?");
else
strpressed = e.KeyChar.ToString();
if (e.KeyChar >= ' ')
@@ -2445,7 +2449,8 @@ namespace Volian.Controls.Library
else if (e.KeyChar == '}')
AddRtf(@"\}");
else if (e.KeyChar == '\\')
AddRtf(@"\\");
AddSymbol(@"\u9586?"); // unicode hex 2572
//AddRtf(@"\\");
else
return;
e.Handled = true; // flag that it's been handled, otherwise, will get 2 chars.
@@ -2504,6 +2509,7 @@ namespace Volian.Controls.Library
ptext = ptext.Replace("\u2013", "-"); // Replace EN 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("\u2572", "\\"); // Replace backslash symbol with backslash character
if (didCharReplace)
MessageBox.Show("Replacing pasted characters that are not supported by Proms with a '?'.");
return ptext;
@@ -2750,6 +2756,7 @@ namespace Volian.Controls.Library
bool keepgoing = true;
while (keepgoing)
{
str = str.Replace("\\", "\u2572").Replace("-","\u2011");
int pos = savRTF.Find(str, startpos, _FindOptions);
keepgoing = false;
if (pos >= 0)

View File

@@ -98,8 +98,9 @@ namespace Volian.Controls.Library
grd.SetSearchCell(SearchString);
}
// convert the '-' to the unicode non-breaking dash (\u8209? or \u2011 hex)
// and the '\' to the unicode backslash sybol (\u9586? or \u2572 hex)
if (!SelectedEditItem.MyStepRTB.IsRoTable)
SelectedEditItem.MyStepRTB.Find(SearchString.Replace('-','\u2011'));
SelectedEditItem.MyStepRTB.Find(SearchString.Replace('-', '\u2011').Replace('\\','\u2572'));
}
#endregion
#region Contructors

View File

@@ -3660,6 +3660,7 @@ namespace Volian.Controls.Library
// Now change the Unicode symbols to DOS symbols
stepText = stepText.Replace(@"\u8209?", "-");
stepText = stepText.Replace(@"\u9586?", "\\");
stepText = stepText.Replace(@"\u9474?", "\xB3"); // Vert Line graphic character
stepText = stepText.Replace(@"\'b0", "\xB0");
stepText = stepText.Replace(@"\up2 ", "\x9566");

View File

@@ -1217,7 +1217,7 @@ namespace Volian.Controls.Library
string PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
DirectoryInfo di = new DirectoryInfo(PEIPath);
if (!di.Exists) di.Create();
string fileName = PEIPath + "\\Approved_Rev_" + ri.RevisionNumber.Replace(" ","_") + "_" + xd.SelectSingleNode("procedure/content/@number").InnerText.Replace(" ","_").Replace(@"\u8209?", "-")+".pxml";
string fileName = PEIPath + "\\Approved_Rev_" + ri.RevisionNumber.Replace(" ","_") + "_" + xd.SelectSingleNode("procedure/content/@number").InnerText.Replace(" ","_").Replace(@"\u8209?", "-").Replace(@"\u9586?","_")+".pxml";
xd.Save(fileName);
MessageBox.Show("Approved procedure saved to import file " + fileName,"Saving TempMod", MessageBoxButtons.OK, MessageBoxIcon.Information);
}