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@5: 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@30: #ifndef _TIME_INSTANT_LAYER_H_ Chris@30: #define _TIME_INSTANT_LAYER_H_ Chris@0: Chris@0: #include "base/Layer.h" Chris@0: #include "model/SparseOneDimensionalModel.h" Chris@0: Chris@0: #include Chris@0: #include Chris@0: Chris@0: class View; Chris@0: class QPainter; Chris@0: Chris@0: class TimeInstantLayer : public Layer Chris@0: { Chris@0: Q_OBJECT Chris@0: Chris@0: public: Chris@0: TimeInstantLayer(View *w); Chris@0: Chris@0: virtual void paint(QPainter &paint, QRect rect) const; Chris@0: Chris@25: virtual QString getFeatureDescription(QPoint &) const; Chris@0: Chris@28: virtual bool snapToFeatureFrame(int &frame, Chris@28: size_t &resolution, Chris@28: SnapType snap) const; Chris@13: Chris@17: virtual void drawStart(QMouseEvent *); Chris@17: virtual void drawDrag(QMouseEvent *); Chris@17: virtual void drawEnd(QMouseEvent *); Chris@17: Chris@18: virtual void editStart(QMouseEvent *); Chris@18: virtual void editDrag(QMouseEvent *); Chris@18: virtual void editEnd(QMouseEvent *); Chris@18: Chris@0: virtual const Model *getModel() const { return m_model; } Chris@0: void setModel(SparseOneDimensionalModel *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@28: enum PlotStyle { Chris@28: PlotInstants, Chris@28: PlotSegmentation Chris@28: }; Chris@28: Chris@28: void setPlotStyle(PlotStyle style); Chris@28: PlotStyle getPlotStyle() const { return m_plotStyle; } Chris@28: Chris@0: virtual bool isLayerScrollable() const; Chris@0: Chris@23: virtual bool isLayerEditable() const { return true; } Chris@23: 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@0: SparseOneDimensionalModel::PointList getLocalPoints(int) const; Chris@0: Chris@0: SparseOneDimensionalModel *m_model; Chris@18: bool m_editing; Chris@17: SparseOneDimensionalModel::Point m_editingPoint; Chris@22: SparseOneDimensionalModel::EditCommand *m_editingCommand; Chris@0: QColor m_colour; Chris@28: PlotStyle m_plotStyle; Chris@0: }; Chris@0: Chris@0: #endif Chris@0: