402f8e2aed5f9644837179456fdb0af75dbdc3ce
[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
35 private:
36
37         struct Columns : public Gtk::TreeModel::ColumnRecord {
38
39                 Columns () {
40                         add (is_visible);
41                         add (gain);
42                         add (record);
43                         add (mute);
44                         add (solo);
45                         add (select);
46                         add (edits);
47                         add (text);
48                         add (routegroup);
49                 }
50
51                 Gtk::TreeModelColumn<bool> is_visible;
52                 Gtk::TreeModelColumn<bool> gain;
53                 Gtk::TreeModelColumn<bool> record;
54                 Gtk::TreeModelColumn<bool> mute;
55                 Gtk::TreeModelColumn<bool> solo;
56                 Gtk::TreeModelColumn<bool> select;
57                 Gtk::TreeModelColumn<bool> edits;
58                 Gtk::TreeModelColumn<std::string> text;
59                 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
60         };
61
62         Columns _columns;
63
64         void add (ARDOUR::RouteGroup *);
65         void row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
66         void name_edit (const Glib::ustring&, const Glib::ustring&);
67         void button_clicked ();
68         gint button_press_event (GdkEventButton* ev);
69         void groups_changed ();
70         void property_changed (ARDOUR::RouteGroup*, const PBD::PropertyChange &);
71         void remove_selected ();
72         void run_new_group_dialog ();
73
74         Glib::RefPtr<Gtk::ListStore> _model;
75         Glib::RefPtr<Gtk::TreeSelection> _selection;
76         Gtk::TreeView _display;
77         Gtk::ScrolledWindow _scroller;
78         Gtk::VBox* _display_packer;
79         bool _in_row_change;
80         PBD::ScopedConnection property_changed_connection;
81 };
82
83