// virtual void AnimKeyframeRuler::mousePressEvent(QMouseEvent * event) { m_hoverKeyframe = -1; if (event->button() != Qt::LeftButton) { QWidget::mousePressEvent(event); return; } int xPos = event->x() - margin; int headOffset = m_lineHeight / 1.5; if (event->y() < m_lineHeight) { // check if we want to move a keyframe for (int i = 0; i < m_keyframes.count(); i++) { int kfrPos = m_keyframes.at(i); if (kfrPos * m_scale - xPos > headOffset) break; if (qAbs(kfrPos * m_scale - xPos) < headOffset) { m_hoverKeyframe = kfrPos; setCursor(Qt::PointingHandCursor); event->accept(); m_dragStart = event->pos(); return; } } } int seekRequest = xPos / m_scale; if (seekRequest != m_position) { m_seekPosition = seekRequest; emit requestSeek(m_seekPosition); update(); } }
/* void TimeSlider::timerRequestSeekTimeout() { if( !isSliderDown() && _movedPos < 0 ) { if( _movedPos == -1 ) { _unableSetPosition = false; _timerRequestSeek.stop(); } else ++_movedPos; } if( _movedPos >= 0 ) { // emit requestSeek(_movedPos*100/(double)maximum(), false); // パーセントによる指定 emit requestSeek((double)_movedPos/10, false); // 時間による直接指定 _movedPos = -UNABLE_SETPOSITION_TIME / REQUEST_SEEK_CYCLE_TIME; } // LogDialog::debug("timer " + QString::number(_movedPos)); } */ void TimeSlider::timerRequestSeekTimeout() { if( _movedPos >= 0 ) { // emit requestSeek(_movedPos*100/(double)maximum(), false); // パーセントによる指定 emit requestSeek((double)_movedPos/10, false); // 時間による直接指定 _movedPos = -1; _timerUnableSetPosition.start(UNABLE_SETPOSITION_TIME); } // LogDialog::debug("TimeSlider::timerRequestSeekTimeout(): movedPos " // + QString::number(_movedPos)); }
void TimeSlider::wheelEvent(QWheelEvent* e) { int pos; if( e->delta() < 0 ) pos = -3; else pos = +3; if( _reverseWheelSeek ) pos *= -1; emit requestSeek(pos, true); }
// virtual void KeyframeHelper::mousePressEvent(QMouseEvent * event) { m_hoverKeyframe = -1; if (event->button() != Qt::LeftButton) { QWidget::mousePressEvent(event); return; } int xPos = event->x() - margin; int headOffset = m_lineHeight / 1.5; if (m_geom != NULL && (event->y() <= headOffset)) { // check if we want to move a keyframe int mousePos = qMax((int)(xPos / m_scale), 0) + m_offset; Mlt::GeometryItem item; if (m_geom->next_key(&item, mousePos) == 0) { if (qAbs((item.frame() - m_offset)* m_scale - xPos) < headOffset) { m_movingItem.x(item.x()); m_movingItem.y(item.y()); m_movingItem.w(item.w()); m_movingItem.h(item.h()); m_movingItem.mix(item.mix()); m_movingItem.frame(item.frame()); while (!m_extraMovingItems.isEmpty()) { Mlt::GeometryItem *gitem = m_extraMovingItems.takeFirst(); if (gitem) delete gitem; } for (int i = 0; i < m_extraGeometries.count(); ++i) { if (m_extraGeometries.at(i)->next_key(item, mousePos) == 0) { Mlt::GeometryItem *item2 = new Mlt::GeometryItem(); item2->x(item.x()); item2->frame(item.frame()); m_extraMovingItems.append(item2); } else { m_extraMovingItems.append(NULL); } } m_dragStart = event->pos(); return; } } } int seekRequest = xPos / m_scale; if (seekRequest != m_position) { m_seekPosition = seekRequest; emit requestSeek(m_seekPosition); update(); } }