/// <summary> /// Get a delete command handling the delete all audio case gracefully. /// </summary> public static urakawa.command.Command GetCommand(Obi.ProjectView.ProjectView view) { Delete command = new Delete(view); if (!command.mHasAudioAfterDeleted && command.mSplitTimeBegin.AsMilliseconds == 0.0) { // Delete the whole audio urakawa.command.CompositeCommand composite = view.Presentation.CreateCompositeCommand(command.ShortDescription); EmptyNode empty = view.Presentation.TreeNodeFactory.Create <EmptyNode>(); composite.ChildCommands.Insert(composite.ChildCommands.Count, new Commands.Node.AddEmptyNode(view, empty, command.mNode.ParentAs <ObiNode>(), command.mNode.Index) ); Commands.Node.MergeAudio.AppendCopyNodeAttributes(composite, view, command.mNode, empty); Commands.Node.Delete delete = new Commands.Node.Delete(view, command.mNode); delete.UpdateSelection = false; composite.ChildCommands.Insert(composite.ChildCommands.Count, delete); return(composite); } else { return(command); } }
public static urakawa.command.CompositeCommand GetCompositeCommandForAssigningRoleOnMultipleNodes(ProjectView.ProjectView view, EmptyNode startNode, EmptyNode endNode, EmptyNode.Role role, string customeClassName) { SectionNode section = startNode.ParentAs <SectionNode>(); urakawa.command.CompositeCommand command = view.Presentation.CommandFactory.CreateCompositeCommand(); for (int i = startNode.Index; i <= endNode.Index; i++) { command.ChildCommands.Insert(command.ChildCommands.Count, new Commands.Node.AssignRole(view, section.PhraseChild(i), role, customeClassName)); } return(command); }