/// <summary> /// Execute a command, but warn first. /// </summary> public void Do(urakawa.command.Command command) { if (command != null) { if (BeforeCommandExecuted != null) { BeforeCommandExecuted(this, new urakawa.events.command.CommandEventArgs(command)); } UndoRedoManager.Execute(command); } }
/// <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); }