From 1e0564f35a3c1c7333b7578e942176cfd046ed5c Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 20 Oct 2010 14:45:12 +0000 Subject: [PATCH] Corrected Logic in ProcessRoTanChanges to save transitions Fixed logic in AddSubStep to show menu if no current substeps exist, even if the step has a table --- PROMS/Volian.Controls.Library/DisplayText.cs | 19 ++++++++++++------- .../Volian.Controls.Library/StepTabRibbon.cs | 12 +++++++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index ff96f65c..efa3cf03 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -558,25 +558,30 @@ namespace Volian.Controls.Library string linkstr = m.Groups[2].Value; string[] tparts = linkstr.Split(" ".ToCharArray()); int type = System.Convert.ToInt32(tparts[0]); - int tr1 = System.Convert.ToInt32(tparts[2]); // tparts[1] is token for tranid + int tr1 = System.Convert.ToInt32(tparts[2]); // tparts[2] is token for tranid + int tr2 = tr1; + if(tparts.Length > 3) + tr2 = System.Convert.ToInt32(tparts[3]); // tparts[3] is token for rangeid bool dispose1 = false; Item itm1 = null; bool dispose2 = false; Item itm2 = null; - if (itm.ItemID != tr1) + if (itm.ItemID == tr1) + itm1 = itm; // a transition that points to itself should not dispose + else { dispose1 = true; itm1 = Item.Get(tr1); } + if (itm.ItemID == tr2) + itm2 = itm; // a transition that points to itself should not dispose + else if (tr1 == tr2) + itm2 = itm1; // if both destinations are the same only dispose the first one else - itm1 = itm; // a transition that points to itself should not dispose - if (dte.Type == E_TextElementType.TransitionRange) { dispose2 = true; - itm2 = Item.Get(System.Convert.ToInt32(tparts[3])); + itm2 = Item.Get(tr2); } - else - itm2 = itm1; ContentTransition ct = itm.MyContent.ContentTransitions.Add(itm1, itm2); //Console.WriteLine("CT {0},{1},{2},{3}", ct.TransitionID, itm.ItemID, itm.MyContent.MyContentUnique, itm.MyContent.ContentTransitions.Count); ct.TranType = type; diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index fc035cee..ad9056e3 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -1168,9 +1168,19 @@ namespace Volian.Controls.Library private void AddSubStep() { - if (MyStepItem.NextDownStepItem.MyItemInfo.MyParent.ItemID == MyStepItem.MyID) + StepItem nextDownStepItem = MyStepItem.NextDownStepItem; + bool skipTable = false; + // If the step has a table, move past it before adding a substep + if (nextDownStepItem != null && nextDownStepItem.MyItemInfo.MyParent.ItemID == MyStepItem.MyID && + nextDownStepItem.MyItemInfo.IsTablePart) + { + nextDownStepItem = nextDownStepItem.NextDownStepItem; + skipTable = true; + } + if (nextDownStepItem != null && nextDownStepItem.MyItemInfo.MyParent.ItemID == MyStepItem.MyID) { MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); + if(skipTable) MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); InsertSiblingBeforeOrAfter("before"); } else