Logo Search packages:      
Sourcecode: kdenlive version File versions

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

Displays the context menu for the timeline

Definition at line 4235 of file kdenlive.cpp.

References addCommand(), DocTrackBase::getClipAt(), getDocument(), m_menuPosition, Gui::KTrackView::panelAt(), Gui::KTimeLine::selectTrack(), Gui::KTimeLine::timeUnderMouse(), KdenliveDoc::track(), and Gui::KTimeLine::trackView().

Referenced by initView().

                                                     {
      int ix = m_timeline->trackView()->panelAt(m_timeline->trackView()->mapFromGlobal(QCursor::pos()).y())->documentTrackIndex();
      DocTrackBase *track = getDocument()->track(ix);
      GenTime mouseTime;
      mouseTime = m_timeline->timeUnderMouse(m_timeline->trackView()->mapFromGlobal(QCursor::pos()).x());
      DocClipRef *clip = track->getClipAt(mouseTime);
      if (clip) {
          // select clip under mouse
        if (!getDocument()->projectClip().clipSelected(clip)) {
            KMacroCommand *macroCommand = new KMacroCommand(i18n("Select Clip"));
            macroCommand->addCommand(Command::KSelectClipCommand::selectNone(getDocument()));
            macroCommand->addCommand(new Command::KSelectClipCommand(getDocument(), clip, true));
            addCommand(macroCommand, true);
            slotCheckTransition(clip);
        }
        removeEffectsMenu->clear();
        QStringList clipEffects = clip->clipEffectNames();
        uint ix = 0;
        for (QStringList::Iterator it = clipEffects.begin(); it != clipEffects.end(); ++it) {
            removeEffectsMenu->insertItem(*it, ix);
            ix++;
        }
          m_timelinePopupMenu = (QPopupMenu *) factory()->container("timeline_clip_context", this);
      }
      else {
          m_timeline->selectTrack(ix);
          m_timelinePopupMenu = (QPopupMenu *) factory()->container("timeline_context", this);
      }

      if (m_timelinePopupMenu) {
            // store the mouse click position
            m_menuPosition = QCursor::pos();
          connect(m_timelinePopupMenu, SIGNAL(aboutToHide()), this, SLOT(slotHideTimelineMenu()));
            // display menu
          m_timelinePopupMenu->popup(QCursor::pos());
      }
      else m_menuPosition = QPoint();
    }


Generated by  Doxygen 1.6.0   Back to index