diff layer/Layer.h @ 283:86a112b5b319

* Make it possible to "measure" a feature on the spectrogram by double- clicking in measure mode * Make shift-click-drag (for zoom to region) work in measure mode as well as navigate mode. It would be nice to be able to shift-doubleclick to zoom on a feature directly using a combination of these last two features, but that isn't possible yet. * Make Del delete the measurement under the mouse pointer.
author Chris Cannam
date Thu, 05 Jul 2007 15:36:37 +0000
parents 3c402c6052f6
children cd2492c5fe45
line wrap: on
line diff
--- a/layer/Layer.h	Thu Jul 05 11:07:01 2007 +0000
+++ b/layer/Layer.h	Thu Jul 05 15:36:37 2007 +0000
@@ -1,4 +1,3 @@
-
 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
 
 /*
@@ -172,6 +171,11 @@
     virtual void measureEnd(View *, QMouseEvent *);
     virtual void measureDoubleClick(View *, QMouseEvent *);
 
+    virtual bool haveCurrentMeasureRect() const {
+        return m_haveCurrentMeasureRect;
+    }
+    virtual void deleteCurrentMeasureRect(); // using a command
+
     /**
      * Open an editor on the item under the mouse (e.g. on
      * double-click).  If there is no item or editing is not
@@ -461,6 +465,21 @@
         MeasureRect m_rect;
     };
 
+    class DeleteMeasurementRectCommand : public Command
+    {
+    public:
+        DeleteMeasurementRectCommand(Layer *layer, MeasureRect rect) :
+            m_layer(layer), m_rect(rect) { }
+
+        virtual QString getName() const;
+        virtual void execute();
+        virtual void unexecute();
+
+    private:
+        Layer *m_layer;
+        MeasureRect m_rect;
+    };
+
     void addMeasureRectToSet(const MeasureRect &r) {
         m_measureRects.insert(r);
         emit layerMeasurementRectsChanged();
@@ -475,6 +494,8 @@
     MeasureRectSet m_measureRects;
     MeasureRect m_draggingRect;
     bool m_haveDraggingRect;
+    mutable bool m_haveCurrentMeasureRect;
+    mutable QPoint m_currentMeasureRectPoint;
    
     // Note that pixrects are only correct for a single view.
     // So we should update them at the start of the paint procedure
@@ -483,6 +504,7 @@
 
     virtual void updateMeasureRectYCoords(View *v, const MeasureRect &r) const;
     virtual void setMeasureRectYCoord(View *v, MeasureRect &r, bool start, int y) const;
+    virtual void setMeasureRectFromPixrect(View *v, MeasureRect &r, QRect pixrect) const;
 
     // This assumes updateMeasurementPixrects has been called
     MeasureRectSet::const_iterator findFocusedMeasureRect(QPoint) const;