Mercurial > hg > svgui
comparison view/View.h @ 810:b68af2be4545 tonioni
Merge from branch warnfix_no_size_t
author | Chris Cannam |
---|---|
date | Wed, 18 Jun 2014 13:42:25 +0100 |
parents | 40c6c9344ff6 |
children | 9ad718fdc369 |
comparison
equal
deleted
inserted
replaced
802:584b11df8e4f | 810:b68af2be4545 |
---|---|
62 /** | 62 /** |
63 * Retrieve the first visible sample frame on the widget. | 63 * Retrieve the first visible sample frame on the widget. |
64 * This is a calculated value based on the centre-frame, widget | 64 * This is a calculated value based on the centre-frame, widget |
65 * width and zoom level. The result may be negative. | 65 * width and zoom level. The result may be negative. |
66 */ | 66 */ |
67 long getStartFrame() const; | 67 int getStartFrame() const; |
68 | 68 |
69 /** | 69 /** |
70 * Set the widget pan based on the given first visible frame. The | 70 * Set the widget pan based on the given first visible frame. The |
71 * frame value may be negative. | 71 * frame value may be negative. |
72 */ | 72 */ |
73 void setStartFrame(long); | 73 void setStartFrame(int); |
74 | 74 |
75 /** | 75 /** |
76 * Return the centre frame of the visible widget. This is an | 76 * Return the centre frame of the visible widget. This is an |
77 * exact value that does not depend on the zoom block size. Other | 77 * exact value that does not depend on the zoom block size. Other |
78 * frame values (start, end) are calculated from this based on the | 78 * frame values (start, end) are calculated from this based on the |
79 * zoom and other factors. | 79 * zoom and other factors. |
80 */ | 80 */ |
81 size_t getCentreFrame() const { return m_centreFrame; } | 81 int getCentreFrame() const { return m_centreFrame; } |
82 | 82 |
83 /** | 83 /** |
84 * Set the centre frame of the visible widget. | 84 * Set the centre frame of the visible widget. |
85 */ | 85 */ |
86 void setCentreFrame(size_t f) { setCentreFrame(f, true); } | 86 void setCentreFrame(int f) { setCentreFrame(f, true); } |
87 | 87 |
88 /** | 88 /** |
89 * Retrieve the last visible sample frame on the widget. | 89 * Retrieve the last visible sample frame on the widget. |
90 * This is a calculated value based on the centre-frame, widget | 90 * This is a calculated value based on the centre-frame, widget |
91 * width and zoom level. | 91 * width and zoom level. |
92 */ | 92 */ |
93 size_t getEndFrame() const; | 93 int getEndFrame() const; |
94 | 94 |
95 /** | 95 /** |
96 * Return the pixel x-coordinate corresponding to a given sample | 96 * Return the pixel x-coordinate corresponding to a given sample |
97 * frame (which may be negative). | 97 * frame (which may be negative). |
98 */ | 98 */ |
99 int getXForFrame(long frame) const; | 99 int getXForFrame(int frame) const; |
100 | 100 |
101 /** | 101 /** |
102 * Return the closest frame to the given pixel x-coordinate. | 102 * Return the closest frame to the given pixel x-coordinate. |
103 */ | 103 */ |
104 long getFrameForX(int x) const; | 104 int getFrameForX(int x) const; |
105 | 105 |
106 /** | 106 /** |
107 * Return the pixel y-coordinate corresponding to a given | 107 * Return the pixel y-coordinate corresponding to a given |
108 * frequency, if the frequency range is as specified. This does | 108 * frequency, if the frequency range is as specified. This does |
109 * not imply any policy about layer frequency ranges, but it might | 109 * not imply any policy about layer frequency ranges, but it might |
131 /** | 131 /** |
132 * Set the zoom level, i.e. the number of frames per pixel. The | 132 * Set the zoom level, i.e. the number of frames per pixel. The |
133 * centre frame will be unchanged; the start and end frames will | 133 * centre frame will be unchanged; the start and end frames will |
134 * change. | 134 * change. |
135 */ | 135 */ |
136 virtual void setZoomLevel(size_t z); | 136 virtual void setZoomLevel(int z); |
137 | 137 |
138 /** | 138 /** |
139 * Zoom in or out. | 139 * Zoom in or out. |
140 */ | 140 */ |
141 virtual void zoom(bool in); | 141 virtual void zoom(bool in); |
175 */ | 175 */ |
176 virtual Layer *getSelectedLayer(); | 176 virtual Layer *getSelectedLayer(); |
177 virtual const Layer *getSelectedLayer() const; | 177 virtual const Layer *getSelectedLayer() const; |
178 | 178 |
179 virtual void setViewManager(ViewManager *m); | 179 virtual void setViewManager(ViewManager *m); |
180 virtual void setViewManager(ViewManager *m, long initialFrame); | 180 virtual void setViewManager(ViewManager *m, int initialFrame); |
181 virtual ViewManager *getViewManager() const { return m_manager; } | 181 virtual ViewManager *getViewManager() const { return m_manager; } |
182 | 182 |
183 virtual void setFollowGlobalPan(bool f); | 183 virtual void setFollowGlobalPan(bool f); |
184 virtual bool getFollowGlobalPan() const { return m_followPan; } | 184 virtual bool getFollowGlobalPan() const { return m_followPan; } |
185 | 185 |
232 virtual QString getPropertyContainerName() const { | 232 virtual QString getPropertyContainerName() const { |
233 return objectName(); | 233 return objectName(); |
234 } | 234 } |
235 virtual QString getPropertyContainerIconName() const = 0; | 235 virtual QString getPropertyContainerIconName() const = 0; |
236 | 236 |
237 virtual size_t getPropertyContainerCount() const; | 237 virtual int getPropertyContainerCount() const; |
238 | 238 |
239 virtual const PropertyContainer *getPropertyContainer(size_t i) const; | 239 virtual const PropertyContainer *getPropertyContainer(int i) const; |
240 virtual PropertyContainer *getPropertyContainer(size_t i); | 240 virtual PropertyContainer *getPropertyContainer(int i); |
241 | 241 |
242 // Render the contents on a wide canvas | 242 // Render the contents on a wide canvas |
243 virtual QImage *toNewImage(size_t f0, size_t f1); | 243 virtual QImage *toNewImage(int f0, int f1); |
244 virtual QImage *toNewImage(); | 244 virtual QImage *toNewImage(); |
245 virtual QSize getImageSize(size_t f0, size_t f1); | 245 virtual QSize getImageSize(int f0, int f1); |
246 virtual QSize getImageSize(); | 246 virtual QSize getImageSize(); |
247 | 247 |
248 virtual int getTextLabelHeight(const Layer *layer, QPainter &) const; | 248 virtual int getTextLabelHeight(const Layer *layer, QPainter &) const; |
249 | 249 |
250 virtual bool getValueExtents(QString unit, float &min, float &max, | 250 virtual bool getValueExtents(QString unit, float &min, float &max, |
252 | 252 |
253 virtual void toXml(QTextStream &stream, QString indent = "", | 253 virtual void toXml(QTextStream &stream, QString indent = "", |
254 QString extraAttributes = "") const; | 254 QString extraAttributes = "") const; |
255 | 255 |
256 // First frame actually in model, to right of scale, if present | 256 // First frame actually in model, to right of scale, if present |
257 virtual size_t getFirstVisibleFrame() const; | 257 virtual int getFirstVisibleFrame() const; |
258 virtual size_t getLastVisibleFrame() const; | 258 virtual int getLastVisibleFrame() const; |
259 | 259 |
260 size_t getModelsStartFrame() const; | 260 int getModelsStartFrame() const; |
261 size_t getModelsEndFrame() const; | 261 int getModelsEndFrame() const; |
262 | 262 |
263 typedef std::set<Model *> ModelSet; | 263 typedef std::set<Model *> ModelSet; |
264 ModelSet getModels(); | 264 ModelSet getModels(); |
265 | 265 |
266 //!!! | 266 //!!! |
267 Model *getAligningModel() const; | 267 Model *getAligningModel() const; |
268 size_t alignFromReference(size_t) const; | 268 int alignFromReference(int) const; |
269 size_t alignToReference(size_t) const; | 269 int alignToReference(int) const; |
270 int getAlignedPlaybackFrame() const; | 270 int getAlignedPlaybackFrame() const; |
271 | 271 |
272 signals: | 272 signals: |
273 void propertyContainerAdded(PropertyContainer *pc); | 273 void propertyContainerAdded(PropertyContainer *pc); |
274 void propertyContainerRemoved(PropertyContainer *pc); | 274 void propertyContainerRemoved(PropertyContainer *pc); |
278 void propertyContainerSelected(PropertyContainer *pc); | 278 void propertyContainerSelected(PropertyContainer *pc); |
279 void propertyChanged(PropertyContainer::PropertyName); | 279 void propertyChanged(PropertyContainer::PropertyName); |
280 | 280 |
281 void layerModelChanged(); | 281 void layerModelChanged(); |
282 | 282 |
283 void centreFrameChanged(unsigned long frame, | 283 void centreFrameChanged(int frame, |
284 bool globalScroll, | 284 bool globalScroll, |
285 PlaybackFollowMode followMode); | 285 PlaybackFollowMode followMode); |
286 | 286 |
287 void zoomLevelChanged(unsigned long, bool); | 287 void zoomLevelChanged(int, bool); |
288 | 288 |
289 void contextHelpChanged(const QString &); | 289 void contextHelpChanged(const QString &); |
290 | 290 |
291 public slots: | 291 public slots: |
292 virtual void modelChanged(); | 292 virtual void modelChanged(); |
293 virtual void modelChanged(size_t startFrame, size_t endFrame); | 293 virtual void modelChangedWithin(int startFrame, int endFrame); |
294 virtual void modelCompletionChanged(); | 294 virtual void modelCompletionChanged(); |
295 virtual void modelAlignmentCompletionChanged(); | 295 virtual void modelAlignmentCompletionChanged(); |
296 virtual void modelReplaced(); | 296 virtual void modelReplaced(); |
297 virtual void layerParametersChanged(); | 297 virtual void layerParametersChanged(); |
298 virtual void layerParameterRangesChanged(); | 298 virtual void layerParameterRangesChanged(); |
299 virtual void layerMeasurementRectsChanged(); | 299 virtual void layerMeasurementRectsChanged(); |
300 virtual void layerNameChanged(); | 300 virtual void layerNameChanged(); |
301 | 301 |
302 virtual void globalCentreFrameChanged(unsigned long); | 302 virtual void globalCentreFrameChanged(int); |
303 virtual void viewCentreFrameChanged(View *, unsigned long); | 303 virtual void viewCentreFrameChanged(View *, int); |
304 virtual void viewManagerPlaybackFrameChanged(unsigned long); | 304 virtual void viewManagerPlaybackFrameChanged(int); |
305 virtual void viewZoomLevelChanged(View *, unsigned long, bool); | 305 virtual void viewZoomLevelChanged(View *, int, bool); |
306 | 306 |
307 virtual void propertyContainerSelected(View *, PropertyContainer *pc); | 307 virtual void propertyContainerSelected(View *, PropertyContainer *pc); |
308 | 308 |
309 virtual void selectionChanged(); | 309 virtual void selectionChanged(); |
310 virtual void toolModeChanged(); | 310 virtual void toolModeChanged(); |
318 protected: | 318 protected: |
319 View(QWidget *, bool showProgress); | 319 View(QWidget *, bool showProgress); |
320 virtual void paintEvent(QPaintEvent *e); | 320 virtual void paintEvent(QPaintEvent *e); |
321 virtual void drawSelections(QPainter &); | 321 virtual void drawSelections(QPainter &); |
322 virtual bool shouldLabelSelections() const { return true; } | 322 virtual bool shouldLabelSelections() const { return true; } |
323 virtual bool render(QPainter &paint, int x0, size_t f0, size_t f1); | 323 virtual bool render(QPainter &paint, int x0, int f0, int f1); |
324 virtual void setPaintFont(QPainter &paint); | 324 virtual void setPaintFont(QPainter &paint); |
325 | 325 |
326 typedef std::vector<Layer *> LayerList; | 326 typedef std::vector<Layer *> LayerList; |
327 | 327 |
328 int getModelsSampleRate() const; | 328 int getModelsSampleRate() const; |
329 bool areLayersScrollable() const; | 329 bool areLayersScrollable() const; |
330 LayerList getScrollableBackLayers(bool testChanged, bool &changed) const; | 330 LayerList getScrollableBackLayers(bool testChanged, bool &changed) const; |
331 LayerList getNonScrollableFrontLayers(bool testChanged, bool &changed) const; | 331 LayerList getNonScrollableFrontLayers(bool testChanged, bool &changed) const; |
332 size_t getZoomConstraintBlockSize(size_t blockSize, | 332 int getZoomConstraintBlockSize(int blockSize, |
333 ZoomConstraint::RoundingDirection dir = | 333 ZoomConstraint::RoundingDirection dir = |
334 ZoomConstraint::RoundNearest) const; | 334 ZoomConstraint::RoundNearest) const; |
335 | 335 |
336 // True if the top layer(s) use colours for meaningful things. If | 336 // True if the top layer(s) use colours for meaningful things. If |
337 // this is the case, selections will be shown using unfilled boxes | 337 // this is the case, selections will be shown using unfilled boxes |
342 // is generally the case except for spectrum/slice layers). It | 342 // is generally the case except for spectrum/slice layers). It |
343 // will not be possible to make or display selections if this is | 343 // will not be possible to make or display selections if this is |
344 // false. | 344 // false. |
345 bool hasTopLayerTimeXAxis() const; | 345 bool hasTopLayerTimeXAxis() const; |
346 | 346 |
347 bool setCentreFrame(size_t f, bool doEmit); | 347 bool setCentreFrame(int f, bool doEmit); |
348 | 348 |
349 void movePlayPointer(unsigned long f); | 349 void movePlayPointer(int f); |
350 | 350 |
351 void checkProgress(void *object); | 351 void checkProgress(void *object); |
352 int getProgressBarWidth() const; // if visible | 352 int getProgressBarWidth() const; // if visible |
353 | 353 |
354 size_t m_centreFrame; | 354 int m_centreFrame; |
355 int m_zoomLevel; | 355 int m_zoomLevel; |
356 bool m_followPan; | 356 bool m_followPan; |
357 bool m_followZoom; | 357 bool m_followZoom; |
358 PlaybackFollowMode m_followPlay; | 358 PlaybackFollowMode m_followPlay; |
359 bool m_followPlayIsDetached; | 359 bool m_followPlayIsDetached; |
360 size_t m_playPointerFrame; | 360 int m_playPointerFrame; |
361 bool m_lightBackground; | 361 bool m_lightBackground; |
362 bool m_showProgress; | 362 bool m_showProgress; |
363 | 363 |
364 QPixmap *m_cache; | 364 QPixmap *m_cache; |
365 size_t m_cacheCentreFrame; | 365 int m_cacheCentreFrame; |
366 int m_cacheZoomLevel; | 366 int m_cacheZoomLevel; |
367 bool m_selectionCached; | 367 bool m_selectionCached; |
368 | 368 |
369 bool m_deleting; | 369 bool m_deleting; |
370 | 370 |