Mercurial > hg > svgui
diff view/ViewProxy.h @ 1148:c0d841cb8ab9 tony-2.0-integration
Merge latest SV 3.0 branch code
author | Chris Cannam |
---|---|
date | Fri, 19 Aug 2016 15:58:57 +0100 |
parents | 179ea8a2f650 |
children | a34a2a25907c |
line wrap: on
line diff
--- a/view/ViewProxy.h Tue Oct 20 12:55:09 2015 +0100 +++ b/view/ViewProxy.h Fri Aug 19 15:58:57 2016 +0100 @@ -15,7 +15,7 @@ #ifndef VIEW_PROXY_H #define VIEW_PROXY_H -#include "LayerGeometryProvider.h" +#include "layer/LayerGeometryProvider.h" class ViewProxy : public LayerGeometryProvider { @@ -23,6 +23,9 @@ ViewProxy(View *view, int scaleFactor) : m_view(view), m_scaleFactor(scaleFactor) { } + virtual int getId() const { + return m_view->getId(); + } virtual sv_frame_t getStartFrame() const { return m_view->getStartFrame(); } @@ -42,6 +45,12 @@ sv_frame_t f1 = m_view->getFrameForX((x / m_scaleFactor) + 1); return f0 + ((f1 - f0) * (x % m_scaleFactor)) / m_scaleFactor; } + virtual int getXForViewX(int viewx) const { + return viewx * m_scaleFactor; + } + virtual int getViewXForX(int x) const { + return x / m_scaleFactor; + } virtual sv_frame_t getModelsStartFrame() const { return m_view->getModelsStartFrame(); } @@ -54,14 +63,10 @@ return m_scaleFactor * m_view->getYForFrequency(frequency, minFreq, maxFreq, logarithmic); } - virtual double getFrequencyForY(int y, double minFreq, double maxFreq, + virtual double getFrequencyForY(double y, double minFreq, double maxFreq, bool logarithmic) const { - double f0 = m_view->getFrequencyForY + return m_view->getFrequencyForY (y / m_scaleFactor, minFreq, maxFreq, logarithmic); - if (m_scaleFactor == 1) return f0; - double f1 = m_view->getFrequencyForY - ((y / m_scaleFactor) + 1, minFreq, maxFreq, logarithmic); - return f0 + ((f1 - f0) * (y % m_scaleFactor)) / m_scaleFactor; } virtual int getTextLabelHeight(const Layer *layer, QPainter &paint) const { return m_scaleFactor * m_view->getTextLabelHeight(layer, paint); @@ -119,16 +124,18 @@ return m_view->shouldShowFeatureLabels(); } - virtual void drawVisibleText(QPainter &p, int x, int y, - QString text, TextStyle style) const { - m_view->drawVisibleText(p, x, y, text, style); - } - virtual void drawMeasurementRect(QPainter &p, const Layer *layer, QRect rect, bool focus) const { m_view->drawMeasurementRect(p, layer, rect, focus); } + virtual void updatePaintRect(QRect r) { + m_view->update(r.x() / m_scaleFactor, + r.y() / m_scaleFactor, + r.width() / m_scaleFactor, + r.height() / m_scaleFactor); + } + virtual View *getView() { return m_view; } virtual const View *getView() const { return m_view; }