Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 87:1b217963e53a
* Update remaining editable layers to support proper realignment on copy/paste
* Permit pasting when no suitable layer is current: create a new layer on paste
* Add preference for showing the splash screen or not
* Rename spectrogram smoothing prefs (partly following Craig's suggestions)
author | Chris Cannam |
---|---|
date | Wed, 06 Feb 2008 14:15:09 +0000 |
parents | dd74c5332b49 |
children | 9c904ede116c |
comparison
equal
deleted
inserted
replaced
86:dd74c5332b49 | 87:1b217963e53a |
---|---|
342 emit canMeasureLayer(haveCurrentLayer); | 342 emit canMeasureLayer(haveCurrentLayer); |
343 emit canSelect(haveMainModel && haveCurrentPane); | 343 emit canSelect(haveMainModel && haveCurrentPane); |
344 emit canPlay(havePlayTarget); | 344 emit canPlay(havePlayTarget); |
345 emit canFfwd(true); | 345 emit canFfwd(true); |
346 emit canRewind(true); | 346 emit canRewind(true); |
347 emit canPaste(haveCurrentEditableLayer && haveClipboardContents); | 347 emit canPaste(haveClipboardContents); |
348 emit canInsertInstant(haveCurrentPane); | 348 emit canInsertInstant(haveCurrentPane); |
349 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection); | 349 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection); |
350 emit canRenumberInstants(haveCurrentTimeInstantsLayer && haveSelection); | 350 emit canRenumberInstants(haveCurrentTimeInstantsLayer && haveSelection); |
351 emit canPlaySelection(haveMainModel && havePlayTarget && haveSelection); | 351 emit canPlaySelection(haveMainModel && havePlayTarget && haveSelection); |
352 emit canClearSelection(haveSelection); | 352 emit canClearSelection(haveSelection); |
603 MainWindowBase::paste() | 603 MainWindowBase::paste() |
604 { | 604 { |
605 Pane *currentPane = m_paneStack->getCurrentPane(); | 605 Pane *currentPane = m_paneStack->getCurrentPane(); |
606 if (!currentPane) return; | 606 if (!currentPane) return; |
607 | 607 |
608 //!!! if we have no current layer, we should create one of the most | |
609 // appropriate type | |
610 | |
611 Layer *layer = currentPane->getSelectedLayer(); | 608 Layer *layer = currentPane->getSelectedLayer(); |
612 if (!layer) return; | |
613 | 609 |
614 Clipboard &clipboard = m_viewManager->getClipboard(); | 610 Clipboard &clipboard = m_viewManager->getClipboard(); |
615 Clipboard::PointList contents = clipboard.getPoints(); | 611 // Clipboard::PointList contents = clipboard.getPoints(); |
616 /* | 612 |
617 long minFrame = 0; | 613 bool inCompound = true; |
618 bool have = false; | 614 |
619 for (int i = 0; i < contents.size(); ++i) { | 615 if (!layer || !layer->isLayerEditable()) { |
620 if (!contents[i].haveFrame()) continue; | 616 |
621 if (!have || contents[i].getFrame() < minFrame) { | 617 CommandHistory::getInstance()->startCompoundOperation |
622 minFrame = contents[i].getFrame(); | 618 (tr("Paste"), true); |
623 have = true; | 619 |
624 } | 620 // no suitable current layer: create one of the most |
625 } | 621 // appropriate sort |
626 | 622 LayerFactory::LayerType type = |
627 long frameOffset = long(m_viewManager->getGlobalCentreFrame()) - minFrame; | 623 LayerFactory::getInstance()->getLayerTypeForClipboardContents(clipboard); |
628 | 624 layer = m_document->createEmptyLayer(type); |
629 layer->paste(clipboard, frameOffset); | 625 |
630 */ | 626 if (!layer) { |
627 CommandHistory::getInstance()->endCompoundOperation(); | |
628 return; | |
629 } | |
630 | |
631 m_document->addLayerToView(currentPane, layer); | |
632 m_paneStack->setCurrentLayer(currentPane, layer); | |
633 | |
634 inCompound = true; | |
635 } | |
636 | |
631 layer->paste(currentPane, clipboard, 0, true); | 637 layer->paste(currentPane, clipboard, 0, true); |
638 | |
639 if (inCompound) CommandHistory::getInstance()->endCompoundOperation(); | |
632 } | 640 } |
633 | 641 |
634 void | 642 void |
635 MainWindowBase::deleteSelected() | 643 MainWindowBase::deleteSelected() |
636 { | 644 { |