comparison view/Pane.cpp @ 972:1011ffb1b6d5 osx-retina

Merge from default branch
author Chris Cannam
date Wed, 10 Jun 2015 13:38:02 +0100
parents faa8532e4f02
children f2c63ec85901 c02c51ae5238
comparison
equal deleted inserted replaced
969:0aac065f09f9 972:1011ffb1b6d5
386 386
387 bool 387 bool
388 Pane::selectionIsBeingEdited() const 388 Pane::selectionIsBeingEdited() const
389 { 389 {
390 if (!m_editingSelection.isEmpty()) { 390 if (!m_editingSelection.isEmpty()) {
391 if (m_mousePos != m_clickPos && 391 if (m_mousePos != m_clickPos &&
392 getFrameForX(m_mousePos.x()) != getFrameForX(m_clickPos.x())) { 392 getFrameForX(m_mousePos.x()) != getFrameForX(m_clickPos.x())) {
393 return true; 393 return true;
394 } 394 }
395 } 395 }
396 return false; 396 return false;
397 } 397 }
398 398
399 void 399 void
2109 } else { 2109 } else {
2110 min = snapFrameLeft; 2110 min = snapFrameLeft;
2111 max = snapFrameRight; 2111 max = snapFrameRight;
2112 } 2112 }
2113 2113
2114 sv_frame_t end = getModelsEndFrame();
2115 if (min > end) min = end;
2116 if (max > end) max = end;
2117
2114 if (m_manager) { 2118 if (m_manager) {
2115 m_manager->setInProgressSelection(Selection(alignToReference(min), 2119
2116 alignToReference(max)), 2120 Selection sel(alignToReference(min), alignToReference(max));
2117 !m_resizing && !m_ctrlPressed); 2121
2118 } 2122 bool exc;
2119 2123 bool same = (m_manager->haveInProgressSelection() &&
2120 edgeScrollMaybe(e->x()); 2124 m_manager->getInProgressSelection(exc) == sel);
2125
2126 m_manager->setInProgressSelection(sel, !m_resizing && !m_ctrlPressed);
2127
2128 if (!same) {
2129 edgeScrollMaybe(e->x());
2130 }
2131 }
2121 2132
2122 update(); 2133 update();
2123 2134
2124 if (min != max) { 2135 if (min != max) {
2125 m_playbackFrameMoveScheduled = false; 2136 m_playbackFrameMoveScheduled = false;
2139 2150
2140 if (doScroll) { 2151 if (doScroll) {
2141 sv_frame_t offset = mouseFrame - getStartFrame(); 2152 sv_frame_t offset = mouseFrame - getStartFrame();
2142 sv_frame_t available = getEndFrame() - getStartFrame(); 2153 sv_frame_t available = getEndFrame() - getStartFrame();
2143 sv_frame_t move = 0; 2154 sv_frame_t move = 0;
2144 if (offset >= double(available) * 0.95) { 2155 sv_frame_t rightEdge = available - (available / 20);
2145 move = sv_frame_t(double(offset - available) * 0.95) + 1; 2156 sv_frame_t leftEdge = (available / 10);
2146 } else if (offset <= double(available) * 0.10) { 2157 if (offset >= rightEdge) {
2147 move = sv_frame_t(double(available) * 0.10 - double(offset)) + 1; 2158 move = offset - rightEdge + 1;
2148 move = -move; 2159 } else if (offset <= leftEdge) {
2160 move = offset - leftEdge - 1;
2149 } 2161 }
2150 if (move != 0) { 2162 if (move != 0) {
2151 setCentreFrame(m_centreFrame + move); 2163 setCentreFrame(m_centreFrame + move);
2152 update(); 2164 update();
2153 } 2165 }