C2022-003-Change-Textboxes-to-RTF-3
This commit is contained in:
@@ -1910,7 +1910,7 @@ namespace RODBInterface
|
||||
string Info = DBE.GetString(3);
|
||||
//B2022-043 &pos; was missing the ;
|
||||
Info = Info.Replace("'", "\'"); // B2021-071: crash when getting/saving field names
|
||||
Info = Regex.Replace(Info, @"\\u([0-9]{1,4})\?", m => Convert.ToChar(int.Parse(m.Groups[1].Value)).ToString()); // RO Editor add symbols C2025 - 003
|
||||
Info = Regex.Replace(Info, @"\\u([0-9]{1,4})\?", m => Convert.ToChar(int.Parse(m.Groups[1].Value)).ToString()); // RO Editor add symbols C2022 - 003
|
||||
|
||||
node.SetAttribute("HasChild", "True");
|
||||
|
||||
@@ -1975,7 +1975,7 @@ namespace RODBInterface
|
||||
elem.SetAttribute("RecID", RecID);
|
||||
elem.SetAttribute("ParentID", node.GetAttribute("RecID"));
|
||||
elem.SetAttribute("Table", node.GetAttribute("Table"));
|
||||
AccPageID = Regex.Replace(AccPageID, @"\\u([0-9]{1,4})\?", m => Convert.ToChar(int.Parse(m.Groups[1].Value)).ToString()); // RO Editor add symbols C2025 - 003
|
||||
AccPageID = Regex.Replace(AccPageID, @"\\u([0-9]{1,4})\?", m => Convert.ToChar(int.Parse(m.Groups[1].Value)).ToString()); // RO Editor add symbols C2022 - 003
|
||||
elem.SetAttribute("AccPageID", AccPageID);
|
||||
}
|
||||
}
|
||||
@@ -2186,7 +2186,7 @@ namespace RODBInterface
|
||||
parent.SetAttribute("ChildLoaded", "True");
|
||||
}
|
||||
string xmlstr = GenerateXmlString(ro, false);
|
||||
string tmp2 = Regex.Replace(xmlstr, @"\\u([0-9]{1,4})\?", m => Convert.ToChar(int.Parse(m.Groups[1].Value)).ToString()); // RO Editor add symbols C2025 - 003
|
||||
string tmp2 = Regex.Replace(xmlstr, @"\\u([0-9]{1,4})\?", m => Convert.ToChar(int.Parse(m.Groups[1].Value)).ToString()); // RO Editor add symbols C2022 - 003
|
||||
string wraccid = null;
|
||||
if (ro.HasAttribute("AccPageID"))
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace ctlXMLEditLib
|
||||
{
|
||||
private System.Windows.Forms.Button btnSave;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.RichTextBox tbZoom; // RO Editor add symbols C2025 - 003
|
||||
private System.Windows.Forms.RichTextBox tbZoom; // RO Editor add symbols C2022 - 003
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
@@ -88,7 +88,7 @@ namespace ctlXMLEditLib
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tbZoom = new System.Windows.Forms.RichTextBox(); // RO Editor add symbols C2025 - 003
|
||||
this.tbZoom = new System.Windows.Forms.RichTextBox(); // RO Editor add symbols C2022 - 003
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
@@ -99,7 +99,7 @@ namespace ctlXMLEditLib
|
||||
this.tbZoom.Location = new System.Drawing.Point(24, 16);
|
||||
this.tbZoom.Multiline = true;
|
||||
this.tbZoom.Name = "tbZoom";
|
||||
this.tbZoom.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; // RO Editor add symbols C2025 - 003
|
||||
this.tbZoom.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; // RO Editor add symbols C2022 - 003
|
||||
this.tbZoom.Size = new System.Drawing.Size(576, 392);
|
||||
this.tbZoom.TabIndex = 0;
|
||||
//
|
||||
|
||||
@@ -204,7 +204,7 @@ using System.Windows;
|
||||
using System.Text.RegularExpressions;
|
||||
using Volian.Base.Library;
|
||||
using System.Linq;
|
||||
//using IniFileIO;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -225,6 +225,7 @@ namespace ctlXMLEditLib
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
public class ctlXMLEdit : System.Windows.Forms.UserControl
|
||||
{
|
||||
/// <summary>
|
||||
@@ -269,6 +270,19 @@ namespace ctlXMLEditLib
|
||||
private GroupBox pcGrpBox = null;
|
||||
/** end C2021-026 **/
|
||||
|
||||
public string _RO_IDEN;
|
||||
public string RO_IDEN
|
||||
{
|
||||
get
|
||||
{
|
||||
return _RO_IDEN;
|
||||
}
|
||||
set
|
||||
{
|
||||
_RO_IDEN = value;
|
||||
}
|
||||
}
|
||||
|
||||
// use this struct to define attributes for the text box fields, storing
|
||||
// the pattern, radio button association, required field flag, etc.
|
||||
struct TextBoxAttrTag
|
||||
@@ -315,7 +329,7 @@ namespace ctlXMLEditLib
|
||||
public string GetParentHTId { get { return parenthtid; } }
|
||||
public void SetParentHTId(string id) { this.parenthtid = id; }
|
||||
}
|
||||
private RichTextBox _TextBoxFocus; // RO Editor add symbols C2025 - 003
|
||||
private RichTextBox _TextBoxFocus; // RO Editor add symbols C2022 - 003
|
||||
public RichTextBox TextBoxFocus
|
||||
{
|
||||
get { return _TextBoxFocus; }
|
||||
@@ -329,6 +343,7 @@ namespace ctlXMLEditLib
|
||||
public ctlXMLEdit(VlnXmlElement myelem, XmlSchema myschema, ArrayList reqfields, ArrayList fldsWithApplic, string [] pckids)
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
|
||||
InitializeComponent();
|
||||
FieldsWithApplic = fldsWithApplic;
|
||||
PCChildren = pckids; //C2021-026 list of Parent/Child children
|
||||
@@ -373,11 +388,12 @@ namespace ctlXMLEditLib
|
||||
// Set required fields based on list. (can add message later).
|
||||
SetRequiredFields(reqfields);
|
||||
dosaveflag=true;
|
||||
RO_IDEN = myelem.GetAccPageIDTemplate();
|
||||
}
|
||||
|
||||
// set the required fields tag on those fields which are included in the passed
|
||||
// in required fields list.
|
||||
private void DoSet(RichTextBox hwnd, string msg) // RO Editor add symbols C2025 - 003
|
||||
private void DoSet(RichTextBox hwnd, string msg) // RO Editor add symbols C2022 - 003
|
||||
{
|
||||
if (hwnd == null) return;
|
||||
if (hwnd.Tag != null)
|
||||
@@ -680,6 +696,7 @@ namespace ctlXMLEditLib
|
||||
// true if success, false if fail.
|
||||
// Note that the Parent and Child XML node variables below are not coding for Parent/Child Applicabily Fields
|
||||
public bool SaveData()
|
||||
|
||||
{
|
||||
if (mysavexml)
|
||||
{
|
||||
@@ -688,7 +705,7 @@ namespace ctlXMLEditLib
|
||||
string imgdate;
|
||||
|
||||
//go thru the hash table to get textboxes. Find the ones that have text.
|
||||
foreach (string str in myHT.Keys) // RO Editor add symbols C2025 - 003
|
||||
foreach (string str in myHT.Keys) // RO Editor add symbols C2022 - 003
|
||||
{
|
||||
object o = myHT[str];
|
||||
hwnd = (RichTextBox) o;
|
||||
@@ -704,7 +721,7 @@ namespace ctlXMLEditLib
|
||||
//Str = @"\u" + ((int)chr); //.ToString("X4");
|
||||
Str = $"\\u{(int)chr}?";
|
||||
|
||||
|
||||
|
||||
result1 = result1 + Str;
|
||||
}
|
||||
else
|
||||
@@ -714,22 +731,6 @@ namespace ctlXMLEditLib
|
||||
|
||||
}
|
||||
|
||||
var pattern = @"\\u([0-9]{1,4})\?"; // RO Editor add symbols C2025 - 003
|
||||
|
||||
var results = Regex.Matches(hwnd.Text, pattern);
|
||||
|
||||
string num1;
|
||||
|
||||
int num2;
|
||||
|
||||
foreach (Match result in results)
|
||||
{
|
||||
num1 = (result.Groups[1].Value);
|
||||
string resultString = Regex.Match(num1, @"\d+").Value;
|
||||
string resultString1 = string.Format("{0:x}", resultString);
|
||||
num2 = int.Parse(resultString, System.Globalization.NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
|
||||
hwnd.Text = result1;
|
||||
|
||||
@@ -849,7 +850,7 @@ namespace ctlXMLEditLib
|
||||
return (false);
|
||||
}
|
||||
|
||||
// RO Editor add symbols C2025 - 003
|
||||
// RO Editor add symbols C2022 - 003
|
||||
private static Regex sreg1 = new Regex(@"\\par\r\n(?!\\)");
|
||||
private static Regex sreg2 = new Regex(@"[\r\n]", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
||||
private static Regex sreg3 = new Regex(@"^\{(.*)\}$", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
||||
@@ -905,7 +906,7 @@ namespace ctlXMLEditLib
|
||||
return retval;
|
||||
}
|
||||
|
||||
// RO Editor add symbols C2025 - 003
|
||||
// RO Editor add symbols C2022 - 003
|
||||
public static string RTFConvertedSymbolsToUnicode(string str)
|
||||
{
|
||||
string rtnStr = str;
|
||||
@@ -1385,7 +1386,16 @@ namespace ctlXMLEditLib
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public delegate void ctlXMLEditEvent(object sender, ctlXMLEditEventArgs args); // RO Editor add symbols C2022 - 003 for turning off symbols btn for RO ID field.
|
||||
public event ctlXMLEditEvent EnableDisableSymbolsBtn;
|
||||
private void OnEnableDisableSymbolsBtn(ctlXMLEditEventArgs args)
|
||||
{
|
||||
if (EnableDisableSymbolsBtn != null)
|
||||
EnableDisableSymbolsBtn(this, args);
|
||||
}
|
||||
|
||||
// when data in a text box has changed, flag it (except for when this
|
||||
// happens during loading of original data). This flag will be used
|
||||
// later to know whether to save data.
|
||||
@@ -1619,7 +1629,20 @@ namespace ctlXMLEditLib
|
||||
else
|
||||
zoomtextbox = null;
|
||||
|
||||
TextBoxFocus = textbox;
|
||||
TextBoxFocus = textbox;
|
||||
|
||||
string RO_IDENDITY = RO_IDEN.Substring(1, RO_IDEN.Length - 2); // RO Editor add symbols C2022 - 003 for turning off symbols btn for RO ID.
|
||||
if (textbox.Name == RO_IDENDITY)
|
||||
{
|
||||
//ROEditor.rbtnSymbols.Enabled = false;
|
||||
OnEnableDisableSymbolsBtn(new ctlXMLEditEventArgs(DisplaySymBolBtn:false));
|
||||
}
|
||||
else
|
||||
{
|
||||
//ROEditor.rbtnSymbols.Enabled = true;
|
||||
OnEnableDisableSymbolsBtn(new ctlXMLEditEventArgs(DisplaySymBolBtn:true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void textbox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
@@ -1653,10 +1676,7 @@ namespace ctlXMLEditLib
|
||||
btnZoom_click(null, null);
|
||||
}
|
||||
}
|
||||
public void btnSymbols_click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
public void btnZoom_click(object sender, System.EventArgs e)
|
||||
{
|
||||
//TextBox tb = (TextBox) sender;
|
||||
@@ -2084,7 +2104,7 @@ namespace ctlXMLEditLib
|
||||
* and overload a couple of it's functions in order to use it.
|
||||
* - called in CalculatePromsDate() above.
|
||||
*/
|
||||
public class ThisTimeZone : TimeZone
|
||||
public class ThisTimeZone : TimeZone
|
||||
{
|
||||
private TimeZone curTZ;
|
||||
public TimeSpan SpanTZ;
|
||||
@@ -2125,7 +2145,22 @@ namespace ctlXMLEditLib
|
||||
return curTZ.GetDaylightChanges(year);
|
||||
}
|
||||
}
|
||||
public static class RichTextBoxExtensions // RO Editor add symbols C2025 - 003
|
||||
public class ctlXMLEditEventArgs : EventArgs // RO Editor add symbols C2022 - 003 for turning off symbols btn for RO ID.
|
||||
{
|
||||
public ctlXMLEditEventArgs() {; }
|
||||
public ctlXMLEditEventArgs(bool DisplaySymBolBtn)
|
||||
{
|
||||
_DisplaySymBolBtn = DisplaySymBolBtn;
|
||||
}
|
||||
private bool _DisplaySymBolBtn;
|
||||
|
||||
public bool DisplaySymBolBtn
|
||||
{
|
||||
get { return _DisplaySymBolBtn; }
|
||||
set { _DisplaySymBolBtn = value; }
|
||||
}
|
||||
}
|
||||
public static class RichTextBoxExtensions // RO Editor add symbols C2022 - 003
|
||||
{
|
||||
public static void InsertSymbol(this RichTextBox richTextBox, int symbcode)
|
||||
{
|
||||
@@ -2134,8 +2169,9 @@ namespace ctlXMLEditLib
|
||||
string RtfPrefixForSymbols = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 FreeMono; } {\f1\fnil\fcharset0 FreeMono; } } {\colortbl;\red255\green0\blue0;\red0\green0\blue255; } \viewkind4\uc1\pard\fs24 \f1\fs24 ";
|
||||
richTextBox.SelectedRtf = RtfPrefixForSymbols + sym + @"}";
|
||||
richTextBox.SelectedRtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033\uc1 }";
|
||||
richTextBox.Select(position, 1);
|
||||
richTextBox.Select(position + 1, 0);
|
||||
richTextBox.Select(position, 0);
|
||||
//richTextBox.Select(position, 1); //left here for reference
|
||||
//richTextBox.Select(position + 1, 0);
|
||||
|
||||
//TextPointer caretPos = rtb.CaretPosition;
|
||||
//if (symbcode < 256)
|
||||
|
||||
Reference in New Issue
Block a user