B2017-048, B2017-052, B2017-055 ROs sometimes have two start tokens which make them uneditable.
This commit is contained in:
parent
ab7d3b4c66
commit
dc6468155f
@ -481,7 +481,6 @@ namespace Volian.Controls.Library
|
|||||||
public void RefreshDisplay(bool activeMode)
|
public void RefreshDisplay(bool activeMode)
|
||||||
{
|
{
|
||||||
if (IsExperimenting) return;
|
if (IsExperimenting) return;
|
||||||
//Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 1");
|
|
||||||
ActiveMode = activeMode;
|
ActiveMode = activeMode;
|
||||||
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(true));
|
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(true));
|
||||||
//Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 2");
|
//Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 2");
|
||||||
@ -875,7 +874,7 @@ namespace Volian.Controls.Library
|
|||||||
private void SetUpStepRTB()
|
private void SetUpStepRTB()
|
||||||
{
|
{
|
||||||
DetectUrls = false;
|
DetectUrls = false;
|
||||||
SpellCheckStatus = false;
|
SpellCheckStatus = false;
|
||||||
this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables
|
this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables
|
||||||
BorderStyle = System.Windows.Forms.BorderStyle.None;
|
BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||||
this.ScrollBars = RichTextBoxScrollBars.None;
|
this.ScrollBars = RichTextBoxScrollBars.None;
|
||||||
@ -1148,12 +1147,29 @@ namespace Volian.Controls.Library
|
|||||||
string indentStr = @"\fi" + match.Groups[1].Value + @"\li" + match.Groups[2].Value;
|
string indentStr = @"\fi" + match.Groups[1].Value + @"\li" + match.Groups[2].Value;
|
||||||
Rtf = Rtf.Replace(@"\pard", @"\pard" + indentStr);
|
Rtf = Rtf.Replace(@"\pard", @"\pard" + indentStr);
|
||||||
}
|
}
|
||||||
|
// B2017-048, B2017-052, B2017-055 ROs sometimes have two start tokens which make them uneditable.
|
||||||
|
newRtf = newRtf.Replace("<START]<START]", "<START]");
|
||||||
|
//Point linkIssues = FindLinkIssues(newRtf);
|
||||||
|
//if (linkIssues.X != linkIssues.Y)
|
||||||
|
// newRtf = FixBadLinks(newRtf,linkIssues);
|
||||||
SelectedRtf = _LastRtf = newRtf;
|
SelectedRtf = _LastRtf = newRtf;
|
||||||
_lastReadOnly = ReadOnly;
|
_lastReadOnly = ReadOnly;
|
||||||
}
|
}
|
||||||
FindAllLinks();
|
FindAllLinks();
|
||||||
if (txt == "") SelectionFont = FormatFont;
|
if (txt == "") SelectionFont = FormatFont;
|
||||||
}
|
}
|
||||||
|
//private string FixBadLinks(string newRtf, Point linkIssues)
|
||||||
|
//{
|
||||||
|
// Console.WriteLine("Bad Link rtf = Starts={0}, Ends={1}, \"{2}\"", linkIssues.X,linkIssues.Y, newRtf);
|
||||||
|
// //Volian.Base.Library.vlnStackTrace.ShowStack();
|
||||||
|
// return newRtf;
|
||||||
|
//}
|
||||||
|
//private static Point FindLinkIssues(string rtf)
|
||||||
|
//{
|
||||||
|
// MatchCollection mcStart = Regex.Matches(rtf, @"\<START\]");
|
||||||
|
// MatchCollection mcEnd = Regex.Matches(rtf, @"\[END\>");
|
||||||
|
// return new Point(mcStart.Count, mcEnd.Count);
|
||||||
|
//}
|
||||||
public void SetTableGridCellRTFPrefix(Font myfont)
|
public void SetTableGridCellRTFPrefix(Font myfont)
|
||||||
{
|
{
|
||||||
if (_FormatFont == null)
|
if (_FormatFont == null)
|
||||||
@ -1192,8 +1208,8 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
base.WndProc(ref m);
|
base.WndProc(ref m);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -1575,6 +1591,8 @@ namespace Volian.Controls.Library
|
|||||||
#region TextAndContentsEvents
|
#region TextAndContentsEvents
|
||||||
void StepRTB_TextChanged(object sender, EventArgs e)
|
void StepRTB_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
//if (Rtf.Contains("<START]<START]"))
|
||||||
|
// Volian.Base.Library.vlnStackTrace.ShowStackLocal(2, 10, "Start Start ItemID={0}", MyItemInfo.ItemID);
|
||||||
if (_InitializingRTB || _IsExperimenting) return;
|
if (_InitializingRTB || _IsExperimenting) return;
|
||||||
// Was setting _IsDirty to true here, but this was getting called from
|
// Was setting _IsDirty to true here, but this was getting called from
|
||||||
// 'dotnetbar' when text was NOT Changed. So _IsDirty was made into
|
// 'dotnetbar' when text was NOT Changed. So _IsDirty was made into
|
||||||
@ -2145,81 +2163,81 @@ namespace Volian.Controls.Library
|
|||||||
//System.Windows.Forms.RichTextBox richTextBox1;
|
//System.Windows.Forms.RichTextBox richTextBox1;
|
||||||
using (System.Windows.Forms.RichTextBox richTextBox1 = new System.Windows.Forms.RichTextBox())
|
using (System.Windows.Forms.RichTextBox richTextBox1 = new System.Windows.Forms.RichTextBox())
|
||||||
{
|
{
|
||||||
richTextBox1.Location = new System.Drawing.Point(35, 32);
|
richTextBox1.Location = new System.Drawing.Point(35, 32);
|
||||||
richTextBox1.Name = "richTextBox1";
|
richTextBox1.Name = "richTextBox1";
|
||||||
richTextBox1.Size = new System.Drawing.Size(67, 58);
|
richTextBox1.Size = new System.Drawing.Size(67, 58);
|
||||||
richTextBox1.TabIndex = 0;
|
richTextBox1.TabIndex = 0;
|
||||||
richTextBox1.Text = "";
|
richTextBox1.Text = "";
|
||||||
richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
|
richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
|
||||||
bool hasEquation = false;
|
bool hasEquation = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DataFormats.Format frm = DataFormats.GetFormat("Embed Source");
|
DataFormats.Format frm = DataFormats.GetFormat("Embed Source");
|
||||||
richTextBox1.Paste(frm);
|
richTextBox1.Paste(frm);
|
||||||
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQU")) hasEquation = true;
|
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQU")) hasEquation = true;
|
||||||
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS VIS")) hasEquation = true; // Support Visio
|
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS VIS")) hasEquation = true; // Support Visio
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
hasEquation = true;
|
hasEquation = true;
|
||||||
}
|
}
|
||||||
if (MyItemInfo != null && MyItemInfo.IsRtfRaw && MyItemInfo.FormatStepData.Type.ToUpper().Contains("EQUATION") && !hasEquation)
|
if (MyItemInfo != null && MyItemInfo.IsRtfRaw && MyItemInfo.FormatStepData.Type.ToUpper().Contains("EQUATION") && !hasEquation)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Cannot paste non-equation data into an equation step type.", "Invalid data", MessageBoxButtons.OK);
|
MessageBox.Show("Cannot paste non-equation data into an equation step type.", "Invalid data", MessageBoxButtons.OK);
|
||||||
//richTextBox1.Dispose();
|
//richTextBox1.Dispose();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if inserting anything other than equation, be sure that an equation is not in the buffer:
|
// if inserting anything other than equation, be sure that an equation is not in the buffer:
|
||||||
else if (hasEquation && (MyItemInfo == null || (MyItemInfo != null && !MyItemInfo.IsRtfRaw && !MyItemInfo.FormatStepData.Type.ToUpper().Contains("EQUATION"))))
|
else if (hasEquation && (MyItemInfo==null || (MyItemInfo != null && !MyItemInfo.IsRtfRaw && !MyItemInfo.FormatStepData.Type.ToUpper().Contains("EQUATION"))))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Cannot paste equation data into an non-equation step type.", "Invalid data", MessageBoxButtons.OK);
|
MessageBox.Show("Cannot paste equation data into an non-equation step type.", "Invalid data", MessageBoxButtons.OK);
|
||||||
//richTextBox1.Dispose();
|
//richTextBox1.Dispose();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only allow the paste of a screen shot image if using the shortcut switch "/EmbedImages"
|
// only allow the paste of a screen shot image if using the shortcut switch "/EmbedImages"
|
||||||
if (Volian.Base.Library.VlnSettings.GetCommandFlag("EmbedImages") && iData.GetDataPresent(DataFormats.Dib)) // Device Independent Bitmap
|
if (Volian.Base.Library.VlnSettings.GetCommandFlag("EmbedImages") && iData.GetDataPresent(DataFormats.Dib)) // Device Independent Bitmap
|
||||||
|
{
|
||||||
|
System.Drawing.Image img = Clipboard.GetImage();
|
||||||
|
ImageWidth = img.Width;
|
||||||
|
Width = ImageWidth + 2;
|
||||||
|
Paste();
|
||||||
|
e.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (iData.GetDataPresent("Embed Source")) //DS Equation") || iData.GetDataPresent("MathType EF"))
|
||||||
|
{
|
||||||
|
Size sz = RtfRawItem.GetRtfRawSize(richTextBox1.Rtf);
|
||||||
|
this.Rtf = richTextBox1.Rtf;
|
||||||
|
Width = sz.Width;
|
||||||
|
Height = sz.Height;
|
||||||
|
e.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (iData.GetDataPresent(DataFormats.Dib))
|
||||||
|
{
|
||||||
|
System.Drawing.Image img = Clipboard.GetImage();
|
||||||
|
ImageWidth = img.Width;
|
||||||
|
Width = ImageWidth + 2;
|
||||||
|
Paste();
|
||||||
|
e.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!iData.GetDataPresent(DataFormats.Text) && !iData.GetDataPresent(DataFormats.Rtf))
|
||||||
{
|
{
|
||||||
System.Drawing.Image img = Clipboard.GetImage();
|
MessageBox.Show("Cannot paste, text has special characters or symbols that will not paste correctly.");
|
||||||
ImageWidth = img.Width;
|
|
||||||
Width = ImageWidth + 2;
|
|
||||||
Paste();
|
|
||||||
e.Handled = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (iData.GetDataPresent("Embed Source")) //DS Equation") || iData.GetDataPresent("MathType EF"))
|
|
||||||
{
|
|
||||||
Size sz = RtfRawItem.GetRtfRawSize(richTextBox1.Rtf);
|
|
||||||
this.Rtf = richTextBox1.Rtf;
|
|
||||||
Width = sz.Width;
|
|
||||||
Height = sz.Height;
|
|
||||||
e.Handled = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (iData.GetDataPresent(DataFormats.Dib))
|
|
||||||
{
|
|
||||||
System.Drawing.Image img = Clipboard.GetImage();
|
|
||||||
ImageWidth = img.Width;
|
|
||||||
Width = ImageWidth + 2;
|
|
||||||
Paste();
|
|
||||||
e.Handled = true;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!iData.GetDataPresent(DataFormats.Text) && !iData.GetDataPresent(DataFormats.Rtf))
|
// if contains bad rtf (from Word), paste as text, otherwise, do the paste here.
|
||||||
{
|
if (!PasteRtfAsText(true)) Paste();
|
||||||
MessageBox.Show("Cannot paste, text has special characters or symbols that will not paste correctly.");
|
if (SelectionLength == 0 && MyStyleFont != null) SelectionFont = MyStyleFont.WindowsFont; // B2017-023 null reference check for empty workdraft set information dialog
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// if contains bad rtf (from Word), paste as text, otherwise, do the paste here.
|
|
||||||
if (!PasteRtfAsText(true)) Paste();
|
|
||||||
if (SelectionLength == 0 && MyStyleFont != null) SelectionFont = MyStyleFont.WindowsFont; // B2017-023 null reference check for empty workdraft set information dialog
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} // end using
|
} // end using
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user