public Paste(ProjectView.ProjectView view, double pasteTime) : base(view) { mNode = view.SelectedNodeAs <PhraseNode>(); //AudioSelection selection = (AudioSelection)view.Selection; mMediaBefore = mNode.Audio.Copy(); mMediaAfter = mMediaBefore.Copy(); urakawa.media.data.audio.ManagedAudioMedia copy; if (view.Clipboard is AudioClipboard) { AudioClipboard clipboard = (AudioClipboard)view.Clipboard; copy = view.Presentation.MediaFactory.CreateManagedAudioMedia(); WavAudioMediaData mediaData = ((WavAudioMediaData)((PhraseNode)clipboard.Node).Audio.AudioMediaData).Copy( new Time((long)(clipboard.AudioRange.SelectionBeginTime * Time.TIME_UNIT)), new Time((long)(clipboard.AudioRange.SelectionEndTime * Time.TIME_UNIT)) ); copy.AudioMediaData = mediaData; } else { copy = ((PhraseNode)view.Clipboard.Node).Audio.Copy(); } urakawa.media.data.audio.ManagedAudioMedia after; after = mMediaAfter.Split(new Time((long)(pasteTime * Time.TIME_UNIT))); double begin = mMediaAfter.Duration.AsMilliseconds; mSelectionAfter = new AudioSelection(mNode, view.Selection.Control, new AudioRange(begin, begin + copy.Duration.AsMilliseconds)); mMediaAfter.AudioMediaData.MergeWith(copy.AudioMediaData); mMediaAfter.AudioMediaData.MergeWith(after.AudioMediaData); SetDescriptions(Localizer.Message("paste_audio")); }
/// <summary> /// Create a section properties dialog to be shown by ShowDialog() for the given view. /// </summary> public SectionProperties(ProjectView.ProjectView View) { InitializeComponent(); mView = View; mNode = View.SelectedNodeAs <SectionNode>(); helpProvider1.HelpNamespace = Localizer.Message("CHMhelp_file_name"); helpProvider1.SetHelpNavigator(this, HelpNavigator.Topic); helpProvider1.SetHelpKeyword(this, "HTML Files/Creating a DTB/Working with Sections/Section Properties.htm"); if (mView.ObiForm.Settings.ObiFont != this.Font.Name) { this.Font = new Font(mView.ObiForm.Settings.ObiFont, this.Font.Size, FontStyle.Regular);//@fontconfig } }
public static CompositeCommand GetSplitCommand(ProjectView.ProjectView view, bool transferProperties) { PhraseNode phrase = view.TransportBar.PlaybackPhrase; if (phrase == null) { phrase = view.SelectedNodeAs <PhraseNode>(); } if (phrase != null) { double begin = view.TransportBar.SplitBeginTime; double end = view.TransportBar.SplitEndTime; if (begin >= phrase.Duration) { begin = 0.0; } if (end >= phrase.Duration) { end = 0.0; } if (begin > 0.0 || end > 0.0) { CompositeCommand command = view.Presentation.CreateCompositeCommand(Localizer.Message("split_phrase")); if (end > 0.0) { AppendSplitCommandWithProperties(view, command, phrase, end, false); } if (begin > 0.0) { if (transferProperties) { AppendSplitCommandWithProperties(view, command, phrase, begin, view.Selection is AudioSelection && ((AudioSelection)view.Selection).AudioRange != null && !((AudioSelection)view.Selection).AudioRange.HasCursor && !(phrase.Role_ == EmptyNode.Role.Silence || phrase.Role_ == EmptyNode.Role.Custom)); } else { AppendSplitCommandWithProperties(view, command, phrase, begin, false); } } if (command.ChildCommands.Count > 0) { return(command); } } } return(null); }
/// <summary> /// Create the dialog to be shown by ShowDialog() for the given view. /// </summary> public PhraseProperties(ProjectView.ProjectView view, bool SetCustomClass) { InitializeComponent(); mView = view; mNode = view.SelectedNodeAs <EmptyNode>(); m_IsSetCustomClass = SetCustomClass; helpProvider1.HelpNamespace = Localizer.Message("CHMhelp_file_name"); helpProvider1.SetHelpNavigator(this, HelpNavigator.Topic); helpProvider1.SetHelpKeyword(this, "HTML Files/Creating a DTB/Working with Phrases/Phrase Properties.htm"); if (mView.TransportBar.IsPlayerActive) { m_IsPause = true; } if (mView.ObiForm.Settings.ObiFont != this.Font.Name) { this.Font = new Font(view.ObiForm.Settings.ObiFont, this.Font.Size, FontStyle.Regular);//@fontconfig } }
public static CompositeCommand GetMergeCommand(ProjectView.ProjectView view) { EmptyNode node = view.SelectedNodeAs <EmptyNode>(); return(GetMergeCommand(view, node, node.NextSibling as EmptyNode)); }