B2016-130: Copy and paste replace steps causing missing and duplicate items in tree (problems with ‘NextItems’)

This commit is contained in:
2017-08-07 13:05:02 +00:00
parent e8ae40ef7f
commit 20a07c6a3e
12 changed files with 135 additions and 31 deletions

View File

@@ -91,7 +91,7 @@ namespace Volian.Controls.Library
}
else
lstCBSteps.Items.Add(startitm, CheckState.Unchecked);
startitm = (startitm.NextItem != null && startitm.NextItems.Count > 0 ? startitm.NextItems[0] : null);
startitm = startitm.GetNext();
}
}
private void listBoxFoldouts_SelectedIndexChanged(object sender, EventArgs e)

View File

@@ -520,7 +520,7 @@ namespace Volian.Controls.Library
// itm.UserID = Volian.Base.Library.VlnSettings.UserID;
// itm.Save();
//}
startitm = (startitm.NextItem != null && startitm.NextItems.Count > 0 ? startitm.NextItems[0] : null);
startitm = startitm.GetNext();
}
msgBox = string.Format("All Step Types at this level were changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]);
}

View File

@@ -513,7 +513,7 @@ namespace Volian.Controls.Library
tvTran.SelectedNode = tvTran.Nodes[active];
setsel = true;
}
startitm = (startitm.NextItem != null && startitm.NextItems.Count > 0 ? startitm.NextItems[0] : null);
startitm = startitm.GetNext();
}
if (!setsel) tvTran.SelectedNode = tvTran.Nodes[0];
tvTran.BeforeExpand += new TreeViewCancelEventHandler(tvTran_BeforeExpand);
@@ -544,7 +544,7 @@ namespace Volian.Controls.Library
if (secitm.ItemID == secstart) cbTranSects.SelectedIndex = active;
}
if (secitm.Sections != null && secitm.Sections.Count > 0) cbTranSectsFillIn(secitm.Sections[0], secstart, false);
secitm = (secitm.NextItem != null && secitm.NextItems.Count > 0 ? secitm.NextItems[0] : null);
secitm = secitm.GetNext();
}
if (cbTranSects.SelectedIndex == -1) cbTranSects.SelectedIndex = 0;
cbTranSects.Refresh();
@@ -562,7 +562,7 @@ namespace Volian.Controls.Library
int active = cbTranProcs.Items.Add(prcitm);
if (_CurrentProcedure.ContentID == prcitm.MyContent.ContentID) _CurrentProcIndex = active;
if (prcitm.MyContent.ContentID == selitm.MyContent.ContentID) cbTranProcs.SelectedIndex = active;
prcitm = (prcitm.NextItem != null && prcitm.NextItems.Count > 0 ? prcitm.NextItems[0] : null);
prcitm = prcitm.GetNext();
}
}
private void SetControlsEnabling()

View File

@@ -3393,7 +3393,7 @@ namespace Volian.Controls.Library
}
}
// if on a caution or note check the step below me, which is really my activeparent (cautions/notes are above their respective parent)
if ((itm.IsCaution || itm.IsNote) && (itm.NextItem == null || itm.NextItemCount == 0) && (itm.ActiveParent as ItemInfo).SupInfos != null && (itm.ActiveParent as ItemInfo).SupInfos.Count > 0)
if ((itm.IsCaution || itm.IsNote) && itm.NextItem == null && (itm.ActiveParent as ItemInfo).SupInfos != null && (itm.ActiveParent as ItemInfo).SupInfos.Count > 0)
return GetEditItemFromItemID((itm.ActiveParent as ItemInfo).ItemID);
// Finally check substeps:

View File

@@ -949,7 +949,8 @@ namespace Volian.Controls.Library
{
if (lookAtSub && ii.Sections != null) return TopPart(ii.Sections[0]);
if (lookAtSub && ii.Steps != null) return TopPart(ii.Steps[0]);
if (ii.IsSection && ii.NextItems != null && ii.NextItems.Count > 0) return TopPart(ii.NextItems[0]);
ItemInfo nxt = ii.GetNext();
if (nxt != null) return TopPart(nxt);
}
else
{
@@ -972,7 +973,8 @@ namespace Volian.Controls.Library
if (lookAtRNO && ii.RNOs != null && ii.RNOLevel >= ii.ColumnMode) return TopPart(ii.RNOs[0]);
// Nextsibling - go to top part of sibling
// TODO: RHM - NextItems was not null when it should have been after delete of a note below a caution
if (ii.NextItems != null && ii.NextItems.Count > 0) return TopPart(ii.NextItems[0]);
ItemInfo nxt = ii.GetNext();
if (nxt != null) return TopPart(nxt);
// If on caution, if parent has note - go to note
if (ii.IsCautionPart && ii.MyParent.Notes != null) return ii.MyParent.Notes[0];
// If on caution, if parent !has note or if on note go to parent
@@ -1001,7 +1003,7 @@ namespace Volian.Controls.Library
ii = ii.LastSibling;
break;
case Keys.PageDown:
ii = ii.NextItems != null && ii.NextItems.Count > 0 ? ii.NextItems[0] : null;
ii = ii.GetNext();
break;
case Keys.PageUp:
ii = ii.MyPrevious;