Mercurial > hg > svcore
diff base/View.cpp @ 34:aaf73f7309f2
* 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
author | Chris Cannam |
---|---|
date | Mon, 27 Feb 2006 17:34:41 +0000 |
parents | 51e158b505da |
children | 935a2419a77c |
line wrap: on
line diff
--- 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")