comparison view/ViewManager.cpp @ 762:b75c95e7f906 tonioni

Fix potential for crash on reloading session file - loading selections should not emit signal as if user had just made them manually
author Chris Cannam
date Thu, 03 Apr 2014 08:51:30 +0100
parents 56ba2b03508e
children c58569bd952e 4c8ca536b54f
comparison
equal deleted inserted replaced
761:6a8d922f991d 762:b75c95e7f906
256 ms.addSelection(selection); 256 ms.addSelection(selection);
257 setSelections(ms); 257 setSelections(ms);
258 } 258 }
259 259
260 void 260 void
261 ViewManager::addSelectionQuietly(const Selection &selection)
262 {
263 MultiSelection ms(m_selections);
264 ms.addSelection(selection);
265 setSelections(ms, true);
266 }
267
268 void
261 ViewManager::removeSelection(const Selection &selection) 269 ViewManager::removeSelection(const Selection &selection)
262 { 270 {
263 MultiSelection ms(m_selections); 271 MultiSelection ms(m_selections);
264 ms.removeSelection(selection); 272 ms.removeSelection(selection);
265 setSelections(ms); 273 setSelections(ms);
272 ms.clearSelections(); 280 ms.clearSelections();
273 setSelections(ms); 281 setSelections(ms);
274 } 282 }
275 283
276 void 284 void
277 ViewManager::setSelections(const MultiSelection &ms) 285 ViewManager::setSelections(const MultiSelection &ms, bool quietly)
278 { 286 {
279 if (m_selections.getSelections() == ms.getSelections()) return; 287 if (m_selections.getSelections() == ms.getSelections()) return;
280 SetSelectionCommand *command = new SetSelectionCommand(this, ms); 288 SetSelectionCommand *command = new SetSelectionCommand(this, ms);
281 CommandHistory::getInstance()->addCommand(command); 289 CommandHistory::getInstance()->addCommand(command);
282 emit selectionChangedByUser(); 290 if (!quietly) {
291 emit selectionChangedByUser();
292 }
283 } 293 }
284 294
285 size_t 295 size_t
286 ViewManager::constrainFrameToSelection(size_t frame) const 296 ViewManager::constrainFrameToSelection(size_t frame) const
287 { 297 {