# HG changeset patch # User Chris Cannam # Date 1197481343 0 # Node ID ac954fc0ec6f69453d62c71e0a0798fee7e531cb # Parent 1d3b27e69bf061ef02320b3e37938aab134c4976 * Fix #1844539 confusing waveform navigator with secondary files diff -r 1d3b27e69bf0 -r ac954fc0ec6f view/Overview.cpp --- 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 diff -r 1d3b27e69bf0 -r ac954fc0ec6f view/Pane.cpp --- 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; diff -r 1d3b27e69bf0 -r ac954fc0ec6f view/View.cpp --- 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); diff -r 1d3b27e69bf0 -r ac954fc0ec6f view/View.h --- 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 LayerList; int getModelsSampleRate() const;