From 0baf0d859d88695cb2ef6e2a64d326da17994dfe Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 6 Jan 2022 12:00:18 -0700 Subject: [PATCH] GUI side of cue behavior (makes it available in the ruler context menu) --- gtk2_ardour/editor.h | 2 ++ gtk2_ardour/editor_markers.cc | 12 ++++++++++++ gtk2_ardour/editor_rulers.cc | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 2b787eca3b..be47a6d7da 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1055,6 +1055,8 @@ private: ArdourCanvas::Rectangle* cd_marker_bar; ArdourCanvas::Rectangle* cue_marker_bar; + void toggle_cue_behavior (); + Gtk::Label minsec_label; Gtk::Label bbt_label; Gtk::Label timecode_label; diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 9fa02ea32c..8bb5ef51b3 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1918,3 +1918,15 @@ Editor::find_marker_from_location_id (PBD::ID const & id, bool is_start) const return 0; } + +void +Editor::toggle_cue_behavior () +{ + CueBehavior cb (Config->get_cue_behavior()); + + if (cb & ARDOUR::FollowCues) { + Config->set_cue_behavior (ARDOUR::CueBehavior (cb & ~ARDOUR::FollowCues)); + } else { + Config->set_cue_behavior (ARDOUR::CueBehavior (cb | ARDOUR::FollowCues)); + } +} diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 4e03e7d2fb..fb7ae76cb9 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -216,6 +216,8 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t) // always build from scratch MenuList& ruler_items = editor_ruler_menu->items(); + CheckMenuItem* cme; + editor_ruler_menu->set_name ("ArdourContextMenu"); ruler_items.clear(); @@ -244,6 +246,10 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t) break; case CueMarkerBarItem: + ruler_items.push_back (CheckMenuElem (_("Ignore cue markers"))); + cme = static_cast (&ruler_items.back()); + cme->set_active (Config->get_cue_behavior() != ARDOUR::FollowCues); + cme->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_cue_behavior)); for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) { /* XXX the "letter" names of the cues need to be subject to i18n somehow */ ruler_items.push_back (MenuElem (string_compose (_("Cue %1"), (char) ('A' + n)), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, n)));