Mercurial > hg > svgui
diff view/View.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 | 092de22db207 |
children | 4e5c1c326794 |
line wrap: on
line diff
--- a/view/View.h Wed Jan 27 11:10:48 2016 +0000 +++ b/view/View.h Fri Jan 29 15:08:01 2016 +0000 @@ -62,7 +62,7 @@ * be managed elsewhere (e.g. by the Document). */ virtual ~View(); - + /** * Retrieve the first visible sample frame on the widget. * This is a calculated value based on the centre-frame, widget @@ -108,6 +108,20 @@ sv_frame_t getFrameForX(int x) const; /** + * Return the closest pixel x-coordinate corresponding to a given + * view x-coordinate. Default is no scaling, ViewProxy handles + * scaling case. + */ + int getXForViewX(int viewx) const { return viewx; } + + /** + * Return the closest view x-coordinate corresponding to a given + * pixel x-coordinate. Default is no scaling, ViewProxy handles + * scaling case. + */ + int getViewXForX(int x) const { return x; } + + /** * 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 @@ -333,6 +347,8 @@ sv_frame_t alignToReference(sv_frame_t) const; sv_frame_t getAlignedPlaybackFrame() const; + void updatePaintRect(QRect r) { update(r); } + View *getView() { return this; } const View *getView() const { return this; } @@ -384,6 +400,9 @@ protected: View(QWidget *, bool showProgress); + + int m_id; + virtual void paintEvent(QPaintEvent *e); virtual void drawSelections(QPainter &); virtual bool shouldLabelSelections() const { return true; }