B2012-397 – fixed pasted logic with respect to the default (v button) setting and the two paste options

This commit is contained in:
John Jenko 2013-01-03 17:32:06 +00:00
parent 570e2813bf
commit 2a6ff5d0b3
2 changed files with 18 additions and 6 deletions

View File

@ -1031,7 +1031,8 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Home Tab #region Home Tab
private bool _PastePlainText = false; private bool _PastePlainTextOvrRide = false;
private bool _PasteStepTextOvrRide = false;
private void btnPaste_Click(object sender, EventArgs e) private void btnPaste_Click(object sender, EventArgs e)
{ {
StartGridEditing(SelectionOption.End); StartGridEditing(SelectionOption.End);
@ -1053,17 +1054,20 @@ namespace Volian.Controls.Library
cmb.SelectedText = myDO.GetData(DataFormats.UnicodeText).ToString(); cmb.SelectedText = myDO.GetData(DataFormats.UnicodeText).ToString();
else if (myDO.GetDataPresent(DataFormats.Text)) else if (myDO.GetDataPresent(DataFormats.Text))
cmb.SelectedText = myDO.GetData(DataFormats.Text).ToString(); cmb.SelectedText = myDO.GetData(DataFormats.Text).ToString();
_PastePlainText = false; _PastePlainTextOvrRide = false;
_PasteStepTextOvrRide = false;
return; return;
} }
else else
{ {
SaveErrorInLogProblemWithType(ctrl); SaveErrorInLogProblemWithType(ctrl);
_PastePlainText = false; _PastePlainTextOvrRide = false;
_PasteStepTextOvrRide = false;
return; return;
} }
} }
if (myDO.GetDataPresent(DataFormats.Rtf) && !_PastePlainText && !PastePlainTextSetting) //if (myDO.GetDataPresent(DataFormats.Rtf) && !_PastePlainTextOvrRide && !PastePlainTextSetting)
if (myDO.GetDataPresent(DataFormats.Rtf) && (_PasteStepTextOvrRide || (!_PastePlainTextOvrRide && !PastePlainTextSetting)))
{ {
string tmpForLink = myDO.GetData(DataFormats.Rtf).ToString(); string tmpForLink = myDO.GetData(DataFormats.Rtf).ToString();
tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> "); tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> ");
@ -1087,7 +1091,8 @@ namespace Volian.Controls.Library
//myRtb.SelectedText = myDO.GetData(DataFormats.Text).ToString(); //myRtb.SelectedText = myDO.GetData(DataFormats.Text).ToString();
} }
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;
_PastePlainText = false; _PastePlainTextOvrRide = false;
_PasteStepTextOvrRide = false;
} }
private void SaveErrorInLogProblemWithType(Control ctrl) private void SaveErrorInLogProblemWithType(Control ctrl)
@ -2449,7 +2454,14 @@ namespace Volian.Controls.Library
private void btnPasteText_Click(object sender, EventArgs e) private void btnPasteText_Click(object sender, EventArgs e)
{ {
StartGridEditing(SelectionOption.End); StartGridEditing(SelectionOption.End);
_PastePlainText = true; _PastePlainTextOvrRide = true;
btnPaste_Click(sender, e);
}
private void btnPasteStepText_Click(object sender, EventArgs e)
{
StartGridEditing(SelectionOption.End);
_PasteStepTextOvrRide = true;
btnPaste_Click(sender, e); btnPaste_Click(sender, e);
} }