diff layer/TimeInstantLayer.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 999ae0f7d10c
line wrap: on
line diff
--- a/layer/TimeInstantLayer.cpp	Wed May 10 16:34:03 2006 +0000
+++ b/layer/TimeInstantLayer.cpp	Thu May 11 11:35:46 2006 +0000
@@ -626,6 +626,8 @@
 void
 TimeInstantLayer::moveSelection(Selection s, size_t newStartFrame)
 {
+    if (!m_model) return;
+
     SparseOneDimensionalModel::EditCommand *command =
 	new SparseOneDimensionalModel::EditCommand(m_model,
 						   tr("Drag Selection"));
@@ -650,6 +652,8 @@
 void
 TimeInstantLayer::resizeSelection(Selection s, Selection newSize)
 {
+    if (!m_model) return;
+
     SparseOneDimensionalModel::EditCommand *command =
 	new SparseOneDimensionalModel::EditCommand(m_model,
 						   tr("Resize Selection"));
@@ -683,6 +687,8 @@
 void
 TimeInstantLayer::deleteSelection(Selection s)
 {
+    if (!m_model) return;
+
     SparseOneDimensionalModel::EditCommand *command =
 	new SparseOneDimensionalModel::EditCommand(m_model,
 						   tr("Delete Selection"));
@@ -701,6 +707,8 @@
 void
 TimeInstantLayer::copy(Selection s, Clipboard &to)
 {
+    if (!m_model) return;
+
     SparseOneDimensionalModel::PointList points =
 	m_model->getPoints(s.getStartFrame(), s.getEndFrame());
 
@@ -716,6 +724,8 @@
 void
 TimeInstantLayer::paste(const Clipboard &from, int frameOffset)
 {
+    if (!m_model) return;
+
     const Clipboard::PointList &points = from.getPoints();
 
     SparseOneDimensionalModel::EditCommand *command =