From bc32e5b5eb2320e22f471317d3b1ebb9f8494514 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 28 Jun 2010 00:41:01 +0000 Subject: [PATCH] Make the L,G,M and O buttons in the region list respond to clicks. Fixes #3252. git-svn-id: svn://localhost/ardour2/branches/3.0@7307 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_regions.cc | 74 ++++++++++++++++++++++++++++++++++- gtk2_ardour/editor_regions.h | 4 ++ 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index 58a6a0e129..e2a97c791e 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -102,6 +102,22 @@ EditorRegions::EditorRegions (Editor* e) tv_col->add_attribute(renderer->property_text(), _columns.name); tv_col->add_attribute(renderer->property_foreground_gdk(), _columns.color_); + CellRendererToggle* locked_cell = dynamic_cast (_display.get_column_cell_renderer (7)); + locked_cell->property_activatable() = true; + locked_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRegions::locked_changed)); + + CellRendererToggle* glued_cell = dynamic_cast (_display.get_column_cell_renderer (8)); + glued_cell->property_activatable() = true; + glued_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRegions::glued_changed)); + + CellRendererToggle* muted_cell = dynamic_cast (_display.get_column_cell_renderer (9)); + muted_cell->property_activatable() = true; + muted_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRegions::muted_changed)); + + CellRendererToggle* opaque_cell = dynamic_cast (_display.get_column_cell_renderer (10)); + opaque_cell->property_activatable() = true; + opaque_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRegions::opaque_changed)); + _display.get_selection()->set_mode (SELECTION_MULTIPLE); _display.add_object_drag (_columns.region.index(), "regions"); @@ -306,7 +322,11 @@ EditorRegions::region_changed (boost::shared_ptr r, const PropertyChange if (what_changed.contains (ARDOUR::Properties::name) || what_changed.contains (ARDOUR::Properties::start) || what_changed.contains (ARDOUR::Properties::position) || - what_changed.contains (ARDOUR::Properties::length)) { + what_changed.contains (ARDOUR::Properties::length) || + what_changed.contains (ARDOUR::Properties::locked) || + what_changed.contains (ARDOUR::Properties::position_lock_style) || + what_changed.contains (ARDOUR::Properties::muted) || + what_changed.contains (ARDOUR::Properties::opaque)) { /* find the region in our model and update its row */ TreeModel::Children rows = _model->children (); @@ -1196,3 +1216,55 @@ EditorRegions::get_single_selection () return (*iter)[_columns.region]; } + +void +EditorRegions::locked_changed (Glib::ustring const & path) +{ + TreeIter i = _model->get_iter (path); + if (i) { + boost::shared_ptr region = (*i)[_columns.region]; + if (region) { + region->set_locked (!(*i)[_columns.locked]); + } + } +} + +void +EditorRegions::glued_changed (Glib::ustring const & path) +{ + TreeIter i = _model->get_iter (path); + if (i) { + boost::shared_ptr region = (*i)[_columns.region]; + if (region) { + /* `glued' means MusicTime, and we're toggling here */ + region->set_position_lock_style ((*i)[_columns.glued] ? AudioTime : MusicTime); + } + } + +} + +void +EditorRegions::muted_changed (Glib::ustring const & path) +{ + TreeIter i = _model->get_iter (path); + if (i) { + boost::shared_ptr region = (*i)[_columns.region]; + if (region) { + region->set_muted (!(*i)[_columns.muted]); + } + } + +} + +void +EditorRegions::opaque_changed (Glib::ustring const & path) +{ + TreeIter i = _model->get_iter (path); + if (i) { + boost::shared_ptr region = (*i)[_columns.region]; + if (region) { + region->set_opaque (!(*i)[_columns.opaque]); + } + } + +} diff --git a/gtk2_ardour/editor_regions.h b/gtk2_ardour/editor_regions.h index c9d5ddf6f5..d7f5d7490b 100644 --- a/gtk2_ardour/editor_regions.h +++ b/gtk2_ardour/editor_regions.h @@ -109,6 +109,10 @@ private: bool set_selected_in_subrow (boost::shared_ptr, Gtk::TreeModel::Row const &, int); bool selection_filter (const Glib::RefPtr& model, const Gtk::TreeModel::Path& path, bool yn); void name_edit (const Glib::ustring&, const Glib::ustring&); + void locked_changed (Glib::ustring const &); + void glued_changed (Glib::ustring const &); + void muted_changed (Glib::ustring const &); + void opaque_changed (Glib::ustring const &); bool key_press (GdkEventKey *); bool button_press (GdkEventButton *);