b1b82fb531952592e7760aebec3a6774bf2431f4
[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
23 {
24 public:
25         EditorRouteGroups (Editor *);
26
27         void connect_to_session (ARDOUR::Session *);
28
29         Gtk::Widget& widget () {
30                 return *_display_packer;
31         }
32
33         Gtk::Menu* menu (ARDOUR::RouteGroup *);
34
35         void clear ();
36         ARDOUR::RouteGroup* new_route_group () const;
37
38 private:
39
40         struct Columns : public Gtk::TreeModel::ColumnRecord {
41
42                 Columns () {
43                         add (is_visible);
44                         add (gain);
45                         add (record);
46                         add (mute);
47                         add (solo);
48                         add (select);
49                         add (edits);
50                         add (text);
51                         add (routegroup);
52                 }
53
54                 Gtk::TreeModelColumn<bool> is_visible;
55                 Gtk::TreeModelColumn<bool> gain;
56                 Gtk::TreeModelColumn<bool> record;
57                 Gtk::TreeModelColumn<bool> mute;
58                 Gtk::TreeModelColumn<bool> solo;
59                 Gtk::TreeModelColumn<bool> select;
60                 Gtk::TreeModelColumn<bool> edits;
61                 Gtk::TreeModelColumn<std::string> text;
62                 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
63         };
64
65         Columns _columns;
66
67         void activate_all ();
68         void disable_all ();
69         void subgroup (ARDOUR::RouteGroup *);
70         void unsubgroup (ARDOUR::RouteGroup *);
71         void collect (ARDOUR::RouteGroup *);
72
73         void row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
74         void name_edit (const Glib::ustring&, const Glib::ustring&);
75         void new_from_selection ();
76         void new_from_rec_enabled ();
77         void new_from_soloed ();
78         void edit (ARDOUR::RouteGroup *);
79         void button_clicked ();
80         gint button_press_event (GdkEventButton* ev);
81         void add (ARDOUR::RouteGroup* group);
82         void remove_route_group ();
83         void groups_changed ();
84         void flags_changed (void*, ARDOUR::RouteGroup*);
85         void set_activation (ARDOUR::RouteGroup *, bool);
86         void remove_selected ();
87         void run_new_group_dialog (const ARDOUR::RouteList&);
88
89         Gtk::Menu* _menu;
90         Glib::RefPtr<Gtk::ListStore> _model;
91         Glib::RefPtr<Gtk::TreeSelection> _selection;
92         Gtk::TreeView _display;
93         Gtk::ScrolledWindow _scroller;
94         Gtk::VBox* _display_packer;
95         bool _in_row_change;
96 };
97
98