diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index 24fe0f7c4b..35eec34c75 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -69,24 +69,54 @@ EditorRoutes::EditorRoutes (Editor* e) _model = ListStore::create (_columns); _display.set_model (_model); + // Record enable toggle CellRendererPixbufToggle* rec_col_renderer = manage (new CellRendererPixbufToggle()); - rec_col_renderer->set_active_pixbuf (::get_icon("record_normal_red")); - rec_col_renderer->set_inactive_pixbuf (::get_icon("record_disabled_grey")); - + rec_col_renderer->set_active_pixbuf (::get_icon("rec-enabled")); + rec_col_renderer->set_inactive_pixbuf (::get_icon("act-disabled")); rec_col_renderer->signal_toggled().connect (mem_fun (*this, &EditorRoutes::on_tv_rec_enable_toggled)); - Gtk::TreeViewColumn* rec_state_column = manage (new TreeViewColumn("Rec", *rec_col_renderer)); + Gtk::TreeViewColumn* rec_state_column = manage (new TreeViewColumn("R", *rec_col_renderer)); + rec_state_column->add_attribute(rec_col_renderer->property_active(), _columns.rec_enabled); rec_state_column->add_attribute(rec_col_renderer->property_visible(), _columns.is_track); + // Mute enable toggle + CellRendererPixbufToggle* mute_col_renderer = manage (new CellRendererPixbufToggle()); + + mute_col_renderer->set_active_pixbuf (::get_icon("mute-enabled")); + mute_col_renderer->set_inactive_pixbuf (::get_icon("act-disabled")); + mute_col_renderer->signal_toggled().connect (mem_fun (*this, &EditorRoutes::on_tv_mute_enable_toggled)); + + Gtk::TreeViewColumn* mute_state_column = manage (new TreeViewColumn("M", *mute_col_renderer)); + + mute_state_column->add_attribute(mute_col_renderer->property_active(), _columns.mute_enabled); + mute_state_column->add_attribute(mute_col_renderer->property_visible(), _columns.is_track); + + // Solo enable toggle + CellRendererPixbufToggle* solo_col_renderer = manage (new CellRendererPixbufToggle()); + + solo_col_renderer->set_active_pixbuf (::get_icon("solo-enabled")); + solo_col_renderer->set_inactive_pixbuf (::get_icon("act-disabled")); + solo_col_renderer->signal_toggled().connect (mem_fun (*this, &EditorRoutes::on_tv_solo_enable_toggled)); + + Gtk::TreeViewColumn* solo_state_column = manage (new TreeViewColumn("S", *solo_col_renderer)); + + solo_state_column->add_attribute(solo_col_renderer->property_active(), _columns.solo_enabled); + 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); + _display.append_column (*solo_state_column); _display.append_column (_("Show"), _columns.visible); _display.append_column (_("Name"), _columns.text); _display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0)); _display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1)); _display.get_column (2)->set_data (X_("colnum"), GUINT_TO_POINTER(2)); + _display.get_column (3)->set_data (X_("colnum"), GUINT_TO_POINTER(3)); + _display.get_column (4)->set_data (X_("colnum"), GUINT_TO_POINTER(4)); _display.set_headers_visible (true); _display.set_name ("TrackListDisplay"); @@ -96,12 +126,13 @@ EditorRoutes::EditorRoutes (Editor* e) _display.set_size_request (100, -1); _display.add_object_drag (_columns.route.index(), "routes"); - CellRendererText* name_cell = dynamic_cast (_display.get_column_cell_renderer (2)); + CellRendererText* name_cell = dynamic_cast (_display.get_column_cell_renderer (4)); + assert (name_cell); name_cell->property_editable() = true; name_cell->signal_edited().connect (mem_fun (*this, &EditorRoutes::name_edit)); - CellRendererToggle* visible_cell = dynamic_cast(_display.get_column_cell_renderer (1)); + CellRendererToggle* visible_cell = dynamic_cast(_display.get_column_cell_renderer (3)); visible_cell->property_activatable() = true; visible_cell->property_radio() = false; @@ -136,6 +167,38 @@ EditorRoutes::on_tv_rec_enable_toggled (Glib::ustring const & path_string) } } + +void +EditorRoutes::on_tv_mute_enable_toggled (Glib::ustring const & path_string) +{ + // Get the model row that has been toggled. + Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string)); + + TimeAxisView *tv = row[_columns.tv]; + AudioTimeAxisView *atv = dynamic_cast (tv); + + if (atv != 0 && atv->is_audio_track()){ + atv->reversibly_apply_track_boolean ("mute-enable change", &Track::set_mute, !atv->track()->muted(), this); + } +} + + + +void +EditorRoutes::on_tv_solo_enable_toggled (Glib::ustring const & path_string) +{ + // Get the model row that has been toggled. + Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string)); + + TimeAxisView *tv = row[_columns.tv]; + AudioTimeAxisView *atv = dynamic_cast (tv); + + if (atv != 0 && atv->is_audio_track()){ + atv->reversibly_apply_track_boolean ("solo-enable change", &Track::set_solo, !atv->track()->soloed(), this); + } +} + + void EditorRoutes::build_menu () { @@ -188,11 +251,9 @@ EditorRoutes::redisplay () } if (!_redisplay_does_not_reset_order_keys) { - /* this reorder is caused by user action, so reassign sort order keys to tracks. */ - route->set_order_key (N_ ("editor"), n); } @@ -215,7 +276,6 @@ EditorRoutes::redisplay () we can't do this here, because we could mess up something that is traversing the track order and has caused a redisplay of the list. */ - Glib::signal_idle().connect (mem_fun (*_editor, &Editor::sync_track_view_list_and_routes)); _editor->full_canvas_height = position + _editor->canvas_timebars_vsize; @@ -290,6 +350,8 @@ EditorRoutes::routes_added (list routes) if ((*x)->is_track()) { boost::shared_ptr t = boost::dynamic_pointer_cast ((*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)); } } @@ -605,6 +667,12 @@ EditorRoutes::button_press (GdkEventButton* ev) /* allow normal processing to occur */ return false; case 1: + /* allow normal processing to occur */ + return false; + case 2: + /* allow normal processing to occur */ + return false; + case 3: if ((iter = _model->get_iter (path))) { TimeAxisView* tv = (*iter)[_columns.tv]; if (tv) { @@ -614,7 +682,7 @@ EditorRoutes::button_press (GdkEventButton* ev) } return true; - case 2: + case 4: /* allow normal processing to occur */ return false; @@ -834,6 +902,46 @@ EditorRoutes::update_rec_display () } } +void +EditorRoutes::update_mute_display (void* /*src*/) +{ + TreeModel::Children rows = _model->children(); + TreeModel::Children::iterator i; + + for (i = rows.begin(); i != rows.end(); ++i) { + boost::shared_ptr route = (*i)[_columns.route]; + + if (boost::dynamic_pointer_cast(route)) { + + if (route->muted()){ + (*i)[_columns.mute_enabled] = true; + } else { + (*i)[_columns.mute_enabled] = false; + } + } + } +} + +void +EditorRoutes::update_solo_display (void* /*src*/) +{ + TreeModel::Children rows = _model->children(); + TreeModel::Children::iterator i; + + for (i = rows.begin(); i != rows.end(); ++i) { + boost::shared_ptr route = (*i)[_columns.route]; + + if (boost::dynamic_pointer_cast(route)) { + + if (route->soloed()){ + (*i)[_columns.solo_enabled] = true; + } else { + (*i)[_columns.solo_enabled] = false; + } + } + } +} + list EditorRoutes::views () const { diff --git a/gtk2_ardour/editor_routes.h b/gtk2_ardour/editor_routes.h index 1086313d08..72554129c8 100644 --- a/gtk2_ardour/editor_routes.h +++ b/gtk2_ardour/editor_routes.h @@ -30,13 +30,16 @@ public: void move_selected_tracks (bool); void show_track_in_display (TimeAxisView &); + void suspend_redisplay () { _no_redisplay = true; } + void resume_redisplay () { _no_redisplay = false; redisplay (); } + void redisplay (); void update_visibility (); void routes_added (std::list routes); @@ -50,6 +53,8 @@ private: void initial_display (); void on_tv_rec_enable_toggled (Glib::ustring const &); + void on_tv_mute_enable_toggled (Glib::ustring const &); + void on_tv_solo_enable_toggled (Glib::ustring const &); void build_menu (); void show_menu (); void route_deleted (Gtk::TreeModel::Path const &); @@ -60,6 +65,8 @@ private: void route_removed (TimeAxisView *); void handle_gui_changes (std::string const &, void *); void update_rec_display (); + void update_mute_display (void* /*src*/); + void update_solo_display (void* /*src*/); void set_all_tracks_visibility (bool); void set_all_audio_visibility (int, bool); void show_all_routes (); @@ -68,9 +75,11 @@ private: void hide_all_audiotracks (); void show_all_audiobus (); void hide_all_audiobus (); + void display_drag_data_received ( Glib::RefPtr const &, gint, gint, Gtk::SelectionData const &, guint, guint ); + void track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const & iter, int* new_order); bool selection_filter (Glib::RefPtr const &, Gtk::TreeModel::Path const &, bool); void name_edit (Glib::ustring const &, Glib::ustring const &); @@ -80,13 +89,18 @@ private: add (text); add (visible); add (rec_enabled); + add (mute_enabled); + add (solo_enabled); add (is_track); add (tv); add (route); } + Gtk::TreeModelColumn text; Gtk::TreeModelColumn visible; Gtk::TreeModelColumn rec_enabled; + Gtk::TreeModelColumn mute_enabled; + Gtk::TreeModelColumn solo_enabled; Gtk::TreeModelColumn is_track; Gtk::TreeModelColumn tv; Gtk::TreeModelColumn > route; @@ -96,9 +110,11 @@ private: Gtkmm2ext::DnDTreeView > _display; Glib::RefPtr _model; ModelColumns _columns; + bool _ignore_reorder; bool _no_redisplay; bool _redisplay_does_not_sync_order_keys; bool _redisplay_does_not_reset_order_keys; + Gtk::Menu* _menu; }; diff --git a/gtk2_ardour/icons/act-disabled.png b/gtk2_ardour/icons/act-disabled.png new file mode 100644 index 0000000000..87700da5e3 Binary files /dev/null and b/gtk2_ardour/icons/act-disabled.png differ diff --git a/gtk2_ardour/icons/mute-enabled.png b/gtk2_ardour/icons/mute-enabled.png new file mode 100644 index 0000000000..34af275336 Binary files /dev/null and b/gtk2_ardour/icons/mute-enabled.png differ diff --git a/gtk2_ardour/icons/rec-enabled.png b/gtk2_ardour/icons/rec-enabled.png new file mode 100644 index 0000000000..1ec43b5fe6 Binary files /dev/null and b/gtk2_ardour/icons/rec-enabled.png differ diff --git a/gtk2_ardour/icons/solo-enabled.png b/gtk2_ardour/icons/solo-enabled.png new file mode 100644 index 0000000000..80a7fcc686 Binary files /dev/null and b/gtk2_ardour/icons/solo-enabled.png differ