void LoopRuler::mouseMoveEvent(QMouseEvent *mE) { // If we are still using the default grid, that means we are being // used by the TrackEditor (instead of the MatrixEditor). if (m_grid == &m_defaultGrid) { // If the ctrl key is pressed, enable snap to beat if ((mE->modifiers() & Qt::ControlModifier) != 0) m_defaultGrid.setSnapTime(SnapGrid::SnapToBeat); else m_defaultGrid.setSnapTime(SnapGrid::NoSnap); } double x = mouseEventToSceneX(mE); if (x < 0) x = 0; if (m_loopingMode) { if (m_loopGrid->snapX(x) != m_endLoop) { m_endLoop = m_loopGrid->snapX(x); emit dragLoopToPosition(m_endLoop); update(); } } else { emit dragPointerToPosition(m_grid->snapX(x)); m_lastMouseXPos = x; } emit mouseMove(); }
void StandardRuler::connectRulerToDocPointer(RosegardenDocument *doc) { RG_DEBUG << "StandardRuler::connectRulerToDocPointer"; Q_ASSERT(m_loopRuler); Q_ASSERT(m_markerRuler); // use the document as a hub for pointer and loop set related signals // pointer and loop drag signals are specific to the current view, // so they are re-emitted from the loop ruler by this widget // QObject::connect (m_loopRuler, SIGNAL(setPointerPosition(timeT)), doc, SLOT(slotSetPointerPosition(timeT))); QObject::connect (m_markerRuler, SIGNAL(setPointerPosition(timeT)), doc, SLOT(slotSetPointerPosition(timeT))); QObject::connect (m_loopRuler, SIGNAL(dragPointerToPosition(timeT)), this, SIGNAL(dragPointerToPosition(timeT))); QObject::connect (m_loopRuler, SIGNAL(dragLoopToPosition(timeT)), this, SIGNAL(dragLoopToPosition(timeT))); QObject::connect (m_markerRuler, SIGNAL(setLoop(timeT, timeT)), doc, SLOT(slotSetLoop(timeT, timeT))); QObject::connect (m_loopRuler, SIGNAL(setLoop(timeT, timeT)), doc, SLOT(slotSetLoop(timeT, timeT))); QObject::connect (doc, SIGNAL(loopChanged(timeT, timeT)), m_loopRuler, SLOT(slotSetLoopMarker(timeT, timeT))); // m_loopRuler->setBackgroundColor(GUIPalette::getColour(GUIPalette::PointerRuler)); }