public void CopyAfterBlock(Block afterBlock) { IEnumerable <Block> blocksToCopy = PrepareBlocksToMove(); IEnumerable <Block> newBlocks = BlockActions.Clone(blocksToCopy); afterBlock.AppendBlocks(newBlocks); }
public virtual void Clear() { if (this.Children.Count == 0) { return; } BlockActions.Delete(this.Children.ToArray()); }
public override string ToString() { var block = SJ(input: BlockActions.Select(el => el.ToString())); var id = InitialDamage.Count == 0 ? "" : $"D{string.Join(',', InitialDamage)}"; var ba = string.Join(',', BlockActions.Select(el => el.Desc)); var da = string.Join(',', DamageAdjustments.Select(el => el.Desc)); var s = string.Join(',', Status.Select(el => el.ToString())); var res = SJ('|', new List <string>() { block, id, ba, da, s }.Where(el => !string.IsNullOrEmpty(el))); return(res); }
/// <summary> /// Deletes the current block. /// Changes the Undo stack. /// </summary> public virtual void Delete() { BlockActions.DeleteBlock(this); //if (this.Parent == null) //{ // return; //} //if (this.Root != null && this.Root.ActionManager != null) //{ // RemoveBlocksAction Action = new RemoveBlocksAction(this.Parent); // Action.PrepareBlocks(GetBlocksToDelete()); // this.Root.ActionManager.RecordAction(Action); //} //else //{ // this.Parent.Children.Delete(GetBlocksToDelete()); //} }
public void AcceptBlocks(DragQuery draggedBlocks, DragQueryResult whereTo) { if (whereTo.DropTargetContainer.CanAcceptBlocks(draggedBlocks) == null) { return; } IEnumerable <Block> toDrop; if (draggedBlocks.ShouldCopyInsteadOfMove) { toDrop = BlockActions.Clone(draggedBlocks); toDrop = IntersperseWithSeparators(toDrop, whereTo); if (whereTo.HowToDrop == DropTargetInfo.DropBeforeTarget) { whereTo.DropTarget.PrependBlocks(toDrop); } else { whereTo.DropTarget.AppendBlocks(toDrop); } } else { using (Root.Transaction()) { foreach (Block b in draggedBlocks) { b.Delete(); } toDrop = IntersperseWithSeparators(draggedBlocks, whereTo); if (whereTo.HowToDrop == DropTargetInfo.DropBeforeTarget) { whereTo.DropTarget.PrependBlocks(toDrop); } else { whereTo.DropTarget.AppendBlocks(toDrop); } } } }
public static void InsertNewLineFromCurrent(Block current, Block newLine) { if (current == null) { return; } TokenLineBlock parent = current.Parent as TokenLineBlock; if (parent == null) { return; } if (current.Prev == null && current.Next != null) { BlockActions.Prepend(parent, newLine); } else { parent.AppendBlocks(newLine); } }
private void AssignSetAccessor(PropertySetBlock value) { if (value == null && mSetAccessor != null) { if (GetAccessor == null) { this.ReplaceWithField(); } else { BlockActions.DeleteBlock(mSetAccessor); } } else if (mSetAccessor == null && value != null) { this.VMembers.Add(value); } else if (mSetAccessor != null && value != null) { mSetAccessor.Replace(value); } mSetAccessor = value; }
public void MoveBeforeBlock(Block beforeChild) { BlockActions.MoveBlocksBeforeBlock(PrepareBlocksToMove(), beforeChild); }
public void MoveAfterBlock(Block afterChild) { BlockActions.MoveBlocksAfterBlock(PrepareBlocksToMove(), afterChild); }
public void Move(ContainerBlock newParent) { BlockActions.MoveBlocks(newParent, PrepareBlocksToMove()); }
internal void AddBlockStep(string v, double v2, int?order = null, bool additive = true) { BlockActions.Add(new FightStep(v, v2, order, additive)); }