// Create a split command preserving used/TODO status, and optionally transferring the role to the next node public static SplitAudio AppendSplitCommandWithProperties(ProjectView.ProjectView view, CompositeCommand command, PhraseNode phrase, double time, bool transferRole) { SplitAudio split = new SplitAudio(view, phrase, time); if (split.Node.TODO) { command.ChildCommands.Insert(command.ChildCommands.Count, new Commands.Node.ToggleNodeTODO(view, split.NodeAfter)); } if (!split.Node.Used) { command.ChildCommands.Insert(command.ChildCommands.Count, new Commands.Node.ToggleNodeUsed(view, split.NodeAfter)); } if (split.Node.Role_ == EmptyNode.Role.Silence || phrase.Role_ == EmptyNode.Role.Custom) { Commands.Node.AssignRole copyRoleCmd = new Commands.Node.AssignRole(view, split.NodeAfter, phrase.Role_, phrase.CustomRole); copyRoleCmd.UpdateSelection = false; command.ChildCommands.Insert(command.ChildCommands.Count, copyRoleCmd); } command.ChildCommands.Insert(command.ChildCommands.Count, split); if (transferRole && phrase.Role_ != EmptyNode.Role.Plain) { command.ChildCommands.Insert(command.ChildCommands.Count, new Commands.Node.AssignRole(view, phrase, EmptyNode.Role.Plain)); if (phrase.Role_ == EmptyNode.Role.Page) { command.ChildCommands.Insert(command.ChildCommands.Count, new Commands.Node.SetPageNumber(view, split.NodeAfter, phrase.PageNumber.Clone())); } else { command.ChildCommands.Insert(command.ChildCommands.Count, new Commands.Node.AssignRole(view, split.NodeAfter, phrase.Role_, phrase.CustomRole)); } } return(split); }
public override void UnExecute() { SplitAudio.Split(View, mNode, mNextNode, mSplitTime, UpdateSelection, false); if (!m_IsNextNodeRooted) { mNextNode.Detach(); } base.UnExecute(); }
/// <summary> /// Get the first node after the split created by a split command. /// </summary> public static PhraseNode GetSplitNode(urakawa.command.Command command) { CompositeCommand c = command as CompositeCommand; SplitAudio split = command as SplitAudio; if (c != null) { System.Collections.Generic.List <urakawa.command.Command> commands = c.ChildCommands.ContentsAs_ListCopy; int i = commands.Count - 1; for (; i >= 0 && !(commands[i] is SplitAudio); --i) { } if (i >= 0) { split = commands[i] as SplitAudio; } } return(split == null ? null : split.NodeAfter); }
/// <summary> /// Get the node after the split node created by a crop command. /// </summary> public static PhraseNode GetCropNode(urakawa.command.Command command, PhraseNode splitNode) { CompositeCommand c = command as CompositeCommand; SplitAudio split = null; if (c != null) { System.Collections.Generic.List <urakawa.command.Command> commands = c.ChildCommands.ContentsAs_ListCopy; int i = 0; for (; i < commands.Count && !((commands[i] is SplitAudio) && ((SplitAudio)commands[i]).NodeAfter != splitNode); ++i) { } if (i < commands.Count) { split = commands[i] as SplitAudio; } } return(split == null ? null : split.NodeAfter); }