]> git.sesse.net Git - kdenlive/blobdiff - src/customruler.cpp
* Fix stabilized clips not loading:
[kdenlive] / src / customruler.cpp
index 336a8d66fd6b299afa77efa6bbfebafe32a7bc36..67401a34ca7cf17d79d359638baf15747999830e 100644 (file)
@@ -44,6 +44,8 @@ static int littleMarkDistance;
 static int mediumMarkDistance;
 static int bigMarkDistance;
 
+#define SEEK_INACTIVE (-1)
+
 #include "definitions.h"
 
 const int CustomRuler::comboScale[] = { 1, 2, 5, 10, 25, 50, 125, 250, 500, 750, 1500, 3000, 6000, 12000};
@@ -88,6 +90,11 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent) :
     setMouseTracking(true);
 }
 
+void CustomRuler::updatePalette()
+{
+    m_zoneColor = KStatefulBrush(KColorScheme::View, KColorScheme::PositiveBackground, KSharedConfig::openConfig(KdenliveSettings::colortheme())).brush(this).color();
+}
+
 void CustomRuler::updateProjectFps(Timecode t)
 {
     m_timecode = t;
@@ -118,7 +125,7 @@ void CustomRuler::slotDeleteGuide()
 
 void CustomRuler::slotGoToGuide(QAction *act)
 {
-    m_view->setCursorPos(act->data().toInt(), true);
+    m_view->seekCursorPos(act->data().toInt());
     m_view->initCursorPos(act->data().toInt());
 }
 
@@ -161,7 +168,7 @@ void CustomRuler::mousePressEvent(QMouseEvent * event)
         m_view->updateSnapPoints(NULL);
     }
     if (m_moveCursor == RULER_CURSOR) {
-        m_view->setCursorPos((int) pos / m_factor);
+        m_view->seekCursorPos((int) pos / m_factor);
         m_clickPoint = event->pos();
         m_startRate = m_rate;
     }
@@ -188,7 +195,7 @@ void CustomRuler::mouseMoveEvent(QMouseEvent * event)
                 } else return;
             }
             if (m_mouseMove == HORIZONTAL_MOVE) {
-                m_view->setCursorPos(pos);
+                m_view->seekCursorPos(pos);
                 m_view->slotCheckPositionScrolling();
             } else {
                 int verticalDiff = m_startRate - (diff.y()) / 7;
@@ -270,6 +277,11 @@ void CustomRuler::slotCursorMoved(int oldpos, int newpos)
     } else update(qMin(oldpos, newpos) * m_factor - offset() - 6, BIG_MARK_X, qAbs(oldpos - newpos) * m_factor + 14, MAX_HEIGHT - BIG_MARK_X);
 }
 
+void CustomRuler::updateRuler(int min, int max)
+{
+    update(min * m_factor - offset(), 0, max - min, height());
+}
+
 void CustomRuler::setPixelPerMark(int rate)
 {
     int scale = comboScale[rate];
@@ -343,7 +355,7 @@ void CustomRuler::paintEvent(QPaintEvent *e)
     p.setClipRect(e->rect());
     
     // Draw background
-    p.fillRect(0, 0, m_duration * m_factor - m_offset, MAX_HEIGHT, palette().alternateBase().color());
+    //p.fillRect(0, 0, m_duration * m_factor - m_offset, MAX_HEIGHT, palette().alternateBase().color());
 
     // Draw zone background
     const int zoneStart = (int)(m_zoneStart * m_factor);
@@ -422,6 +434,12 @@ void CustomRuler::paintEvent(QPaintEvent *e)
     }
     
     // draw pointer
+    int pos = m_view->seekPosition();
+    if (pos != SEEK_INACTIVE) {
+       pos  = pos * m_factor - m_offset;
+       p.fillRect(pos - 1, 0, 3, height(), palette().highlight());
+    }
+    
     const int value  = m_view->cursorPos() * m_factor - m_offset;
     QPolygon pa(3);
     pa.setPoints(3, value - 6, BIG_MARK_X, value + 6, BIG_MARK_X, value, MAX_HEIGHT - 1);