Extract snap subdivision to a constant.
authorCarl Hetherington <cth@carlh.net>
Fri, 22 Dec 2023 17:25:40 +0000 (18:25 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 12 Mar 2024 22:41:00 +0000 (23:41 +0100)
src/lib/constants.h
src/wx/content_timeline.cc

index 3b187155453d32b0a6f822e799fbbe08f918432a..bfe144420281ae7805408884bbebaf68eed01f59 100644 (file)
@@ -47,6 +47,7 @@
 #define MAX_CLOSED_CAPTION_XML_SIZE (256 * 1024)
 #define MAX_CLOSED_CAPTION_XML_SIZE_TEXT "256KB"
 #define CERTIFICATE_VALIDITY_PERIOD (10 * 365)
+#define SNAP_SUBDIVISION 64
 
 
 #endif
index 7257f3587df1570733356aa58636786aca0b0683..663f93030f65006a1fb134246156ed899b6e85ee 100644 (file)
@@ -32,6 +32,7 @@
 #include "wx_util.h"
 #include "lib/atmos_mxf_content.h"
 #include "lib/audio_content.h"
+#include "lib/constants.h"
 #include "lib/film.h"
 #include "lib/image_content.h"
 #include "lib/playlist.h"
@@ -845,7 +846,7 @@ ContentTimeline::set_position_from_event(wxMouseEvent& ev, bool force_emit)
 
                if (nearest_distance) {
                        /* Snap if it's close; `close' means within a proportion of the time on the timeline */
-                       if (nearest_distance.get().abs() < DCPTime::from_seconds ((width() / pps) / 64)) {
+                       if (nearest_distance.get().abs() < DCPTime::from_seconds ((width() / pps) / SNAP_SUBDIVISION)) {
                                new_position += nearest_distance.get ();
                        }
                }