rationalize MVC and functionality in editor route group list
[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 "gtkmm2ext/stateful_button.h"
21 #include "editor_component.h"
22
23 class EditorRouteGroups : public EditorComponent, public ARDOUR::SessionHandlePtr
24 {
25 public:
26         EditorRouteGroups (Editor *);
27
28         void set_session (ARDOUR::Session *);
29
30         Gtk::Widget& widget () {
31                 return _display_packer;
32         }
33
34         void clear ();
35         Gtkmm2ext::StatefulToggleButton& all_group_active_button() { return _all_group_active_button; }
36
37 private:
38
39         struct Columns : public Gtk::TreeModel::ColumnRecord {
40
41                 Columns () {
42                         add (gdkcolor);
43                         add (text);
44                         add (is_visible);
45                         add (gain);
46                         add (gain_relative);
47                         add (mute);
48                         add (solo);
49                         add (record);
50                         add (monitoring);
51                         add (select);
52                         add (edits);
53                         add (active_state);
54                         add (routegroup);
55                 }
56
57                 Gtk::TreeModelColumn<Gdk::Color> gdkcolor;
58                 Gtk::TreeModelColumn<std::string> text;
59                 Gtk::TreeModelColumn<bool> is_visible;
60                 Gtk::TreeModelColumn<bool> gain;
61                 Gtk::TreeModelColumn<bool> gain_relative;
62                 Gtk::TreeModelColumn<bool> mute;
63                 Gtk::TreeModelColumn<bool> solo;
64                 Gtk::TreeModelColumn<bool> record;
65                 Gtk::TreeModelColumn<bool> monitoring;
66                 Gtk::TreeModelColumn<bool> select;
67                 Gtk::TreeModelColumn<bool> edits;
68                 Gtk::TreeModelColumn<bool> active_state;
69                 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
70         };
71
72         Columns _columns;
73
74         void add (ARDOUR::RouteGroup *);
75         void row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
76         void name_edit (const std::string&, const std::string&);
77         void button_clicked ();
78         bool button_press_event (GdkEventButton* ev);
79         void groups_changed ();
80         void property_changed (ARDOUR::RouteGroup*, const PBD::PropertyChange &);
81         void remove_selected ();
82         void run_new_group_dialog ();
83         void all_group_toggled();
84         void all_group_changed (const PBD::PropertyChange&);
85         void row_deleted (Gtk::TreeModel::Path const &);
86
87         Glib::RefPtr<Gtk::ListStore> _model;
88         Glib::RefPtr<Gtk::TreeSelection> _selection;
89         Gtk::TreeView _display;
90         Gtk::ScrolledWindow _scroller;
91         Gtk::VBox _display_packer;
92         Gtkmm2ext::StatefulToggleButton _all_group_active_button;
93         bool _in_row_change;
94         bool _in_rebuild;
95         PBD::ScopedConnectionList _property_changed_connections;
96         PBD::ScopedConnection all_route_groups_changed_connection;
97         Gtk::ColorSelectionDialog color_dialog;
98 };
99
100