Correct cursor position after RO Insert

Correct dispose logic for transition destination ITEMs
Correct cursor position after Transition Insert
Correct logic to parse Transition Link Token
Correct Save Config to dispose of ITEM
Removed debug vlnStackTrace
This commit is contained in:
Rich
2010-09-27 16:12:46 +00:00
parent fb3ed8d053
commit dc7eb108cb
6 changed files with 104 additions and 81 deletions

View File

@@ -678,9 +678,11 @@ namespace Volian.Controls.Library
public void SaveConfig()
{
if (!_MyItemInfo.MyConfig.IsDirty) return;
Item itm = _MyItemInfo.Get();
itm.MyContent.Config = _MyItemInfo.MyConfig.ToString();
itm.Save();
using (Item itm = _MyItemInfo.Get())
{
itm.MyContent.Config = _MyItemInfo.MyConfig.ToString();
itm.Save();
}
_MyItemInfo.MyConfig.IsDirty = false;
}
#endregion
@@ -720,9 +722,7 @@ namespace Volian.Controls.Library
_SelectedRtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}");
_SelectedRtfSB.Append("\r\n");
// use styles to construct rtf commands to insert into next line (where \b, etc is)
//_SelectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}";
_SelectedRtfSB.Append(@"\viewkind4\uc1\sb240\slmult0\pard" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}";
_SelectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}";
}
private bool FontIsFixed()
@@ -1466,29 +1466,29 @@ namespace Volian.Controls.Library
IsControlChar = true;
switch (e.KeyCode)
{
//case Keys.X: //ctrl-X
//case Keys.C: //ctrl-C
// // handle the clipboard copy and cut when a Transition or RO is selected
// // For now, we are coping/cutting just the displayed text to the clipboard (like 16-bit VE-PROMS)
// Clipboard.SetText(GetSelectedDisplayableText());
// e.Handled = true;
// e.SuppressKeyPress = true;
// if (e.KeyCode == Keys.X) // cut to clipboard - delete the selected text
// HandleDeleteKeyWithSelectedText(e, null);
// break;
//case Keys.V:
// IDataObject iData = Clipboard.GetDataObject();
// if (!iData.GetDataPresent(DataFormats.Text) && !iData.GetDataPresent(DataFormats.Rtf))
// {
// MessageBox.Show("Cannot paste, text has special characters or symbols that will not paste correctly.");
// }
// else
// {
// Paste();
// if (SelectionLength == 0) SelectionFont = MyStyleFont.WindowsFont;
// }
// e.Handled = true;
// return;
case Keys.X: //ctrl-X
case Keys.C: //ctrl-C
// handle the clipboard copy and cut when a Transition or RO is selected
// For now, we are coping/cutting just the displayed text to the clipboard (like 16-bit VE-PROMS)
Clipboard.SetText(GetSelectedDisplayableText());
e.Handled = true;
e.SuppressKeyPress = true;
if (e.KeyCode == Keys.X) // cut to clipboard - delete the selected text
HandleDeleteKeyWithSelectedText(e, null);
break;
case Keys.V:
IDataObject iData = Clipboard.GetDataObject();
if (!iData.GetDataPresent(DataFormats.Text) && !iData.GetDataPresent(DataFormats.Rtf))
{
MessageBox.Show("Cannot paste, text has special characters or symbols that will not paste correctly.");
}
else
{
Paste();
if (SelectionLength == 0) SelectionFont = MyStyleFont.WindowsFont;
}
e.Handled = true;
return;
case Keys.Home:
StepRTB_HomeEndPressed(e);
e.Handled = true;
@@ -2346,6 +2346,7 @@ namespace Volian.Controls.Library
@"\u9508", // HEX@"\u2524",// Right Tee - 16-bit char: '\xB4'
@"\u9532", // HEX@"\u253c" // + Plus - 16-bit char: '\xC5'
};
private int MaxCharacterWidth()
{
// loop through lines and get the width in characters