Logo Search packages:      
Sourcecode: kdenlive version File versions

bool TrackPanelRazorFunction::mousePressed ( Gui::KTrackPanel panel,
QMouseEvent *  event 
) [virtual]

A mouse button has been pressed. Returns true if we want to handle this event

Implements TrackPanelFunction.

Definition at line 76 of file trackpanelrazorfunction.cpp.

References Gui::KdenliveApp::addCommand(), Gui::KTrackPanel::documentTrackIndex(), KdenliveDoc::framesPerSecond(), DocTrackBase::getClipAt(), Gui::KTrackPanel::hasDocumentTrackIndex(), Gui::KTimeLine::mapLocalToValue(), Gui::KTimeLine::timeUnderMouse(), and KdenliveDoc::track().

{
    if (panel->hasDocumentTrackIndex()) {
      DocTrackBase *track =
          m_document->track(panel->documentTrackIndex());
      if (track) {
            GenTime mouseTime((int)(m_timeline->mapLocalToValue(event->x())),
            m_document->framesPerSecond());
          GenTime roundedMouseTime =
            m_timeline->timeUnderMouse(event->x());

          m_clipUnderMouse = track->getClipAt(mouseTime);
          if (m_clipUnderMouse) {
            //m_document->activateSceneListGeneration(false);
            if (event->state() & ShiftButton) {
                m_app->
                  addCommand(Command::DocumentMacroCommands::
                  razorAllClipsAt(m_document, roundedMouseTime),
                  true);
            } else {
                  m_app->addCommand(new Command::KRazorClipsCommand(m_app, m_document, *track, roundedMouseTime), true);
                /*m_app->
                  addCommand(Command::DocumentMacroCommands::
                  razorClipAt(m_document, *track, roundedMouseTime),
                  true);*/
            }
            return true;
          }
      }
    }
    return true;
}


Generated by  Doxygen 1.6.0   Back to index