more tweaks/fixes for region layer editor
[ardour.git] / gtk2_ardour / region_layering_order_editor.h
1 #ifndef __gtk2_ardour_region_layering_order_editor_h__
2 #define __gtk2_ardour_region_layering_order_editor_h__
3
4 #include <gtkmm/dialog.h>
5 #include <gtkmm/liststore.h>
6 #include <gtkmm/treeview.h>
7 #include <gtkmm/scrolledwindow.h>
8
9 #include <ardour/region.h>
10 #include <ardour/playlist.h>
11
12 #include "ardour_dialog.h"
13 #include "audio_clock.h"
14
15 class PublicEditor;
16
17 namespace ARDOUR {
18         class Session;
19 }
20
21 class RegionLayeringOrderEditor : public ArdourDialog
22 {
23   public:
24         RegionLayeringOrderEditor (PublicEditor&);
25         virtual ~RegionLayeringOrderEditor ();
26         
27         void set_context(const std::string& name, ARDOUR::Session* s, const boost::shared_ptr<ARDOUR::Playlist>  & pl, nframes64_t position);
28         void maybe_present ();
29         
30   protected:
31         virtual bool on_key_press_event (GdkEventKey* event);
32
33   private:
34         boost::shared_ptr<ARDOUR::Playlist> playlist;
35         nframes64_t position;
36         bool in_row_change;
37         uint32_t regions_at_position;
38         
39         sigc::connection playlist_modified_connection;
40
41         struct LayeringOrderColumns : public Gtk::TreeModel::ColumnRecord {
42                 LayeringOrderColumns () {
43                         add (name);
44                         add (region);
45                 }
46                 Gtk::TreeModelColumn<std::string> name;
47                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
48         };
49         LayeringOrderColumns layering_order_columns;
50         Glib::RefPtr<Gtk::ListStore> layering_order_model;
51         Gtk::TreeView layering_order_display;
52         AudioClock clock;
53         Gtk::Label track_label;
54         Gtk::Label track_name_label;
55         Gtk::Label clock_label;
56         Gtk::ScrolledWindow scroller;   // Available layers
57         PublicEditor& editor;
58
59         void row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
60         void refill ();
61         void playlist_modified ();
62 };
63
64 #endif /* __gtk2_ardour_region_layering_order_editor_h__ */