– Fix button enabling and KetTips

This commit is contained in:
John Jenko 2009-12-02 14:31:24 +00:00
parent f2360272a3
commit 1097842f36

View File

@ -72,10 +72,12 @@ namespace Volian.Controls.Library
default:
break;
}
//_MyStepRTB.KeyDown += new KeyEventHandler(MyStepRTB_SelectionChanged);
_MyStepRTB.KeyUp += new KeyEventHandler(_MyStepRTB_KeyUp); //+= new KeyEventHandler(MyStepRTB_SelectionChanged);
// The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly.
// ex. Positon on a substep, press <shift><F6> <N> <S> <S>, to list the substep types
//_MyStepRTB.MouseUp += new MouseEventHandler(_MyStepRTB_MouseUp); //+= new MouseEventHandler(MyStepRTB_SelectionChanged);
//_MyStepRTB.KeyUp += new KeyEventHandler(_MyStepRTB_KeyUp); //+= new KeyEventHandler(MyStepRTB_SelectionChanged);
_MyStepRTB.SelectionChanged += new EventHandler(_MyStepRTB_SelectionChanged);
_MyStepRTB.ModeChange += new StepRTBModeChangeEvent(_MyStepRTB_ModeChange);
_MyStepRTB.MouseUp += new MouseEventHandler(_MyStepRTB_MouseUp); //+= new MouseEventHandler(MyStepRTB_SelectionChanged);
_MyStepRTB.Leave += new EventHandler(MyStepRTB_Leave);
_MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
// Add symbols into the tab ribbon based on format selection. For now, only add symbols once
@ -105,15 +107,19 @@ namespace Volian.Controls.Library
}
}
void _MyStepRTB_MouseUp(object sender, MouseEventArgs e)
void _MyStepRTB_SelectionChanged(object sender, EventArgs e)
{
SetButtonAndMenuEnabling(false);
}
//void _MyStepRTB_MouseUp(object sender, MouseEventArgs e)
//{
// //SetButtonAndMenuEnabling(false);
//}
void _MyStepRTB_KeyUp(object sender, KeyEventArgs e)
{
SetButtonAndMenuEnabling(false);
}
//void _MyStepRTB_KeyUp(object sender, KeyEventArgs e)
//{
// //SetButtonAndMenuEnabling(false);
//}
private void BuildSymbolGallery(SymbolList sl, DevComponents.DotNetBar.GalleryContainer gc)
{
@ -185,16 +191,14 @@ namespace Volian.Controls.Library
}
void MyStepRTB_Leave(object sender, EventArgs e)
{
_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp);
_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp); //-= new MouseEventHandler(MyStepRTB_SelectionChanged);
// The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly.
// ex. Positon on a substep, press <shift><F6> <N> <S> <S>, to list the substep types
//_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp);
//_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp);
_MyStepRTB.SelectionChanged -=new EventHandler(_MyStepRTB_SelectionChanged);
_MyStepRTB.Leave -= new EventHandler(MyStepRTB_Leave);
_MyStepRTB.LinkChanged -= new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
}
//void MyStepRTB_SelectionChanged(object sender, EventArgs e)
//{
// //Console.WriteLine(string.Format("StepTabRibbon: In MyStepRTB_SelectionChanged, Selected Text = {0}", MyStepRTB.SelectedText));
// SetButtonAndMenuEnabling(false);
//}
void btnInsStep_Click(object sender, EventArgs e)
{
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender;
@ -261,7 +265,7 @@ namespace Volian.Controls.Library
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));
}
private void SetButtonMenuEnabledDisabled(bool setting)
private void SetButtonMenuEnabledDisabledOnSelection(bool setting)
{
btnCMBold.Enabled = btnBold.Enabled = setting;
btnCMItalics.Enabled = btnItalics.Enabled = setting;
@ -272,17 +276,20 @@ namespace Volian.Controls.Library
btnCMUndo.Enabled = btnUndo.Enabled = setting;
btnCMRedo.Enabled = btnRedo.Enabled = setting;
btnCMPaste.Enabled = btnPaste.Enabled = setting;
}
private void SetButtonMenuEnabledDisabledOnStepType(bool 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;
btnInsAftH.Enabled = btnInsBefH.Enabled = setting;
btnCMChgCase.Enabled = btnChgCase.Enabled = setting;
btnCMHardSpace.Enabled = btnInsHrdSpc.Enabled = setting;
btnCMSymbol.Enabled = btnSymbols.Enabled = setting;
btnIndent.Enabled = setting;
btnDelelete.Enabled = btnDelStep.Enabled = setting;
btnInsAftH.Enabled = btnInsBefH.Enabled = setting;
}
private void SetButtonAndMenuEnabling(bool docontextmenus)
{
@ -293,11 +300,11 @@ namespace Volian.Controls.Library
if (dvi == null) return;
if (dvi.VersionType > 127 || MyStepItem.MyStepPanel.PanelViewEditMode == E_ViewMode.View)
{
SetButtonMenuEnabledDisabled(false);
SetButtonMenuEnabledDisabledOnSelection(false);
}
else
{
SetButtonMenuEnabledDisabled(true);
SetButtonMenuEnabledDisabledOnSelection(true);
if (_MyStepRTB.SelectionFont != null)
{
@ -330,10 +337,17 @@ namespace Volian.Controls.Library
btnCMEditTran.Enabled = false;
btnCMEditRO.Enabled = false;
}
//SetStepButtonAndMenuEnabling(docontextmenus);
// OLD: SetStepButtonAndMenuEnabling(docontextmenus);
}
private void SetStepButtonAndMenuEnabling(bool docontextmenus)
{
DocVersionInfo dvi = MyStepItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
if (dvi == null) return;
if (dvi.VersionType > 127 || MyStepItem.MyStepPanel.PanelViewEditMode == E_ViewMode.View)
{
SetButtonMenuEnabledDisabledOnStepType(false);
return;
}
btnInsPgBrk.Checked = false;
// see if manual page break - only available on HLS
if (MyItemInfo.IsHigh)
@ -357,7 +371,7 @@ namespace Volian.Controls.Library
btnInsTrans.Enabled = btnCMTransition.Enabled = btnInsRO.Enabled = btnCMRO.Enabled = false;
btnInsAftH.Enabled = btnInsBefH.Enabled = false;
btnInsHLS.Enabled = (!MyItemInfo.IsStepSection) ? false : true; // allow hls from step section
if (btnInsHLS.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.HLS, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.HLS, btnInsHLS, (int)E_FromType.Step, btnCMInsHLS,docontextmenus);
if (btnInsHLS.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.HLS, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.HLS, btnInsHLS, (int)E_FromType.Step, btnCMInsHLS, docontextmenus);
this.Refresh();
return;
}
@ -709,8 +723,8 @@ namespace Volian.Controls.Library
#endif
private void btnToggleEditView_Click(object sender, EventArgs e)
{
MyStepRTB.ToggleEditView();
SetStepButtonAndMenuEnabling(true);
}
#endregion
@ -893,6 +907,8 @@ namespace Volian.Controls.Library
private void btnFindRplDlg_Click(object sender, EventArgs e)
{
MessageBox.Show("Functionality not available.", "Find/Replace");
//FindReplace dlgFindReplace = new FindReplace();
//dlgFindReplace.Show();
}