comparison view/View.h @ 1324:13d9b422f7fe zoom

Merge from default branch
author Chris Cannam
date Mon, 17 Sep 2018 13:51:31 +0100
parents 57d192e26331 a34a2a25907c
children 40b9a495a0e0
comparison
equal deleted inserted replaced
1183:57d192e26331 1324:13d9b422f7fe
11 published by the Free Software Foundation; either version 2 of the 11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #ifndef _VIEW_H_ 16 #ifndef SV_VIEW_H
17 #define _VIEW_H_ 17 #define SV_VIEW_H
18 18
19 #include <QFrame> 19 #include <QFrame>
20 #include <QProgressBar> 20 #include <QProgressBar>
21 21
22 #include "layer/LayerGeometryProvider.h" 22 #include "layer/LayerGeometryProvider.h"
49 * mechanisms for doing so (as well as any other operations and 49 * mechanisms for doing so (as well as any other operations and
50 * properties available) depend on the subclass. 50 * properties available) depend on the subclass.
51 */ 51 */
52 52
53 class View : public QFrame, 53 class View : public QFrame,
54 public XmlExportable, 54 public XmlExportable,
55 public LayerGeometryProvider 55 public LayerGeometryProvider
56 { 56 {
57 Q_OBJECT 57 Q_OBJECT
58 58
59 public: 59 public:
134 * be useful for layers to match theirs up if desired. 134 * be useful for layers to match theirs up if desired.
135 * 135 *
136 * Not thread-safe in logarithmic mode. Call only from GUI thread. 136 * Not thread-safe in logarithmic mode. Call only from GUI thread.
137 */ 137 */
138 double getYForFrequency(double frequency, double minFreq, double maxFreq, 138 double getYForFrequency(double frequency, double minFreq, double maxFreq,
139 bool logarithmic) const; 139 bool logarithmic) const;
140 140
141 /** 141 /**
142 * Return the closest frequency to the given pixel y-coordinate, 142 * Return the closest frequency to the given pixel y-coordinate,
143 * if the frequency range is as specified. 143 * if the frequency range is as specified.
144 * 144 *
272 272
273 virtual bool shouldShowFeatureLabels() const { 273 virtual bool shouldShowFeatureLabels() const {
274 return m_manager && m_manager->shouldShowFeatureLabels(); 274 return m_manager && m_manager->shouldShowFeatureLabels();
275 } 275 }
276 virtual bool shouldIlluminateLocalFeatures(const Layer *, QPoint &) const { 276 virtual bool shouldIlluminateLocalFeatures(const Layer *, QPoint &) const {
277 return false; 277 return false;
278 } 278 }
279 virtual bool shouldIlluminateLocalSelection(QPoint &, bool &, bool &) const { 279 virtual bool shouldIlluminateLocalSelection(QPoint &, bool &, bool &) const {
280 return false; 280 return false;
281 } 281 }
282 282
283 virtual void setPlaybackFollow(PlaybackFollowMode m); 283 virtual void setPlaybackFollow(PlaybackFollowMode m);
284 virtual PlaybackFollowMode getPlaybackFollow() const { return m_followPlay; } 284 virtual PlaybackFollowMode getPlaybackFollow() const { return m_followPlay; }
285 285
291 // delegates back to us. 291 // delegates back to us.
292 virtual PropertyContainer::PropertyList getProperties() const; 292 virtual PropertyContainer::PropertyList getProperties() const;
293 virtual QString getPropertyLabel(const PropertyName &) const; 293 virtual QString getPropertyLabel(const PropertyName &) const;
294 virtual PropertyContainer::PropertyType getPropertyType(const PropertyName &) const; 294 virtual PropertyContainer::PropertyType getPropertyType(const PropertyName &) const;
295 virtual int getPropertyRangeAndValue(const PropertyName &, 295 virtual int getPropertyRangeAndValue(const PropertyName &,
296 int *min, int *max, int *deflt) const; 296 int *min, int *max, int *deflt) const;
297 virtual QString getPropertyValueLabel(const PropertyName &, 297 virtual QString getPropertyValueLabel(const PropertyName &,
298 int value) const; 298 int value) const;
299 virtual void setProperty(const PropertyName &, int value); 299 virtual void setProperty(const PropertyName &, int value);
300 virtual QString getPropertyContainerName() const { 300 virtual QString getPropertyContainerName() const {
301 return objectName(); 301 return objectName();
302 } 302 }
303 virtual QString getPropertyContainerIconName() const = 0; 303 virtual QString getPropertyContainerIconName() const = 0;
304 304
305 virtual int getPropertyContainerCount() const; 305 virtual int getPropertyContainerCount() const;
306 306
307 // The 0th property container is the view's own; the rest are the 307 // The 0th property container is the view's own; the rest are the
308 // layers in fixed-order series 308 // layers in fixed-order series
309 virtual const PropertyContainer *getPropertyContainer(int i) const; 309 virtual const PropertyContainer *getPropertyContainer(int i) const;
310 virtual PropertyContainer *getPropertyContainer(int i); 310 virtual PropertyContainer *getPropertyContainer(int i);
311 311
312 // Render the contents on a wide canvas 312 /**
313 virtual QImage *toNewImage(sv_frame_t f0, sv_frame_t f1); 313 * Render the view contents to a new QImage (which may be wider
314 virtual QImage *toNewImage(); 314 * than the visible View).
315 virtual QSize getImageSize(sv_frame_t f0, sv_frame_t f1); 315 */
316 virtual QSize getImageSize(); 316 virtual QImage *renderToNewImage();
317 317
318 /**
319 * Render the view contents between the given frame extents to a
320 * new QImage (which may be wider than the visible View).
321 */
322 virtual QImage *renderPartToNewImage(sv_frame_t f0, sv_frame_t f1);
323
324 /**
325 * Calculate and return the size of image that will be generated
326 * by renderToNewImage().
327 */
328 virtual QSize getRenderedImageSize();
329
330 /**
331 * Calculate and return the size of image that will be generated
332 * by renderPartToNewImage(f0, f1).
333 */
334 virtual QSize getRenderedPartImageSize(sv_frame_t f0, sv_frame_t f1);
335
336 /**
337 * Render the view contents to a new SVG file.
338 */
339 virtual bool renderToSvgFile(QString filename);
340
341 /**
342 * Render the view contents between the given frame extents to a
343 * new SVG file.
344 */
345 virtual bool renderPartToSvgFile(QString filename,
346 sv_frame_t f0, sv_frame_t f1);
347
318 virtual int getTextLabelHeight(const Layer *layer, QPainter &) const; 348 virtual int getTextLabelHeight(const Layer *layer, QPainter &) const;
319 349
320 virtual bool getValueExtents(QString unit, double &min, double &max, 350 virtual bool getValueExtents(QString unit, double &min, double &max,
321 bool &log) const; 351 bool &log) const;
322 352
459 bool m_followPlayIsDetached; 489 bool m_followPlayIsDetached;
460 sv_frame_t m_playPointerFrame; 490 sv_frame_t m_playPointerFrame;
461 bool m_lightBackground; 491 bool m_lightBackground;
462 bool m_showProgress; 492 bool m_showProgress;
463 493
464 QPixmap *m_cache; 494 QPixmap *m_cache; // I own this
465 QPixmap *m_buffer; 495 QPixmap *m_buffer; // I own this
466 sv_frame_t m_cacheCentreFrame; 496 sv_frame_t m_cacheCentreFrame;
467 ZoomLevel m_cacheZoomLevel; 497 ZoomLevel m_cacheZoomLevel;
468 bool m_selectionCached; 498 bool m_selectionCached;
469 499
470 bool m_deleting; 500 bool m_deleting;
508 PropertyList getProperties() const { return m_v->getProperties(); } 538 PropertyList getProperties() const { return m_v->getProperties(); }
509 QString getPropertyLabel(const PropertyName &n) const { 539 QString getPropertyLabel(const PropertyName &n) const {
510 return m_v->getPropertyLabel(n); 540 return m_v->getPropertyLabel(n);
511 } 541 }
512 PropertyType getPropertyType(const PropertyName &n) const { 542 PropertyType getPropertyType(const PropertyName &n) const {
513 return m_v->getPropertyType(n); 543 return m_v->getPropertyType(n);
514 } 544 }
515 int getPropertyRangeAndValue(const PropertyName &n, int *min, int *max, 545 int getPropertyRangeAndValue(const PropertyName &n, int *min, int *max,
516 int *deflt) const { 546 int *deflt) const {
517 return m_v->getPropertyRangeAndValue(n, min, max, deflt); 547 return m_v->getPropertyRangeAndValue(n, min, max, deflt);
518 } 548 }
519 QString getPropertyValueLabel(const PropertyName &n, int value) const { 549 QString getPropertyValueLabel(const PropertyName &n, int value) const {
520 return m_v->getPropertyValueLabel(n, value); 550 return m_v->getPropertyValueLabel(n, value);
521 } 551 }
522 QString getPropertyContainerName() const { 552 QString getPropertyContainerName() const {
523 return m_v->getPropertyContainerName(); 553 return m_v->getPropertyContainerName();
524 } 554 }
525 QString getPropertyContainerIconName() const { 555 QString getPropertyContainerIconName() const {
526 return m_v->getPropertyContainerIconName(); 556 return m_v->getPropertyContainerIconName();
527 } 557 }
528 558
529 public slots: 559 public slots:
530 virtual void setProperty(const PropertyName &n, int value) { 560 virtual void setProperty(const PropertyName &n, int value) {
531 m_v->setProperty(n, value); 561 m_v->setProperty(n, value);
532 } 562 }
533 563
534 protected: 564 protected:
535 View *m_v; 565 View *m_v;
536 }; 566 };