Mercurial > hg > tony
changeset 296:d4530fab80bd
very simple, probably too simple implementation of select by move note
author | matthiasm |
---|---|
date | Thu, 12 Jun 2014 09:54:05 +0100 |
parents | 948e7dcc9e15 |
children | 378028e6765f 7777fa612a16 |
files | src/MainWindow.cpp src/MainWindow.h |
diffstat | 2 files changed, 23 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/MainWindow.cpp Wed Jun 11 21:43:38 2014 +0100 +++ b/src/MainWindow.cpp Thu Jun 12 09:54:05 2014 +0100 @@ -101,7 +101,8 @@ m_rwdAction(0), m_intelligentActionOn(true), //GF: !!! temporary m_activityLog(new ActivityLog()), - m_keyReference(new KeyReference()) + m_keyReference(new KeyReference()), + m_selectionAnchor(0) { setWindowTitle(QApplication::applicationName()); @@ -1088,41 +1089,41 @@ MainWindow::moveOneNoteRight() { // cerr << "MainWindow::moveOneNoteRight" << endl; - moveByOneNote(true); + moveByOneNote(true, false); } void MainWindow::moveOneNoteLeft() { // cerr << "MainWindow::moveOneNoteLeft" << endl; - moveByOneNote(false); + moveByOneNote(false, false); } void MainWindow::selectOneNoteRight() { - int left = m_viewManager->getPlaybackFrame(); - moveByOneNote(false); - int right = m_viewManager->getPlaybackFrame(); + moveByOneNote(true, true); } void MainWindow::selectOneNoteLeft() { - int right = m_viewManager->getPlaybackFrame(); - moveByOneNote(false); - int left = m_viewManager->getPlaybackFrame(); + moveByOneNote(false, true); } void -MainWindow::moveByOneNote(bool right) +MainWindow::moveByOneNote(bool right, bool doSelect) { // cerr << "MainWindow::moveByOneNote" << endl; int frame = m_viewManager->getPlaybackFrame(); Pane *p = m_analyser->getPane(); + if (!doSelect) { + m_selectionAnchor = frame; + } + Layer *layer = m_analyser->getLayer(Analyser::Notes); if (!layer) return; @@ -1156,6 +1157,15 @@ } frame = *i2; m_viewManager->setPlaybackFrame(frame); + if (doSelect) { + Selection sel; + if (frame > m_selectionAnchor) { + sel = Selection(m_selectionAnchor, frame); + } else { + sel = Selection(frame, m_selectionAnchor); + } + m_viewManager->setSelection(sel); + } } void
--- a/src/MainWindow.h Wed Jun 11 21:43:38 2014 +0100 +++ b/src/MainWindow.h Thu Jun 12 09:54:05 2014 +0100 @@ -223,6 +223,8 @@ KeyReference *m_keyReference; VersionTester *m_versionTester; + int m_selectionAnchor; + Analyser::FrequencyRange m_pendingConstraint; QString exportToSVL(QString path, Layer *layer); @@ -245,7 +247,7 @@ virtual void updateVisibleRangeDisplay(Pane *p) const; virtual void updatePositionStatusDisplays() const; - void moveByOneNote(bool right); + void moveByOneNote(bool right, bool doSelect); };