18 #include "data/model/Model.h" 19 #include "base/ZoomConstraint.h" 21 #include <QPaintEvent> 30 m_clickedInRange(false),
33 setObjectName(tr(
"Overview"));
43 bool zoomChanged =
false;
46 int zoomLevel = frameCount / width();
47 if (zoomLevel < 1) zoomLevel = 1;
49 ZoomConstraint::RoundUp);
58 if ((*i)->getModel() &&
59 (!(*i)->getModel()->isOK() ||
60 !(*i)->getModel()->isReady())) {
100 #ifdef DEBUG_OVERVIEW 101 cerr <<
"Overview::globalCentreFrameChanged: " << f << endl;
108 #ifdef DEBUG_OVERVIEW
113 #ifdef DEBUG_OVERVIEW 114 cerr <<
"Overview[" <<
this <<
"]::viewCentreFrameChanged(" << v <<
"): " << f << endl;
124 if (v ==
this)
return;
133 #ifdef DEBUG_OVERVIEW 134 cerr <<
"Overview[" <<
this <<
"]::viewManagerPlaybackFrameChanged(" << f <<
"): " << f << endl;
137 bool changed =
false;
144 if (changed) update();
152 #ifdef DEBUG_OVERVIEW 153 cerr <<
"Overview::paintEvent: width is " << width() <<
", centre frame " <<
m_centreFrame << endl;
158 int zoomLevel = frameCount / width();
159 if (zoomLevel < 1) zoomLevel = 1;
161 ZoomConstraint::RoundUp);
167 int centreFrame = startFrame +
m_zoomLevel * (width() / 2);
172 #ifdef DEBUG_OVERVIEW 173 cerr <<
"Overview::paintEvent: Centre frame changed from " 177 #ifdef DEBUG_OVERVIEW 192 paint.setClipRect(r);
202 for (ViewSet::iterator i =
m_views.begin(); i !=
m_views.end(); ++i) {
222 if (x0 != prevx0 || x1 != prevx1) {
223 y += height() / 10 + 1;
228 if (x1 <= x0) x1 = x0 + 1;
230 paint.drawRect(x0, y, x1 - x0, height() - 2 * y);
245 for (ViewSet::iterator i =
m_views.begin(); i !=
m_views.end(); ++i) {
272 newCentreFrame += frameOff;
273 }
else if (newCentreFrame >=
int(-frameOff)) {
274 newCentreFrame += frameOff;
281 if (newCentreFrame > 0) --newCentreFrame;
287 #ifdef DEBUG_OVERVIEW 288 cerr <<
"Overview::mouseMoveEvent: x " << e->x() <<
" and click x " <<
m_clickPos.x() <<
" -> frame " << newCentreFrame <<
" -> rf " << rf << endl;
305 #ifdef DEBUG_OVERVIEW 306 cerr <<
"Overview::mouseDoubleClickEvent: frame " << frame <<
" -> rf " << rf << endl;
int getFrameForX(int x) const
Return the closest frame to the given pixel x-coordinate.
int getZoomConstraintBlockSize(int blockSize, ZoomConstraint::RoundingDirection dir=ZoomConstraint::RoundNearest) const
virtual void modelReplaced()
View scrolls continuously during playback, keeping the playback position at the centre.
virtual void viewCentreFrameChanged(View *, int)
virtual QColor getForeground() const
int getModelsStartFrame() const
virtual void modelReplaced()
virtual void mouseMoveEvent(QMouseEvent *e)
virtual void viewManagerPlaybackFrameChanged(int)
virtual void enterEvent(QEvent *)
int getAlignedPlaybackFrame() const
void zoomLevelChanged(int, bool)
virtual void paintEvent(QPaintEvent *e)
virtual void globalCentreFrameChanged(int)
int alignToReference(int) const
View follows playback page-by-page, but dragging the view relocates playback to the centre frame.
Model * getAligningModel() const
!!
virtual void paintEvent(QPaintEvent *e)
int getStartFrame() const
Retrieve the first visible sample frame on the widget.
int alignFromReference(int) const
View is detached from playback.
virtual void modelChangedWithin(int startFrame, int endFrame)
virtual void mouseReleaseEvent(QMouseEvent *e)
Overview(QWidget *parent=0)
virtual void leaveEvent(QEvent *)
PlaybackFollowMode m_followPlay
void contextHelpChanged(const QString &)
int getModelsEndFrame() const
void unregisterView(View *view)
virtual void modelChangedWithin(int startFrame, int endFrame)
virtual void setPlaybackFollow(PlaybackFollowMode m)
View is the base class of widgets that display one or more overlaid views of data against a horizonta...
virtual void mousePressEvent(QMouseEvent *e)
void registerView(View *view)
int getXForFrame(int frame) const
Return the pixel x-coordinate corresponding to a given sample frame (which may be negative).
virtual void mouseDoubleClickEvent(QMouseEvent *e)
virtual void viewZoomLevelChanged(View *, int, bool)
void centreFrameChanged(int frame, bool globalScroll, PlaybackFollowMode followMode)