This commit is contained in:
Kathy Ruffing 2009-07-24 11:55:19 +00:00
parent b1da81e65f
commit 00d13a8dbc
3 changed files with 60 additions and 18 deletions

View File

@ -137,6 +137,7 @@ namespace Volian.Controls.Library
_MyStepPanel.ItemClick +=new Volian.Controls.Library.StepPanelEvent(_MyStepPanel_ItemClick); _MyStepPanel.ItemClick +=new Volian.Controls.Library.StepPanelEvent(_MyStepPanel_ItemClick);
_MyStepPanel.AttachmentClicked += new Volian.Controls.Library.StepPanelAttachmentEvent(_MyStepPanel_AttachmentClicked); _MyStepPanel.AttachmentClicked += new Volian.Controls.Library.StepPanelAttachmentEvent(_MyStepPanel_AttachmentClicked);
_MyStepPanel.ItemSelectedChanged += new ItemSelectedChangedEvent(_MyStepPanel_ItemSelectedChanged); _MyStepPanel.ItemSelectedChanged += new ItemSelectedChangedEvent(_MyStepPanel_ItemSelectedChanged);
_MyStepPanel.ModeChange += new Volian.Controls.Library.StepPanelModeChangeEvent(_MyStepPanel_ModeChange);
} }
#endregion #endregion
#region Event Handlers #region Event Handlers
@ -215,6 +216,12 @@ namespace Volian.Controls.Library
_MyStepTabRibbon.MyStepItem = args.MyStepItem; _MyStepTabRibbon.MyStepItem = args.MyStepItem;
_MyDisplayTabControl.OnItemSelectedChanged(sender, args); _MyDisplayTabControl.OnItemSelectedChanged(sender, args);
} }
// Occurs when the Mode Changes
void _MyStepPanel_ModeChange(object sender, StepRTBModeChangeEventArgs args)
{
_MyDisplayTabControl.OnModeChange(sender, args);
}
/// <summary> /// <summary>
/// Occurs when the user clicks on the Attachment Expander /// Occurs when the user clicks on the Attachment Expander
/// </summary> /// </summary>

View File

@ -39,6 +39,7 @@ namespace Volian.Controls.Library
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit); _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit);
//_MyStepRTB.KeyDown += new KeyEventHandler(MyStepRTB_SelectionChanged); //_MyStepRTB.KeyDown += new KeyEventHandler(MyStepRTB_SelectionChanged);
_MyStepRTB.KeyUp += new KeyEventHandler(MyStepRTB_SelectionChanged); _MyStepRTB.KeyUp += new KeyEventHandler(MyStepRTB_SelectionChanged);
_MyStepRTB.ModeChange += new StepRTBModeChangeEvent(_MyStepRTB_ModeChange);
_MyStepRTB.MouseUp += new MouseEventHandler(MyStepRTB_SelectionChanged); _MyStepRTB.MouseUp += new MouseEventHandler(MyStepRTB_SelectionChanged);
_MyStepRTB.Leave += new EventHandler(MyStepRTB_Leave); _MyStepRTB.Leave += new EventHandler(MyStepRTB_Leave);
_MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged); _MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
@ -86,6 +87,11 @@ namespace Volian.Controls.Library
} }
} }
} }
void _MyStepRTB_ModeChange(object sender, StepRTBModeChangeEventArgs args)
{
SetButtonAndMenuEnabling();
}
#endregion #endregion
#region Constructor #region Constructor
public StepTabRibbon() public StepTabRibbon()
@ -171,9 +177,39 @@ namespace Volian.Controls.Library
btnUnderline.Enabled = btnCMUnderline.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Underline) == E_Style.Underline)); btnUnderline.Enabled = btnCMUnderline.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Underline) == E_Style.Underline));
btnItalics.Enabled = btnCMItalics.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Italics) == E_Style.Italics)); btnItalics.Enabled = btnCMItalics.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Italics) == E_Style.Italics));
} }
private void SetButtonMenuEnabledDisabled(bool setting)
{
btnCMBold.Enabled = btnBold.Enabled = setting;
btnCMItalics.Enabled = btnItalics.Enabled = setting;
btnCMUnderline.Enabled = btnUnderline.Enabled = setting;
btnCMSubscript.Enabled = btnSubscript.Enabled = setting;
btnCMSuperscript.Enabled = btnSuperscript.Enabled = setting;
btnCMCut.Enabled = btnCMCopy.Enabled = btnCut.Enabled = btnCopy.Enabled = setting;
btnCMUndo.Enabled = btnUndo.Enabled = setting;
btnCMRedo.Enabled = btnRedo.Enabled = setting;
btnCMPaste.Enabled = btnPaste.Enabled = setting;
btnInsPgBrk.Enabled = setting;
btnChgTyp.Enabled = setting;
btnInsHLS.Enabled = btnInsCaut.Enabled = btnInsNote.Enabled = btnInsRNO.Enabled = btnInsFig.Enabled =
btnInsTable.Enabled = btnInsSubstep.Enabled = btnInsBefore.Enabled = btnInsAfter.Enabled = setting;
btnInsTrans.Enabled = btnCMTransition.Enabled = btnInsRO.Enabled = btnCMRO.Enabled = setting;
btnCMChgCase.Enabled = btnChgCase.Enabled = setting;
btnCMHardSpace.Enabled = btnInsHrdSpc.Enabled = setting;
btnCMSymbol.Enabled = btnSymbols.Enabled = setting;
btnIndent.Enabled = setting;
}
private void SetButtonAndMenuEnabling() private void SetButtonAndMenuEnabling()
{ {
if (_MyStepRTB == null) return; if (_MyStepRTB == null) return;
DocVersionInfo dvi = MyStepItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
if (dvi == null) return;
if (dvi.VersionType > 127 || MyStepItem.MyStepPanel.PanelViewEditMode == E_ViewMode.View)
{
SetButtonMenuEnabledDisabled(false);
}
else
{
SetButtonMenuEnabledDisabled(true);
if (_MyStepRTB.SelectionFont != null) if (_MyStepRTB.SelectionFont != null)
{ {
btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB); btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB);
@ -191,7 +227,7 @@ namespace Volian.Controls.Library
// for paste, see if there is clipboard data, & if so, of a type we can use. // for paste, see if there is clipboard data, & if so, of a type we can use.
IDataObject iData = Clipboard.GetDataObject(); IDataObject iData = Clipboard.GetDataObject();
btnCMPaste.Enabled = btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf)); btnCMPaste.Enabled = btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf));
}
// do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type. // do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type.
btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); //(_MyStepRTB.MyLinkText != null); btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); //(_MyStepRTB.MyLinkText != null);
@ -516,13 +552,12 @@ namespace Volian.Controls.Library
OutputAllChildren(itm); OutputAllChildren(itm);
} }
private void btnCMToggle_Click(object sender, EventArgs e) private void btnToggleEditView_Click(object sender, EventArgs e)
{ {
MyStepRTB.ToggleViewEdit();
MyStepRTB.ToggleEditView();
} }
#endif #endif
#endregion #endregion
} }