Mercurial > hg > svgui
diff view/LayerGeometryProvider.h @ 1030:0be17aafa935 spectrogram-minor-refactor
Start refactoring out the spectrogram image cache
author | Chris Cannam |
---|---|
date | Fri, 29 Jan 2016 15:08:01 +0000 |
parents | a5488775f880 |
children | 55ac6ac1982e |
line wrap: on
line diff
--- a/view/LayerGeometryProvider.h Wed Jan 27 11:10:48 2016 +0000 +++ b/view/LayerGeometryProvider.h Fri Jan 29 15:08:01 2016 +0000 @@ -17,6 +17,9 @@ #include "base/BaseTypes.h" +#include <QMutex> +#include <QMutexLocker> + class ViewManager; class View; class Layer; @@ -24,6 +27,20 @@ class LayerGeometryProvider { public: + LayerGeometryProvider() { + static QMutex idMutex; + static int nextId = 1; + QMutexLocker locker(&idMutex); + m_id = nextId; + nextId++; + } + + /** + * Retrieve the id of this object. Each LayerGeometryProvider has + * a separate id. + */ + int getId() const { return m_id; } + /** * Retrieve the first visible sample frame on the widget. * This is a calculated value based on the centre-frame, widget @@ -61,6 +78,18 @@ virtual sv_frame_t getModelsEndFrame() const = 0; /** + * Return the closest pixel x-coordinate corresponding to a given + * view x-coordinate. + */ + virtual int getXForViewX(int viewx) const = 0; + + /** + * Return the closest view x-coordinate corresponding to a given + * pixel x-coordinate. + */ + virtual int getViewXForX(int x) const = 0; + + /** * Return the pixel y-coordinate corresponding to a given * frequency, if the frequency range is as specified. This does * not imply any policy about layer frequency ranges, but it might @@ -123,8 +152,13 @@ virtual void drawMeasurementRect(QPainter &p, const Layer *, QRect rect, bool focus) const = 0; + virtual void updatePaintRect(QRect r) = 0; + virtual View *getView() = 0; virtual const View *getView() const = 0; + +private: + int m_id; }; #endif