diff layer/TextLayer.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 05c41701dc6c
children 0f36cdf407a6
line wrap: on
line diff
--- a/layer/TextLayer.cpp	Wed May 10 16:34:03 2006 +0000
+++ b/layer/TextLayer.cpp	Thu May 11 11:35:46 2006 +0000
@@ -605,13 +605,15 @@
     if (ok && label != points.begin()->label) {
 	TextModel::RelabelCommand *command =
 	    new TextModel::RelabelCommand(m_model, *points.begin(), label);
-	CommandHistory::getInstance()->addCommand(command, true);
+	CommandHistory::getInstance()->addCommand(command);
     }
 }    
 
 void
 TextLayer::moveSelection(Selection s, size_t newStartFrame)
 {
+    if (!m_model) return;
+
     TextModel::EditCommand *command =
 	new TextModel::EditCommand(m_model, tr("Drag Selection"));
 
@@ -635,6 +637,8 @@
 void
 TextLayer::resizeSelection(Selection s, Selection newSize)
 {
+    if (!m_model) return;
+
     TextModel::EditCommand *command =
 	new TextModel::EditCommand(m_model, tr("Resize Selection"));
 
@@ -667,6 +671,8 @@
 void
 TextLayer::deleteSelection(Selection s)
 {
+    if (!m_model) return;
+
     TextModel::EditCommand *command =
 	new TextModel::EditCommand(m_model, tr("Delete Selection"));
 
@@ -684,6 +690,8 @@
 void
 TextLayer::copy(Selection s, Clipboard &to)
 {
+    if (!m_model) return;
+
     TextModel::PointList points =
 	m_model->getPoints(s.getStartFrame(), s.getEndFrame());
 
@@ -699,6 +707,8 @@
 void
 TextLayer::paste(const Clipboard &from, int frameOffset)
 {
+    if (!m_model) return;
+
     const Clipboard::PointList &points = from.getPoints();
 
     TextModel::EditCommand *command =