]> git.sesse.net Git - kdenlive/blobdiff - src/customruler.cpp
Fix version number (now 0.7), add myself as author
[kdenlive] / src / customruler.cpp
index 461a58034cf4a09fceeba205971b6dcea24dd04e..a7133bb16d0d5aa319900ef81bb4789a13d91a02 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <KDebug>
 #include <KIcon>
+#include <KCursor>
 #include <KGlobalSettings>
 
 #include "customruler.h"
@@ -89,10 +90,13 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent)
     m_contextMenu = new QMenu(this);
     QAction *addGuide = m_contextMenu->addAction(KIcon("document-new"), i18n("Add Guide"));
     connect(addGuide, SIGNAL(triggered()), m_view, SLOT(slotAddGuide()));
-    QAction *delGuide = m_contextMenu->addAction(KIcon("document-new"), i18n("Delete Guide"));
-    connect(delGuide, SIGNAL(triggered()), m_view, SLOT(slotDeleteGuide()));
-    QAction *editGuide = m_contextMenu->addAction(KIcon("document-new"), i18n("Edit Guide"));
+    QAction *editGuide = m_contextMenu->addAction(KIcon("document-properties"), i18n("Edit Guide"));
     connect(editGuide, SIGNAL(triggered()), m_view, SLOT(slotEditGuide()));
+    QAction *delGuide = m_contextMenu->addAction(KIcon("edit-delete"), i18n("Delete Guide"));
+    connect(delGuide, SIGNAL(triggered()), m_view, SLOT(slotDeleteGuide()));
+    QAction *delAllGuides = m_contextMenu->addAction(KIcon("edit-delete"), i18n("Delete All Guides"));
+    connect(delAllGuides, SIGNAL(triggered()), m_view, SLOT(slotDeleteAllGuides()));
+    setMouseTracking(true);
 }
 
 // virtual
@@ -115,19 +119,28 @@ void CustomRuler::mousePressEvent(QMouseEvent * event) {
 
 // virtual
 void CustomRuler::mouseMoveEvent(QMouseEvent * event) {
-    int pos = (int)((event->x() + offset()) / pixelPerMark() / FRAME_SIZE);
-    if (pos < 0) pos = 0;
-    if (m_moveCursor == RULER_CURSOR) {
-        m_view->setCursorPos(pos);
-        return;
-    } else if (m_moveCursor == RULER_START) m_zoneStart = pos;
-    else if (m_moveCursor == RULER_END) m_zoneEnd = pos;
-    else if (m_moveCursor == RULER_MIDDLE) {
-        int move = pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2);
-        m_zoneStart += move;
-        m_zoneEnd += move;
+    if (event->buttons() == Qt::LeftButton) {
+        int pos = (int)((event->x() + offset()) / pixelPerMark() / FRAME_SIZE);
+        if (pos < 0) pos = 0;
+        if (m_moveCursor == RULER_CURSOR) {
+            m_view->setCursorPos(pos);
+            return;
+        } else if (m_moveCursor == RULER_START) m_zoneStart = pos;
+        else if (m_moveCursor == RULER_END) m_zoneEnd = pos;
+        else if (m_moveCursor == RULER_MIDDLE) {
+            int move = pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2);
+            m_zoneStart += move;
+            m_zoneEnd += move;
+        }
+        update();
+    } else {
+        int pos = (int)((event->x() + offset()));
+        if (event->y() <= 10) setCursor(Qt::ArrowCursor);
+        else if (qAbs(pos - m_zoneStart * pixelPerMark() * FRAME_SIZE) < 4) setCursor(KCursor("left_side", Qt::SizeHorCursor));
+        else if (qAbs(pos - m_zoneEnd * pixelPerMark() * FRAME_SIZE) < 4) setCursor(KCursor("right_side", Qt::SizeHorCursor));
+        else if (qAbs(pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2) * pixelPerMark() * FRAME_SIZE) < 4) setCursor(Qt::SizeHorCursor);
+        else setCursor(Qt::ArrowCursor);
     }
-    update();
 }