internal IBlock StackBelow(TopLevelScript b1, IBlock b2) { ParentRelationship b2_oldRelationship = b2.ParentRelationship; BlockStack b3 = MergeStacks(b2, b1.Block); RemoveScript(b1); Become(b2_oldRelationship, b2, b3); return(b3); }
// 'a' shall become 'b', how? // - If a is toplevel, remove it and add b in its place // - If it isn't the parent has to replace a with b void Become(ParentRelationship pr, IBlock a, IBlock b) { if (pr.Type == ParentRelationshipType.None) { TopLevelScript tl = FindScript(a); RemoveScript(tl); AddScript(new TopLevelScript(tl.Location, b, this)); } else { switch (pr.Type) { case ParentRelationshipType.Arg: ((InvokationBlock)pr.Parent).SetArg(pr.Index, b); break; case ParentRelationshipType.Stack: // break; } } }
public TextBlock(string text) { ParentRelationship = new ParentRelationship(); this.text = text; this.TextChanged += delegate(object sender, string newStr) { }; }