This commit is contained in:
Kathy Ruffing 2008-11-19 14:06:23 +00:00
parent 183026d98d
commit 4badbdba17
3 changed files with 25 additions and 6 deletions

View File

@ -122,7 +122,7 @@ namespace Volian.Controls.Library
} }
#if(DEBUG) #if(DEBUG)
// TODO: This formatting should come from the format file // TODO: This formatting should come from the format file
if (value.MyContent.Type == 20001) if (value.MyContent.Type == 20002)
Circle = true; Circle = true;
if (_TabFormat == "o ") if (_TabFormat == "o ")
CheckOff = true; CheckOff = true;

View File

@ -293,6 +293,7 @@ namespace Volian.Controls.Library
{ {
_SelectedStepRTB.BackColor = InactiveColor; _SelectedStepRTB.BackColor = InactiveColor;
_SelectedStepRTB.SaveText(); // Save any changes to the text _SelectedStepRTB.SaveText(); // Save any changes to the text
_SelectedStepRTB.SaveConfig(); // This may be redundant
} }
_SelectedStepRTB = value; _SelectedStepRTB = value;
if (_SelectedItemInfo.ItemID != value.MyItemInfo.ItemID) if (_SelectedItemInfo.ItemID != value.MyItemInfo.ItemID)

View File

@ -15,7 +15,7 @@ namespace Volian.Controls.Library
public partial class StepRTB : RichTextBox , IStepRTB public partial class StepRTB : RichTextBox , IStepRTB
{ {
#region Properties and Variables #region Properties and Variables
// use newer rich text box.... // use newer rich text box....
//[DllImport("kernel32.dll", CharSet = CharSet.Auto)] //[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
//static extern IntPtr LoadLibrary(string lpFileName); //static extern IntPtr LoadLibrary(string lpFileName);
//protected override CreateParams CreateParams //protected override CreateParams CreateParams
@ -80,6 +80,7 @@ namespace Volian.Controls.Library
//_InitializingRTB = false; //_InitializingRTB = false;
_IsDirty = false; _IsDirty = false;
ClearUndo(); ClearUndo();
_MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged);
} }
} }
} }
@ -192,6 +193,11 @@ namespace Volian.Controls.Library
//this.SelectionChanged += new EventHandler(DisplayRTB_SelectionChanged); //this.SelectionChanged += new EventHandler(DisplayRTB_SelectionChanged);
} }
void MyConfig_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
SaveConfig();
}
private void StepRTB_Click(object sender, EventArgs e) private void StepRTB_Click(object sender, EventArgs e)
{ {
if (ReadOnly) return; if (ReadOnly) return;
@ -252,13 +258,24 @@ namespace Volian.Controls.Library
{ {
if (ReadOnly) return; if (ReadOnly) return;
if (!_IsDirty) return; if (!_IsDirty) return;
bool success = _origDisplayText.Save((RichTextBox)this); if (_IsDirty)
if (success)
{ {
_IsDirty = false; bool success = _origDisplayText.Save((RichTextBox)this);
ClearUndo(); if (success)
{
_IsDirty = false;
ClearUndo();
}
} }
} }
public void SaveConfig()
{
if (!_MyItemInfo.MyConfig.IsDirty) return;
Item itm = _MyItemInfo.Get();
itm.MyContent.Config = _MyItemInfo.MyConfig.ToString();
itm.Save();
_MyItemInfo.MyConfig.IsDirty = false;
}
#endregion #endregion
#region AddRtfTextAndStyles #region AddRtfTextAndStyles
private void AddRtfText(DisplayText myDisplayText) private void AddRtfText(DisplayText myDisplayText)
@ -287,6 +304,7 @@ namespace Volian.Controls.Library
} }
private void AddSymbol(string str) private void AddSymbol(string str)
{ {
MessageBox.Show(SelectedRtf);
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset0 Arial Unicode MS;}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + /* ConvertUnicodeChar(str) */ str + @"}"; SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset0 Arial Unicode MS;}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + /* ConvertUnicodeChar(str) */ str + @"}";
} }
private void AddRtfLink(displayLinkElement myDisplayLinkElement) private void AddRtfLink(displayLinkElement myDisplayLinkElement)