diff view/Pane.cpp @ 759:30bc7b2155dc tonioni

Grey out the areas outside the main work model. This may not be appropriate as-is for SV, but it might be nice in Tony
author Chris Cannam
date Wed, 02 Apr 2014 10:26:27 +0100
parents 785c6f175ccc
children 410816717c2c
line wrap: on
line diff
--- a/view/Pane.cpp	Wed Apr 02 09:01:56 2014 +0100
+++ b/view/Pane.cpp	Wed Apr 02 10:26:27 2014 +0100
@@ -465,6 +465,10 @@
 
     m_scaleWidth = 0;
 
+    if (workModel) {
+        drawModelTimeExtents(r, paint, workModel);
+    }
+
     if (m_manager && m_manager->shouldShowVerticalScale() && topLayer) {
         drawVerticalScale(r, topLayer, paint);
     }
@@ -775,6 +779,39 @@
 }
 
 void
+Pane::drawModelTimeExtents(QRect r, QPainter &paint, const Model *model)
+{
+    int x0 = getXForFrame(model->getStartFrame());
+    int x1 = getXForFrame(model->getEndFrame());
+
+    int lw = 10;
+
+    paint.save();
+
+    QBrush brush;
+
+    if (hasLightBackground()) {
+        brush = QBrush(QColor("#f8f8f8"));
+        paint.setPen(Qt::black);
+    } else {
+        brush = QBrush(QColor("#101010"));
+        paint.setPen(Qt::white);
+    }
+
+    if (x0 > r.x()) {
+        paint.fillRect(0, 0, x0, height(), brush);
+        paint.drawLine(x0, 0, x0, height());
+    }
+
+    if (x1 < r.x() + r.width()) {
+        paint.fillRect(x1, 0, width() - x1, height(), brush);
+        paint.drawLine(x1, 0, x1, height());
+    }
+
+    paint.restore();
+}
+
+void
 Pane::drawAlignmentStatus(QRect r, QPainter &paint, const Model *model,
                           bool down)
 {