quick checks on empty control lists, to avoid unnecessary work
[ardour.git] / gtk2_ardour / editor_snapshots.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 <gtkmm/widget.h>
21 #include <gtkmm/scrolledwindow.h>
22 #include <gtkmm/treemodel.h>
23 #include <gtkmm/treeview.h>
24 #include "editor_component.h"
25
26 class EditorSnapshots : public EditorComponent, public ARDOUR::SessionHandlePtr
27 {
28 public:
29         EditorSnapshots (Editor *);
30
31         void set_session (ARDOUR::Session *);
32
33         Gtk::Widget& widget () {
34                 return _scroller;
35         }
36
37         void redisplay ();
38
39 private:
40
41         Gtk::ScrolledWindow _scroller;
42
43         struct Columns : public Gtk::TreeModel::ColumnRecord {
44                 Columns () {
45                         add (visible_name);
46                         add (real_name);
47                         add (time_formatted);
48                 }
49                 Gtk::TreeModelColumn<std::string> visible_name;
50                 Gtk::TreeModelColumn<std::string> real_name;
51                 Gtk::TreeModelColumn<std::string> time_formatted;
52         };
53
54         Columns _columns;
55         Glib::RefPtr<Gtk::ListStore> _model;
56         Gtk::TreeView _display;
57         Gtk::Menu _menu;
58
59         bool button_press (GdkEventButton *);
60         void selection_changed ();
61         void popup_context_menu (int, int32_t, std::string);
62         void remove (std::string);
63         void rename (std::string);
64 };