Make the L,G,M and O buttons in the region list respond to clicks. Fixes #3252.
authorCarl Hetherington <carl@carlh.net>
Mon, 28 Jun 2010 00:41:01 +0000 (00:41 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 28 Jun 2010 00:41:01 +0000 (00:41 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7307 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_regions.cc
gtk2_ardour/editor_regions.h

index 58a6a0e1298d33019557f8e7f06e942c7aa6acab..e2a97c791ed5aa8fff33f79473d9ddf01521c2c9 100644 (file)
@@ -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<CellRendererToggle*> (_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<CellRendererToggle*> (_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<CellRendererToggle*> (_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<CellRendererToggle*> (_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<Region> 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<ARDOUR::Region> 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<ARDOUR::Region> 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<ARDOUR::Region> 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<ARDOUR::Region> region = (*i)[_columns.region];
+               if (region) {
+                       region->set_opaque (!(*i)[_columns.opaque]);
+               }
+       }
+
+}
index c9d5ddf6f592787b9aae7a0b30a8fc84e6c783b1..d7f5d7490bb7a66973ef06c6e33ca6ffc1940bde 100644 (file)
@@ -109,6 +109,10 @@ private:
        bool set_selected_in_subrow (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
        bool selection_filter (const Glib::RefPtr<Gtk::TreeModel>& 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 *);