Chris@0: /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@0: A waveform viewer and audio annotation editor. Chris@3: Chris Cannam, Queen Mary University of London, 2005-2006 Chris@0: Chris@0: This is experimental software. Not for distribution. Chris@0: */ Chris@0: Chris@0: #ifndef _TIME_VALUE_VIEW_H_ Chris@0: #define _TIME_VALUE_VIEW_H_ Chris@0: Chris@0: #include "base/Layer.h" Chris@0: #include "model/SparseTimeValueModel.h" Chris@0: Chris@0: #include Chris@0: #include Chris@0: Chris@0: class View; Chris@0: class QPainter; Chris@0: Chris@0: class TimeValueLayer : public Layer Chris@0: { Chris@0: Q_OBJECT Chris@0: Chris@0: public: Chris@0: TimeValueLayer(View *w); Chris@0: Chris@0: virtual void paint(QPainter &paint, QRect rect) const; Chris@0: Chris@0: virtual QRect getFeatureDescriptionRect(QPainter &, QPoint) const; Chris@0: virtual void paintLocalFeatureDescription(QPainter &, QRect, QPoint) const; Chris@0: Chris@13: virtual int getNearestFeatureFrame(int frame, Chris@13: size_t &resolution, Chris@13: bool snapRight = true) const; Chris@13: Chris@21: virtual void drawStart(QMouseEvent *); Chris@21: virtual void drawDrag(QMouseEvent *); Chris@21: virtual void drawEnd(QMouseEvent *); Chris@21: Chris@21: virtual void editStart(QMouseEvent *); Chris@21: virtual void editDrag(QMouseEvent *); Chris@21: virtual void editEnd(QMouseEvent *); Chris@21: Chris@0: virtual const Model *getModel() const { return m_model; } Chris@0: void setModel(SparseTimeValueModel *model); Chris@0: Chris@0: virtual PropertyList getProperties() const; Chris@0: virtual PropertyType getPropertyType(const PropertyName &) const; Chris@0: virtual int getPropertyRangeAndValue(const PropertyName &, Chris@0: int *min, int *max) const; Chris@0: virtual QString getPropertyValueLabel(const PropertyName &, Chris@0: int value) const; Chris@0: virtual void setProperty(const PropertyName &, int value); Chris@0: Chris@0: void setBaseColour(QColor); Chris@0: QColor getBaseColour() const { return m_colour; } Chris@0: Chris@6: enum PlotStyle { PlotPoints, PlotStems, PlotConnectedPoints, PlotLines, PlotCurve }; Chris@0: Chris@0: void setPlotStyle(PlotStyle style); Chris@0: PlotStyle getPlotStyle() const { return m_plotStyle; } Chris@0: Chris@0: virtual bool isLayerScrollable() const; Chris@0: Chris@0: virtual int getCompletion() const { return m_model->getCompletion(); } Chris@0: Chris@6: virtual QString toXmlString(QString indent = "", Chris@6: QString extraAttributes = "") const; Chris@6: Chris@11: void setProperties(const QXmlAttributes &attributes); Chris@11: Chris@0: protected: Chris@21: int getYForValue(float value) const; Chris@21: float getValueForY(int y) const; Chris@21: Chris@0: SparseTimeValueModel::PointList getLocalPoints(int) const; Chris@0: Chris@0: SparseTimeValueModel *m_model; Chris@21: bool m_editing; Chris@21: SparseTimeValueModel::Point m_editingPoint; Chris@0: QColor m_colour; Chris@0: PlotStyle m_plotStyle; Chris@0: }; Chris@0: Chris@0: #endif Chris@0: