changeset 3:7af44e8578c8

* Add "curve" plot style to TimeValueLayer * Update copyrights to 2006
author Chris Cannam
date Thu, 12 Jan 2006 13:42:30 +0000
parents 77dad696d740
children ce747045a023
files layer/TimeValueLayer.cpp layer/TimeValueLayer.h
diffstat 2 files changed, 23 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp	Tue Jan 10 17:37:43 2006 +0000
+++ b/layer/TimeValueLayer.cpp	Thu Jan 12 13:42:30 2006 +0000
@@ -2,7 +2,7 @@
 
 /*
     A waveform viewer and audio annotation editor.
-    Chris Cannam, Queen Mary University of London, 2005
+    Chris Cannam, Queen Mary University of London, 2005-2006
     
     This is experimental software.  Not for distribution.
 */
@@ -86,7 +86,7 @@
     } else if (name == tr("Plot Type")) {
 	
 	*min = 0;
-	*max = 2;
+	*max = 3;
 	
 	deft = int(m_plotStyle);
 
@@ -118,6 +118,7 @@
 	case 0: return tr("Points");
 	case 1: return tr("Stems");
 	case 2: return tr("Lines");
+	case 3: return tr("Curve");
 	}
     }
     return tr("<unknown>");
@@ -317,7 +318,11 @@
 
 	if (w < 1) w = 1;
 
-	paint.setPen(m_colour);
+	if (m_plotStyle == PlotCurve) {
+	    paint.setPen(QPen(QBrush(m_colour), 2));
+	} else {
+	    paint.setPen(m_colour);
+	}	    
 	paint.setBrush(brushColour);
 
 	if (m_plotStyle == PlotStems) {
@@ -338,27 +343,29 @@
 	    paint.setBrush(Qt::black);//!!!
 	}
 
-	paint.drawRect(x, y - 1, w, 2);
+	if (m_plotStyle != PlotCurve) {
+	    paint.drawRect(x, y - 1, w, 2);
+	}
 
-//	if (w > 1) {
-//	    paint.setPen(brushColour);
-//	    paint.drawRect(x, y - 1, w - 1, 2);
-//	    paint.setPen(m_colour);
-//	}
-//	paint.drawLine(x, 0, x, m_view->height());
+	if (m_plotStyle == PlotLines || m_plotStyle == PlotCurve) {
 
-	if (m_plotStyle == PlotLines) {
-
-	    paint.setPen(brushColour);
 	    SparseTimeValueModel::PointList::const_iterator j = i;
 	    ++j;
+
 	    if (j != points.end()) {
+
 		const SparseTimeValueModel::Point &q(*j);
 		int nx = (q.frame - startFrame) / zoomLevel;
 		int ny = int(nearbyint(m_view->height() -
 				       ((q.value - min) * m_view->height()) /
 				       (max - min)));
-		paint.drawLine(x + w, y, nx, ny);
+
+		if (m_plotStyle == PlotLines) {
+		    paint.setPen(brushColour);
+		    paint.drawLine(x + w, y, nx, ny);
+		} else {
+		    paint.drawLine(x, y, nx, ny);
+		}
 	    }
 	}
 
--- a/layer/TimeValueLayer.h	Tue Jan 10 17:37:43 2006 +0000
+++ b/layer/TimeValueLayer.h	Thu Jan 12 13:42:30 2006 +0000
@@ -2,7 +2,7 @@
 
 /*
     A waveform viewer and audio annotation editor.
-    Chris Cannam, Queen Mary University of London, 2005
+    Chris Cannam, Queen Mary University of London, 2005-2006
     
     This is experimental software.  Not for distribution.
 */
@@ -45,7 +45,7 @@
     void setBaseColour(QColor);
     QColor getBaseColour() const { return m_colour; }
 
-    enum PlotStyle { PlotPoints, PlotStems, PlotLines };
+    enum PlotStyle { PlotPoints, PlotStems, PlotLines, PlotCurve };
 
     void setPlotStyle(PlotStyle style);
     PlotStyle getPlotStyle() const { return m_plotStyle; }