Add Editor preference to snap to playhead position.

This commit is contained in:
Robin Gareus 2023-04-29 00:40:06 +02:00
parent 78216b422f
commit d82ece39e1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 16 additions and 0 deletions

View File

@ -3173,6 +3173,11 @@ Editor::snap_to_internal (timepos_t& start, Temporal::RoundMode direction, SnapP
check_best_snap (presnap, test, dist, best);
}
if ((pref == SnapToAny_Visual) && uic.get_snap_to_playhead ()) {
test = timepos_t (_session->audible_sample());
check_best_snap (presnap, test, dist, best);
}
/* check snap-to-region-{start/end/sync} */
if ((pref == SnapToAny_Visual) && (uic.get_snap_to_region_start () || uic.get_snap_to_region_end () || uic.get_snap_to_region_sync ())) {

View File

@ -204,6 +204,8 @@
snap grid editor mouse
[snap-to-marks]
snap grid editor mouse markers marks
[snap-to-playhead]
snap grid editor mouse playhead
[snap-to-region-end]
snap grid editor mouse regions boundaries boundary
[snap-to-region-start]

View File

@ -3393,6 +3393,14 @@ These settings will only take effect after %1 is restarted.\n\
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_snap_to_marks)
));
add_option (_("Editor/Snap"),
new BoolOption (
"snap-to-playhead",
_("Playhead"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_snap_to_playhead),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_snap_to_playhead)
));
add_option (_("Editor/Snap"),
new BoolOption (
"snap-to-region-sync",

View File

@ -132,6 +132,7 @@ UI_CONFIG_VARIABLE (bool, show_snapped_cursor, "show-snapped-cursor", true)
UI_CONFIG_VARIABLE (uint32_t, snap_threshold, "snap-threshold", 25)
UI_CONFIG_VARIABLE (uint32_t, ruler_granularity, "ruler-granularity", 25)
UI_CONFIG_VARIABLE (bool, snap_to_marks, "snap-to-marks", true)
UI_CONFIG_VARIABLE (bool, snap_to_playhead, "snap-to-playhead", true)
UI_CONFIG_VARIABLE (bool, snap_to_region_sync, "snap-to-region-sync", true)
UI_CONFIG_VARIABLE (bool, snap_to_region_start, "snap-to-region-start", true)
UI_CONFIG_VARIABLE (bool, snap_to_region_end, "snap-to-region-end", true)