Handle the deleting of a step marked for copy

This commit is contained in:
2013-08-01 21:41:26 +00:00
parent 75991ef8e3
commit 2ce0990d62
3 changed files with 97 additions and 43 deletions

View File

@@ -645,6 +645,7 @@ namespace Volian.Controls.Library
btnCMGoTo.Enabled = btnGoTo.Enabled = true;
else
{
if (_MyStepRTB == null) return;
if (_MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength))
{
// if selected text = ?, i.e. a missing/undefined destination, don't allow go to
@@ -1810,6 +1811,15 @@ namespace Volian.Controls.Library
public void btnDelStep_Click(object sender, EventArgs e)
{
bool clearCopyStep = false;
StepTabPanel tmp = Parent as StepTabPanel;
if (tmp.MyDisplayTabControl.MyCopyStep != null &&
tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyEditItem.MyItemInfo.ItemID)
{
if (MessageBox.Show("Are you sure?\n\nIf you delete this step you will not able to paste it.\nYou should paste it before you delete it.", "Attempting to delete copied step.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return;
clearCopyStep = true;
}
bool surpressMessageBox = (e == null);
SectionInfo si = MyEditItem.MyItemInfo as SectionInfo;
if (si != null)
@@ -1836,7 +1846,7 @@ namespace Volian.Controls.Library
StepInfo stpi = MyEditItem.MyItemInfo as StepInfo;
if (stpi == null) // not sure that it will every get here!
{
MessageBox.Show("Unknown type {0}, cannot delete!",MyEditItem.MyItemInfo.GetType().Name);
MessageBox.Show("Unknown type {0}, cannot delete!", MyEditItem.MyItemInfo.GetType().Name);
return;
}
if (!surpressMessageBox)
@@ -1858,10 +1868,24 @@ namespace Volian.Controls.Library
}
MyEditItem.IdentifyChildren(false);
if (results == DialogResult.Yes)
{
MyEditItem.RemoveItem();
if (clearCopyStep)
{
tmp.MyDisplayTabControl.MyCopyStep = null;
SetPasteButtonEnabled();
}
}
}
else
{
MyEditItem.RemoveItem();
if (clearCopyStep)
{
tmp.MyDisplayTabControl.MyCopyStep = null;
SetPasteButtonEnabled();
}
}
}
private void btnCMIns_PopupClose(object sender, EventArgs e)