# HG changeset patch # User Chris Cannam # Date 1141061681 0 # Node ID aaf73f7309f29b5e6b910935c4c0eaca270f9b09 # Parent 51e158b505da8acf6b3519dfde9559c94dc32436 * Add "Export Audio File" option * Make note layer align in frequency with any spectrogram layer on the same view (if it's set to frequency mode) * Start to implement mouse editing for ranges of points by dragging the selection * First scrappy attempt at a vertical scale for time value layer diff -r 51e158b505da -r aaf73f7309f2 base/View.cpp --- a/base/View.cpp Thu Feb 23 18:01:31 2006 +0000 +++ b/base/View.cpp Mon Feb 27 17:34:41 2006 +0000 @@ -1014,6 +1014,14 @@ } } + if (selectionCacheable) { + QPoint localPos; + bool closeToLeft, closeToRight; + if (shouldIlluminateLocalSelection(localPos, closeToLeft, closeToRight)) { + selectionCacheable = false; + } + } + #ifdef DEBUG_VIEW_WIDGET_PAINT std::cerr << "View(" << this << ")::paintEvent: have " << scrollables.size() << " scrollable back layers and " << nonScrollables.size() @@ -1237,11 +1245,18 @@ } paint.save(); - paint.setPen(QColor(150, 150, 255)); paint.setBrush(QColor(150, 150, 255, 80)); int sampleRate = getModelsSampleRate(); + QPoint localPos; + long illuminateFrame = -1; + bool closeToLeft, closeToRight; + + if (shouldIlluminateLocalSelection(localPos, closeToLeft, closeToRight)) { + illuminateFrame = getFrameForX(localPos.x()); + } + const QFontMetrics &metrics = paint.fontMetrics(); for (MultiSelection::SelectionList::iterator i = selections.begin(); @@ -1256,8 +1271,34 @@ std::cerr << "View::drawSelections: " << p0 << ",-1 [" << (p1-p0) << "x" << (height()+1) << "]" << std::endl; #endif + bool illuminateThis = + (illuminateFrame >= 0 && i->contains(illuminateFrame)); + + paint.setPen(QColor(150, 150, 255)); paint.drawRect(p0, -1, p1 - p0, height() + 1); + if (illuminateThis) { + paint.save(); + if (hasLightBackground()) { + paint.setPen(QPen(Qt::black, 2)); + } else { + paint.setPen(QPen(Qt::white, 2)); + } + if (closeToLeft) { + paint.drawLine(p0, 1, p1, 1); + paint.drawLine(p0, 0, p0, height()); + paint.drawLine(p0, height() - 1, p1, height() - 1); + } else if (closeToRight) { + paint.drawLine(p0, 1, p1, 1); + paint.drawLine(p1, 0, p1, height()); + paint.drawLine(p0, height() - 1, p1, height() - 1); + } else { + paint.setBrush(Qt::NoBrush); + paint.drawRect(p0, 1, p1 - p0, height() - 2); + } + paint.restore(); + } + if (sampleRate && shouldLabelSelections()) { QString startText = QString("%1 / %2") diff -r 51e158b505da -r aaf73f7309f2 base/View.h --- a/base/View.h Thu Feb 23 18:01:31 2006 +0000 +++ b/base/View.h Mon Feb 27 17:34:41 2006 +0000 @@ -170,6 +170,9 @@ virtual bool shouldIlluminateLocalFeatures(const Layer *, QPoint &) { return false; } + virtual bool shouldIlluminateLocalSelection(QPoint &, bool &, bool &) { + return false; + } enum PlaybackFollowMode { PlaybackScrollContinuous, diff -r 51e158b505da -r aaf73f7309f2 base/ViewManager.cpp --- a/base/ViewManager.cpp Thu Feb 23 18:01:31 2006 +0000 +++ b/base/ViewManager.cpp Mon Feb 27 17:34:41 2006 +0000 @@ -104,6 +104,12 @@ emit inProgressSelectionChanged(); } +const MultiSelection & +ViewManager::getSelection() const +{ + return m_selections; +} + const MultiSelection::SelectionList & ViewManager::getSelections() const {