From 4badbdba17dd0c843c75b038385e0c8d17ebd1f1 Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 19 Nov 2008 14:06:23 +0000 Subject: [PATCH] --- PROMS/Volian.Controls.Library/StepItem.cs | 2 +- PROMS/Volian.Controls.Library/StepPanel.cs | 1 + PROMS/Volian.Controls.Library/StepRTB.cs | 28 ++++++++++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepItem.cs b/PROMS/Volian.Controls.Library/StepItem.cs index db33acd1..445396fb 100644 --- a/PROMS/Volian.Controls.Library/StepItem.cs +++ b/PROMS/Volian.Controls.Library/StepItem.cs @@ -122,7 +122,7 @@ namespace Volian.Controls.Library } #if(DEBUG) // TODO: This formatting should come from the format file - if (value.MyContent.Type == 20001) + if (value.MyContent.Type == 20002) Circle = true; if (_TabFormat == "o ") CheckOff = true; diff --git a/PROMS/Volian.Controls.Library/StepPanel.cs b/PROMS/Volian.Controls.Library/StepPanel.cs index 9e9edacd..ee323169 100644 --- a/PROMS/Volian.Controls.Library/StepPanel.cs +++ b/PROMS/Volian.Controls.Library/StepPanel.cs @@ -293,6 +293,7 @@ namespace Volian.Controls.Library { _SelectedStepRTB.BackColor = InactiveColor; _SelectedStepRTB.SaveText(); // Save any changes to the text + _SelectedStepRTB.SaveConfig(); // This may be redundant } _SelectedStepRTB = value; if (_SelectedItemInfo.ItemID != value.MyItemInfo.ItemID) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index b735512a..9f2a3218 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -15,7 +15,7 @@ namespace Volian.Controls.Library public partial class StepRTB : RichTextBox , IStepRTB { #region Properties and Variables - // use newer rich text box.... + // use newer rich text box.... //[DllImport("kernel32.dll", CharSet = CharSet.Auto)] //static extern IntPtr LoadLibrary(string lpFileName); //protected override CreateParams CreateParams @@ -80,6 +80,7 @@ namespace Volian.Controls.Library //_InitializingRTB = false; _IsDirty = false; ClearUndo(); + _MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged); } } } @@ -192,6 +193,11 @@ namespace Volian.Controls.Library //this.SelectionChanged += new EventHandler(DisplayRTB_SelectionChanged); } + void MyConfig_PropertyChanged(object sender, PropertyChangedEventArgs e) + { + SaveConfig(); + } + private void StepRTB_Click(object sender, EventArgs e) { if (ReadOnly) return; @@ -252,13 +258,24 @@ namespace Volian.Controls.Library { if (ReadOnly) return; if (!_IsDirty) return; - bool success = _origDisplayText.Save((RichTextBox)this); - if (success) + if (_IsDirty) { - _IsDirty = false; - ClearUndo(); + bool success = _origDisplayText.Save((RichTextBox)this); + 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 #region AddRtfTextAndStyles private void AddRtfText(DisplayText myDisplayText) @@ -287,6 +304,7 @@ namespace Volian.Controls.Library } 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 + @"}"; } private void AddRtfLink(displayLinkElement myDisplayLinkElement)