]> git.sesse.net Git - kdenlive/blobdiff - src/smallruler.cpp
start implementing monitor zone
[kdenlive] / src / smallruler.cpp
index 901660918bcbc6cba8eefe519efbb584fca8a069..2a41544c966e0b8ece69365bf18ef10ee1c133d9 100644 (file)
@@ -28,6 +28,8 @@
 
 SmallRuler::SmallRuler(QWidget *parent)
         : QWidget(parent), m_scale(1), m_maxval(25) {
+    m_zoneStart = 10;
+    m_zoneEnd = 60;
 }
 
 void SmallRuler::adjustScale(int maximum) {
@@ -49,6 +51,12 @@ void SmallRuler::adjustScale(int maximum) {
     update();
 }
 
+void SmallRuler::setZone(int start, int end) {
+    m_zoneStart = start;
+    m_zoneEnd = end;
+    update();
+}
+
 // virtual
 void SmallRuler::mousePressEvent(QMouseEvent * event) {
     const int pos = event->x() / m_scale;
@@ -87,6 +95,11 @@ void SmallRuler::paintEvent(QPaintEvent *e) {
     double f, fend;
     p.setPen(palette().dark().color());
 
+    const int zoneStart = (int)(m_zoneStart * m_scale);
+    const int zoneEnd = (int)(m_zoneEnd * m_scale);
+
+    p.fillRect(QRect(zoneStart, height() / 2, zoneEnd - zoneStart, height() / 2), QBrush(QColor(133, 255, 143)));
+
     if (r.top() < 9) {
         // draw the little marks
         fend = m_scale * m_small;