This commit is contained in:
2011-04-08 13:15:41 +00:00
parent 2d16db5bf2
commit 76dd59be14
9 changed files with 495 additions and 441 deletions

View File

@@ -302,9 +302,13 @@ namespace Volian.Controls.Library
{
InitializeComponent();
_RibbonControl.SizeChanged += new EventHandler(_RibbonControl_SizeChanged);
// When AutoExpand is set to true, [CTRL][F1] will hide/expand the ribbon bar
// When AutoExpand is set to true, [CTRL][F1] and double click will hide/expand the ribbon bar
// causing its state to be out of sync with that of the QAT menu option to
// expand/hide the ribbon.
// We now set AutoExpand to false and issue an event to expand/collapse the ribbon
// in a generic event method (ribbonTab_DoubleClick)
// and assigned it to the DoubleClick event of each tab in the ribbon.
// (see ribbonTab_DoubleClick() for more information) -jsj 07-APR-2011
// Note: the QAT menu is to the right of the V start button in the upper left
_RibbonControl.AutoExpand = false;
_RibbonControl.Items[0].RaiseClick(); // initially default to HOME tab
@@ -459,6 +463,7 @@ namespace Volian.Controls.Library
btnCMPaste.Enabled = btnPaste.Enabled = setting;
btnCMCopy.Enabled = btnCopy.Enabled = setting;
btnPasteAfter.Enabled = btnPasteBefore.Enabled = btnStepPaste.Enabled = btnPasteReplace.Enabled = setting;
btnCMGrid.Enabled = setting;
}
private void SetButtonMenuEnabledDisabledOnStepType(bool setting)
{
@@ -475,6 +480,7 @@ namespace Volian.Controls.Library
btnDelelete.Enabled = btnDelStep.Enabled = setting;
btnSpell.Enabled = setting;
rtabTableGridTools.Visible = setting;
btnCMGrid.Enabled = setting;
}
private void SetButtonAndMenuEnabling(bool docontextmenus)
{
@@ -579,9 +585,18 @@ namespace Volian.Controls.Library
btnCMEditMode1.Enabled = btnEditMode.Enabled = false; // in approved
if (dvi.VersionType > 127 || MyEditItem.MyStepPanel.VwMode == E_ViewMode.View)
{
if (rtabTableGridTools.Checked)
rtabHome.Select();
Console.WriteLine("rtabTableGridTools.Visible1 = {0}", rtabTableGridTools.Visible);
rtabTableGridTools.Visible = false;
Console.WriteLine("rtabTableGridTools.Visible2 = {0}", rtabTableGridTools.Visible);
SetButtonMenuEnabledDisabledOnStepType(false);
this.Refresh();
return;
}
else
SetButtonMenuEnabledDisabledOnStepType(true);
btnInsPgBrk.Checked = false;
// see if manual page break - only available on HLS
if (MyItemInfo.IsHigh)
@@ -590,6 +605,7 @@ namespace Volian.Controls.Library
btnInsPgBrk.Checked = cfg == null ? false : cfg.Step_ManualPagebreak;
}
btnInsPgBrk.Enabled = MyItemInfo.IsHigh;
btnPageBreak.Enabled = MyItemInfo.IsHigh; // edit context menu
btnEditMode.Checked = btnCMEditMode1.Checked = MyEditItem.MyStepPanel.VwMode == E_ViewMode.View;
// if on procedure, 'Delete' buttons should be disabled.
btnDelelete.Enabled = btnDelStep.Enabled = !MyItemInfo.IsProcedure;
@@ -604,7 +620,7 @@ namespace Volian.Controls.Library
rtabTableGridTools.Visible = tmpGridItm != null && !tmpGridItm.MyFlexGrid.IsRoTable;
// If no longer on a table (grid) or the newly selectd table is an RO table
// then select the Home tab (since the Table tab is not visable)
if ((!(MyEditItem is GridItem) && rtabTableGridTools.Checked) || !rtabTableGridTools.Visible)
if ((!(MyEditItem is GridItem) && rtabTableGridTools.Checked)) // || ((MyEditItem is GridItem) && !rtabTableGridTools.Visible))
{
rtabHome.Select();
}
@@ -857,7 +873,7 @@ namespace Volian.Controls.Library
// toggle manual page break
StepConfig cfg = MyItemInfo.MyConfig as StepConfig;
cfg.Step_ManualPagebreak = !cfg.Step_ManualPagebreak;
btnInsPgBrk.Checked = cfg.Step_ManualPagebreak;
btnPageBreak.Checked = btnInsPgBrk.Checked = cfg.Step_ManualPagebreak;
}
private void btnIndent_Click(object sender, EventArgs e)
{
@@ -1065,6 +1081,8 @@ namespace Volian.Controls.Library
//#endif
#endregion
private void btnToggleEditView_Click(object sender, EventArgs e)
{
MyEditItem.MyStepPanel.VwMode = MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit ? E_ViewMode.View : E_ViewMode.Edit;
@@ -1073,8 +1091,8 @@ namespace Volian.Controls.Library
SetStepButtonAndMenuEnabling(true);
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnModeChange(this, new StepRTBModeChangeEventArgs(MyEditItem.MyStepPanel.VwMode));
btnEditMode.Checked = btnCMEditMode1.Checked = MyEditItem.MyStepPanel.VwMode == E_ViewMode.View;
MyEditItem.MyStepRTB.SpellCheckContextMenuOn(MyEditItem.MyStepPanel.VwMode != E_ViewMode.View);
}
#endregion
private void btnROEdit_Click(object sender, EventArgs e)
{
@@ -1178,6 +1196,7 @@ namespace Volian.Controls.Library
private void rtabAdmin_Click(object sender, EventArgs e)
{
ribbonTab_SingleClick(sender, e);
btnUpdROVal.Enabled = false;
if (MyDVI.DocVersionAssociations.Count < 1) return;
if (!NewerRoFst()) return;
@@ -1992,6 +2011,53 @@ namespace Volian.Controls.Library
_RibbonControl.Height = rbnBorderlistBox.Height + _RibbonControl.Height - _RibbonControl.ClientSize.Height;
//_RibbonControl.Height = rbnBorderlistBox.Height + _RibbonControl.Height - _RibbonControl.ClientSize.Height;
}
#region Expand/Collaspe Ribbon
// In MS Word, a Double Click of a ribbon tab will toggle (Expand/Collapse) the ribbon.
// Once collapsed, a Single Click of a ribbon tab will temporarily expand the ribbon but does not push the text window
// down to make room. Thus your edit cursor could end up behind the ribbon.
// In our implementation of the ribbon interface, when we double click to collapse/expand the
// ribbon, the QAT menu on the main form gets out of sync, so we need to handle this manually, turning off AutoExpand
// on the ribbon control. (see StepTabRibbon() constructor) and issue an event to expand/collapse the ribbon.
// As a result of turning off the AutoExpand, a single click is not recongized internally.
// To get around this, we handle the single click event.
// Our single click event will expand the ribbon tabs if needed but not temporarily.
// Instead, it acts like a double click which is not the same a MS Word, but on the plus side,
// it elimates the risk of the ribbon expanding on top of the current edit window.
//-----------------------------
// This is assigned the DoubleClick event on all of the ribbon tabs
// Note that a single mouse click will expand the tabs if collapsed
// Note too that a double click also fires the single click event
// the "didSingleClick" variable handle this case
private void ribbonTab_DoubleClick(object sender, EventArgs e)
{
if (TimeSpan.FromTicks(DateTime.Now.Ticks - _LastClick.Ticks).TotalMilliseconds > 500)
{
//SendKeys.Send("^{F1}"); // toggle expand/collapse ribbon tabs <CTRL><F1>
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnToggleRibbonExpanded(this, new EventArgs());
_LastDoubleClick = DateTime.Now;
}
}
private DateTime _LastClick = DateTime.Now;
private DateTime _LastDoubleClick = DateTime.Now;
// This is assigned the Click event on all of the ribbon tabs
// If the tabs are collapsed, then expand them on a single click of the tab
private void ribbonTab_SingleClick(object sender, EventArgs e)
{
if ((!_RibbonControl.Expanded) && TimeSpan.FromTicks(DateTime.Now.Ticks - _LastDoubleClick.Ticks).TotalMilliseconds > 500)
{
//SendKeys.Send("^{F1}"); // Expand the ribbon tabs <CTRL><F1>
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnToggleRibbonExpanded(this, new EventArgs());
_LastClick = DateTime.Now;
}
}
#endregion // Expand/Collapse Ribbon
}
public enum E_FieldToEdit { StepText, Text, Number, PSI };
public class StepTabRibbonEventArgs : EventArgs