Exemple #1
0
        // Paste a node in or after another node.
        protected virtual urakawa.command.Command PasteCommandNode(ProjectView.ProjectView view, bool allowAutoSpecialRoleAssign)   //@AssociateNode
        {
            Commands.Node.Paste paste = new Commands.Node.Paste(view);
            paste.AllowRoleChangeAccordingToSurroundingSpecialNodes = allowAutoSpecialRoleAssign;   //@AssociateNode
            CompositeCommand p = view.Presentation.CreateCompositeCommand(paste.ShortDescription);

            p.ChildCommands.Insert(p.ChildCommands.Count, paste);
            if (paste.DeleteSelectedBlock)
            {
                Commands.Node.Delete delete = new Commands.Node.Delete(view, view.Selection.Node);
                delete.UpdateSelection = false;
                p.ChildCommands.Insert(p.ChildCommands.Count, delete);
            }
            // If the node to paste is a heading phrase, revert to a plain phrase.
            // We consider that being a heading is more of a section things (copying sections conserve the heading.)
            if (paste.Copy is PhraseNode && ((PhraseNode)paste.Copy).Role_ == EmptyNode.Role.Heading)
            {
                Commands.Node.AssignRole behead =
                    new Commands.Node.AssignRole(view, (EmptyNode)paste.Copy, EmptyNode.Role.Plain);
                behead.UpdateSelection = false;
                p.ChildCommands.Insert(p.ChildCommands.Count, behead);
            }
            if (paste.Copy.Used && !paste.CopyParent.Used)
            {
                view.AppendMakeUnused(p, paste.Copy);
            }
            return(p);
        }
Exemple #2
0
 public override void Execute()
 {
     mParent.Insert(mNode, mIndex);
     if (AllowRoleChangeAccordingToSurroundingSpecialNodes)
     {
         AssignRole.AssignRoleToEmptyNodeSurroundedByCustomRoles(mNode);
     }
     if (UpdateSelection)
     {
         View.Selection = mSelection;
     }
     TriggerProgressChanged();
 }
Exemple #3
0
 // Perform a split given a time and a node with no audio, optionally updating the selection in the view afterward.
 public static void Split(ProjectView.ProjectView view, PhraseNode node, PhraseNode nodeAfter, Time splitTime,
                          bool updateSelection, bool allowSpecialRoleMarkForSurrounding)
 {
     nodeAfter.Audio = node.SplitAudio(splitTime);
     node.InsertAfterSelf(nodeAfter);
     if (allowSpecialRoleMarkForSurrounding)
     {
         AssignRole.AssignRoleToEmptyNodeSurroundedByCustomRoles(nodeAfter);
     }
     if (updateSelection)
     {
         view.SelectedBlockNode = nodeAfter;
     }
     view.UpdateBlocksLabelInStrip(node.AncestorAs <SectionNode>());
 }
Exemple #4
0
 public override void Execute()
 {
     mParent.Insert(mCopy, mIndex);
     if (AllowRoleChangeAccordingToSurroundingSpecialNodes)
     {
         AssignRole.AssignRoleToEmptyNodeSurroundedByCustomRoles(mCopy);
     }
     if (UpdateSelection)
     {
         View.Selection = mSelection;
     }
     if (mParent != null && mParent is SectionNode)
     {
         View.UpdateBlocksLabelInStrip((SectionNode)mParent);
     }
 }