diff layer/SpectrogramLayer.cpp @ 13:01849cd277e6

* Hook up tool selection buttons to switch the cursor mode * Implement simple and multi-selection, snapping to the resolution of the current layer. You can't actually do anything with a selection yet
author Chris Cannam
date Mon, 23 Jan 2006 17:02:57 +0000
parents 2d5005f2b3d9
children 1deb5f87a18c
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Thu Jan 19 17:59:11 2006 +0000
+++ b/layer/SpectrogramLayer.cpp	Mon Jan 23 17:02:57 2006 +0000
@@ -1636,6 +1636,17 @@
 		   ybase + 9 + fontAscent + fontHeight * 2, dBMaxText);
 }
 
+int
+SpectrogramLayer::getNearestFeatureFrame(int frame, 
+					 size_t &resolution,
+					 bool snapRight) const
+{
+    resolution = getWindowIncrement();
+    int snapFrame = (frame / resolution) * resolution;
+    if (snapRight) snapFrame += resolution;
+    return snapFrame;
+}
+
 /*!!!
 
 bool