This commit is contained in:
Kathy Ruffing 2012-05-08 13:05:32 +00:00
parent 83f38ec348
commit 00e634f4ed
3 changed files with 42 additions and 6 deletions

View File

@ -166,7 +166,7 @@ namespace Volian.Controls.Library
}
else // otherwise, get data from config
{
if (CurItemInfo.IsHigh) cbPageBreak.Checked = sc.Step_ManualPagebreak;
if (CurItemInfo.IsHigh) cbPageBreak.Checked = sc.Step_NewManualPagebreak;
cbCAS.Checked = sc.Step_CAS;
}
@ -280,7 +280,7 @@ namespace Volian.Controls.Library
if (_Initalizing) return;
StepConfig sc = CurItemInfo.MyConfig as StepConfig;
if (sc == null) return;
sc.Step_ManualPagebreak = cbPageBreak.Checked;
sc.Step_NewManualPagebreak = cbPageBreak.Checked;
}
private void cbCAS_CheckedChanged(object sender, EventArgs e)
{

View File

@ -531,6 +531,8 @@ namespace Volian.Controls.Library
InitializeComponent();
SetUpStepRTB();
AddEventHandlers();
this.BorderStyleChanged += new EventHandler(StepRTB_BorderStyleChanged);
}
public StepRTB(IContainer container)
{
@ -539,6 +541,8 @@ namespace Volian.Controls.Library
_Container = container;
SetUpStepRTB();
AddEventHandlers();
this.BorderStyleChanged += new EventHandler(StepRTB_BorderStyleChanged);
}
protected override void OnMouseWheel(MouseEventArgs e)
{
@ -546,8 +550,12 @@ namespace Volian.Controls.Library
//MyRTBItem.MyStepPanel.MouseWheel(e);
//base.OnMouseWheel(e);
}
// When a border style is changed, the richtextbox's handle is 'destroyed', so that the handleDestroyed
// event is done. This was causing the event handlers to be removed (RemoveEventHandler) so that the
// keypress event handler was not run.
private void RemoveEventHandlers()
{
if (_EventHandlersForKeyPress==0) return;
ContentsResized -= new ContentsResizedEventHandler(StepRTB_ContentsResized);
this.Click -= new EventHandler(StepRTB_Click);
this.KeyPress -= new KeyPressEventHandler(StepRTB_KeyPress);
@ -561,9 +569,15 @@ namespace Volian.Controls.Library
this.ContextMenuStripChanged -= new EventHandler(StepRTB_ContextMenuStripChanged);
this.RTBSelectionChanged -= new StepRTBEvent(StepRTB_RTBSelectionChanged);
this.HandleDestroyed -= new EventHandler(StepRTB_HandleDestroyed);
_EventHandlersForKeyPress = _EventHandlersForKeyPress - 1;
}
private int _EventHandlersForKeyPress = 0;
// When a border style is changed, the richtextbox's handle is 'destroyed', so that the handleDestroyed
// event is done. This was causing the event handlers to be removed (RemoveEventHandler) so that the
// keypress event handler was not run.
private void AddEventHandlers()
{
if (_EventHandlersForKeyPress>0) return;
// Always be sure to add the same event handlers to RemoveEventHandlers
BorderStyle = System.Windows.Forms.BorderStyle.None;
this.DetectUrls = true;
@ -580,6 +594,17 @@ namespace Volian.Controls.Library
this.ContextMenuStripChanged += new EventHandler(StepRTB_ContextMenuStripChanged);
this.RTBSelectionChanged += new StepRTBEvent(StepRTB_RTBSelectionChanged);
this.HandleDestroyed += new EventHandler(StepRTB_HandleDestroyed);
_EventHandlersForKeyPress = _EventHandlersForKeyPress+1;
}
// When a border style is changed, the richtextbox's handle is 'destroyed', so that the handleDestroyed
// event is done. This was causing the event handlers to be removed (RemoveEventHandler) so that the
// keypress event handler was not run. The following was added so that the keypress event is restored
// after the border style was changed. This is specifically for the steprtb's on property pages.
void StepRTB_BorderStyleChanged(object sender, EventArgs e)
{
if (_EventHandlersForKeyPress==0)
this.KeyPress += new KeyPressEventHandler(StepRTB_KeyPress);
_EventHandlersForKeyPress++;
}
private bool _Closed = false;
public bool Closed
@ -1763,6 +1788,7 @@ namespace Volian.Controls.Library
break;
}
}
if (((int)e.KeyCode) == 220) e.Handled = true;
switch (e.KeyCode)
{
case Keys.Left:
@ -2009,8 +2035,18 @@ namespace Volian.Controls.Library
}
private void StepRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (!ReadOnly)
if (!ReadOnly)
{
// The richtextbox in steprtb does not properly place backslashes into the rtf text. It appears
// that the backslash is stored as a single backslash rather than a double backslash which
// causes the rtf/displaytext saving to strip additional characters. For now, the easiest
// approach is to not allow backslashes to be used. This is a 'temporary' fix for B2011-077.
if (e.KeyChar == 92)
{
MessageBox.Show("Backslash is not a usable character in PROMS", "Backslash", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
e.Handled = true;
return;
}
// add the character with its font depending on the char....
if (!IsControlChar)
{

View File

@ -653,7 +653,7 @@ namespace Volian.Controls.Library
if (MyItemInfo.IsHigh)
{
StepConfig cfg = MyItemInfo.MyConfig as StepConfig;
btnInsPgBrk.Checked = cfg == null ? false : cfg.Step_ManualPagebreak;
btnInsPgBrk.Checked = cfg == null ? false : cfg.Step_NewManualPagebreak;
}
btnInsPgBrk.Enabled = MyItemInfo.IsHigh;
btnPageBreak.Enabled = MyItemInfo.IsHigh; // edit context menu
@ -973,8 +973,8 @@ namespace Volian.Controls.Library
// toggle manual page break
StepConfig cfg = MyItemInfo.MyConfig as StepConfig;
cfg.Step_ManualPagebreak = !cfg.Step_ManualPagebreak;
btnPageBreak.Checked = btnInsPgBrk.Checked = cfg.Step_ManualPagebreak;
cfg.Step_NewManualPagebreak = !cfg.Step_NewManualPagebreak;
btnPageBreak.Checked = btnInsPgBrk.Checked = cfg.Step_NewManualPagebreak;
}
private void btnIndent_Click(object sender, EventArgs e)
{