comparison framework/MainWindowBase.cpp @ 538:287fce13a1ae subdivide-instants

Add Winnow as well
author Chris Cannam
date Fri, 25 Nov 2016 09:57:36 +0000
parents dd195633fc9f
children 0d5c3abc9658
comparison
equal deleted inserted replaced
537:dd195633fc9f 538:287fce13a1ae
624 emit canInsertInstant(haveCurrentPane); 624 emit canInsertInstant(haveCurrentPane);
625 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection); 625 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection);
626 emit canInsertItemAtSelection(haveCurrentPane && haveSelection && haveCurrentDurationLayer); 626 emit canInsertItemAtSelection(haveCurrentPane && haveSelection && haveCurrentDurationLayer);
627 emit canRenumberInstants(haveCurrentTimeInstantsLayer && haveSelection); 627 emit canRenumberInstants(haveCurrentTimeInstantsLayer && haveSelection);
628 emit canSubdivideInstants(haveCurrentTimeInstantsLayer && haveSelection); 628 emit canSubdivideInstants(haveCurrentTimeInstantsLayer && haveSelection);
629 emit canWinnowInstants(haveCurrentTimeInstantsLayer && haveSelection);
629 emit canPlaySelection(haveMainModel && havePlayTarget && haveSelection); 630 emit canPlaySelection(haveMainModel && havePlayTarget && haveSelection);
630 emit canClearSelection(haveSelection); 631 emit canClearSelection(haveSelection);
631 emit canEditSelection(haveSelection && haveCurrentEditableLayer); 632 emit canEditSelection(haveSelection && haveCurrentEditableLayer);
632 emit canSave(m_sessionFile != "" && m_documentModified); 633 emit canSave(m_sessionFile != "" && m_documentModified);
633 emit canSaveAs(haveMainModel); 634 emit canSaveAs(haveMainModel);
1242 1243
1243 Labeller labeller(*m_labeller); 1244 Labeller labeller(*m_labeller);
1244 labeller.setSampleRate(sodm->getSampleRate()); 1245 labeller.setSampleRate(sodm->getSampleRate());
1245 1246
1246 Command *c = labeller.subdivide<SparseOneDimensionalModel::Point> 1247 Command *c = labeller.subdivide<SparseOneDimensionalModel::Point>
1248 (*sodm, &ms, n);
1249 if (c) CommandHistory::getInstance()->addCommand(c, false);
1250 }
1251
1252 void
1253 MainWindowBase::winnowInstantsBy(int n)
1254 {
1255 Pane *pane = m_paneStack->getCurrentPane();
1256 if (!pane) return;
1257
1258 Layer *layer = dynamic_cast<TimeInstantLayer *>(pane->getSelectedLayer());
1259 if (!layer) return;
1260
1261 MultiSelection ms(m_viewManager->getSelection());
1262
1263 Model *model = layer->getModel();
1264 SparseOneDimensionalModel *sodm =
1265 dynamic_cast<SparseOneDimensionalModel *>(model);
1266 if (!sodm) return;
1267
1268 if (!m_labeller) return;
1269
1270 Labeller labeller(*m_labeller);
1271 labeller.setSampleRate(sodm->getSampleRate());
1272
1273 Command *c = labeller.winnow<SparseOneDimensionalModel::Point>
1247 (*sodm, &ms, n); 1274 (*sodm, &ms, n);
1248 if (c) CommandHistory::getInstance()->addCommand(c, false); 1275 if (c) CommandHistory::getInstance()->addCommand(c, false);
1249 } 1276 }
1250 1277
1251 MainWindowBase::FileOpenStatus 1278 MainWindowBase::FileOpenStatus