editor: refactor snap to bbt to allow specifying non-grid-setting grid type
This commit is contained in:
parent
49439d2acf
commit
ece438d73d
@ -2952,6 +2952,12 @@ Editor::snap_to_cd_frames (timepos_t const & presnap, Temporal::RoundMode direct
|
||||
|
||||
timepos_t
|
||||
Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, SnapPref gpref)
|
||||
{
|
||||
return _snap_to_bbt (presnap, direction, gpref, _grid_type);
|
||||
}
|
||||
|
||||
timepos_t
|
||||
Editor::_snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, SnapPref gpref, GridType grid_type)
|
||||
{
|
||||
timepos_t ret(presnap);
|
||||
TempoMap::SharedPtr tmap (TempoMap::use());
|
||||
@ -2963,7 +2969,7 @@ Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, S
|
||||
* nearby grid and walk towards the next bar point.
|
||||
*/
|
||||
|
||||
if (_grid_type == GridTypeBar) {
|
||||
if (grid_type == GridTypeBar) {
|
||||
TempoMetric m (tmap->metric_at (presnap));
|
||||
BBT_Argument bbt (m.bbt_at (presnap));
|
||||
switch (direction) {
|
||||
|
@ -2387,6 +2387,11 @@ private:
|
||||
Temporal::RoundMode direction,
|
||||
ARDOUR::SnapPref gpref);
|
||||
|
||||
Temporal::timepos_t _snap_to_bbt (Temporal::timepos_t const & start,
|
||||
Temporal::RoundMode direction,
|
||||
ARDOUR::SnapPref gpref,
|
||||
Editing::GridType grid_type);
|
||||
|
||||
void snap_to_internal (Temporal::timepos_t& first,
|
||||
Temporal::RoundMode direction = Temporal::RoundNearest,
|
||||
ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual,
|
||||
|
Loading…
Reference in New Issue
Block a user