Fix #2926 and #2927; presence and behaviour of solo/mute icons in the editor list.

git-svn-id: svn://localhost/ardour2/branches/3.0@6185 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-11-26 03:02:16 +00:00
parent 7664d86dc5
commit 966e09677d
4 changed files with 83 additions and 66 deletions

View File

@ -92,7 +92,6 @@ EditorRoutes::EditorRoutes (Editor* e)
Gtk::TreeViewColumn* mute_state_column = manage (new TreeViewColumn("M", *mute_col_renderer));
mute_state_column->add_attribute(mute_col_renderer->property_state(), _columns.mute_state);
mute_state_column->add_attribute(mute_col_renderer->property_visible(), _columns.is_track);
// Solo enable toggle
CellRendererPixbufMulti* solo_col_renderer = manage (new CellRendererPixbufMulti());
@ -104,8 +103,6 @@ EditorRoutes::EditorRoutes (Editor* e)
Gtk::TreeViewColumn* solo_state_column = manage (new TreeViewColumn("S", *solo_col_renderer));
solo_state_column->add_attribute(solo_col_renderer->property_state(), _columns.solo_state);
solo_state_column->add_attribute(solo_col_renderer->property_visible(), _columns.is_track);
_display.append_column (*rec_state_column);
_display.append_column (*mute_state_column);
@ -157,6 +154,8 @@ EditorRoutes::connect_to_session (Session* s)
EditorComponent::connect_to_session (s);
initial_display ();
_session->SoloChanged.connect (mem_fun (*this, &EditorRoutes::solo_changed_so_update_mute));
}
void
@ -184,8 +183,8 @@ EditorRoutes::on_tv_mute_enable_toggled (Glib::ustring const & path_string)
TimeAxisView *tv = row[_columns.tv];
AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
if (atv != 0 && atv->is_audio_track()){
atv->reversibly_apply_track_boolean ("mute-enable change", &Track::set_mute, !atv->track()->muted(), this);
if (atv != 0) {
atv->reversibly_apply_route_boolean ("mute-enable change", &Route::set_mute, !atv->route()->muted(), this);
}
}
@ -198,8 +197,8 @@ EditorRoutes::on_tv_solo_enable_toggled (Glib::ustring const & path_string)
TimeAxisView *tv = row[_columns.tv];
AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
if (atv != 0 && atv->is_audio_track()){
atv->reversibly_apply_track_boolean ("solo-enable change", &Track::set_solo, !atv->track()->soloed(), this);
if (atv != 0) {
atv->reversibly_apply_route_boolean ("solo-enable change", &Route::set_solo, !atv->route()->soloed(), this);
}
}
@ -354,9 +353,10 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
if ((*x)->is_track()) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> ((*x)->route());
t->diskstream()->RecordEnableChanged.connect (mem_fun (*this, &EditorRoutes::update_rec_display));
t->mute_changed.connect (mem_fun (*this, &EditorRoutes::update_mute_display));
t->solo_changed.connect (mem_fun (*this, &EditorRoutes::update_solo_display));
}
(*x)->route()->mute_changed.connect (mem_fun (*this, &EditorRoutes::update_mute_display));
(*x)->route()->solo_changed.connect (mem_fun (*this, &EditorRoutes::update_solo_display));
}
update_rec_display ();
@ -911,15 +911,7 @@ EditorRoutes::update_mute_display (void* /*src*/)
for (i = rows.begin(); i != rows.end(); ++i) {
boost::shared_ptr<Route> route = (*i)[_columns.route];
if (boost::dynamic_pointer_cast<Track>(route)) {
if (route->muted()){
(*i)[_columns.mute_state] = 1;
} else {
(*i)[_columns.mute_state] = 0;
}
}
(*i)[_columns.mute_state] = RouteUI::mute_visual_state (*_session, route) > 0 ? 1 : 0;
}
}
@ -931,15 +923,7 @@ EditorRoutes::update_solo_display (void* /*src*/)
for (i = rows.begin(); i != rows.end(); ++i) {
boost::shared_ptr<Route> route = (*i)[_columns.route];
if (boost::dynamic_pointer_cast<Track>(route)) {
if (route->soloed()){
(*i)[_columns.solo_state] = 1;
} else {
(*i)[_columns.solo_state] = 0;
}
}
(*i)[_columns.solo_state] = RouteUI::solo_visual_state (route) > 0 ? 1 : 0;
}
}
@ -976,3 +960,11 @@ EditorRoutes::name_edit (Glib::ustring const & path, Glib::ustring const & new_t
route->set_name (new_text);
}
}
void
EditorRoutes::solo_changed_so_update_mute ()
{
ENSURE_GUI_THREAD (mem_fun (*this, &EditorRoutes::solo_changed_so_update_mute));
update_mute_display (this);
}

View File

@ -83,6 +83,7 @@ private:
void track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const & iter, int* new_order);
bool selection_filter (Glib::RefPtr<Gtk::TreeModel> const &, Gtk::TreeModel::Path const &, bool);
void name_edit (Glib::ustring const &, Glib::ustring const &);
void solo_changed_so_update_mute ();
struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
ModelColumns() {

View File

@ -658,11 +658,36 @@ RouteUI::listen_changed(void* /*src*/)
Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &RouteUI::update_solo_display));
}
int
RouteUI::solo_visual_state (boost::shared_ptr<Route> r)
{
if (Config->get_solo_control_is_listen_control()) {
if (r->listening()) {
return 1;
} else {
return 0;
}
} else {
if (r->solo_isolated()) {
return 2;
} else if (r->soloed()) {
return 1;
} else {
return 0;
}
}
return 0;
}
void
RouteUI::update_solo_display ()
{
bool x;
if (Config->get_solo_control_is_listen_control()) {
if (solo_button->get_active() != (x = _route->listening())) {
@ -671,29 +696,17 @@ RouteUI::update_solo_display ()
ignore_toggle = false;
}
if (x) {
solo_button->set_visual_state (1);
} else {
solo_button->set_visual_state (0);
}
} else {
if (solo_button->get_active() != (x = _route->soloed())){
if (solo_button->get_active() != (x = _route->soloed())) {
ignore_toggle = true;
solo_button->set_active (x);
ignore_toggle = false;
}
if (_route->solo_isolated()) {
solo_button->set_visual_state (2);
} else if (x) {
solo_button->set_visual_state (1);
} else {
solo_button->set_visual_state (0);
}
}
solo_button->set_visual_state (solo_visual_state (_route));
}
void
@ -708,6 +721,36 @@ RouteUI::mute_changed(void* /*src*/)
Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &RouteUI::update_mute_display));
}
int
RouteUI::mute_visual_state (Session& s, boost::shared_ptr<Route> r)
{
if (Config->get_show_solo_mutes()) {
if (r->muted ()) {
/* full mute */
return 2;
} else if (s.soloing() && !r->soloed() && !r->solo_isolated()) {
/* mute-because-not-soloed */
return 1;
} else {
/* no mute at all */
return 0;
}
} else {
if (r->muted()) {
/* full mute */
return 2;
} else {
/* no mute at all */
return 0;
}
}
return 0;
}
void
RouteUI::update_mute_display ()
{
@ -724,29 +767,7 @@ RouteUI::update_mute_display ()
ignore_toggle = false;
}
/* now attend to visual state */
if (Config->get_show_solo_mutes()) {
if (_route->muted()) {
/* full mute */
mute_button->set_visual_state (2);
} else if (_session.soloing() && !_route->soloed() && !_route->solo_isolated()) {
/* mute-because-not-soloed */
mute_button->set_visual_state (1);
} else {
/* no mute at all */
mute_button->set_visual_state (0);
}
} else {
if (_route->muted()) {
/* full mute */
mute_button->set_visual_state (2);
} else {
/* no mute at all */
mute_button->set_visual_state (0);
}
}
mute_button->set_visual_state (mute_visual_state (_session, _route));
}
void

View File

@ -195,6 +195,9 @@ class RouteUI : public virtual AxisView
void save_as_template ();
void open_remote_control_id_dialog ();
static int solo_visual_state (boost::shared_ptr<ARDOUR::Route>);
static int mute_visual_state (ARDOUR::Session &, boost::shared_ptr<ARDOUR::Route>);
protected:
std::vector<sigc::connection> connections;
bool self_destruct;