diff layer/TimeValueLayer.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/TimeValueLayer.cpp	Wed May 10 16:34:03 2006 +0000
+++ b/layer/TimeValueLayer.cpp	Thu May 11 11:35:46 2006 +0000
@@ -992,6 +992,8 @@
 void
 TimeValueLayer::moveSelection(Selection s, size_t newStartFrame)
 {
+    if (!m_model) return;
+
     SparseTimeValueModel::EditCommand *command =
 	new SparseTimeValueModel::EditCommand(m_model,
 					      tr("Drag Selection"));
@@ -1016,6 +1018,8 @@
 void
 TimeValueLayer::resizeSelection(Selection s, Selection newSize)
 {
+    if (!m_model) return;
+
     SparseTimeValueModel::EditCommand *command =
 	new SparseTimeValueModel::EditCommand(m_model,
 					      tr("Resize Selection"));
@@ -1049,6 +1053,8 @@
 void
 TimeValueLayer::deleteSelection(Selection s)
 {
+    if (!m_model) return;
+
     SparseTimeValueModel::EditCommand *command =
 	new SparseTimeValueModel::EditCommand(m_model,
 					      tr("Delete Selected Points"));
@@ -1070,6 +1076,8 @@
 void
 TimeValueLayer::copy(Selection s, Clipboard &to)
 {
+    if (!m_model) return;
+
     SparseTimeValueModel::PointList points =
 	m_model->getPoints(s.getStartFrame(), s.getEndFrame());
 
@@ -1085,6 +1093,8 @@
 void
 TimeValueLayer::paste(const Clipboard &from, int frameOffset)
 {
+    if (!m_model) return;
+
     const Clipboard::PointList &points = from.getPoints();
 
     SparseTimeValueModel::EditCommand *command =