diff layer/TimeValueLayer.cpp @ 34:c43f2c4f66f2

* As previous commit
author Chris Cannam
date Fri, 17 Feb 2006 18:11:08 +0000
parents 202d1dca67d2
children 1bdf285c4eac
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp	Fri Feb 17 18:04:26 2006 +0000
+++ b/layer/TimeValueLayer.cpp	Fri Feb 17 18:11:08 2006 +0000
@@ -420,6 +420,22 @@
 	int x = getXForFrame(p.frame);
 	int y = getYForValue(p.value);
 
+	bool haveNext = false;
+	int nx = getXForFrame(m_model->getEndFrame());
+	int ny = y;
+
+	SparseTimeValueModel::PointList::const_iterator j = i;
+	++j;
+
+	if (j != points.end()) {
+	    const SparseTimeValueModel::Point &q(*j);
+	    nx = getXForFrame(q.frame);
+	    ny = getYForValue(q.value);
+	    haveNext = true;
+	}
+
+	int labelY = y;
+
 	if (w < 1) w = 1;
 	paint.setPen(m_colour);
 
@@ -428,6 +444,7 @@
 	    QColor colour = QColor::fromHsv(256 - value, value / 2 + 128, value);
 	    paint.setBrush(QColor(colour.red(), colour.green(), colour.blue(),
 				  120));
+	    labelY = m_view->height();
 	} else if (m_plotStyle == PlotLines ||
 		   m_plotStyle == PlotCurve) {
 	    paint.setBrush(Qt::NoBrush);
@@ -473,17 +490,10 @@
 	    m_plotStyle == PlotLines ||
 	    m_plotStyle == PlotCurve) {
 
-	    SparseTimeValueModel::PointList::const_iterator j = i;
-	    ++j;
-
-	    if (j != points.end()) {
-
-		const SparseTimeValueModel::Point &q(*j);
-		int nx = getXForFrame(q.frame);
-		int ny = getYForValue(q.value);
+	    if (haveNext) {
 
 		if (m_plotStyle == PlotConnectedPoints) {
-
+		    
 		    paint.setPen(brushColour);
 		    paint.drawLine(x + w, y, nx, ny);
 
@@ -508,18 +518,6 @@
 
 	if (m_plotStyle == PlotSegmentation) {
 	    
-	    SparseTimeValueModel::PointList::const_iterator j = i;
-	    ++j;
-
-	    int nx;
-
-	    if (j != points.end()) {
-		const SparseTimeValueModel::Point &q(*j);
-		nx = getXForFrame(q.frame);
-	    } else {
-		nx = getXForFrame(m_model->getEndFrame());
-	    }
-
 	    if (nx <= x) continue;
 
 	    if (illuminateFrame != p.frame &&