comparison view/View.h @ 1183:57d192e26331 zoom

Some hackery toward having a zoomlevel type
author Chris Cannam
date Mon, 12 Dec 2016 15:18:52 +0000
parents 179ea8a2f650
children 13d9b422f7fe
comparison
equal deleted inserted replaced
1182:6605984fa98f 1183:57d192e26331
146 */ 146 */
147 double getFrequencyForY(double y, double minFreq, double maxFreq, 147 double getFrequencyForY(double y, double minFreq, double maxFreq,
148 bool logarithmic) const; 148 bool logarithmic) const;
149 149
150 /** 150 /**
151 * Return the zoom level, i.e. the number of frames per pixel 151 * Return the zoom level, i.e. the number of frames per pixel or
152 */ 152 * pixels per frame
153 int getZoomLevel() const; 153 */
154 154 ZoomLevel getZoomLevel() const;
155 /** 155
156 * Set the zoom level, i.e. the number of frames per pixel. The 156 /**
157 * centre frame will be unchanged; the start and end frames will 157 * Set the zoom level, i.e. the number of frames per pixel or
158 * change. 158 * pixels per frame. The centre frame will be unchanged; the
159 */ 159 * start and end frames will change.
160 virtual void setZoomLevel(int z); 160 */
161 virtual void setZoomLevel(ZoomLevel z);
161 162
162 /** 163 /**
163 * Zoom in or out. 164 * Zoom in or out.
164 */ 165 */
165 virtual void zoom(bool in); 166 virtual void zoom(bool in);
368 369
369 void centreFrameChanged(sv_frame_t frame, 370 void centreFrameChanged(sv_frame_t frame,
370 bool globalScroll, 371 bool globalScroll,
371 PlaybackFollowMode followMode); 372 PlaybackFollowMode followMode);
372 373
373 void zoomLevelChanged(int level, bool locked); 374 void zoomLevelChanged(ZoomLevel level, bool locked);
374 375
375 void contextHelpChanged(const QString &); 376 void contextHelpChanged(const QString &);
376 377
377 public slots: 378 public slots:
378 virtual void modelChanged(); 379 virtual void modelChanged();
386 virtual void layerNameChanged(); 387 virtual void layerNameChanged();
387 388
388 virtual void globalCentreFrameChanged(sv_frame_t); 389 virtual void globalCentreFrameChanged(sv_frame_t);
389 virtual void viewCentreFrameChanged(View *, sv_frame_t); 390 virtual void viewCentreFrameChanged(View *, sv_frame_t);
390 virtual void viewManagerPlaybackFrameChanged(sv_frame_t); 391 virtual void viewManagerPlaybackFrameChanged(sv_frame_t);
391 virtual void viewZoomLevelChanged(View *, int, bool); 392 virtual void viewZoomLevelChanged(View *, ZoomLevel, bool);
392 393
393 virtual void propertyContainerSelected(View *, PropertyContainer *pc); 394 virtual void propertyContainerSelected(View *, PropertyContainer *pc);
394 395
395 virtual void selectionChanged(); 396 virtual void selectionChanged();
396 virtual void toolModeChanged(); 397 virtual void toolModeChanged();
424 425
425 sv_samplerate_t getModelsSampleRate() const; 426 sv_samplerate_t getModelsSampleRate() const;
426 bool areLayersScrollable() const; 427 bool areLayersScrollable() const;
427 LayerList getScrollableBackLayers(bool testChanged, bool &changed) const; 428 LayerList getScrollableBackLayers(bool testChanged, bool &changed) const;
428 LayerList getNonScrollableFrontLayers(bool testChanged, bool &changed) const; 429 LayerList getNonScrollableFrontLayers(bool testChanged, bool &changed) const;
429 int getZoomConstraintBlockSize(int blockSize, 430 ZoomLevel getZoomConstraintLevel(ZoomLevel level,
430 ZoomConstraint::RoundingDirection dir = 431 ZoomConstraint::RoundingDirection dir =
431 ZoomConstraint::RoundNearest) const; 432 ZoomConstraint::RoundNearest) const;
432 433
433 // True if the top layer(s) use colours for meaningful things. If 434 // True if the top layer(s) use colours for meaningful things. If
434 // this is the case, selections will be shown using unfilled boxes 435 // this is the case, selections will be shown using unfilled boxes
435 // rather than with a translucent fill. 436 // rather than with a translucent fill.
436 bool areLayerColoursSignificant() const; 437 bool areLayerColoursSignificant() const;
449 int getProgressBarWidth() const; // if visible 450 int getProgressBarWidth() const; // if visible
450 451
451 int effectiveDevicePixelRatio() const; 452 int effectiveDevicePixelRatio() const;
452 453
453 sv_frame_t m_centreFrame; 454 sv_frame_t m_centreFrame;
454 int m_zoomLevel; 455 ZoomLevel m_zoomLevel;
455 bool m_followPan; 456 bool m_followPan;
456 bool m_followZoom; 457 bool m_followZoom;
457 PlaybackFollowMode m_followPlay; 458 PlaybackFollowMode m_followPlay;
458 bool m_followPlayIsDetached; 459 bool m_followPlayIsDetached;
459 sv_frame_t m_playPointerFrame; 460 sv_frame_t m_playPointerFrame;
461 bool m_showProgress; 462 bool m_showProgress;
462 463
463 QPixmap *m_cache; 464 QPixmap *m_cache;
464 QPixmap *m_buffer; 465 QPixmap *m_buffer;
465 sv_frame_t m_cacheCentreFrame; 466 sv_frame_t m_cacheCentreFrame;
466 int m_cacheZoomLevel; 467 ZoomLevel m_cacheZoomLevel;
467 bool m_selectionCached; 468 bool m_selectionCached;
468 469
469 bool m_deleting; 470 bool m_deleting;
470 471
471 LayerList m_layerStack; // I don't own these, but see dtor note above 472 LayerList m_layerStack; // I don't own these, but see dtor note above