the "final" (??) fixes for transport state stuff before 2.8.4. y'all let me know...
[ardour.git] / gtk2_ardour / editor_edit_groups.cc
index 8df76fef258ca5c18c592a01efa1603e4d50a163..3383e6bfe93d8095848d02aa43fafea2dff8697f 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #include <cstdlib>
@@ -53,6 +52,9 @@ Editor::build_edit_group_list_menu ()
        items.push_back (MenuElem (_("Activate All"), mem_fun(*this, &Editor::activate_all_edit_groups)));
        items.push_back (MenuElem (_("Disable All"), mem_fun(*this, &Editor::disable_all_edit_groups)));
        items.push_back (SeparatorElem());
+       items.push_back (MenuElem (_("Show All"), mem_fun(*this, &Editor::show_all_edit_groups)));
+       items.push_back (MenuElem (_("Hide All"), mem_fun(*this, &Editor::hide_all_edit_groups)));
+       items.push_back (SeparatorElem());
        items.push_back (MenuElem (_("Add group"), mem_fun(*this, &Editor::new_edit_group)));
        
 }
@@ -75,6 +77,24 @@ Editor::disable_all_edit_groups ()
        }
 }
 
+void
+Editor::show_all_edit_groups ()
+{
+        Gtk::TreeModel::Children children = group_model->children();
+       for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
+               (*iter)[group_columns.is_visible] = true;
+       }
+}
+
+void
+Editor::hide_all_edit_groups ()
+{
+        Gtk::TreeModel::Children children = group_model->children();
+       for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
+               (*iter)[group_columns.is_visible] = false;
+       }
+}
+
 void
 Editor::new_edit_group ()
 {
@@ -119,7 +139,7 @@ Editor::edit_group_list_button_press_event (GdkEventButton* ev)
                if (edit_group_list_menu == 0) {
                        build_edit_group_list_menu ();
                }
-               edit_group_list_menu->popup (1, 0);
+               edit_group_list_menu->popup (1, ev->time);
                return true;
        }
 
@@ -141,6 +161,9 @@ Editor::edit_group_list_button_press_event (GdkEventButton* ev)
                        if ((iter = group_model->get_iter (path))) {
                                if ((group = (*iter)[group_columns.routegroup]) != 0) {
                                        // edit_route_group (group);
+#ifdef GTKOSX
+                                       edit_group_display.queue_draw();
+#endif
                                        return true;
                                }
                        }
@@ -152,6 +175,9 @@ Editor::edit_group_list_button_press_event (GdkEventButton* ev)
                if ((iter = group_model->get_iter (path))) {
                        bool active = (*iter)[group_columns.is_active];
                        (*iter)[group_columns.is_active] = !active;
+#ifdef GTKOSX
+                       edit_group_display.queue_draw();
+#endif
                        return true;
                }
                break;
@@ -160,6 +186,9 @@ Editor::edit_group_list_button_press_event (GdkEventButton* ev)
                if ((iter = group_model->get_iter (path))) {
                        bool visible = (*iter)[group_columns.is_visible];
                        (*iter)[group_columns.is_visible] = !visible;
+#ifdef GTKOSX
+                       edit_group_display.queue_draw();
+#endif
                        return true;
                }
                break;
@@ -200,7 +229,9 @@ Editor::edit_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeM
 
        bool active = (*iter)[group_columns.is_active];
        group->set_active (active, this);
-
+       
+       bool visible = (*iter)[group_columns.is_visible];
+       group->set_hidden (!visible, this);
 
        string name = (*iter)[group_columns.text];
 
@@ -250,15 +281,6 @@ Editor::edit_groups_changed ()
 
        group_model->clear ();
 
-       {
-               TreeModel::Row row;
-               row = *(group_model->append());
-               row[group_columns.is_active] = false;
-               row[group_columns.is_visible] = true;
-               row[group_columns.text] = (_("-all-"));
-               row[group_columns.routegroup] = 0;
-       }
-
        session->foreach_edit_group (mem_fun (*this, &Editor::add_edit_group));
 }