***************************************************************************/
#include "customruler.h"
+#include "kdenlivesettings.h"
#include <KDebug>
#include <KIcon>
connect(m_deleteGuide , SIGNAL(triggered()), this, SLOT(slotDeleteGuide()));
QAction *delAllGuides = m_contextMenu->addAction(KIcon("edit-delete"), i18n("Delete All Guides"));
connect(delAllGuides, SIGNAL(triggered()), m_view, SLOT(slotDeleteAllGuides()));
+ m_goMenu = m_contextMenu->addMenu(i18n("Go To"));
+ connect(m_goMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotGoToGuide(QAction *)));
setMouseTracking(true);
setMinimumHeight(20);
}
m_view->slotDeleteGuide(m_clickedGuide);
}
+void CustomRuler::slotGoToGuide(QAction *act)
+{
+ m_view->initCursorPos(act->data().toInt());
+}
+
void CustomRuler::setZone(QPoint p)
{
- int min = qMin(m_zoneStart, p.x());
- int max = qMax(m_zoneEnd, p.y());
m_zoneStart = p.x();
m_zoneEnd = p.y();
- update(min * m_factor - 2, 0, (max - min) * m_factor + 4, height());
+ update();
}
-void CustomRuler::mouseReleaseEvent(QMouseEvent * event)
+void CustomRuler::mouseReleaseEvent(QMouseEvent * /*event*/)
{
m_mouseMove = NO_MOVE;
}
m_clickedGuide = m_view->hasGuide((int)(pos / m_factor), (int)(5 / m_factor + 1));
m_editGuide->setEnabled(m_clickedGuide > 0);
m_deleteGuide->setEnabled(m_clickedGuide > 0);
+ m_view->buildGuidesMenu(m_goMenu);
m_contextMenu->exec(event->globalPos());
return;
}
if (m_moveCursor == RULER_CURSOR) {
QPoint diff = event->pos() - m_clickPoint;
if (m_mouseMove == NO_MOVE) {
- if (qAbs(diff.x()) >= QApplication::startDragDistance()) {
+ if (!KdenliveSettings::verticalzoom() || qAbs(diff.x()) >= QApplication::startDragDistance()) {
m_mouseMove = HORIZONTAL_MOVE;
} else if (qAbs(diff.y()) >= QApplication::startDragDistance()) {
m_mouseMove = VERTICAL_MOVE;
if (event->y() <= 10) setCursor(Qt::ArrowCursor);
else if (qAbs(pos - m_zoneStart * m_factor) < 4) {
setCursor(KCursor("left_side", Qt::SizeHorCursor));
- setToolTip(i18n("Zone start: %1", m_timecode.getTimecodeFromFrames(m_zoneStart)));
+ if (KdenliveSettings::frametimecode()) setToolTip(i18n("Zone start: %1", m_zoneStart));
+ else setToolTip(i18n("Zone start: %1", m_timecode.getTimecodeFromFrames(m_zoneStart)));
} else if (qAbs(pos - m_zoneEnd * m_factor) < 4) {
setCursor(KCursor("right_side", Qt::SizeHorCursor));
- setToolTip(i18n("Zone end: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd)));
+ if (KdenliveSettings::frametimecode()) setToolTip(i18n("Zone end: %1", m_zoneEnd));
+ else setToolTip(i18n("Zone end: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd)));
} else if (qAbs(pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2) * m_factor) < 4) {
setCursor(Qt::SizeHorCursor);
- setToolTip(i18n("Zone duration: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd - m_zoneStart)));
+ if (KdenliveSettings::frametimecode()) setToolTip(i18n("Zone duration: %1", m_zoneEnd - m_zoneStart));
+ else setToolTip(i18n("Zone duration: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd - m_zoneStart)));
} else {
setCursor(Qt::ArrowCursor);
- setToolTip(QString());
+ if (KdenliveSettings::frametimecode()) setToolTip(i18n("Position: %1", (int)(pos / m_factor)));
+ else setToolTip(i18n("Position: %1", m_timecode.getTimecodeFromFrames(pos / m_factor)));
}
}
}