From 1973243a988be0717948f0fb2075bce4fe11e27b Mon Sep 17 00:00:00 2001 From: Colin Fletcher Date: Fri, 6 Feb 2015 23:56:34 +0000 Subject: [PATCH] Separate out creation of xrun markers from Editor::mouse_add_new_marker() Remove the is_xrun parameter from Editor::mouse_add_new_marker(), and just create the marker directly in ARDOUR_UI::create_xrun_marker(), so that xrun markers don't become automatically selected when they appear. --- gtk2_ardour/ardour_ui.cc | 5 ++++- gtk2_ardour/editor.h | 2 +- gtk2_ardour/editor_markers.cc | 15 ++++----------- gtk2_ardour/editor_rulers.cc | 4 ++-- gtk2_ardour/public_editor.h | 2 +- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index c9ef1387af..ee27e8c6f3 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -3894,7 +3894,10 @@ ARDOUR_UI::keyboard_settings () const void ARDOUR_UI::create_xrun_marker (framepos_t where) { - editor->mouse_add_new_marker (where, false, true); + if (_session) { + Location *location = new Location (*_session, where, where, _("xrun"), Location::IsMark); + _session->locations()->add (location); + } } void diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index fd308bed12..fd090edee1 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -519,7 +519,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void metric_get_minsec (std::vector&, gdouble, gdouble, gint); /* editing operations that need to be public */ - void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false); + void mouse_add_new_marker (framepos_t where, bool is_cd=false); void split_regions_at (framepos_t, RegionSelection&); void split_region_at_points (boost::shared_ptr, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false); RegionSelection get_regions_from_selection_and_mouse (framepos_t); diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index d982de3a32..17315d702f 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -636,21 +636,14 @@ Editor::LocationMarkers::setup_lines () } void -Editor::mouse_add_new_marker (framepos_t where, bool is_cd, bool is_xrun) +Editor::mouse_add_new_marker (framepos_t where, bool is_cd) { - string markername, markerprefix; + string markername; int flags = (is_cd ? Location::IsCDMarker|Location::IsMark : Location::IsMark); - if (is_xrun) { - markerprefix = "xrun"; - flags = Location::IsMark; - } else { - markerprefix = "mark"; - } - if (_session) { - _session->locations()->next_available_name(markername, markerprefix); - if (!is_xrun && !choose_new_marker_name(markername)) { + _session->locations()->next_available_name(markername, _("mark")); + if (!choose_new_marker_name(markername)) { return; } Location *location = new Location (*_session, where, where, markername, (Location::Flags) flags); diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 9ef589facb..4bbacb024d 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -208,7 +208,7 @@ Editor::popup_ruler_menu (framepos_t where, ItemType t) switch (t) { case MarkerBarItem: - ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false, false))); + ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false))); ruler_items.push_back (MenuElem (_("Clear all locations"), sigc::mem_fun(*this, &Editor::clear_markers))); ruler_items.push_back (MenuElem (_("Unhide locations"), sigc::mem_fun(*this, &Editor::unhide_markers))); ruler_items.push_back (SeparatorElem ()); @@ -226,7 +226,7 @@ Editor::popup_ruler_menu (framepos_t where, ItemType t) case CdMarkerBarItem: // TODO - ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true, false))); + ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true))); break; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 3b18cd41e1..5e7a0f6095 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -285,7 +285,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi virtual void toggle_meter_updating() = 0; virtual void split_regions_at (framepos_t, RegionSelection&) = 0; virtual void split_region_at_points (boost::shared_ptr, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0; - virtual void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false) = 0; + virtual void mouse_add_new_marker (framepos_t where, bool is_cd=false) = 0; virtual void foreach_time_axis_view (sigc::slot) = 0; virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 0; virtual framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next) = 0;