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
This commit is contained in:
Rich 2010-10-20 14:45:12 +00:00
parent 18b9fb3c2e
commit 1e0564f35a
2 changed files with 23 additions and 8 deletions

View File

@ -558,25 +558,30 @@ namespace Volian.Controls.Library
string linkstr = m.Groups[2].Value; string linkstr = m.Groups[2].Value;
string[] tparts = linkstr.Split(" ".ToCharArray()); string[] tparts = linkstr.Split(" ".ToCharArray());
int type = System.Convert.ToInt32(tparts[0]); 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; bool dispose1 = false;
Item itm1 = null; Item itm1 = null;
bool dispose2 = false; bool dispose2 = false;
Item itm2 = null; 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; dispose1 = true;
itm1 = Item.Get(tr1); 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 else
itm1 = itm; // a transition that points to itself should not dispose
if (dte.Type == E_TextElementType.TransitionRange)
{ {
dispose2 = true; 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); 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); //Console.WriteLine("CT {0},{1},{2},{3}", ct.TransitionID, itm.ItemID, itm.MyContent.MyContentUnique, itm.MyContent.ContentTransitions.Count);
ct.TranType = type; ct.TranType = type;

View File

@ -1168,9 +1168,19 @@ namespace Volian.Controls.Library
private void AddSubStep() 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); MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
if(skipTable) MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
InsertSiblingBeforeOrAfter("before"); InsertSiblingBeforeOrAfter("before");
} }
else else