Ejemplo n.º 1
0
        public static void AppendSecondLineToFirst(Block lowerSeparator)
        {
            if (lowerSeparator == null ||
                lowerSeparator.Parent == null ||
                lowerSeparator.Parent.Prev == null ||
                lowerSeparator.Prev != null)
            {
                return;
            }

            ContainerBlock oldParent = lowerSeparator.Parent;
            ContainerBlock newParent = oldParent.Prev as ContainerBlock;
            Block          newFocus  = null;

            if (newParent == null)
            {
                return;
            }
            else
            {
                newFocus = newParent.FindLastFocusableBlock();
            }

            ActionBuilder a = new ActionBuilder(lowerSeparator.Root);

            if (lowerSeparator.Next != null)
            {
                foreach (Block child in oldParent.Children)
                {
                    if (child != lowerSeparator)
                    {
                        a.MoveBlock(newParent, child);
                    }
                }
            }

            a.DeleteBlock(oldParent);

            a.RunWithoutRedraw();

            if (newFocus != null)
            {
                newFocus.SetFocus(true);
            }
        }
Ejemplo n.º 2
0
        public static void AppendLineBelowToCurrentLine(Block higherSeparator)
        {
            if (higherSeparator == null ||
                higherSeparator.Parent == null ||
                higherSeparator.Parent.Next == null ||
                higherSeparator.Next != null)
            {
                return;
            }

            ContainerBlock newParent = higherSeparator.Parent;
            ContainerBlock oldParent = newParent.Next as ContainerBlock;
            Block          newFocus  = null;

            if (oldParent == null)
            {
                return;
            }
            else
            {
                newFocus = oldParent.FindFirstFocusableBlock();
            }

            ActionBuilder a = new ActionBuilder(higherSeparator.Root);

            a.DeleteBlock(higherSeparator);

            foreach (Block child in oldParent.Children)
            {
                a.MoveBlock(newParent, child);
            }

            a.DeleteBlock(oldParent);

            a.RunWithoutRedraw();

            if (newFocus != null)
            {
                newFocus.SetFocus(true);
            }
        }