comparison 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
comparison
equal deleted inserted replaced
946:36cddc3de023 976:f2c63ec85901
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
2113 } else { 2113 } else {
2114 min = snapFrameLeft; 2114 min = snapFrameLeft;
2115 max = snapFrameRight; 2115 max = snapFrameRight;
2116 } 2116 }
2117 2117
2118 sv_frame_t end = getModelsEndFrame();
2119 if (min > end) min = end;
2120 if (max > end) max = end;
2121
2118 if (m_manager) { 2122 if (m_manager) {
2119 m_manager->setInProgressSelection(Selection(alignToReference(min), 2123
2120 alignToReference(max)), 2124 Selection sel(alignToReference(min), alignToReference(max));
2121 !m_resizing && !m_ctrlPressed); 2125
2122 } 2126 bool exc;
2123 2127 bool same = (m_manager->haveInProgressSelection() &&
2124 edgeScrollMaybe(e->x()); 2128 m_manager->getInProgressSelection(exc) == sel);
2129
2130 m_manager->setInProgressSelection(sel, !m_resizing && !m_ctrlPressed);
2131
2132 if (!same) {
2133 edgeScrollMaybe(e->x());
2134 }
2135 }
2125 2136
2126 update(); 2137 update();
2127 2138
2128 if (min != max) { 2139 if (min != max) {
2129 m_playbackFrameMoveScheduled = false; 2140 m_playbackFrameMoveScheduled = false;
2143 2154
2144 if (doScroll) { 2155 if (doScroll) {
2145 sv_frame_t offset = mouseFrame - getStartFrame(); 2156 sv_frame_t offset = mouseFrame - getStartFrame();
2146 sv_frame_t available = getEndFrame() - getStartFrame(); 2157 sv_frame_t available = getEndFrame() - getStartFrame();
2147 sv_frame_t move = 0; 2158 sv_frame_t move = 0;
2148 if (offset >= double(available) * 0.95) { 2159 sv_frame_t rightEdge = available - (available / 20);
2149 move = sv_frame_t(double(offset - available) * 0.95) + 1; 2160 sv_frame_t leftEdge = (available / 10);
2150 } else if (offset <= double(available) * 0.10) { 2161 if (offset >= rightEdge) {
2151 move = sv_frame_t(double(available) * 0.10 - double(offset)) + 1; 2162 move = offset - rightEdge + 1;
2152 move = -move; 2163 } else if (offset <= leftEdge) {
2164 move = offset - leftEdge - 1;
2153 } 2165 }
2154 if (move != 0) { 2166 if (move != 0) {
2155 setCentreFrame(m_centreFrame + move); 2167 setCentreFrame(m_centreFrame + move);
2156 update(); 2168 update();
2157 } 2169 }