Mercurial > hg > svgui
changeset 339:ac954fc0ec6f
* Fix #1844539 confusing waveform navigator with secondary files
author | Chris Cannam |
---|---|
date | Wed, 12 Dec 2007 17:42:23 +0000 |
parents | 1d3b27e69bf0 |
children | ffa448b0e1bc |
files | view/Overview.cpp view/Pane.cpp view/View.cpp view/View.h |
diffstat | 4 files changed, 47 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/view/Overview.cpp Tue Dec 11 14:58:29 2007 +0000 +++ b/view/Overview.cpp Wed Dec 12 17:42:23 2007 +0000 @@ -71,6 +71,7 @@ void Overview::modelReplaced() { + m_playPointerFrame = getAlignedPlaybackFrame(); View::modelReplaced(); } @@ -116,6 +117,8 @@ { bool changed = false; + f = getAlignedPlaybackFrame(); + if (getXForFrame(m_playPointerFrame) != getXForFrame(f)) changed = true; m_playPointerFrame = f; @@ -179,6 +182,15 @@ long f0 = w->getFrameForX(0); long f1 = w->getFrameForX(w->width()); + if (f0 >= 0) { + size_t rf0 = w->alignToReference(f0); + f0 = alignFromReference(rf0); + } + if (f1 >= 0) { + size_t rf1 = w->alignToReference(f1); + f1 = alignFromReference(rf1); + } + int x0 = getXForFrame(f0); int x1 = getXForFrame(f1); @@ -200,12 +212,16 @@ Overview::mousePressEvent(QMouseEvent *e) { m_clickPos = e->pos(); + long clickFrame = getFrameForX(m_clickPos.x()); + if (clickFrame > 0) m_dragCentreFrame = clickFrame; + else m_dragCentreFrame = 0; + m_clickedInRange = true; + for (ViewSet::iterator i = m_views.begin(); i != m_views.end(); ++i) { - if (*i) { - m_clickedInRange = true; - m_dragCentreFrame = ((View *)*i)->getCentreFrame(); - break; - } + if (*i && (*i)->getAligningModel() == getAligningModel()) { + m_dragCentreFrame = (*i)->getCentreFrame(); + break; + } } } @@ -242,7 +258,8 @@ if (std::max(m_centreFrame, newCentreFrame) - std::min(m_centreFrame, newCentreFrame) > size_t(m_zoomLevel)) { - emit centreFrameChanged(newCentreFrame, true, PlaybackScrollContinuous); + size_t rf = alignToReference(newCentreFrame); + emit centreFrameChanged(rf, true, PlaybackScrollContinuous); } } @@ -250,7 +267,9 @@ Overview::mouseDoubleClickEvent(QMouseEvent *e) { long frame = getFrameForX(e->x()); - emit centreFrameChanged(frame, true, PlaybackScrollContinuous); + size_t rf = 0; + if (frame > 0) rf = alignToReference(frame); + emit centreFrameChanged(rf, true, PlaybackScrollContinuous); } void
--- a/view/Pane.cpp Tue Dec 11 14:58:29 2007 +0000 +++ b/view/Pane.cpp Wed Dec 12 17:42:23 2007 +0000 @@ -389,10 +389,7 @@ View::paintEvent(e); paint.begin(this); - - QFont font(paint.font()); - font.setPointSize(Preferences::getInstance()->getViewFontSize()); - paint.setFont(font); + setPaintFont(paint); if (e) paint.setClipRect(r); @@ -1678,6 +1675,9 @@ newCentreFrame = 0; } + std::cerr << "Pane::dragTopLayer: newCentreFrame = " << newCentreFrame << + ", models end frame = " << getModelsEndFrame() << std::endl; + if (newCentreFrame >= getModelsEndFrame()) { newCentreFrame = getModelsEndFrame(); if (newCentreFrame > 0) --newCentreFrame;
--- a/view/View.cpp Tue Dec 11 14:58:29 2007 +0000 +++ b/view/View.cpp Wed Dec 12 17:42:23 2007 +0000 @@ -522,8 +522,11 @@ m_progressBars[layer]->setMinimum(0); m_progressBars[layer]->setMaximum(100); m_progressBars[layer]->setMinimumWidth(80); + QFont f(m_progressBars[layer]->font()); - f.setPointSize(Preferences::getInstance()->getViewFontSize()); + int fs = Preferences::getInstance()->getViewFontSize(); + f.setPointSize(std::min(fs, int(ceil(fs * 0.85)))); + m_progressBars[layer]->setFont(f); m_progressBars[layer]->hide(); @@ -1401,6 +1404,14 @@ } void +View::setPaintFont(QPainter &paint) +{ + QFont font(paint.font()); + font.setPointSize(Preferences::getInstance()->getViewFontSize()); + paint.setFont(font); +} + +void View::paintEvent(QPaintEvent *e) { // Profiler prof("View::paintEvent", false); @@ -1585,11 +1596,7 @@ if (repaintCache) paint.begin(m_cache); else paint.begin(this); - - QFont font(paint.font()); - font.setPointSize(Preferences::getInstance()->getViewFontSize()); - paint.setFont(font); - + setPaintFont(paint); paint.setClipRect(cacheRect); paint.setPen(getBackground()); @@ -1630,11 +1637,7 @@ paint.begin(this); paint.setClipRect(nonCacheRect); - - QFont font(paint.font()); - font.setPointSize(Preferences::getInstance()->getViewFontSize()); - paint.setFont(font); - + setPaintFont(paint); if (scrollables.empty()) { paint.setPen(getBackground()); paint.setBrush(getBackground()); @@ -1652,6 +1655,7 @@ paint.end(); paint.begin(this); + setPaintFont(paint); if (e) paint.setClipRect(e->rect()); if (!m_selectionCached) { drawSelections(paint);
--- a/view/View.h Tue Dec 11 14:58:29 2007 +0000 +++ b/view/View.h Wed Dec 12 17:42:23 2007 +0000 @@ -310,7 +310,8 @@ virtual void drawSelections(QPainter &); virtual bool shouldLabelSelections() const { return true; } virtual bool render(QPainter &paint, int x0, size_t f0, size_t f1); - + virtual void setPaintFont(QPainter &paint); + typedef std::vector<Layer *> LayerList; int getModelsSampleRate() const;