Mercurial > hg > svgui
diff view/Pane.cpp @ 976:f2c63ec85901 alignment-simple
Branch to test simple FFT model code
author | Chris Cannam |
---|---|
date | Mon, 15 Jun 2015 09:15:55 +0100 |
parents | 36cddc3de023 faa8532e4f02 |
children | ee01a4062747 |
line wrap: on
line diff
--- a/view/Pane.cpp Mon Apr 20 09:19:52 2015 +0100 +++ b/view/Pane.cpp Mon Jun 15 09:15:55 2015 +0100 @@ -388,10 +388,10 @@ Pane::selectionIsBeingEdited() const { if (!m_editingSelection.isEmpty()) { - if (m_mousePos != m_clickPos && - getFrameForX(m_mousePos.x()) != getFrameForX(m_clickPos.x())) { - return true; - } + if (m_mousePos != m_clickPos && + getFrameForX(m_mousePos.x()) != getFrameForX(m_clickPos.x())) { + return true; + } } return false; } @@ -2115,14 +2115,25 @@ max = snapFrameRight; } + sv_frame_t end = getModelsEndFrame(); + if (min > end) min = end; + if (max > end) max = end; + if (m_manager) { - m_manager->setInProgressSelection(Selection(alignToReference(min), - alignToReference(max)), - !m_resizing && !m_ctrlPressed); + + Selection sel(alignToReference(min), alignToReference(max)); + + bool exc; + bool same = (m_manager->haveInProgressSelection() && + m_manager->getInProgressSelection(exc) == sel); + + m_manager->setInProgressSelection(sel, !m_resizing && !m_ctrlPressed); + + if (!same) { + edgeScrollMaybe(e->x()); + } } - edgeScrollMaybe(e->x()); - update(); if (min != max) { @@ -2145,11 +2156,12 @@ sv_frame_t offset = mouseFrame - getStartFrame(); sv_frame_t available = getEndFrame() - getStartFrame(); sv_frame_t move = 0; - if (offset >= double(available) * 0.95) { - move = sv_frame_t(double(offset - available) * 0.95) + 1; - } else if (offset <= double(available) * 0.10) { - move = sv_frame_t(double(available) * 0.10 - double(offset)) + 1; - move = -move; + sv_frame_t rightEdge = available - (available / 20); + sv_frame_t leftEdge = (available / 10); + if (offset >= rightEdge) { + move = offset - rightEdge + 1; + } else if (offset <= leftEdge) { + move = offset - leftEdge - 1; } if (move != 0) { setCentreFrame(m_centreFrame + move);