enabling/disabling of copy/paste buttons
adding (or not) paste menu items depending on to/from document types
This commit is contained in:
@@ -573,6 +573,10 @@ namespace Volian.Controls.Library
|
||||
btnInsAftH.Enabled = btnInsBefH.Enabled = btnInsAfter.Enabled = btnInsBefore.Enabled = btnCpyStp.Enabled = value;
|
||||
}
|
||||
}
|
||||
public void SetCopyStepButton(bool val)
|
||||
{
|
||||
btnCpyStp.Enabled = val;
|
||||
}
|
||||
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.
|
||||
@@ -1115,17 +1119,35 @@ namespace Volian.Controls.Library
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false; // don't replace itself
|
||||
return;
|
||||
}
|
||||
// THE FOLLOWING NEEDS TO BE ADDED IN - CODE HAD TO BE CHECKED IN BEFORE THIS COULD BE TESTED BY SOFTWARE ENGINEER (KBR) but is needed.
|
||||
// for now (Jan 2016 - initial implementation of enhanced document support) do NOT paste any step (MyCopyStep) that has enhanced data associated
|
||||
// with it unless pasting within a enhanced source document. The reason is that code would need to handle clearing the pasted enhanced config
|
||||
// data if it is pasted into a non-enhanced location.
|
||||
//if ((!MyItemInfo.IsEnhancedSection && !!!MyItemInfo.IsEnhancedStep) && tmp.MyDisplayTabControl.MyCopyStep.IsEnhancedStep)
|
||||
//{
|
||||
// btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||
// btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||
// btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||
// return;
|
||||
//}
|
||||
if ((!MyItemInfo.IsEnhancedSection && !MyItemInfo.IsEnhancedStep) && tmp.MyDisplayTabControl.MyCopyStep.IsEnhancedStep)
|
||||
{
|
||||
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
|
||||
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||
return;
|
||||
}
|
||||
// enhanced: if 'from' step is not enhanced, only allow paste before/after
|
||||
if (MyItemInfo.IsHigh && !MyItemInfo.IsEnhancedStep)
|
||||
{
|
||||
StepConfig stepToCfg = MyItemInfo.MyConfig as StepConfig;
|
||||
if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count>0 && stepToCfg.MyEnhancedDocuments[0].Type != 0)
|
||||
{
|
||||
// Current selected step is source (i.e. has enhanced links to enhanced steps)
|
||||
// check if 'from' step is non. If so, allow paste before/after but not replace
|
||||
if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh)
|
||||
{
|
||||
StepConfig fromCfg = tmp.MyDisplayTabControl.MyCopyStep.MyConfig as StepConfig;
|
||||
if (fromCfg != null && (fromCfg.MyEnhancedDocuments==null || fromCfg.MyEnhancedDocuments.Count==0))
|
||||
{
|
||||
btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//copy item is high level step
|
||||
// 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))
|
||||
@@ -2293,7 +2315,7 @@ namespace Volian.Controls.Library
|
||||
|
||||
bool surpressMessageBox = (e == null);
|
||||
SectionInfo si = MyEditItem.MyItemInfo as SectionInfo;
|
||||
if (si != null) // KBR What if linked to an enhanced section?
|
||||
if (si != null)
|
||||
{
|
||||
string msg = si.HasChildren ? "Are you sure you want to delete this section and its steps?" : "Are you sure you want to delete this section?";
|
||||
DialogResult result = MessageBox.Show(msg, "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
|
Reference in New Issue
Block a user