mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
NO-OP: cleanup snap-to code, mostly whitespace
This commit is contained in:
parent
3a2f0e40cf
commit
6b9bdbf0ff
1 changed files with 12 additions and 13 deletions
|
|
@ -2690,7 +2690,7 @@ Editor::snap_to (MusicSample& start, RoundMode direction, SnapPref pref, bool en
|
||||||
snap_to_internal (start, direction, pref, ensure_snap);
|
snap_to_internal (start, direction, pref, ensure_snap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
check_best_snap (samplepos_t presnap, samplepos_t &test, samplepos_t &dist, samplepos_t &best)
|
check_best_snap (samplepos_t presnap, samplepos_t &test, samplepos_t &dist, samplepos_t &best)
|
||||||
{
|
{
|
||||||
samplepos_t diff = abs (test - presnap);
|
samplepos_t diff = abs (test - presnap);
|
||||||
|
|
@ -2971,6 +2971,7 @@ Editor::snap_to_marker (samplepos_t presnap, RoundMode direction)
|
||||||
void
|
void
|
||||||
Editor::snap_to_internal (MusicSample& start, RoundMode direction, SnapPref pref, bool ensure_snap)
|
Editor::snap_to_internal (MusicSample& start, RoundMode direction, SnapPref pref, bool ensure_snap)
|
||||||
{
|
{
|
||||||
|
UIConfiguration const& uic (UIConfiguration::instance ());
|
||||||
const samplepos_t presnap = start.sample;
|
const samplepos_t presnap = start.sample;
|
||||||
|
|
||||||
samplepos_t test = max_samplepos; // for each snap, we'll use this value
|
samplepos_t test = max_samplepos; // for each snap, we'll use this value
|
||||||
|
|
@ -2978,20 +2979,18 @@ Editor::snap_to_internal (MusicSample& start, RoundMode direction, SnapPref pref
|
||||||
samplepos_t best = max_samplepos; // this records the best snap-result we've found so far
|
samplepos_t best = max_samplepos; // this records the best snap-result we've found so far
|
||||||
|
|
||||||
/* check snap-to-marker */
|
/* check snap-to-marker */
|
||||||
if ((pref == SnapToAny_Visual) && UIConfiguration::instance().get_snap_to_marks()) {
|
if ((pref == SnapToAny_Visual) && uic.get_snap_to_marks ()) {
|
||||||
test = snap_to_marker (presnap, direction);
|
test = snap_to_marker (presnap, direction);
|
||||||
check_best_snap(presnap, test, dist, best);
|
check_best_snap (presnap, test, dist, best);
|
||||||
}
|
}
|
||||||
|
|
||||||
const UIConfiguration& uic (UIConfiguration::instance());
|
|
||||||
|
|
||||||
/* check snap-to-region-{start/end/sync} */
|
/* 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())) {
|
if ((pref == SnapToAny_Visual) && (uic.get_snap_to_region_start () || uic.get_snap_to_region_end () || uic.get_snap_to_region_sync ())) {
|
||||||
|
|
||||||
if (!region_boundary_cache.empty()) {
|
if (!region_boundary_cache.empty ()) {
|
||||||
|
|
||||||
vector<samplepos_t>::iterator prev = region_boundary_cache.begin();
|
vector<samplepos_t>::iterator prev = region_boundary_cache.begin ();
|
||||||
vector<samplepos_t>::iterator next = std::upper_bound (region_boundary_cache.begin(), region_boundary_cache.end(), presnap);
|
vector<samplepos_t>::iterator next = std::upper_bound (region_boundary_cache.begin (), region_boundary_cache.end (), presnap);
|
||||||
if (next != region_boundary_cache.begin ()) {
|
if (next != region_boundary_cache.begin ()) {
|
||||||
prev = next;
|
prev = next;
|
||||||
prev--;
|
prev--;
|
||||||
|
|
@ -3011,14 +3010,14 @@ Editor::snap_to_internal (MusicSample& start, RoundMode direction, SnapPref pref
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_best_snap(presnap, test, dist, best);
|
check_best_snap (presnap, test, dist, best);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check Grid */
|
/* check Grid */
|
||||||
if (uic.get_snap_to_grid() && (_grid_type != GridTypeNone)) {
|
if (uic.get_snap_to_grid () && (_grid_type != GridTypeNone)) {
|
||||||
MusicSample pre(presnap, 0);
|
MusicSample pre (presnap, 0);
|
||||||
MusicSample post = snap_to_grid (pre, direction, pref);
|
MusicSample post = snap_to_grid (pre, direction, pref);
|
||||||
check_best_snap(presnap, post.sample, dist, best);
|
check_best_snap (presnap, post.sample, dist, best);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now check "magnetic" state: is the grid within reasonable on-screen distance to trigger a snap?
|
/* now check "magnetic" state: is the grid within reasonable on-screen distance to trigger a snap?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue