Re-order route group editor list columns to match up with the order in the route...
[ardour.git] / gtk2_ardour / editor_route_groups.h
1 /*
2     Copyright (C) 2000-2009 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "editor_component.h"
21
22 class EditorRouteGroups : public EditorComponent, public ARDOUR::SessionHandlePtr
23 {
24 public:
25         EditorRouteGroups (Editor *);
26
27         void set_session (ARDOUR::Session *);
28
29         Gtk::Widget& widget () {
30                 return _display_packer;
31         }
32
33         void clear ();
34         Gtk::ToggleButton& all_group_active_button() { return _all_group_active_button; }
35
36 private:
37
38         struct Columns : public Gtk::TreeModel::ColumnRecord {
39
40                 Columns () {
41                         add (text);
42                         add (gain);
43                         add (gain_relative);
44                         add (mute);
45                         add (solo);
46                         add (record);
47                         add (select);
48                         add (edits);
49                         add (active_state);
50                         add (is_visible);
51                         add (routegroup);
52                 }
53
54                 Gtk::TreeModelColumn<std::string> text;
55                 Gtk::TreeModelColumn<bool> gain;
56                 Gtk::TreeModelColumn<bool> gain_relative;
57                 Gtk::TreeModelColumn<bool> mute;
58                 Gtk::TreeModelColumn<bool> solo;
59                 Gtk::TreeModelColumn<bool> record;
60                 Gtk::TreeModelColumn<bool> select;
61                 Gtk::TreeModelColumn<bool> edits;
62                 Gtk::TreeModelColumn<bool> active_state;
63                 Gtk::TreeModelColumn<bool> is_visible;
64                 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
65         };
66
67         Columns _columns;
68
69         void add (ARDOUR::RouteGroup *);
70         void row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
71         void name_edit (const std::string&, const std::string&);
72         void button_clicked ();
73         gint button_press_event (GdkEventButton* ev);
74         void groups_changed ();
75         void property_changed (ARDOUR::RouteGroup*, const PBD::PropertyChange &);
76         void remove_selected ();
77         void run_new_group_dialog ();
78         void all_group_toggled();
79         void all_group_changed (const PBD::PropertyChange&);
80         void row_deleted (Gtk::TreeModel::Path const &);
81
82         Glib::RefPtr<Gtk::ListStore> _model;
83         Glib::RefPtr<Gtk::TreeSelection> _selection;
84         Gtk::TreeView _display;
85         Gtk::ScrolledWindow _scroller;
86         Gtk::VBox _display_packer;
87         Gtk::ToggleButton _all_group_active_button;
88         bool _in_row_change;
89         bool _in_rebuild;
90         PBD::ScopedConnectionList _property_changed_connections;
91         PBD::ScopedConnection all_route_groups_changed_connection;
92 };
93
94