comparison view/View.h @ 1030:0be17aafa935 spectrogram-minor-refactor

Start refactoring out the spectrogram image cache
author Chris Cannam
date Fri, 29 Jan 2016 15:08:01 +0000
parents 092de22db207
children 4e5c1c326794
comparison
equal deleted inserted replaced
1029:fdfd84b022df 1030:0be17aafa935
60 /** 60 /**
61 * Deleting a View does not delete any of its layers. They should 61 * Deleting a View does not delete any of its layers. They should
62 * be managed elsewhere (e.g. by the Document). 62 * be managed elsewhere (e.g. by the Document).
63 */ 63 */
64 virtual ~View(); 64 virtual ~View();
65 65
66 /** 66 /**
67 * Retrieve the first visible sample frame on the widget. 67 * Retrieve the first visible sample frame on the widget.
68 * This is a calculated value based on the centre-frame, widget 68 * This is a calculated value based on the centre-frame, widget
69 * width and zoom level. The result may be negative. 69 * width and zoom level. The result may be negative.
70 */ 70 */
104 104
105 /** 105 /**
106 * Return the closest frame to the given pixel x-coordinate. 106 * Return the closest frame to the given pixel x-coordinate.
107 */ 107 */
108 sv_frame_t getFrameForX(int x) const; 108 sv_frame_t getFrameForX(int x) const;
109
110 /**
111 * Return the closest pixel x-coordinate corresponding to a given
112 * view x-coordinate. Default is no scaling, ViewProxy handles
113 * scaling case.
114 */
115 int getXForViewX(int viewx) const { return viewx; }
116
117 /**
118 * Return the closest view x-coordinate corresponding to a given
119 * pixel x-coordinate. Default is no scaling, ViewProxy handles
120 * scaling case.
121 */
122 int getViewXForX(int x) const { return x; }
109 123
110 /** 124 /**
111 * Return the pixel y-coordinate corresponding to a given 125 * Return the pixel y-coordinate corresponding to a given
112 * frequency, if the frequency range is as specified. This does 126 * frequency, if the frequency range is as specified. This does
113 * not imply any policy about layer frequency ranges, but it might 127 * not imply any policy about layer frequency ranges, but it might
331 Model *getAligningModel() const; 345 Model *getAligningModel() const;
332 sv_frame_t alignFromReference(sv_frame_t) const; 346 sv_frame_t alignFromReference(sv_frame_t) const;
333 sv_frame_t alignToReference(sv_frame_t) const; 347 sv_frame_t alignToReference(sv_frame_t) const;
334 sv_frame_t getAlignedPlaybackFrame() const; 348 sv_frame_t getAlignedPlaybackFrame() const;
335 349
350 void updatePaintRect(QRect r) { update(r); }
351
336 View *getView() { return this; } 352 View *getView() { return this; }
337 const View *getView() const { return this; } 353 const View *getView() const { return this; }
338 354
339 signals: 355 signals:
340 void propertyContainerAdded(PropertyContainer *pc); 356 void propertyContainerAdded(PropertyContainer *pc);
382 398
383 virtual void progressCheckStalledTimerElapsed(); 399 virtual void progressCheckStalledTimerElapsed();
384 400
385 protected: 401 protected:
386 View(QWidget *, bool showProgress); 402 View(QWidget *, bool showProgress);
403
404 int m_id;
405
387 virtual void paintEvent(QPaintEvent *e); 406 virtual void paintEvent(QPaintEvent *e);
388 virtual void drawSelections(QPainter &); 407 virtual void drawSelections(QPainter &);
389 virtual bool shouldLabelSelections() const { return true; } 408 virtual bool shouldLabelSelections() const { return true; }
390 virtual bool render(QPainter &paint, int x0, sv_frame_t f0, sv_frame_t f1); 409 virtual bool render(QPainter &paint, int x0, sv_frame_t f0, sv_frame_t f1);
391 virtual void setPaintFont(QPainter &paint); 410 virtual void setPaintFont(QPainter &paint);