lbajardsilogic@18: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ lbajardsilogic@18: lbajardsilogic@18: /* lbajardsilogic@18: Sound Access lbajardsilogic@18: EASAIER client application. lbajardsilogic@18: Silogic 2007. Luc Barthélémy. lbajardsilogic@18: lbajardsilogic@18: This program is free software; you can redistribute it and/or lbajardsilogic@18: modify it under the terms of the GNU General Public License as lbajardsilogic@18: published by the Free Software Foundation; either version 2 of the lbajardsilogic@18: License, or (at your option) any later version. See the file lbajardsilogic@18: COPYING included with this distribution for more information. lbajardsilogic@18: */ lbajardsilogic@18: lbajardsilogic@18: lbajardsilogic@18: #ifndef _INTERVAL_LAYER_H_ lbajardsilogic@18: #define _INTERVAL_LAYER_H_ lbajardsilogic@18: lbajardsilogic@18: #include "layer/Layer.h" lbajardsilogic@18: #include "data/model/IntervalModel.h" lbajardsilogic@18: lbajardsilogic@18: #include lbajardsilogic@18: #include lbajardsilogic@18: lbajardsilogic@18: class View; lbajardsilogic@18: class QPainter; lbajardsilogic@18: lbajardsilogic@18: class IntervalLayer : public Layer lbajardsilogic@18: { lbajardsilogic@18: Q_OBJECT lbajardsilogic@18: lbajardsilogic@18: public: lbajardsilogic@18: IntervalLayer(); lbajardsilogic@18: virtual ~IntervalLayer(); lbajardsilogic@18: lbajardsilogic@18: lbajardsilogic@18: virtual const Model *getModel() const { return m_model; } lbajardsilogic@18: void setModel(IntervalModel *model); lbajardsilogic@18: lbajardsilogic@18: virtual void paint(View *, QPainter &, QRect) const; lbajardsilogic@18: lbajardsilogic@18: virtual QString toXmlString(QString indent = "", lbajardsilogic@18: QString extraAttributes = "") const; lbajardsilogic@18: lbajardsilogic@18: virtual QString toEasaierXmlString(QString indent = "", lbajardsilogic@18: QString extraAttributes = "") const; lbajardsilogic@18: lbajardsilogic@18: // From PropertyContainer lbajardsilogic@18: virtual PropertyList getProperties() const; lbajardsilogic@18: virtual PropertyType getPropertyType(const PropertyName &) const; lbajardsilogic@18: virtual int getPropertyRangeAndValue(const PropertyName &, lbajardsilogic@18: int *min, int *max, int *deflt) const; lbajardsilogic@18: virtual QString getPropertyValueLabel(const PropertyName &, lbajardsilogic@18: int value) const; lbajardsilogic@18: lbajardsilogic@18: void setProperties(const QXmlAttributes &attributes); lbajardsilogic@18: virtual void setProperty(const PropertyName &, int value); lbajardsilogic@18: lbajardsilogic@18: virtual QString getPropertyLabel(const PropertyName &) const; lbajardsilogic@18: benoitrigolleau@61: virtual void setBaseColour(QColor); benoitrigolleau@61: virtual QColor getBaseColour() const { return m_colour; } lbajardsilogic@18: lbajardsilogic@18: virtual bool getValueExtents(float &min, float &max, lbajardsilogic@18: bool &log, QString &unit) const; lbajardsilogic@18: lbajardsilogic@18: virtual QString getFeatureDescription(View *v, QPoint &) const; lbajardsilogic@18: lbajardsilogic@18: virtual bool isLayerEditable() const { return true; } lbajardsilogic@18: lbajardsilogic@18: virtual bool snapToFeatureFrame(View *v, int &frame, lbajardsilogic@18: size_t &resolution, lbajardsilogic@18: SnapType snap) const; lbajardsilogic@18: lbajardsilogic@18: // for edition lbajardsilogic@18: virtual void drawStart(View *, QMouseEvent *); lbajardsilogic@18: virtual void drawDrag(View *, QMouseEvent *); lbajardsilogic@18: virtual void drawEnd(View *, QMouseEvent *); lbajardsilogic@18: lbajardsilogic@18: virtual void editStart(View *, QMouseEvent *); lbajardsilogic@18: virtual void editDrag(View *, QMouseEvent *); lbajardsilogic@18: virtual void editEnd(View *, QMouseEvent *); lbajardsilogic@18: lbajardsilogic@18: virtual void editOpen(View *, QMouseEvent *); // on double-click lbajardsilogic@18: lbajardsilogic@18: virtual void moveSelection(Selection s, size_t newStartFrame); lbajardsilogic@18: virtual void resizeSelection(Selection s, Selection newSize); lbajardsilogic@18: virtual void deleteSelection(Selection s); lbajardsilogic@18: lbajardsilogic@18: virtual void copy(Selection s, Clipboard &to); lbajardsilogic@18: virtual void paste(const Clipboard &from, int frameOffset); lbajardsilogic@18: lbajardsilogic@18: protected: lbajardsilogic@18: lbajardsilogic@18: int getYForHeight(View *v, float height) const; lbajardsilogic@18: float getHeightForY(View *v, int y) const; lbajardsilogic@18: lbajardsilogic@18: IntervalList getIntervalAt(View *v, int x, int y); lbajardsilogic@18: IntervalList getInterval(long start, long end); lbajardsilogic@18: lbajardsilogic@18: private: lbajardsilogic@18: lbajardsilogic@18: IntervalModel* m_model; lbajardsilogic@18: QColor m_colour; lbajardsilogic@18: lbajardsilogic@18: int m_editing; lbajardsilogic@18: TimeIntervalPtr m_editingInterval; lbajardsilogic@18: IntervalModel::IntervalCommand* m_editingCommand; lbajardsilogic@18: }; lbajardsilogic@18: lbajardsilogic@18: #endif //_INTERVAL_LAYER_H_