comparison layer/Layer.h @ 374:64e84e5efb76 spectrogram-cache-rejig

* Merge from trunk
author Chris Cannam
date Wed, 27 Feb 2008 11:59:42 +0000
parents 984c1975f1ff
children
comparison
equal deleted inserted replaced
332:6440e280122e 374:64e84e5efb76
90 } 90 }
91 91
92 virtual QString getPropertyContainerIconName() const; 92 virtual QString getPropertyContainerIconName() const;
93 93
94 virtual QString getPropertyContainerName() const { 94 virtual QString getPropertyContainerName() const {
95 return objectName(); 95 if (m_presentationName != "") return m_presentationName;
96 } 96 else return objectName();
97 }
98
99 virtual void setPresentationName(QString name);
97 100
98 virtual QString getLayerPresentationName() const; 101 virtual QString getLayerPresentationName() const;
99 virtual QPixmap getLayerPresentationPixmap(QSize) const { return QPixmap(); } 102 virtual QPixmap getLayerPresentationPixmap(QSize) const { return QPixmap(); }
100 103
101 virtual int getVerticalScaleWidth(View *, QPainter &) const { return 0; } 104 virtual int getVerticalScaleWidth(View *, QPainter &) const { return 0; }
149 SnapType /* snap */) const { 152 SnapType /* snap */) const {
150 resolution = 1; 153 resolution = 1;
151 return false; 154 return false;
152 } 155 }
153 156
154 // Draw and edit modes: 157 // Draw, erase, and edit modes:
155 // 158 //
156 // Layer needs to get actual mouse events, I guess. Draw mode is 159 // Layer needs to get actual mouse events, I guess. Draw mode is
157 // probably the easier. 160 // probably the easier.
158 161
159 virtual void drawStart(View *, QMouseEvent *) { } 162 virtual void drawStart(View *, QMouseEvent *) { }
160 virtual void drawDrag(View *, QMouseEvent *) { } 163 virtual void drawDrag(View *, QMouseEvent *) { }
161 virtual void drawEnd(View *, QMouseEvent *) { } 164 virtual void drawEnd(View *, QMouseEvent *) { }
165
166 virtual void eraseStart(View *, QMouseEvent *) { }
167 virtual void eraseDrag(View *, QMouseEvent *) { }
168 virtual void eraseEnd(View *, QMouseEvent *) { }
162 169
163 virtual void editStart(View *, QMouseEvent *) { } 170 virtual void editStart(View *, QMouseEvent *) { }
164 virtual void editDrag(View *, QMouseEvent *) { } 171 virtual void editDrag(View *, QMouseEvent *) { }
165 virtual void editEnd(View *, QMouseEvent *) { } 172 virtual void editEnd(View *, QMouseEvent *) { }
166 173
187 194
188 virtual void moveSelection(Selection, size_t /* newStartFrame */) { } 195 virtual void moveSelection(Selection, size_t /* newStartFrame */) { }
189 virtual void resizeSelection(Selection, Selection /* newSize */) { } 196 virtual void resizeSelection(Selection, Selection /* newSize */) { }
190 virtual void deleteSelection(Selection) { } 197 virtual void deleteSelection(Selection) { }
191 198
192 virtual void copy(Selection, Clipboard & /* to */) { } 199 virtual void copy(View *, Selection, Clipboard & /* to */) { }
193 200
194 /** 201 /**
195 * Paste from the given clipboard onto the layer at the given 202 * Paste from the given clipboard onto the layer at the given
196 * frame offset. If interactive is true, the layer may ask the 203 * frame offset. If interactive is true, the layer may ask the
197 * user about paste options through a dialog if desired, and may 204 * user about paste options through a dialog if desired, and may
198 * return false if the user cancelled the paste operation. This 205 * return false if the user cancelled the paste operation. This
199 * function should return true if a paste actually occurred. 206 * function should return true if a paste actually occurred.
200 */ 207 */
201 virtual bool paste(const Clipboard & /* from */, 208 virtual bool paste(View *,
209 const Clipboard & /* from */,
202 int /* frameOffset */, 210 int /* frameOffset */,
203 bool /* interactive */) { return false; } 211 bool /* interactive */) { return false; }
204 212
205 // Text mode: 213 // Text mode:
206 // 214 //
459 void verticalZoomChanged(); 467 void verticalZoomChanged();
460 468
461 protected: 469 protected:
462 void connectSignals(const Model *); 470 void connectSignals(const Model *);
463 471
472 virtual size_t alignToReference(View *v, size_t frame) const;
473 virtual size_t alignFromReference(View *v, size_t frame) const;
474 bool clipboardHasDifferentAlignment(View *v, const Clipboard &clip) const;
475
464 struct MeasureRect { 476 struct MeasureRect {
465 477
466 mutable QRect pixrect; 478 mutable QRect pixrect;
467 bool haveFrames; 479 bool haveFrames;
468 long startFrame; // only valid if haveFrames 480 long startFrame; // only valid if haveFrames
534 MeasureRectSet::const_iterator findFocusedMeasureRect(QPoint) const; 546 MeasureRectSet::const_iterator findFocusedMeasureRect(QPoint) const;
535 547
536 void paintMeasurementRect(View *v, QPainter &paint, 548 void paintMeasurementRect(View *v, QPainter &paint,
537 const MeasureRect &r, bool focus) const; 549 const MeasureRect &r, bool focus) const;
538 550
551 QString m_presentationName;
552
539 private: 553 private:
540 mutable QMutex m_dormancyMutex; 554 mutable QMutex m_dormancyMutex;
541 mutable std::map<const void *, bool> m_dormancy; 555 mutable std::map<const void *, bool> m_dormancy;
542 }; 556 };
543 557