changeset 18:4563a72c1d8b

* 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 2fb933f88604
children a7ed14263fe4
files base/Layer.h base/View.cpp base/ViewManager.cpp transform/TransformFactory.cpp transform/TransformFactory.h
diffstat 5 files changed, 36 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/base/Layer.h	Tue Jan 31 15:57:25 2006 +0000
+++ b/base/Layer.h	Tue Jan 31 17:19:45 2006 +0000
@@ -138,6 +138,14 @@
     virtual bool isLayerOpaque() const { return false; }
 
     /**
+     * This should return true if the layer can be edited by the user.
+     * If this is the case, the appropriate edit tools may be made
+     * available by the application and the layer's drawStart/Drag/End
+     * and editStart/Drag/End methods should be implemented.
+     */
+    virtual bool isLayerEditable() const { return false; }
+
+    /**
      * Return the proportion of background work complete in drawing
      * this view, as a percentage -- in most cases this will be the
      * value returned by pointer from a call to the underlying model's
--- a/base/View.cpp	Tue Jan 31 15:57:25 2006 +0000
+++ b/base/View.cpp	Tue Jan 31 17:19:45 2006 +0000
@@ -23,7 +23,7 @@
 #include <iostream>
 #include <cassert>
 
-#define DEBUG_VIEW_WIDGET_PAINT 1
+//#define DEBUG_VIEW_WIDGET_PAINT 1
 
 using std::cerr;
 using std::endl;
@@ -512,9 +512,6 @@
 
     if (m_playPointerFrame == f) return;
     bool visible = (getXForFrame(m_playPointerFrame) != getXForFrame(f));
-    std::cerr << "old x = " << getXForFrame(m_playPointerFrame)
-	      << ", new x = " << getXForFrame(f)
-	      << ", visible = " << visible << std::endl;
     size_t oldPlayPointerFrame = m_playPointerFrame;
     m_playPointerFrame = f;
     if (!visible) return;
@@ -559,6 +556,10 @@
 
 	int xnew = getXForFrame(m_playPointerFrame);
 
+#ifdef DEBUG_VIEW_WIDGET_PAINT
+	std::cerr << "xnew = " << xnew << ", width = " << width() << std::endl;
+#endif
+
 	if (xnew < width()/8 || xnew > (width()*7)/8) {
 	    if (QApplication::mouseButtons() == Qt::NoButton &&
 		QApplication::keyboardModifiers() == Qt::NoModifier) {
--- a/base/ViewManager.cpp	Tue Jan 31 15:57:25 2006 +0000
+++ b/base/ViewManager.cpp	Tue Jan 31 17:19:45 2006 +0000
@@ -14,7 +14,7 @@
 
 #include <iostream>
 
-#define DEBUG_VIEW_MANAGER 1
+//#define DEBUG_VIEW_MANAGER 1
 
 ViewManager::ViewManager() :
     m_playSource(0),
--- a/transform/TransformFactory.cpp	Tue Jan 31 15:57:25 2006 +0000
+++ b/transform/TransformFactory.cpp	Tue Jan 31 17:19:45 2006 +0000
@@ -99,6 +99,19 @@
     } else return "";
 }
 
+QString
+TransformFactory::getTransformFriendlyName(TransformName name)
+{
+    QString description = getTransformDescription(name);
+
+    int i = description.indexOf(':');
+    if (i >= 0) {
+	return description.remove(0, i + 2);
+    } else {
+	return description;
+    }
+}
+
 Transform *
 TransformFactory::createTransform(TransformName name, Model *inputModel)
 {
--- a/transform/TransformFactory.h	Tue Jan 31 15:57:25 2006 +0000
+++ b/transform/TransformFactory.h	Tue Jan 31 17:19:45 2006 +0000
@@ -52,8 +52,17 @@
      */
     Model *transform(TransformName name, Model *inputModel);
 
+    /**
+     * Full description of a transform, suitable for putting on a menu.
+     */
     QString getTransformDescription(TransformName name);
 
+    /**
+     * Brief but friendly description of a transform, suitable for use
+     * as the name of the output layer.
+     */
+    QString getTransformFriendlyName(TransformName name);
+
     //!!! Need some way to indicate that the input model has changed /
     //been deleted so as not to blow up backgrounded transform!  -- Or
     //indeed, if the output model has been deleted -- could equally