changeset 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 d0fd7630d32f
files view/Pane.cpp view/Pane.h
diffstat 2 files changed, 38 insertions(+), 0 deletions(-) [+]
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)
 {
--- a/view/Pane.h	Wed Apr 02 09:01:56 2014 +0100
+++ b/view/Pane.h	Wed Apr 02 10:26:27 2014 +0100
@@ -107,6 +107,7 @@
     void drawVerticalScale(QRect r, Layer *, QPainter &);
     void drawFeatureDescription(Layer *, QPainter &);
     void drawCentreLine(int, QPainter &, bool omitLine);
+    void drawModelTimeExtents(QRect, QPainter &, const Model *);
     void drawDurationAndRate(QRect, const Model *, int, QPainter &);
     void drawWorkTitle(QRect, QPainter &, const Model *);
     void drawLayerNames(QRect, QPainter &);