diff layer/TimeValueLayer.cpp @ 23:ca57f70b0e48

* Add Zero Crossings output from zc plugin (as well as Zero Crossings Count) * Use brief friendly names for layers instead of full transform descriptions * Clearer command names for editing commands * Some efficiencies in drawing dense points in TimeInstantLayer
author Chris Cannam
date Tue, 31 Jan 2006 17:19:45 +0000
parents 179bf7b5ddea
children dcdb21b62dbb
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp	Tue Jan 31 15:57:25 2006 +0000
+++ b/layer/TimeValueLayer.cpp	Tue Jan 31 17:19:45 2006 +0000
@@ -27,6 +27,7 @@
     Layer(w),
     m_model(0),
     m_editing(false),
+    m_originalPoint(0, 0.0, tr("New Point")),
     m_editingPoint(0, 0.0, tr("New Point")),
     m_editingCommand(0),
     m_colour(Qt::black),
@@ -497,6 +498,7 @@
     float value = getValueForY(e->y());
 
     m_editingPoint = SparseTimeValueModel::Point(frame, value, tr("New Point"));
+    m_originalPoint = m_editingPoint;
 
     if (m_editingCommand) m_editingCommand->finish();
     m_editingCommand = new SparseTimeValueModel::EditCommand(m_model,
@@ -546,6 +548,7 @@
     if (points.empty()) return;
 
     m_editingPoint = *points.begin();
+    m_originalPoint = m_editingPoint;
 
     if (m_editingCommand) {
 	m_editingCommand->finish();
@@ -584,7 +587,25 @@
 {
     std::cerr << "TimeValueLayer::editEnd(" << e->x() << "," << e->y() << ")" << std::endl;
     if (!m_model || !m_editing) return;
-    if (m_editingCommand) m_editingCommand->finish();
+
+    if (m_editingCommand) {
+
+	QString newName = m_editingCommand->getName();
+
+	if (m_editingPoint.frame != m_originalPoint.frame) {
+	    if (m_editingPoint.value != m_originalPoint.value) {
+		newName = tr("Edit Point");
+	    } else {
+		newName = tr("Relocate Point");
+	    }
+	} else {
+	    newName = tr("Change Point Value");
+	}
+
+	m_editingCommand->setName(newName);
+	m_editingCommand->finish();
+    }
+
     m_editingCommand = 0;
     m_editing = false;
 }