Fixed paste bug (B2016-005) remove paste options from tree context menus when copied step is deleted.
Made a public method to enable/disable the ribbon’s paste buttons so it can be called when a step is deleted from the tree view. (B2016-005)
This commit is contained in:
parent
9753dc90a2
commit
7ce40b53a7
@ -1015,10 +1015,18 @@ namespace VEPROMS
|
||||
{
|
||||
if (displayHistory.MyEditItem != null && displayHistory.MyItemInfo.MyProcedure.ItemID == args.MyItemInfo.ItemID)
|
||||
displayHistory.MyEditItem = null;
|
||||
return tc.DeleteRTBItem(args.MyItemInfo);
|
||||
//if (si == null) return false;
|
||||
//si.RemoveItem();
|
||||
//return true;
|
||||
// bug fix B2016-005 - set MyCopyStep to null. This will take the paste options off of the tree node context menus. jsj 4-19-2016
|
||||
if (args.MyItemInfo.ItemID == tc.MyCopyStep.ItemID)
|
||||
tc.MyCopyStep = null;
|
||||
bool rtval = tc.DeleteRTBItem(args.MyItemInfo);
|
||||
// Also disable the paste options on the ribbon if it is open. jsj 4-19-2016
|
||||
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyStepTabPanel != null) // MyStepTabPanel will be null if the active tab is a Word Attachment
|
||||
{
|
||||
StepPanel pnl = tc.SelectedDisplayTabItem.MyStepTabPanel.MyStepPanel;
|
||||
if (pnl != null)
|
||||
pnl.MyStepTabPanel.MyStepTabRibbon.SetPasteButtons(false);
|
||||
}
|
||||
return rtval;
|
||||
}
|
||||
private bool tv_PasteItemInfo(object sender, vlnTreeItemInfoPasteEventArgs args)
|
||||
{
|
||||
|
@ -1157,36 +1157,36 @@ namespace Volian.Controls.Library
|
||||
btnCASCreate.Enabled = (MyEditItem != null) ? (MyEditItem.MyStepPanel.ApplDisplayMode > 0) : false;
|
||||
}
|
||||
|
||||
// Made a public method so that it can be called when a step is deleted from the tree view.
|
||||
// part of bug fix for B2016-005 - jsj 4-19-2016
|
||||
public void SetPasteButtons(bool enable)
|
||||
{
|
||||
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = enable;
|
||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = enable;
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = enable;
|
||||
}
|
||||
private void SetPasteButtonEnabled()
|
||||
{
|
||||
#region new code
|
||||
StepTabPanel tmp = Parent as StepTabPanel;
|
||||
//turn all on
|
||||
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = true;
|
||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = true;
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = true;
|
||||
SetPasteButtons(true);
|
||||
//copy item is null, turn all off and return
|
||||
if (tmp.MyDisplayTabControl.MyCopyStep == null)
|
||||
{
|
||||
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||
SetPasteButtons(false);
|
||||
return;
|
||||
}
|
||||
//copy item is procedure, turn all off and return must be done from tree
|
||||
if(tmp.MyDisplayTabControl.MyCopyStep.IsProcedure)
|
||||
{
|
||||
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||
SetPasteButtons(false);
|
||||
return;
|
||||
}
|
||||
//copy item is section
|
||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsSection && !MyItemInfo.IsSection)
|
||||
{
|
||||
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||
SetPasteButtons(false);
|
||||
return;
|
||||
}
|
||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsSection && MyItemInfo.IsSection && tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID)
|
||||
@ -1212,9 +1212,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
if ((!MyItemInfo.IsEnhancedSection && !MyItemInfo.IsEnhancedStep && !toSourceHasEnhancedLinks) && fromSourceHasEnhancedLinks)
|
||||
{
|
||||
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||
SetPasteButtons(false);
|
||||
return;
|
||||
}
|
||||
// enhanced: if 'from' step is not enhanced, only allow paste before/after
|
||||
@ -1243,27 +1241,21 @@ namespace Volian.Controls.Library
|
||||
// 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
|
||||
// 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
|
||||
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||
SetPasteButtons(false);
|
||||
return;
|
||||
}
|
||||
// don't allow a paste of a substep into a table, figure, sectino,or procedure type
|
||||
// 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;
|
||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||
SetPasteButtons(false);
|
||||
return;
|
||||
}
|
||||
// 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;
|
||||
SetPasteButtons(false);
|
||||
return;
|
||||
}
|
||||
//otherwise everything is ok except for same item prevent replace
|
||||
|
Loading…
x
Reference in New Issue
Block a user