diff layer/NoteLayer.cpp @ 99:453f7da3534e

* Fix serious failure to reload "imported" (i.e. all non-derived non-main) models from .sv file * Give a short playback duration to notes with formal duration of 0 or 1 * Show crosshairs on spectrogram even when there is another layer on top (if it isn't opaque) * Always paste to the same time in the layer as the cut/copy was from, rather than to the playback pointer -- less flexible, but more predictable and less annoying. We probably need a way to get the old behaviour if pasting from somewhere else in the future (e.g. from a text file), but we can't do that yet anyway * Use a compound operation for dragging and resizing selections, so as to ensure a single undo operation works * Use a note model as the target for feature extraction plugins that output variable samplerate data with more than one value per feature * Avoid possible crashes in cut/paste if a layer proves to have no model
author Chris Cannam
date Thu, 11 May 2006 11:35:46 +0000
parents 4b98bda7e94d
children 0db5e7492ce8
line wrap: on
line diff
--- a/layer/NoteLayer.cpp	Wed May 10 16:34:03 2006 +0000
+++ b/layer/NoteLayer.cpp	Thu May 11 11:35:46 2006 +0000
@@ -688,6 +688,8 @@
 void
 NoteLayer::moveSelection(Selection s, size_t newStartFrame)
 {
+    if (!m_model) return;
+
     NoteModel::EditCommand *command =
 	new NoteModel::EditCommand(m_model, tr("Drag Selection"));
 
@@ -711,6 +713,8 @@
 void
 NoteLayer::resizeSelection(Selection s, Selection newSize)
 {
+    if (!m_model) return;
+
     NoteModel::EditCommand *command =
 	new NoteModel::EditCommand(m_model, tr("Resize Selection"));
 
@@ -748,6 +752,8 @@
 void
 NoteLayer::deleteSelection(Selection s)
 {
+    if (!m_model) return;
+
     NoteModel::EditCommand *command =
 	new NoteModel::EditCommand(m_model, tr("Delete Selected Points"));
 
@@ -768,6 +774,8 @@
 void
 NoteLayer::copy(Selection s, Clipboard &to)
 {
+    if (!m_model) return;
+
     NoteModel::PointList points =
 	m_model->getPoints(s.getStartFrame(), s.getEndFrame());
 
@@ -783,6 +791,8 @@
 void
 NoteLayer::paste(const Clipboard &from, int frameOffset)
 {
+    if (!m_model) return;
+
     const Clipboard::PointList &points = from.getPoints();
 
     NoteModel::EditCommand *command =