Added EditItem_Enter event to better handle the enable/disable of ribbon button used to insert step types and for copy/paste step
Don’t allow a table to be copied into a non-table step type. Allow copy step from a sub-step to a high level step.
This commit is contained in:
parent
8e39a307f2
commit
07fc46d11d
@ -49,12 +49,24 @@ namespace Volian.Controls.Library
|
|||||||
public EditItem()
|
public EditItem()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.Enter += EditItem_Enter;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This event was added to better control enabling or disabling of the Insert and Copy Step buttons on the ribbon
|
||||||
|
void EditItem_Enter(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("EditItem Enter {0}", MyItemInfo);
|
||||||
|
bool allow = (MyStepPanel.VwMode == E_ViewMode.Edit);
|
||||||
|
StepTabRibbon str = MyStepPanel.MyStepTabPanel.MyStepTabRibbon;
|
||||||
|
str.SiblingsButtonsEnabled = allow;
|
||||||
|
str.InsertButtonsEnabled = allow && !(MyItemInfo.IsProcedure || MyItemInfo.IsSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditItem(IContainer container)
|
public EditItem(IContainer container)
|
||||||
{
|
{
|
||||||
container.Add(this);
|
container.Add(this);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.Enter += EditItem_Enter;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Properties
|
#region Properties
|
||||||
|
@ -556,16 +556,16 @@ namespace Volian.Controls.Library
|
|||||||
// page breaks, copy step, nor creating a pdf
|
// page breaks, copy step, nor creating a pdf
|
||||||
bool allow = (_MyStepRTB.TextLength > 0 && (MyEditItem == null || MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit));
|
bool allow = (_MyStepRTB.TextLength > 0 && (MyEditItem == null || MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit));
|
||||||
|
|
||||||
// turn ribbon items on/off base on whether there is text in the edit window
|
//// turn ribbon items on/off base on whether there is text in the edit window
|
||||||
rbnSiblings.Enabled = rbnParagraph.Enabled = rbnStepParts.Enabled = allow;
|
//rbnSiblings.Enabled = rbnParagraph.Enabled = rbnStepParts.Enabled = allow;
|
||||||
// only turn on the Insert Before/After and the CopyStep buttons if on a step part
|
//// only turn on the Insert Before/After and the CopyStep buttons if on a step part
|
||||||
btnInsAftH.Enabled = btnInsBefH.Enabled = btnInsAfter.Enabled = btnInsBefore.Enabled = btnCpyStp.Enabled =
|
////btnInsAftH.Enabled = btnInsBefH.Enabled = btnInsAfter.Enabled = btnInsBefore.Enabled = btnCpyStp.Enabled =
|
||||||
allow && !(MyItemInfo.IsProcedure || MyItemInfo.IsSection || MyItemInfo.IsFigure || MyItemInfo.IsTable || MyItemInfo.IsRNOPart);
|
//// allow && !(MyItemInfo.IsProcedure || MyItemInfo.IsSection || MyItemInfo.IsFigure || MyItemInfo.IsTable || MyItemInfo.IsRNOPart);
|
||||||
rbPdf.Enabled = allow;
|
rbPdf.Enabled = allow;
|
||||||
|
|
||||||
// toggle context menus used with the shortcut key
|
//// toggle context menus used with the shortcut key
|
||||||
btnCMInsHLS.Enabled = btnCMInsRNO.Enabled = btnCMInsSubStps.Enabled = btnCMInsCaution.Enabled =
|
//btnCMInsHLS.Enabled = btnCMInsRNO.Enabled = btnCMInsSubStps.Enabled = btnCMInsCaution.Enabled =
|
||||||
btnCMInsNote.Enabled = btnCMInsTable.Enabled = btnCMInsFigure.Enabled = allow;
|
// btnCMInsNote.Enabled = btnCMInsTable.Enabled = btnCMInsFigure.Enabled = allow;
|
||||||
// if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes
|
// if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes
|
||||||
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
|
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
|
||||||
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = allow && !MyItemInfo.IsInCalvertConditionResponse;
|
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = allow && !MyItemInfo.IsInCalvertConditionResponse;
|
||||||
@ -607,6 +607,22 @@ namespace Volian.Controls.Library
|
|||||||
MyFlexGrid.SelChange -= new EventHandler(MyFlexGrid_SelChange);
|
MyFlexGrid.SelChange -= new EventHandler(MyFlexGrid_SelChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool SiblingsButtonsEnabled
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
// turn ribbon items on/off base on whether there is text in the edit window
|
||||||
|
rbnSiblings.Enabled = rbnParagraph.Enabled = rbnStepParts.Enabled =value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool InsertButtonsEnabled
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
// only turn on the Insert Before/After and the CopyStep buttons if on a step part
|
||||||
|
btnInsAftH.Enabled = btnInsBefH.Enabled = btnInsAfter.Enabled = btnInsBefore.Enabled = btnCpyStp.Enabled = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
void _MyEditItem_Enter(object sender, EventArgs e)
|
void _MyEditItem_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly.
|
// The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly.
|
||||||
@ -630,7 +646,7 @@ namespace Volian.Controls.Library
|
|||||||
MyFlexGrid.SelChange += new EventHandler(MyFlexGrid_SelChange);
|
MyFlexGrid.SelChange += new EventHandler(MyFlexGrid_SelChange);
|
||||||
//Console.WriteLine("Turn on SelChange");
|
//Console.WriteLine("Turn on SelChange");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MyFlexGrid_CopyOptionChanged(object sender, EventArgs args)
|
void MyFlexGrid_CopyOptionChanged(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
btnTblDgnPaste.Enabled = true;
|
btnTblDgnPaste.Enabled = true;
|
||||||
@ -1117,41 +1133,43 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsSection && MyItemInfo.IsSection && tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID)
|
if (tmp.MyDisplayTabControl.MyCopyStep.IsSection && MyItemInfo.IsSection && tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID)
|
||||||
{
|
{
|
||||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false; // don't replace itself
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//copy item is high level step
|
//copy item is high level step
|
||||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh && !MyItemInfo.IsHigh)
|
// Allow a High Level step to be pasted to a sub-step, but not to a table, figure, section or procedure type
|
||||||
|
if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh && (MyItemInfo.IsTable || MyItemInfo.IsFigure || MyItemInfo.IsSection || MyItemInfo.IsProcedure))
|
||||||
{
|
{
|
||||||
// commenting these lines out allows us to use Copy Step to copy a High Level Step
|
// commenting these lines out allows us to use Copy Step to copy a High Level Step
|
||||||
// to a sub-step level. - 05/18/2015 jsj
|
// to a sub-step level. - 05/18/2015 jsj
|
||||||
//btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
// changed above if so the the high level step cannot be paste to a Table, Figure, Section (on the editor panel), Procedure (on the editor panel) - jsj 09/17/2015
|
||||||
//btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||||
//btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh && MyItemInfo.IsHigh && tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID)
|
|
||||||
{
|
|
||||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//copy item is step that is not high is not a table and is not a figure
|
// don't allow a paste of a substep into a table, figure, sectino,or procedure type
|
||||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsSubStep && !MyItemInfo.IsSubStep)
|
// this also allows a substep (text) to be copyed to a high level step type C2015-011
|
||||||
|
if (tmp.MyDisplayTabControl.MyCopyStep.IsSubStep && (MyItemInfo.IsTable || MyItemInfo.IsFigure || MyItemInfo.IsSection || MyItemInfo.IsProcedure))
|
||||||
{
|
{
|
||||||
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsStep && MyItemInfo.IsStep && tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID)
|
// copy item is a table of figure - don't allow pasting at High Level Step, Caution or Note level, as well as not at a section or procedure level)
|
||||||
|
// Bug fix B2015-152
|
||||||
|
if (tmp.MyDisplayTabControl.MyCopyStep.IsTable && !MyItemInfo.IsTable || tmp.MyDisplayTabControl.MyCopyStep.IsFigure && !MyItemInfo.IsFigure)
|
||||||
{
|
{
|
||||||
|
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||||
|
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//otherwise everything is ok except for same item prevent replace
|
//otherwise everything is ok except for same item prevent replace
|
||||||
if (tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID)
|
if (tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID)
|
||||||
{
|
{
|
||||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false; // don't replace itself
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -1236,7 +1254,6 @@ namespace Volian.Controls.Library
|
|||||||
btnEditMode.Checked = btnCMEditMode1.Checked = MyEditItem.MyStepPanel.VwMode == E_ViewMode.View;
|
btnEditMode.Checked = btnCMEditMode1.Checked = MyEditItem.MyStepPanel.VwMode == E_ViewMode.View;
|
||||||
// if on procedure, 'Delete' buttons should be disabled.
|
// if on procedure, 'Delete' buttons should be disabled.
|
||||||
btnDelelete.Enabled = btnDelStep.Enabled = !MyItemInfo.IsProcedure;
|
btnDelelete.Enabled = btnDelStep.Enabled = !MyItemInfo.IsProcedure;
|
||||||
btnCpyStp.Enabled = !MyItemInfo.IsProcedure;
|
|
||||||
// Only display the table edit tools if in a grid (table) and that grid (table) is not an RO Table.
|
// Only display the table edit tools if in a grid (table) and that grid (table) is not an RO Table.
|
||||||
GridItem tmpGridItm = MyEditItem as GridItem;
|
GridItem tmpGridItm = MyEditItem as GridItem;
|
||||||
if (btnTblDgnAdjustSize.Checked)
|
if (btnTblDgnAdjustSize.Checked)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user