13
0

Hide/Remove to apply to the track selection.

git-svn-id: svn://localhost/ardour2/branches/3.0@9090 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-03-07 13:05:45 +00:00
parent 8f45604f27
commit eabe5b31f8
8 changed files with 66 additions and 50 deletions

View File

@ -5026,16 +5026,28 @@ Editor::timeaxisview_deleted (TimeAxisView *tv)
}
void
Editor::hide_track_in_display (TimeAxisView* tv, bool /*temponly*/)
Editor::hide_track_in_display (TimeAxisView* tv, bool apply_to_selection)
{
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
if (apply_to_selection) {
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ) {
if (rtv && current_mixer_strip && (rtv->route() == current_mixer_strip->route())) {
// this will hide the mixer strip
set_selected_mixer_strip (*tv);
TrackSelection::iterator j = i;
++j;
hide_track_in_display (*i, false);
i = j;
}
} else {
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
if (rtv && current_mixer_strip && (rtv->route() == current_mixer_strip->route())) {
// this will hide the mixer strip
set_selected_mixer_strip (*tv);
}
_routes->hide_track_in_display (*tv);
}
_routes->hide_track_in_display (*tv);
}
bool

View File

@ -326,7 +326,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void show_editor_list (bool yn);
void set_selected_mixer_strip (TimeAxisView&);
void mixer_strip_width_changed ();
void hide_track_in_display (TimeAxisView* tv, bool temporary = false);
void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false);
/* nudge is initiated by transport controls owned by ARDOUR_UI */

View File

@ -1545,7 +1545,7 @@ Editor::temporal_zoom_region (bool both_axes)
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
if (find (tracks.begin(), tracks.end(), (*i)) == tracks.end()) {
hide_track_in_display (*i, true);
hide_track_in_display (*i);
}
}

View File

@ -1365,7 +1365,7 @@ MixerStrip::build_route_ops_menu ()
}
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Remove"), sigc::mem_fun(*this, &RouteUI::remove_this_route)));
items.push_back (MenuElem (_("Remove"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), false)));
}
gboolean

View File

@ -233,7 +233,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual void select_all_tracks () = 0;
virtual void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0;
virtual void set_selected_mixer_strip (TimeAxisView&) = 0;
virtual void hide_track_in_display (TimeAxisView* tv, bool temporary = false) = 0;
virtual void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false) = 0;
virtual void set_stationary_playhead (bool yn) = 0;
virtual void toggle_stationary_playhead () = 0;

View File

@ -649,12 +649,12 @@ RouteTimeAxisView::build_display_menu ()
i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), click_sets_active, true));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Hide"), sigc::bind (sigc::mem_fun(_editor, &PublicEditor::hide_track_in_display), this, false)));
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::mem_fun(*this, &RouteUI::remove_this_route)));
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::mem_fun(*this, &RouteUI::remove_this_route)));
items.push_front (MenuElem (_("Delete"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), true)));
}
}

View File

@ -1373,15 +1373,18 @@ RouteUI::set_color_from_route ()
}
void
RouteUI::remove_this_route ()
RouteUI::remove_this_route (bool apply_to_selection)
{
if ((route()->is_master() || route()->is_monitor()) &&
!Config->get_allow_special_bus_removal()) {
MessageDialog msg (_("That would be bad news ...."),
false,
Gtk::MESSAGE_INFO,
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 (_(
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\
@ -1389,34 +1392,35 @@ 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\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());
}
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));
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\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());
}
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));
}
}
}

View File

@ -167,7 +167,7 @@ class RouteUI : public virtual AxisView
int set_color_from_route ();
void remove_this_route ();
void remove_this_route (bool apply_to_selection = false);
static gint idle_remove_this_route (RouteUI *);
void route_rename();