summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-04-06 17:56:18 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-04-06 17:56:23 -0400
commit803853b4a43582f8d89542d0b3ec58e972826f64 (patch)
tree99ed6cfe2fb26efcee2bdd1d1b0d5be740f15a16
parent537b3a2a0e34f1e49d47b8a51d08c690e02f1454 (diff)
rationalize incorrect design for removing tracks.
Still requires a way to make this work correctly from the mixer window
-rw-r--r--gtk2_ardour/editor.h5
-rw-r--r--gtk2_ardour/editor_actions.cc8
-rw-r--r--gtk2_ardour/editor_ops.cc33
-rw-r--r--gtk2_ardour/mixer_strip.cc3
-rw-r--r--gtk2_ardour/public_editor.h3
-rw-r--r--gtk2_ardour/route_time_axis.cc8
-rw-r--r--gtk2_ardour/route_ui.cc60
-rw-r--r--gtk2_ardour/route_ui.h3
8 files changed, 33 insertions, 90 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 2e2593dbf1..7cfc6ff9ff 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -261,6 +261,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
+ void remove_tracks ();
+
/* tempo */
void set_show_measures (bool yn);
@@ -2134,7 +2136,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void fit_selection ();
void set_track_height (Height);
- void remove_tracks ();
+ void _remove_tracks ();
+ bool idle_remove_tracks ();
void toggle_tracks_active ();
bool _have_idled;
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 1e104c1fdd..322a823ff2 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -401,11 +401,9 @@ Editor::register_actions ()
act = reg_sens (editor_actions, "toggle-track-active", _("Toggle Active"), (sigc::mem_fun(*this, &Editor::toggle_tracks_active)));
ActionManager::track_selection_sensitive_actions.push_back (act);
- if (Profile->get_sae()) {
- act = reg_sens (editor_actions, "remove-track", _("Delete"), (sigc::mem_fun(*this, &Editor::remove_tracks)));
- } else {
- act = reg_sens (editor_actions, "remove-track", _("Remove"), (sigc::mem_fun(*this, &Editor::remove_tracks)));
- }
+ act = reg_sens (editor_actions, "remove-track", _("Remove"), (sigc::mem_fun(*this, &Editor::remove_tracks)));
+ /* not selection sensitive? */
+
ActionManager::track_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "fit-selection", _("Fit Selection (Vertical)"), sigc::mem_fun(*this, &Editor::fit_selection));
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 5ccf589ef3..116bc4571d 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -6750,6 +6750,23 @@ Editor::toggle_tracks_active ()
void
Editor::remove_tracks ()
{
+ /* this will delete GUI objects that may be the subject of an event
+ handler in which this method is called. Defer actual deletion to the
+ next idle callback, when all event handling is finished.
+ */
+ Glib::signal_idle().connect (sigc::mem_fun (*this, &Editor::idle_remove_tracks));
+}
+
+bool
+Editor::idle_remove_tracks ()
+{
+ _remove_tracks ();
+ return false; /* do not call again */
+}
+
+void
+Editor::_remove_tracks ()
+{
TrackSelection& ts (selection->tracks);
if (ts.empty()) {
@@ -6804,19 +6821,9 @@ edit your ardour.rc file to set the\n\
return;
}
- // XXX should be using gettext plural forms, maybe?
- if (ntracks > 1) {
- trackstr = _("tracks");
- } else {
- trackstr = _("track");
- }
-
- if (nbusses > 1) {
- busstr = _("busses");
- } else {
- busstr = _("bus");
- }
-
+ trackstr = P_("track", "tracks", ntracks);
+ busstr = P_("bus", "busses", nbusses);
+
if (ntracks) {
if (nbusses) {
prompt = string_compose (_("Do you really want to remove %1 %2 and %3 %4?\n"
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index 03d0cbad92..ae5a0023c1 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -1540,7 +1540,8 @@ MixerStrip::build_route_ops_menu ()
}
items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Remove"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), false)));
+ /* gah, this is wrong ... it will operate on the wrong selection */
+ items.push_front (MenuElem (_("Remove"), sigc::mem_fun(PublicEditor::instance(), &PublicEditor::remove_tracks)));
}
gboolean
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index a16ae9f05c..1ee068f141 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -204,7 +204,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual void remove_location_at_playhead_cursor () = 0;
virtual void set_show_measures (bool yn) = 0;
virtual bool show_measures () const = 0;
-
+ virtual void remove_tracks () = 0;
+
virtual Editing::MouseMode effective_mouse_mode () const = 0;
/** Import existing media */
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index bec98d8756..2e3dee4626 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -852,12 +852,8 @@ RouteTimeAxisView::build_display_menu ()
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Hide"), sigc::bind (sigc::mem_fun(_editor, &PublicEditor::hide_track_in_display), this, true)));
- if (!Profile->get_sae()) {
- items.push_back (MenuElem (_("Remove"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), true)));
- } else {
- items.push_front (SeparatorElem());
- items.push_front (MenuElem (_("Delete"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), true)));
- }
+ items.push_front (SeparatorElem());
+ items.push_front (MenuElem (_("Delete"), sigc::mem_fun(_editor, &PublicEditor::remove_tracks)));
}
void
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index fc2472ed37..9f1acf49ed 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -1534,66 +1534,6 @@ RouteUI::set_color_from_route ()
return 0;
}
-void
-RouteUI::remove_this_route (bool apply_to_selection)
-{
- if (apply_to_selection) {
- ARDOUR_UI::instance()->the_editor().get_selection().tracks.foreach_route_ui (boost::bind (&RouteUI::remove_this_route, _1, false));
- } else {
- if ((route()->is_master() || route()->is_monitor()) &&
- !Config->get_allow_special_bus_removal()) {
- MessageDialog msg (_("That would be bad news ...."),
- false,
- Gtk::MESSAGE_INFO,
- Gtk::BUTTONS_OK);
- msg.set_secondary_text (string_compose (_(
-"Removing the master or monitor bus is such a bad idea\n\
-that %1 is not going to allow it.\n\
-\n\
-If you really want to do this sort of thing\n\
-edit your ardour.rc file to set the\n\
-\"allow-special-bus-removal\" option to be \"yes\""), PROGRAM_NAME));
-
- msg.present ();
- msg.run ();
- return;
- }
-
- vector<string> choices;
- string prompt;
-
- if (is_track()) {
- prompt = string_compose (_("Do you really want to remove track \"%1\" ?\n\nYou may also lose the playlist used by this track.\n\n(This action cannot be undone, and the session file will be overwritten)"), _route->name());
- } else {
- prompt = string_compose (_("Do you really want to remove bus \"%1\" ?\n\n(This action cannot be undone, and the session file will be overwritten)"), _route->name());
- }
-
- choices.push_back (_("No, do nothing."));
- choices.push_back (_("Yes, remove it."));
-
- string title;
- if (is_track()) {
- title = _("Remove track");
- } else {
- title = _("Remove bus");
- }
-
- Choice prompter (title, prompt, choices);
-
- if (prompter.run () == 1) {
- Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun (&RouteUI::idle_remove_this_route), this));
- }
- }
-}
-
-gint
-RouteUI::idle_remove_this_route (RouteUI *rui)
-{
- DisplaySuspender ds;
- rui->_session->remove_route (rui->route());
- return false;
-}
-
/** @return true if this name should be used for the route, otherwise false */
bool
RouteUI::verify_new_route_name (const std::string& name)
diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h
index 0da95cdc23..98d66fef84 100644
--- a/gtk2_ardour/route_ui.h
+++ b/gtk2_ardour/route_ui.h
@@ -187,9 +187,6 @@ class RouteUI : public virtual AxisView
int set_color_from_route ();
- void remove_this_route (bool apply_to_selection = false);
- static gint idle_remove_this_route (RouteUI *);
-
void route_rename();
virtual void property_changed (const PBD::PropertyChange&);