diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index a495cd8715..146ac56e0b 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -3565,6 +3565,13 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) session_add_audio_track (input_chan.n_audio(), output_chan.n_audio(), ARDOUR::Normal, NULL, _add_tracks_dialog->count(), ""); } +void +ARDOUR_UI::delete_selected_tracks() +{ + TrackSelection& track_selection = ARDOUR_UI::instance()->the_editor().get_selection().tracks; + track_selection.foreach_route_ui (boost::bind (&RouteUI::remove_this_route, _1, false)); +} + void ARDOUR_UI::add_audio_track_instantly () { diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 806acf9989..f226e94670 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -237,6 +237,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void synchronize_sync_source_and_video_pullup (); void add_route (Gtk::Window* float_window); + void delete_selected_tracks(); void add_routes_part_two (); void add_routes_thread (); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index bb27a53f2b..23abe5761a 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -134,6 +134,9 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); + act = ActionManager::register_action (main_actions, X_("DeleteSelectedTracks"), _("Delete selected tracks"), sigc::mem_fun(*this, &ARDOUR_UI::delete_selected_tracks)); + ActionManager::track_selection_sensitive_actions.push_back (act); + act = ActionManager::register_action (main_actions, X_("OpenVideo"), _("Open Video"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_video), (Gtk::Window*) 0)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 0edc858e91..ffe5471966 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1696,6 +1696,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void time_selection_changed (); void update_time_selection_display (); void track_selection_changed (); + bool non_master_track_selected (); void output_connection_mode_changed (); void region_selection_changed (); sigc::connection editor_regions_selection_changed_connection; diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 5824af29af..160903a35d 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -939,6 +939,30 @@ Editor::set_selected_regionview_from_map_event (GdkEventAny* /*ev*/, StreamView* return true; } +/* + Return true if selection is empty even MasterTrack is selected + Otherwise return false +*/ +bool +Editor::non_master_track_selected () +{ + if( selection->tracks.empty() ) + return false; + + if( selection->tracks.size() >=2 ) + return true; + + TimeAxisView* tv = selection->tracks.front(); + RouteTimeAxisView* rtv = dynamic_cast (tv); + if (rtv) { + AudioTrack* atr = dynamic_cast (rtv->route().get() ); + if (atr && _session && atr->is_master_track() ) + return false; + else + return true; + } +} + void Editor::track_selection_changed () { @@ -1026,7 +1050,7 @@ Editor::track_selection_changed () } } - ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, !selection->tracks.empty()); + ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, non_master_track_selected()); /* notify control protocols */ diff --git a/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj b/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj index 5fb85383e7..f622f08d1b 100644 --- a/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj +++ b/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj @@ -269,6 +269,7 @@ 43279460194F0062003C9FEA /* tracks_preferences.xml in Resources */ = {isa = PBXBuildFile; fileRef = 43279430194F0062003C9FEA /* tracks_preferences.xml */; }; 4327947F194F009E003C9FEA /* tracks.menus.in in Resources */ = {isa = PBXBuildFile; fileRef = 43279475194F009E003C9FEA /* tracks.menus.in */; }; 43B351ED194F04E00038C140 /* step_editing.bindings in Resources */ = {isa = PBXBuildFile; fileRef = 43B351C0194F04E00038C140 /* step_editing.bindings */; }; + CE1A907A199A37AE00ECA62B /* add_tracks_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = CE1A9079199A37AE00ECA62B /* add_tracks_dialog.cc */; }; CE1C6DCE19879F04006BDB03 /* compact_meter_bridge.cc in Sources */ = {isa = PBXBuildFile; fileRef = CE1C6DCC19879F04006BDB03 /* compact_meter_bridge.cc */; }; CE1C6DCF19879F04006BDB03 /* compact_meter_strip.cc in Sources */ = {isa = PBXBuildFile; fileRef = CE1C6DCD19879F04006BDB03 /* compact_meter_strip.cc */; }; CE1C6DE01987A924006BDB03 /* master_bus_ui.cc in Sources */ = {isa = PBXBuildFile; fileRef = CE1C6DDF1987A924006BDB03 /* master_bus_ui.cc */; }; @@ -1093,6 +1094,8 @@ 43B351EE194F12FB0038C140 /* waves_audiobackend.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = waves_audiobackend.xcodeproj; path = ../../libs/backends/wavesaudio/macosx/waves_audiobackend.xcodeproj; sourceTree = ""; }; 43B351F4194F130C0038C140 /* libardour.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libardour.xcodeproj; path = ../../libs/ardour/macosx/libardour.xcodeproj; sourceTree = ""; }; 43B351FA194F131D0038C140 /* pbd.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = pbd.xcodeproj; path = ../../libs/pbd/macosx/pbd.xcodeproj; sourceTree = ""; }; + CE1A9079199A37AE00ECA62B /* add_tracks_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = add_tracks_dialog.cc; path = ../add_tracks_dialog.cc; sourceTree = ""; }; + CE1A907E199A37BF00ECA62B /* add_tracks_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = add_tracks_dialog.h; path = ../add_tracks_dialog.h; sourceTree = ""; }; CE1C6DCC19879F04006BDB03 /* compact_meter_bridge.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compact_meter_bridge.cc; path = ../compact_meter_bridge.cc; sourceTree = ""; }; CE1C6DCD19879F04006BDB03 /* compact_meter_strip.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compact_meter_strip.cc; path = ../compact_meter_strip.cc; sourceTree = ""; }; CE1C6DD319879F1B006BDB03 /* compact_meter_bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = compact_meter_bridge.h; path = ../compact_meter_bridge.h; sourceTree = ""; }; @@ -1154,6 +1157,7 @@ 43279040194EFF38003C9FEA /* source */ = { isa = PBXGroup; children = ( + CE1A9079199A37AE00ECA62B /* add_tracks_dialog.cc */, CE1C6DDF1987A924006BDB03 /* master_bus_ui.cc */, CE1C6DCC19879F04006BDB03 /* compact_meter_bridge.cc */, CE1C6DCD19879F04006BDB03 /* compact_meter_strip.cc */, @@ -1779,6 +1783,7 @@ 43279480194F00CB003C9FEA /* headers */ = { isa = PBXGroup; children = ( + CE1A907E199A37BF00ECA62B /* add_tracks_dialog.h */, CE1C6DDB1987A910006BDB03 /* master_bus_ui.h */, CE1C6DD319879F1B006BDB03 /* compact_meter_bridge.h */, CE1C6DD419879F1B006BDB03 /* compact_meter_strip.h */, @@ -2443,6 +2448,7 @@ CE1C6DCE19879F04006BDB03 /* compact_meter_bridge.cc in Sources */, CE1C6DCF19879F04006BDB03 /* compact_meter_strip.cc in Sources */, CE1C6DE01987A924006BDB03 /* master_bus_ui.cc in Sources */, + CE1A907A199A37AE00ECA62B /* add_tracks_dialog.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index dc22ea5a9a..300bec2e45 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1331,52 +1331,31 @@ RouteUI::set_color_from_route () 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)); + if (apply_to_selection) { + TrackSelection& track_selection = ARDOUR_UI::instance()->the_editor().get_selection().tracks; + + for (list::iterator i = track_selection.begin(); i != track_selection.end(); ++i) { + RouteUI* t = dynamic_cast (*i); + if (t) { + if ( t->route()->is_master() || t->route()->is_monitor() ) + continue; + + AudioTrack* audio_track = dynamic_cast( t->route().get() ); + if( audio_track && audio_track->is_master_track() ) + continue; + + Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun (&RouteUI::idle_remove_this_route), t)); + } + } } 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 (); + if ( route()->is_master() || route()->is_monitor() ) return; - } - - vector 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)); - } + + AudioTrack* audio_track = dynamic_cast( route().get() ); + if( audio_track && audio_track->is_master_track() ) + return; + + Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun (&RouteUI::idle_remove_this_route), this)); } } diff --git a/gtk2_ardour/tracks.menus.in b/gtk2_ardour/tracks.menus.in index 357b107ceb..3de2605d02 100644 --- a/gtk2_ardour/tracks.menus.in +++ b/gtk2_ardour/tracks.menus.in @@ -96,6 +96,7 @@ +