Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 694:b5000a78249a by-id
Fix up labelling commands
author | Chris Cannam |
---|---|
date | Wed, 17 Jul 2019 14:00:59 +0100 |
parents | c8ba09756eff |
children | 721eb532840d |
comparison
equal
deleted
inserted
replaced
693:3c5dc95bea91 | 694:b5000a78249a |
---|---|
1350 | 1350 |
1351 Layer *layer = dynamic_cast<TimeInstantLayer *>(pane->getSelectedLayer()); | 1351 Layer *layer = dynamic_cast<TimeInstantLayer *>(pane->getSelectedLayer()); |
1352 if (!layer) return; | 1352 if (!layer) return; |
1353 | 1353 |
1354 MultiSelection ms(m_viewManager->getSelection()); | 1354 MultiSelection ms(m_viewManager->getSelection()); |
1355 | 1355 |
1356 auto sodm = ModelById::getAs<SparseOneDimensionalModel>(layer->getModel()); | 1356 ModelId modelId = layer->getModel(); |
1357 | |
1358 auto sodm = ModelById::getAs<SparseOneDimensionalModel>(modelId); | |
1357 if (!sodm) return; | 1359 if (!sodm) return; |
1358 | 1360 |
1359 if (!m_labeller) return; | 1361 if (!m_labeller) return; |
1360 | 1362 |
1361 Labeller labeller(*m_labeller); | 1363 Labeller labeller(*m_labeller); |
1362 labeller.setSampleRate(sodm->getSampleRate()); | 1364 labeller.setSampleRate(sodm->getSampleRate()); |
1363 | 1365 |
1364 /*!!! | 1366 Command *c = labeller.labelAll(modelId.untyped, &ms, sodm->getAllEvents()); |
1365 Command *c = labeller.labelAll(sodm->getId().untyped, &ms); | |
1366 if (c) CommandHistory::getInstance()->addCommand(c, false); | 1367 if (c) CommandHistory::getInstance()->addCommand(c, false); |
1367 */ | |
1368 } | 1368 } |
1369 | 1369 |
1370 void | 1370 void |
1371 MainWindowBase::subdivideInstantsBy(int n) | 1371 MainWindowBase::subdivideInstantsBy(int n) |
1372 { | 1372 { |
1375 | 1375 |
1376 Layer *layer = dynamic_cast<TimeInstantLayer *>(pane->getSelectedLayer()); | 1376 Layer *layer = dynamic_cast<TimeInstantLayer *>(pane->getSelectedLayer()); |
1377 if (!layer) return; | 1377 if (!layer) return; |
1378 | 1378 |
1379 MultiSelection ms(m_viewManager->getSelection()); | 1379 MultiSelection ms(m_viewManager->getSelection()); |
1380 | 1380 |
1381 auto sodm = ModelById::getAs<SparseOneDimensionalModel>(layer->getModel()); | 1381 ModelId modelId = layer->getModel(); |
1382 | |
1383 auto sodm = ModelById::getAs<SparseOneDimensionalModel>(modelId); | |
1382 if (!sodm) return; | 1384 if (!sodm) return; |
1383 | 1385 |
1384 if (!m_labeller) return; | 1386 if (!m_labeller) return; |
1385 | 1387 |
1386 Labeller labeller(*m_labeller); | 1388 Labeller labeller(*m_labeller); |
1387 labeller.setSampleRate(sodm->getSampleRate()); | 1389 labeller.setSampleRate(sodm->getSampleRate()); |
1388 | 1390 |
1389 (void)n; | 1391 Command *c = labeller.subdivide(modelId.untyped, &ms, sodm->getAllEvents(), n); |
1390 /*!!! | |
1391 Command *c = labeller.subdivide(sodm->getId().untyped, &ms, n); | |
1392 if (c) CommandHistory::getInstance()->addCommand(c, false); | 1392 if (c) CommandHistory::getInstance()->addCommand(c, false); |
1393 */ | |
1394 } | 1393 } |
1395 | 1394 |
1396 void | 1395 void |
1397 MainWindowBase::winnowInstantsBy(int n) | 1396 MainWindowBase::winnowInstantsBy(int n) |
1398 { | 1397 { |
1401 | 1400 |
1402 Layer *layer = dynamic_cast<TimeInstantLayer *>(pane->getSelectedLayer()); | 1401 Layer *layer = dynamic_cast<TimeInstantLayer *>(pane->getSelectedLayer()); |
1403 if (!layer) return; | 1402 if (!layer) return; |
1404 | 1403 |
1405 MultiSelection ms(m_viewManager->getSelection()); | 1404 MultiSelection ms(m_viewManager->getSelection()); |
1406 | 1405 |
1407 auto sodm = ModelById::getAs<SparseOneDimensionalModel>(layer->getModel()); | 1406 ModelId modelId = layer->getModel(); |
1407 | |
1408 auto sodm = ModelById::getAs<SparseOneDimensionalModel>(modelId); | |
1408 if (!sodm) return; | 1409 if (!sodm) return; |
1409 | 1410 |
1410 if (!m_labeller) return; | 1411 if (!m_labeller) return; |
1411 | 1412 |
1412 Labeller labeller(*m_labeller); | 1413 Labeller labeller(*m_labeller); |
1413 labeller.setSampleRate(sodm->getSampleRate()); | 1414 labeller.setSampleRate(sodm->getSampleRate()); |
1414 | 1415 |
1415 (void)n; | 1416 Command *c = labeller.winnow(modelId.untyped, &ms, sodm->getAllEvents(), n); |
1416 //!!! to update: (and the above two functions) | |
1417 /* | |
1418 Command *c = labeller.winnow(sodm->getId.untyped, &ms, n); | |
1419 if (c) CommandHistory::getInstance()->addCommand(c, false); | 1417 if (c) CommandHistory::getInstance()->addCommand(c, false); |
1420 */ | |
1421 } | 1418 } |
1422 | 1419 |
1423 MainWindowBase::FileOpenStatus | 1420 MainWindowBase::FileOpenStatus |
1424 MainWindowBase::openPath(QString fileOrUrl, AudioFileOpenMode mode) | 1421 MainWindowBase::openPath(QString fileOrUrl, AudioFileOpenMode mode) |
1425 { | 1422 { |