# HG changeset patch # User Chris Cannam # Date 1137073350 0 # Node ID 7af44e8578c8b09c36477bf359e051e68cab5c18 # Parent 77dad696d7409b96828246df1bf4a0ebcee7ac14 * Add "curve" plot style to TimeValueLayer * Update copyrights to 2006 diff -r 77dad696d740 -r 7af44e8578c8 layer/TimeValueLayer.cpp --- 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(""); @@ -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); + } } } diff -r 77dad696d740 -r 7af44e8578c8 layer/TimeValueLayer.h --- 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; }