Mercurial > hg > svgui
diff view/View.h @ 946:36cddc3de023 alignment_view
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:19:52 +0100 |
parents | 99373ca20caf 4a578a360011 |
children | f535f6e5dbb0 |
line wrap: on
line diff
--- a/view/View.h Thu Jan 15 16:00:53 2015 +0000 +++ b/view/View.h Mon Apr 20 09:19:52 2015 +0100 @@ -23,6 +23,7 @@ #include "base/PropertyContainer.h" #include "ViewManager.h" #include "base/XmlExportable.h" +#include "base/BaseTypes.h" // #define DEBUG_VIEW_WIDGET_PAINT 1 @@ -64,13 +65,13 @@ * This is a calculated value based on the centre-frame, widget * width and zoom level. The result may be negative. */ - int getStartFrame() const; + sv_frame_t getStartFrame() const; /** * Set the widget pan based on the given first visible frame. The * frame value may be negative. */ - void setStartFrame(int); + void setStartFrame(sv_frame_t); /** * Return the centre frame of the visible widget. This is an @@ -78,30 +79,30 @@ * frame values (start, end) are calculated from this based on the * zoom and other factors. */ - int getCentreFrame() const { return m_centreFrame; } + sv_frame_t getCentreFrame() const { return m_centreFrame; } /** * Set the centre frame of the visible widget. */ - void setCentreFrame(int f) { setCentreFrame(f, true); } + void setCentreFrame(sv_frame_t f) { setCentreFrame(f, true); } /** * Retrieve the last visible sample frame on the widget. * This is a calculated value based on the centre-frame, widget * width and zoom level. */ - int getEndFrame() const; + sv_frame_t getEndFrame() const; /** * Return the pixel x-coordinate corresponding to a given sample * frame (which may be negative). */ - int getXForFrame(int frame) const; + int getXForFrame(sv_frame_t frame) const; /** * Return the closest frame to the given pixel x-coordinate. */ - int getFrameForX(int x) const; + sv_frame_t getFrameForX(int x) const; /** * Return the pixel y-coordinate corresponding to a given @@ -111,7 +112,7 @@ * * Not thread-safe in logarithmic mode. Call only from GUI thread. */ - float getYForFrequency(float frequency, float minFreq, float maxFreq, + double getYForFrequency(double frequency, double minFreq, double maxFreq, bool logarithmic) const; /** @@ -120,7 +121,7 @@ * * Not thread-safe in logarithmic mode. Call only from GUI thread. */ - float getFrequencyForY(int y, float minFreq, float maxFreq, + double getFrequencyForY(int y, double minFreq, double maxFreq, bool logarithmic) const; /** @@ -163,7 +164,7 @@ * Return the number of layers, regardless of whether visible or * dormant, i.e. invisible, in this view. */ - virtual int getLayerCount() const { return m_layerStack.size(); } + virtual int getLayerCount() const { return int(m_layerStack.size()); } /** * Return the nth layer, counted in stacking order. That is, @@ -172,7 +173,7 @@ * dormant, i.e. invisible. */ virtual Layer *getLayer(int n) { - if (n < int(m_layerStack.size())) return m_layerStack[n]; + if (in_range_for(m_layerStack, n)) return m_layerStack[n]; else return 0; } @@ -229,7 +230,7 @@ } virtual void setViewManager(ViewManager *m); - virtual void setViewManager(ViewManager *m, int initialFrame); + virtual void setViewManager(ViewManager *m, sv_frame_t initialFrame); virtual ViewManager *getViewManager() const { return m_manager; } virtual void setFollowGlobalPan(bool f); @@ -294,34 +295,34 @@ virtual PropertyContainer *getPropertyContainer(int i); // Render the contents on a wide canvas - virtual QImage *toNewImage(int f0, int f1); + virtual QImage *toNewImage(sv_frame_t f0, sv_frame_t f1); virtual QImage *toNewImage(); - virtual QSize getImageSize(int f0, int f1); + virtual QSize getImageSize(sv_frame_t f0, sv_frame_t f1); virtual QSize getImageSize(); virtual int getTextLabelHeight(const Layer *layer, QPainter &) const; - virtual bool getValueExtents(QString unit, float &min, float &max, + virtual bool getValueExtents(QString unit, double &min, double &max, bool &log) const; virtual void toXml(QTextStream &stream, QString indent = "", QString extraAttributes = "") const; // First frame actually in model, to right of scale, if present - virtual int getFirstVisibleFrame() const; - virtual int getLastVisibleFrame() const; + virtual sv_frame_t getFirstVisibleFrame() const; + virtual sv_frame_t getLastVisibleFrame() const; - int getModelsStartFrame() const; - int getModelsEndFrame() const; + sv_frame_t getModelsStartFrame() const; + sv_frame_t getModelsEndFrame() const; typedef std::set<Model *> ModelSet; ModelSet getModels(); //!!! Model *getAligningModel() const; - int alignFromReference(int) const; - int alignToReference(int) const; - int getAlignedPlaybackFrame() const; + sv_frame_t alignFromReference(sv_frame_t) const; + sv_frame_t alignToReference(sv_frame_t) const; + sv_frame_t getAlignedPlaybackFrame() const; signals: void propertyContainerAdded(PropertyContainer *pc); @@ -334,7 +335,7 @@ void layerModelChanged(); - void centreFrameChanged(int frame, + void centreFrameChanged(sv_frame_t frame, bool globalScroll, PlaybackFollowMode followMode); @@ -344,7 +345,7 @@ public slots: virtual void modelChanged(); - virtual void modelChangedWithin(int startFrame, int endFrame); + virtual void modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame); virtual void modelCompletionChanged(); virtual void modelAlignmentCompletionChanged(); virtual void modelReplaced(); @@ -353,9 +354,9 @@ virtual void layerMeasurementRectsChanged(); virtual void layerNameChanged(); - virtual void globalCentreFrameChanged(int); - virtual void viewCentreFrameChanged(View *, int); - virtual void viewManagerPlaybackFrameChanged(int); + virtual void globalCentreFrameChanged(sv_frame_t); + virtual void viewCentreFrameChanged(View *, sv_frame_t); + virtual void viewManagerPlaybackFrameChanged(sv_frame_t); virtual void viewZoomLevelChanged(View *, int, bool); virtual void propertyContainerSelected(View *, PropertyContainer *pc); @@ -374,12 +375,12 @@ virtual void paintEvent(QPaintEvent *e); virtual void drawSelections(QPainter &); virtual bool shouldLabelSelections() const { return true; } - virtual bool render(QPainter &paint, int x0, int f0, int f1); + virtual bool render(QPainter &paint, int x0, sv_frame_t f0, sv_frame_t f1); virtual void setPaintFont(QPainter &paint); typedef std::vector<Layer *> LayerList; - int getModelsSampleRate() const; + sv_samplerate_t getModelsSampleRate() const; bool areLayersScrollable() const; LayerList getScrollableBackLayers(bool testChanged, bool &changed) const; LayerList getNonScrollableFrontLayers(bool testChanged, bool &changed) const; @@ -398,25 +399,25 @@ // false. bool hasTopLayerTimeXAxis() const; - bool setCentreFrame(int f, bool doEmit); + bool setCentreFrame(sv_frame_t f, bool doEmit); - void movePlayPointer(int f); + void movePlayPointer(sv_frame_t f); void checkProgress(void *object); int getProgressBarWidth() const; // if visible - int m_centreFrame; + sv_frame_t m_centreFrame; int m_zoomLevel; bool m_followPan; bool m_followZoom; PlaybackFollowMode m_followPlay; bool m_followPlayIsDetached; - int m_playPointerFrame; + sv_frame_t m_playPointerFrame; bool m_lightBackground; bool m_showProgress; QPixmap *m_cache; - int m_cacheCentreFrame; + sv_frame_t m_cacheCentreFrame; int m_cacheZoomLevel; bool m_selectionCached;