Logo Search packages:      
Sourcecode: kdenlive version File versions

void Gui::KdenliveApp::slotEditPaste (  )  [slot]

paste the clipboard into the document

Definition at line 2462 of file kdenlive.cpp.

References KdenliveDoc::activateSceneListGeneration(), DocTrackBase::addClip(), addCommand(), DocTrackBase::checkTrackLength(), DocClipProject::duration(), effectList(), KdenliveDoc::framesPerSecond(), getDocument(), m_doc, Gui::KTrackView::panelAt(), KdenliveDoc::projectClip(), slotStatusMsg(), Gui::KTimeLine::timeUnderMouse(), KdenliveDoc::track(), and Gui::KTimeLine::trackView().

Referenced by initActions().

    {
      if (!m_copiedClip) {
            KMessageBox::sorry(this, i18n("No clip in clipboard"));
            return;
        }
      slotStatusMsg(i18n("Pasting clip %1.").arg(m_copiedClip->name()));
      QPoint position = mousePosition();
      int ix = m_timeline->trackView()->panelAt(m_timeline->trackView()->mapFromGlobal(position).y())->documentTrackIndex();

      GenTime insertTime = m_timeline->timeUnderMouse(m_timeline->trackView()->mapFromGlobal(position).x());

      DocClipRef *m_pastedClip = m_copiedClip->clone(getDocument());

      DocClipRefList selectedClip;
      selectedClip.append(m_pastedClip);
      if (getDocument()->projectClip().canAddClipsToTracks(selectedClip, ix, insertTime)) {
            m_pastedClip->setParentTrack(getDocument()->track(ix), ix);
            m_pastedClip->moveTrackStart(insertTime);
            getDocument()->track(ix)->addClip(m_pastedClip, false);

            KMacroCommand *macroCommand = new KMacroCommand(i18n("Paste"));
            macroCommand->addCommand(Command::KSelectClipCommand::selectNone(getDocument()));
            macroCommand->addCommand(new Command::KSelectClipCommand(getDocument(), m_pastedClip, true));
            addCommand(macroCommand, true);

            addCommand(new Command::KAddRefClipCommand(effectList(), *m_doc, m_pastedClip, true), false);

            if (m_pastedClip->trackEnd() > getDocument()->projectClip().duration())
                   getDocument()->track(ix)->checkTrackLength();
            getDocument()->activateSceneListGeneration(true);
            slotStatusMsg(i18n("Ready."));
      }
      else {
            slotStatusMsg(i18n("Cannot past clip %1 on track %2 at %3").arg(m_pastedClip->name()).arg(ix).arg(Timecode::getEasyTimecode(insertTime, m_doc->framesPerSecond())));
      }
    }


Generated by  Doxygen 1.6.0   Back to index