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