diff layer/BoxLayer.h @ 1547:e6362cf5ff1d

Pass a y-coord, optionally, to Layer::snapToFeatureFrame. This is necessary for BoxLayer which needs to coordinate its snaps with the box it is highlighting for editing. Then in BoxLayer, merge getPointToDrag and getLocalPoints into a single getLocalPoint and use this throughout.
author Chris Cannam
date Thu, 17 Oct 2019 11:12:54 +0100
parents ec837d223bd9
children
line wrap: on
line diff
--- a/layer/BoxLayer.h	Thu Oct 17 10:26:21 2019 +0100
+++ b/layer/BoxLayer.h	Thu Oct 17 11:12:54 2019 +0100
@@ -46,7 +46,7 @@
 
     bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame,
                             int &resolution,
-                            SnapType snap) const override;
+                            SnapType snap, int ycoord) const override;
 
     void drawStart(LayerGeometryProvider *v, QMouseEvent *) override;
     void drawDrag(LayerGeometryProvider *v, QMouseEvent *) override;
@@ -118,9 +118,12 @@
 protected:
     void getScaleExtents(LayerGeometryProvider *, double &min, double &max, bool &log) const;
 
-    EventVector getLocalPoints(LayerGeometryProvider *v, int x) const;
-
-    bool getPointToDrag(LayerGeometryProvider *v, int x, int y, Event &) const;
+    // Return the event that "most closely contains" the given
+    // coordinates, if any; or the closest event that spans the given
+    // x coordinate in the time axis; or false otherwise. This
+    // subsumes the uses of both getPointToDrag and getLocalPoints in
+    // some other layer implementations.
+    bool getLocalPoint(LayerGeometryProvider *v, int x, int y, Event &) const;
 
     ModelId m_model;
     bool m_editing;