summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-05-25 00:35:53 +0000
committerCarl Hetherington <carl@carlh.net>2010-05-25 00:35:53 +0000
commite3b0cb086d2cec5f28a24fed16fd62e06080fe1a (patch)
treea72693675a3932bd3b586c14b4da02efe31b44e3
parentbd2cbe9e76b28d5cc3d9688c7df6c5206d6be771 (diff)
Clean up snap-to code in various places. Fix a couple of typos. Should fix #3165 and #3172.
git-svn-id: svn://localhost/ardour2/branches/3.0@7152 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editing_syms.h1
-rw-r--r--gtk2_ardour/editor.cc68
-rw-r--r--gtk2_ardour/editor_actions.cc45
-rw-r--r--gtk2_ardour/editor_rulers.cc63
4 files changed, 95 insertions, 82 deletions
diff --git a/gtk2_ardour/editing_syms.h b/gtk2_ardour/editing_syms.h
index b16a192b40..409e0d9cbd 100644
--- a/gtk2_ardour/editing_syms.h
+++ b/gtk2_ardour/editing_syms.h
@@ -37,6 +37,7 @@ SNAPTYPE(SnapToBeatDiv6)
SNAPTYPE(SnapToBeatDiv5)
SNAPTYPE(SnapToBeatDiv4)
SNAPTYPE(SnapToBeatDiv3)
+SNAPTYPE(SnapToBeatDiv2)
SNAPTYPE(SnapToBeat)
SNAPTYPE(SnapToBar)
SNAPTYPE(SnapToMark)
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index c2748e5af3..78dcdcd091 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -157,6 +157,7 @@ static const gchar *_snap_type_strings[] = {
N_("Beats/5"),
N_("Beats/4"),
N_("Beats/3"),
+ N_("Beats/2"),
N_("Beats"),
N_("Bars"),
N_("Marks"),
@@ -2112,6 +2113,7 @@ Editor::set_snap_to (SnapType st)
case SnapToBeatDiv5:
case SnapToBeatDiv4:
case SnapToBeatDiv3:
+ case SnapToBeatDiv2:
compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
update_tempo_based_rulers ();
break;
@@ -2659,12 +2661,17 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
start = _session->tempo_map().round_to_beat (start, direction);
break;
+ case SnapToBeatDiv32:
+ start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction);
+ break;
case SnapToBeatDiv28:
start = _session->tempo_map().round_to_beat_subdivision (start, 28, direction);
break;
-
case SnapToBeatDiv24:
- start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction);
+ start = _session->tempo_map().round_to_beat_subdivision (start, 24, direction);
+ break;
+ case SnapToBeatDiv16:
+ start = _session->tempo_map().round_to_beat_subdivision (start, 16, direction);
break;
case SnapToBeatDiv14:
start = _session->tempo_map().round_to_beat_subdivision (start, 14, direction);
@@ -2675,6 +2682,9 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
case SnapToBeatDiv10:
start = _session->tempo_map().round_to_beat_subdivision (start, 10, direction);
break;
+ case SnapToBeatDiv8:
+ start = _session->tempo_map().round_to_beat_subdivision (start, 8, direction);
+ break;
case SnapToBeatDiv7:
start = _session->tempo_map().round_to_beat_subdivision (start, 7, direction);
break;
@@ -2684,21 +2694,15 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
case SnapToBeatDiv5:
start = _session->tempo_map().round_to_beat_subdivision (start, 5, direction);
break;
- case SnapToBeatDiv32:
- start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction);
- break;
- case SnapToBeatDiv16:
- start = _session->tempo_map().round_to_beat_subdivision (start, 16, direction);
- break;
- case SnapToBeatDiv8:
- start = _session->tempo_map().round_to_beat_subdivision (start, 8, direction);
- break;
case SnapToBeatDiv4:
start = _session->tempo_map().round_to_beat_subdivision (start, 4, direction);
break;
case SnapToBeatDiv3:
start = _session->tempo_map().round_to_beat_subdivision (start, 3, direction);
break;
+ case SnapToBeatDiv2:
+ start = _session->tempo_map().round_to_beat_subdivision (start, 2, direction);
+ break;
case SnapToMark:
if (for_mark) {
@@ -3456,32 +3460,34 @@ Editor::snap_type_selection_done ()
string choice = snap_type_selector.get_active_text();
SnapType snaptype = SnapToBeat;
- if (choice == _("Beats/3")) {
+ if (choice == _("Beats/2")) {
+ snaptype = SnapToBeatDiv2;
+ } else if (choice == _("Beats/3")) {
snaptype = SnapToBeatDiv3;
} else if (choice == _("Beats/4")) {
snaptype = SnapToBeatDiv4;
- } else if (choice == _("Beats/8")) {
- snaptype = SnapToBeatDiv8;
- } else if (choice == _("Beats/16")) {
- snaptype = SnapToBeatDiv16;
- } else if (choice == _("Beats/32")) {
- snaptype = SnapToBeatDiv32;
} else if (choice == _("Beats/5")) {
snaptype = SnapToBeatDiv5;
} else if (choice == _("Beats/6")) {
snaptype = SnapToBeatDiv6;
} else if (choice == _("Beats/7")) {
snaptype = SnapToBeatDiv7;
+ } else if (choice == _("Beats/8")) {
+ snaptype = SnapToBeatDiv8;
} else if (choice == _("Beats/10")) {
snaptype = SnapToBeatDiv10;
} else if (choice == _("Beats/12")) {
snaptype = SnapToBeatDiv12;
} else if (choice == _("Beats/14")) {
snaptype = SnapToBeatDiv14;
+ } else if (choice == _("Beats/16")) {
+ snaptype = SnapToBeatDiv16;
} else if (choice == _("Beats/24")) {
snaptype = SnapToBeatDiv24;
} else if (choice == _("Beats/28")) {
snaptype = SnapToBeatDiv28;
+ } else if (choice == _("Beats/32")) {
+ snaptype = SnapToBeatDiv32;
} else if (choice == _("Beats")) {
snaptype = SnapToBeat;
} else if (choice == _("Bars")) {
@@ -3842,12 +3848,18 @@ Editor::get_grid_type_as_beats (bool& success, nframes64_t position)
return 1.0;
break;
+ case SnapToBeatDiv32:
+ return 1.0/32.0;
+ break;
case SnapToBeatDiv28:
return 1.0/28.0;
break;
case SnapToBeatDiv24:
return 1.0/24.0;
break;
+ case SnapToBeatDiv16:
+ return 1.0/16.0;
+ break;
case SnapToBeatDiv14:
return 1.0/14.0;
break;
@@ -3857,6 +3869,9 @@ Editor::get_grid_type_as_beats (bool& success, nframes64_t position)
case SnapToBeatDiv10:
return 1.0/10.0;
break;
+ case SnapToBeatDiv8:
+ return 1.0/8.0;
+ break;
case SnapToBeatDiv7:
return 1.0/7.0;
break;
@@ -3866,26 +3881,15 @@ Editor::get_grid_type_as_beats (bool& success, nframes64_t position)
case SnapToBeatDiv5:
return 1.0/5.0;
break;
-
- case SnapToBeatDiv32:
- return 1.0/32.0;
- break;
-
- case SnapToBeatDiv16:
- return 1.0/16.0;
- break;
-
- case SnapToBeatDiv8:
- return 1.0/8.0;
- break;
-
case SnapToBeatDiv4:
return 1.0/4.0;
break;
-
case SnapToBeatDiv3:
return 1.0/3.0;
break;
+ case SnapToBeatDiv2:
+ return 1.0/2.0;
+ break;
case SnapToBar:
if (_session) {
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 56919e0399..eeb604c2e5 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -714,20 +714,20 @@ Editor::register_actions ()
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-seconds"), _("Snap to Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSeconds)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-minutes"), _("Snap to Minutes"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMinutes)));
- ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyeighths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv28)));
- ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyfourths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv24)));
- ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twelfths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv14)));
- ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fourteenths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv12)));
- ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-tenths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv10)));
- ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sevenths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv7)));
- ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sixths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv6)));
- ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fifths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv5)));
-
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirtyseconds"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv32)));
- ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-asixteenthbeat"), _("Snap to A Sixteenth Beat"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv16)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyeighths"), _("Snap to Twenty Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv28)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyfourths"), _("Snap to Twenty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv24)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-asixteenthbeat"), _("Snap to Sixteenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv16)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fourteenths"), _("Snap to Fourteenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv14)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twelfths"), _("Snap to Tweflths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv12)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-tenths"), _("Snap to Tenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv10)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-eighths"), _("Snap to Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv8)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sevenths"), _("Snap to Sevenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv7)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sixths"), _("Snap to Sixths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv6)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fifths"), _("Snap to Fifths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv5)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-quarters"), _("Snap to Quarters"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv4)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirds"), _("Snap to Thirds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv3)));
+ ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-halves"), _("Snap to Halves"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv2)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-beat"), _("Snap to Beat"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeat)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-bar"), _("Snap to Bar"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBar)));
@@ -958,7 +958,6 @@ Editor::toggle_logo_visibility ()
RefPtr<RadioAction>
Editor::snap_type_action (SnapType type)
{
-
const char* action = 0;
RefPtr<Action> act;
@@ -981,12 +980,18 @@ Editor::snap_type_action (SnapType type)
case Editing::SnapToMinutes:
action = "snap-to-minutes";
break;
+ case Editing::SnapToBeatDiv32:
+ action = "snap-to-thirtyseconds";
+ break;
case Editing::SnapToBeatDiv28:
action = "snap-to-twentyeighths";
break;
case Editing::SnapToBeatDiv24:
action = "snap-to-twentyfourths";
break;
+ case Editing::SnapToBeatDiv16:
+ action = "snap-to-asixteenthbeat";
+ break;
case Editing::SnapToBeatDiv14:
action = "snap-to-fourteenths";
break;
@@ -996,6 +1001,9 @@ Editor::snap_type_action (SnapType type)
case Editing::SnapToBeatDiv10:
action = "snap-to-tenths";
break;
+ case Editing::SnapToBeatDiv8:
+ action = "snap-to-eighths";
+ break;
case Editing::SnapToBeatDiv7:
action = "snap-to-sevenths";
break;
@@ -1005,21 +1013,15 @@ Editor::snap_type_action (SnapType type)
case Editing::SnapToBeatDiv5:
action = "snap-to-fifths";
break;
- case Editing::SnapToBeatDiv32:
- action = "snap-to-thirtyseconds";
- break;
- case Editing::SnapToBeatDiv16:
- action = "snap-to-asixteenthbeat";
- break;
- case Editing::SnapToBeatDiv8:
- action = "snap-to-eighths";
- break;
case Editing::SnapToBeatDiv4:
action = "snap-to-quarters";
break;
case Editing::SnapToBeatDiv3:
action = "snap-to-thirds";
break;
+ case Editing::SnapToBeatDiv2:
+ action = "snap-to-halves";
+ break;
case Editing::SnapToBeat:
action = "snap-to-beat";
break;
@@ -1117,6 +1119,9 @@ Editor::cycle_snap_choice()
set_snap_to (Editing::SnapToBeatDiv3);
break;
case Editing::SnapToBeatDiv3:
+ set_snap_to (Editing::SnapToBeatDiv2);
+ break;
+ case Editing::SnapToBeatDiv2:
set_snap_to (Editing::SnapToBeat);
break;
case Editing::SnapToBeat:
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 79ea23815d..873e491958 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -1153,55 +1153,58 @@ Editor::compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper)
bbt_ruler_scale = bbt_over;
switch (_snap_type) {
+ case SnapToBeatDiv2:
+ bbt_beat_subdivision = 2;
+ break;
case SnapToBeatDiv3:
bbt_beat_subdivision = 3;
break;
case SnapToBeatDiv4:
bbt_beat_subdivision = 4;
break;
+ case SnapToBeatDiv5:
+ bbt_beat_subdivision = 5;
+ bbt_accent_modulo = 2; // XXX YIKES
+ break;
+ case SnapToBeatDiv6:
+ bbt_beat_subdivision = 6;
+ bbt_accent_modulo = 2; // XXX YIKES
+ break;
+ case SnapToBeatDiv7:
+ bbt_beat_subdivision = 7;
+ bbt_accent_modulo = 2; // XXX YIKES
+ break;
case SnapToBeatDiv8:
bbt_beat_subdivision = 8;
bbt_accent_modulo = 2;
break;
- case SnapToBeatDiv16:
- bbt_beat_subdivision = 16;
- bbt_accent_modulo = 4;
- break;
- case SnapToBeatDiv32:
- bbt_beat_subdivision = 32;
- bbt_accent_modulo = 8;
- break;
- case SnapToBeatDiv28:
- bbt_beat_subdivision = 28;
- bbt_accent_modulo = 7;
+ case SnapToBeatDiv10:
+ bbt_beat_subdivision = 10;
+ bbt_accent_modulo = 2; // XXX YIKES
break;
- case SnapToBeatDiv24:
- bbt_beat_subdivision = 24;
- bbt_accent_modulo = 6;
+ case SnapToBeatDiv12:
+ bbt_beat_subdivision = 12;
+ bbt_accent_modulo = 3;
break;
case SnapToBeatDiv14:
bbt_beat_subdivision = 14;
bbt_accent_modulo = 3; // XXX YIKES!
break;
- case SnapToBeatDiv12:
- bbt_beat_subdivision = 12;
- bbt_accent_modulo = 3;
- break;
- case SnapToBeatDiv10:
- bbt_beat_subdivision = 10;
- bbt_accent_modulo = 2; // XXX YIKES
+ case SnapToBeatDiv16:
+ bbt_beat_subdivision = 16;
+ bbt_accent_modulo = 4;
break;
- case SnapToBeatDiv7:
- bbt_beat_subdivision = 7;
- bbt_accent_modulo = 2; // XXX YIKES
+ case SnapToBeatDiv24:
+ bbt_beat_subdivision = 24;
+ bbt_accent_modulo = 6;
break;
- case SnapToBeatDiv6:
- bbt_beat_subdivision = 6;
- bbt_accent_modulo = 2; // XXX YIKES
+ case SnapToBeatDiv28:
+ bbt_beat_subdivision = 28;
+ bbt_accent_modulo = 7;
break;
- case SnapToBeatDiv5:
- bbt_beat_subdivision = 5;
- bbt_accent_modulo = 2; // XXX YIKES
+ case SnapToBeatDiv32:
+ bbt_beat_subdivision = 32;
+ bbt_accent_modulo = 8;
break;
default:
bbt_beat_subdivision = 4;