Update GPL boilerplate and (C)
[ardour.git] / gtk2_ardour / region_layering_order_editor.h
1 /*
2  * Copyright (C) 2010-2012 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2010-2017 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2011 David Robillard <d@drobilla.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef __gtk2_ardour_region_layering_order_editor_h__
22 #define __gtk2_ardour_region_layering_order_editor_h__
23
24 #include <gtkmm/dialog.h>
25 #include <gtkmm/liststore.h>
26 #include <gtkmm/treeview.h>
27 #include <gtkmm/scrolledwindow.h>
28
29 #include "ardour/region.h"
30 #include "ardour/playlist.h"
31
32 #include "ardour_window.h"
33 #include "audio_clock.h"
34
35 class PublicEditor;
36
37 namespace ARDOUR {
38         class Session;
39 }
40
41 class RegionLayeringOrderEditor : public ArdourWindow
42 {
43 public:
44         RegionLayeringOrderEditor (PublicEditor&);
45         virtual ~RegionLayeringOrderEditor ();
46
47         void set_context (const std::string &, ARDOUR::Session *, TimeAxisView *, boost::shared_ptr<ARDOUR::Playlist>, ARDOUR::samplepos_t);
48         void maybe_present ();
49
50 protected:
51         virtual bool on_key_press_event (GdkEventKey* event);
52
53 private:
54         samplepos_t position;
55         bool in_row_change;
56         uint32_t regions_at_position;
57
58         PBD::ScopedConnection playlist_modified_connection;
59
60         struct LayeringOrderColumns : public Gtk::TreeModel::ColumnRecord {
61                 LayeringOrderColumns () {
62                         add (name);
63                         add (region_view);
64                 }
65                 Gtk::TreeModelColumn<std::string> name;
66                 Gtk::TreeModelColumn<RegionView *> region_view;
67         };
68         LayeringOrderColumns layering_order_columns;
69         Glib::RefPtr<Gtk::ListStore> layering_order_model;
70         Gtk::TreeView layering_order_display;
71         AudioClock clock;
72         Gtk::Label track_label;
73         Gtk::Label track_name_label;
74         Gtk::Label clock_label;
75         Gtk::ScrolledWindow scroller;   // Available layers
76         PublicEditor& editor;
77         TimeAxisView* _time_axis_view;
78
79         void row_selected ();
80         void refill ();
81         void playlist_modified ();
82 };
83
84 #endif /* __gtk2_ardour_region_layering_order_editor_h__ */