a metric ton of changes
[ardour.git] / gtk2_ardour / editor.h
index 11fefa96c9f3783a03bd37509350ce6382f7489f..349781c4062841c44ff68a457cc9ef76b16b5a16 100644 (file)
 #include <string>
 #include <sys/time.h>
 
+#include <libgnomecanvasmm/canvas.h>
+#include <libgnomecanvasmm/group.h>
+#include <libgnomecanvasmm/line.h>
+
 #include <cmath>
 
 #include <sndfile.h>
 
-#include <gtkmm.h>
 #include <gtkmm/layout.h>
 #include <gtkmm/comboboxtext.h>
-#include <libgnomecanvas/libgnomecanvas.h>
-#include <libgnomecanvas/gnome-canvas-util.h>
+
 #include <gtkmm2ext/selector.h>
 #include <gtkmm2ext/click_box.h>
+#include <gtkmm2ext/dndtreeview.h>
 
 #include <ardour/stateful.h>
 #include <ardour/session.h>
@@ -45,7 +48,6 @@
 #include <ardour/location.h>
 #include <ardour/region.h>
 
-#include "keyboard_target.h"
 #include "audio_clock.h"
 #include "gtk-custom-ruler.h"
 #include "ardour_dialog.h"
@@ -53,6 +55,7 @@
 #include "editing.h"
 #include "enums.h"
 #include "region_selection.h"
+#include "canvas.h"
 
 namespace Gtkmm2ext {
        class TearOff;
@@ -97,7 +100,6 @@ class TimeSelection;
 class TrackSelection;
 class AutomationSelection;
 class MixerStrip;
-class SoundFileSelector;
 class StreamView;
 class ControlPoint;
 
@@ -140,11 +142,11 @@ class Editor : public PublicEditor
        void step_mouse_mode (bool next);
        Editing::MouseMode current_mouse_mode () { return mouse_mode; }
 
-       void add_imageframe_time_axis(std::string track_name, void*) ;
-       void add_imageframe_marker_time_axis(std::string track_name, TimeAxisView* marked_track, void*) ;
+       void add_imageframe_time_axis(const string & track_name, void*) ;
+       void add_imageframe_marker_time_axis(const string & track_name, TimeAxisView* marked_track, void*) ;
        void connect_to_image_compositor() ;
        void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
-       TimeAxisView* get_named_time_axis(std::string name) ;
+       TimeAxisView* get_named_time_axis(const string & name) ;
        /* </CMT Additions> */
 
        void consider_auditioning (ARDOUR::Region&);
@@ -197,14 +199,14 @@ class Editor : public PublicEditor
                */
 
                if (pixel >= 0) {
-                       return (jack_nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_gnome_canvas.gobj())->pixels_per_unit);
+                       return (jack_nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
                } else {
                        return 0;
                }
        }
 
        gulong frame_to_pixel (jack_nframes_t frame) {
-               return (gulong) rint ((frame / (frames_per_unit *  GNOME_CANVAS(track_gnome_canvas.gobj())->pixels_per_unit)));
+               return (gulong) rint ((frame / (frames_per_unit *  GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
        }
 
        /* selection */
@@ -258,7 +260,7 @@ class Editor : public PublicEditor
        void show_editor_mixer (bool yn);
        void set_selected_mixer_strip (TimeAxisView&);
        void unselect_strip_in_display (TimeAxisView& tv);
-       void select_strip_in_display (TimeAxisView& tv);
+       void select_strip_in_display (TimeAxisView* tv);
 
        /* nudge is initiated by transport controls owned by ARDOUR_UI */
 
@@ -276,6 +278,13 @@ class Editor : public PublicEditor
        void toggle_follow_playhead ();
        bool follow_playhead() const { return _follow_playhead; }
 
+       void toggle_waveform_visibility ();
+       void toggle_waveforms_while_recording ();
+       void toggle_measure_visibility ();
+
+       void set_meter_falloff (float);
+       void set_meter_hold (int32_t);
+
        /* xfades */
 
        void toggle_xfades_active();
@@ -306,7 +315,6 @@ class Editor : public PublicEditor
        void map_position_change (jack_nframes_t);
 
        void on_realize();
-       void on_map ();
 
   private:
        
@@ -372,10 +380,10 @@ class Editor : public PublicEditor
        Editing::MouseMode mouse_mode;
        void      mouse_insert (GdkEventButton *);
 
-       void pane_allocation_handler (GtkAllocation*, Gtk::Paned*);
+       void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
 
-       Gtk::HPaned   canvas_region_list_pane;
-       Gtk::HPaned   track_list_canvas_pane;
+       Gtk::Notebook the_notebook;
+       Gtk::HPaned   edit_pane;
 
        Gtk::EventBox meter_base;
        Gtk::HBox     meter_box;
@@ -390,7 +398,7 @@ class Editor : public PublicEditor
        void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
        void add_new_location (ARDOUR::Location *);
        void location_gone (ARDOUR::Location *);
-       void remove_marker (Gnome::Canvas::Polygon&, GdkEvent*);
+       void remove_marker (ArdourCanvas::Item&, GdkEvent*);
        gint really_remove_marker (ARDOUR::Location* loc);
 
        uint32_t location_marker_color;
@@ -418,7 +426,7 @@ class Editor : public PublicEditor
        typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
        LocationMarkerMap location_markers;
 
-       void hide_marker (GnomeCanvasItem*, GdkEvent*);
+       void hide_marker (ArdourCanvas::Item*, GdkEvent*);
        void clear_marker_display ();
        void mouse_add_new_marker (jack_nframes_t where);
 
@@ -435,7 +443,7 @@ class Editor : public PublicEditor
        void set_selected_track_from_click (bool add = false, bool with_undo = true, bool no_remove=false);
        void set_selected_regionview_from_click (bool add = false, bool no_track_remove=false);
        void set_selected_regionview_from_region_list (ARDOUR::Region& region, bool add = false);
-       gint set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
+       bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
        void collect_new_region_view (AudioRegionView *);
 
        Gtk::Menu track_context_menu;
@@ -470,22 +478,23 @@ class Editor : public PublicEditor
        Gtk::VBox           global_vpacker;
        Gtk::VBox           vpacker;
 
-       GdkCursor          *current_canvas_cursor;
+       Gdk::Cursor*          current_canvas_cursor;
 
-       Gnome::CanvasAA track_canvas;
-       Gnome::CanvasAA time_canvas;
+       ArdourCanvas::CanvasAA track_canvas;
+       ArdourCanvas::CanvasAA time_canvas;
 
-       Gnome::Canvas::Text* first_action_message;
-       Gnome::Canvas::Text* verbose_canvas_cursor;
+       ArdourCanvas::Text* first_action_message;
+       ArdourCanvas::Text* verbose_canvas_cursor;
        bool                 verbose_cursor_visible;
 
        void session_control_changed (ARDOUR::Session::ControlType);
        void queue_session_control_changed (ARDOUR::Session::ControlType);
 
        
-       gint track_canvas_motion (GdkEvent*);
-       void set_verbose_canvas_cursor (string, double x, double y);
-       void set_verbose_canvas_cursor_text (string);
+       bool track_canvas_motion (GdkEvent*);
+
+       void set_verbose_canvas_cursor (const string &, double x, double y);
+       void set_verbose_canvas_cursor_text (const string &);
        void show_verbose_canvas_cursor();
        void hide_verbose_canvas_cursor();
 
@@ -498,15 +507,15 @@ class Editor : public PublicEditor
        Gtk::EventBox      track_canvas_event_box;
        Gtk::EventBox      time_button_event_box;
 
-       Gnome::Canvas::Group      *minsec_group;
-       Gnome::Canvas::Group      *bbt_group;
-       Gnome::Canvas::Group      *smpte_group;
-       Gnome::Canvas::Group      *frame_group;
-       Gnome::Canvas::Group      *tempo_group;
-       Gnome::Canvas::Group      *meter_group;
-       Gnome::Canvas::Group      *marker_group;
-       Gnome::Canvas::Group      *range_marker_group;
-       Gnome::Canvas::Group      *transport_marker_group;
+       ArdourCanvas::Group      *minsec_group;
+       ArdourCanvas::Group      *bbt_group;
+       ArdourCanvas::Group      *smpte_group;
+       ArdourCanvas::Group      *frame_group;
+       ArdourCanvas::Group      *tempo_group;
+       ArdourCanvas::Group      *meter_group;
+       ArdourCanvas::Group      *marker_group;
+       ArdourCanvas::Group      *range_marker_group;
+       ArdourCanvas::Group      *transport_marker_group;
        
        enum {
                ruler_metric_smpte = 0,
@@ -543,15 +552,15 @@ class Editor : public PublicEditor
        void store_ruler_visibility ();
        void restore_ruler_visibility ();
        
-       static gint _metric_get_smpte (GtkCustomRulerMark **, gulong, gulong, gint);
-       static gint _metric_get_bbt (GtkCustomRulerMark **, gulong, gulong, gint);
-       static gint _metric_get_frames (GtkCustomRulerMark **, gulong, gulong, gint);
-       static gint _metric_get_minsec (GtkCustomRulerMark **, gulong, gulong, gint);
+       static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
+       static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
+       static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
+       static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
        
-       gint metric_get_smpte (GtkCustomRulerMark **, gulong, gulong, gint);
-       gint metric_get_bbt (GtkCustomRulerMark **, gulong, gulong, gint);
-       gint metric_get_frames (GtkCustomRulerMark **, gulong, gulong, gint);
-       gint metric_get_minsec (GtkCustomRulerMark **, gulong, gulong, gint);
+       gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
+       gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
+       gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
+       gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
 
        GtkWidget          *_smpte_ruler;
        GtkWidget          *_bbt_ruler;
@@ -567,24 +576,18 @@ class Editor : public PublicEditor
        guint32 visible_timebars;
        Gtk::Menu          *editor_ruler_menu;
        
-       Gnome::Canvas::SimpleRect* tempo_bar;
-       Gnome::Canvas::SimpleRect* meter_bar;
-       Gnome::Canvas::SimpleRect* marker_bar;
-       Gnome::Canvas::SimpleRect* range_marker_bar;
-       Gnome::Canvas::SimpleRect* transport_marker_bar;
+       ArdourCanvas::SimpleRect* tempo_bar;
+       ArdourCanvas::SimpleRect* meter_bar;
+       ArdourCanvas::SimpleRect* marker_bar;
+       ArdourCanvas::SimpleRect* range_marker_bar;
+       ArdourCanvas::SimpleRect* transport_marker_bar;
 
        
-       Gnome::Canvas::Line* tempo_line;
-       Gnome::Canvas::Line* meter_line;
-       Gnome::Canvas::Line* marker_line;
-       Gnome::Canvas::Line* range_marker_line;
-       Gnome::Canvas::Line* transport_marker_line;
-
-       Gnome::Canvas::Points* tempo_line_points;
-       Gnome::Canvas::Points* meter_line_points;
-       Gnome::Canvas::Points* marker_line_points;
-       Gnome::Canvas::Points* range_marker_line_points;
-       Gnome::Canvas::Points* transport_marker_line_points;
+       ArdourCanvas::SimpleLine* tempo_line;
+       ArdourCanvas::SimpleLine* meter_line;
+       ArdourCanvas::SimpleLine* marker_line;
+       ArdourCanvas::SimpleLine* range_marker_line;
+       ArdourCanvas::SimpleLine* transport_marker_line;
 
        Gtk::Label  minsec_label;
        Gtk::Label  bbt_label;
@@ -601,19 +604,18 @@ class Editor : public PublicEditor
        Gtk::HBox          time_button_hbox;
 
        struct Cursor {
-           Editor&             editor;
-           Gnome::Canvas::Points* points;
-           Gnome::Canvas::Item*   canvas_item;
-           jack_nframes_t      current_frame;
-           GtkSignalFunc       callback;
-               double                          length;
-
-           Cursor (Editor&, const string& color, GtkSignalFunc callback);
+           Editor&               editor;
+           ArdourCanvas::Points  points;
+           ArdourCanvas::Line    canvas_item;
+           jack_nframes_t        current_frame;
+           double                length;
+
+           Cursor (Editor&, const string& color, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
            ~Cursor ();
 
            void set_position (jack_nframes_t);
            void set_length (double units);
-               void set_y_axis (double position);
+           void set_y_axis (double position);
        };
 
        friend struct Cursor; /* it needs access to several private
@@ -622,7 +624,7 @@ class Editor : public PublicEditor
 
        Cursor* playhead_cursor;
        Cursor* edit_cursor;
-       Gnome::Canvas::Group* cursor_group;
+       ArdourCanvas::Group* cursor_group;
 
        void    cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
        void    cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
@@ -644,48 +646,24 @@ class Editor : public PublicEditor
        Gtk::Frame          edit_frame;
        Gtk::VScrollbar     edit_vscrollbar;
 
-       /* the horizontal scroller works in a rather different way
-          than a regular scrollbar, since its used for
-          zoom control/indication as well. But more importantly,
-          its different components (slider, left arrow, right arrow) 
-          have to be packed separately into the edit_packer.
-       */
+       Gtk::Adjustment     vertical_adjustment;
+       Gtk::Adjustment     horizontal_adjustment;
+
+       Gtk::Layout         controls_layout;
+       bool Editor::control_layout_scroll (GdkEventScroll* ev);
 
        Gtk::HScrollbar     edit_hscrollbar;
-       Gtk::DrawingArea    edit_hscroll_slider;
-       Gtk::Arrow          edit_hscroll_left_arrow;
-       Gtk::Arrow          edit_hscroll_right_arrow;
-       Gtk::EventBox       edit_hscroll_left_arrow_event;
-       Gtk::EventBox       edit_hscroll_right_arrow_event;
-       gint                edit_hscroll_slider_width;
-       gint                edit_hscroll_slider_height;
-       static const gint   edit_hscroll_edge_width = 3;
        bool                edit_hscroll_dragging;
-       double              edit_hscroll_drag_last;
        
-       void hscroll_slider_allocate (GtkAllocation *);
-       gint hscroll_slider_expose (GdkEventExpose*);
-       gint hscroll_slider_button_press (GdkEventButton*);
-       gint hscroll_slider_button_release (GdkEventButton*);
-       gint hscroll_slider_motion (GdkEventMotion*);
-
-       gint hscroll_trough_expose (GdkEventExpose*);
-       gint hscroll_trough_button_press (GdkEventButton*);
-       gint hscroll_trough_button_release (GdkEventButton*);
-
-       void update_hscroller ();
-
-       gint hscroll_left_arrow_button_press (GdkEventButton *);
-       gint hscroll_left_arrow_button_release (GdkEventButton *);
-       gint hscroll_right_arrow_button_press (GdkEventButton *);
-       gint hscroll_right_arrow_button_release (GdkEventButton *);
-       
-       guint32             canvas_width;
-       guint32             canvas_height;
+       bool hscrollbar_button_press (GdkEventButton*);
+       bool hscrollbar_button_release (GdkEventButton*);
+       void hscrollbar_allocate (Gtk::Allocation &alloc);
+
+       double canvas_width;
+       double canvas_height;
 
-       Gtk::ScrolledWindow  track_canvas_scroller;
-       Gtk::ScrolledWindow  time_canvas_scroller;
-       Gtk::ScrolledWindow  edit_controls_scroller;
+       bool track_canvas_map_handler (GdkEventAny*);
+       bool time_canvas_map_handler (GdkEventAny*);
 
        gint edit_controls_button_release (GdkEventButton*);
        Gtk::Menu *edit_controls_left_menu;
@@ -712,18 +690,21 @@ class Editor : public PublicEditor
            RegionListDisplayModelColumns() {
                    add (name);
                    add (region);
+                   add (color_);
            }
            Gtk::TreeModelColumn<Glib::ustring> name;
            Gtk::TreeModelColumn<ARDOUR::Region*> region;
+               Gtk::TreeModelColumn<Gdk::Color> color_;
        };
            
        RegionListDisplayModelColumns    region_list_columns;
-       Gtk::TreeView                    region_list_display;
+       Gtkmm2ext::DnDTreeView           region_list_display;
        Glib::RefPtr<Gtk::TreeStore>     region_list_model;
-       Glib::RefPtr<Gtk::TreeModelSort> region_list_sort_model;
-       Glib::RefPtr<Gtk::Action>        toggle_full_region_list_action;
+       Glib::RefPtr<Gtk::ToggleAction>  toggle_full_region_list_action;
+       Glib::RefPtr<Gtk::ToggleAction>  toggle_show_auto_regions_action;
 
        void region_list_selection_changed ();
+       bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
 
        Gtk::Menu          *region_list_menu;
        Gtk::ScrolledWindow region_list_scroller;
@@ -733,17 +714,10 @@ class Editor : public PublicEditor
        bool region_list_display_key_release (GdkEventKey *);
        bool region_list_display_button_press (GdkEventButton *);
        bool region_list_display_button_release (GdkEventButton *);
-       bool region_list_display_enter_notify (GdkEventCrossing *);
-       bool region_list_display_leave_notify (GdkEventCrossing *);
        void region_list_clear ();
        void region_list_selection_mapover (sigc::slot<void,ARDOUR::Region&>);
        void build_region_list_menu ();
-
-       Gtk::CheckMenuItem* toggle_auto_regions_item;
-       Gtk::CheckMenuItem* toggle_full_region_list_item;
-
-       Gtk::MenuItem* import_audio_item;
-       Gtk::MenuItem* embed_audio_item;
+       void show_region_list_display_context_menu (int button, int time);
 
        bool show_automatic_regions_in_region_list;
        Editing::RegionListSortType region_list_sort_type;
@@ -756,15 +730,46 @@ class Editor : public PublicEditor
 
        int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
 
+       /* snapshots */
+
+       Gtk::ScrolledWindow      snapshot_display_scroller;
+       struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
+           SnapshotDisplayModelColumns() { 
+                   add (visible_name);
+                   add (real_name);
+           }
+           Gtk::TreeModelColumn<Glib::ustring> visible_name;
+           Gtk::TreeModelColumn<Glib::ustring> real_name;
+       };
+
+       SnapshotDisplayModelColumns snapshot_display_columns;
+       Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
+       Gtk::TreeView snapshot_display;
+
+       bool snapshot_display_button_press (GdkEventButton*);
+       void snapshot_display_selection_changed ();
+       void redisplay_snapshots();
+
        /* named selections */
 
-       Gtk::VPaned         region_selection_vpane;
-       Gtk::TreeView          named_selection_display;
-       Gtk::ScrolledWindow named_selection_scroller;
+       struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
+           NamedSelectionDisplayModelColumns() { 
+                   add (text);
+                   add (selection);
+           }
+           Gtk::TreeModelColumn<Glib::ustring>  text;
+           Gtk::TreeModelColumn<ARDOUR::NamedSelection*>    selection;
+       };
+
+       NamedSelectionDisplayModelColumns named_selection_columns;
+       Glib::RefPtr<Gtk::TreeStore>     named_selection_model;
+
+       Gtkmm2ext::DnDTreeView named_selection_display;
+       Gtk::ScrolledWindow    named_selection_scroller;
 
        void name_selection();
        void named_selection_name_chosen ();
-       void create_named_selection (string);
+       void create_named_selection (const string &);
        void paste_named_selection (float times);
 
        void handle_new_named_selection ();
@@ -772,25 +777,23 @@ class Editor : public PublicEditor
        void redisplay_named_selections ();
 
        gint named_selection_display_button_press (GdkEventButton *ev);
-       void named_selection_display_selected (gint row, gint col, GdkEvent *ev);
-       void named_selection_display_unselected (gint row, gint col, GdkEvent *ev);
+       void named_selection_display_selection_changed ();
 
        /* track views */
        int track_spacing;
        TrackViewList  track_views;
        TimeAxisView     *trackview_by_y_position (double ypos);
 
-       static GdkCursor* cross_hair_cursor;
-       static GdkCursor* trimmer_cursor;
-       static GdkCursor* selector_cursor;
-       static GdkCursor* grabber_cursor;
-       static GdkCursor* zoom_cursor;
-       static GdkCursor* time_fx_cursor;
-       static GdkCursor* fader_cursor;
-       static GdkCursor* speaker_cursor;
-       static GdkCursor* null_cursor;
-       static GdkCursor* wait_cursor;
-       static GdkCursor* timebar_cursor;
+       static Gdk::Cursor* cross_hair_cursor;
+       static Gdk::Cursor* trimmer_cursor;
+       static Gdk::Cursor* selector_cursor;
+       static Gdk::Cursor* grabber_cursor;
+       static Gdk::Cursor* zoom_cursor;
+       static Gdk::Cursor* time_fx_cursor;
+       static Gdk::Cursor* fader_cursor;
+       static Gdk::Cursor* speaker_cursor;
+       static Gdk::Cursor* wait_cursor;
+       static Gdk::Cursor* timebar_cursor;
 
        static void build_cursors ();
 
@@ -811,17 +814,16 @@ class Editor : public PublicEditor
        jack_nframes_t cut_buffer_start;
        jack_nframes_t cut_buffer_length;
 
-       gint typed_event (GnomeCanvasItem*, GdkEvent*, ItemType);
-       gint button_press_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
-       gint button_release_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
-       gint motion_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
-       gint enter_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
-       gint leave_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
+       bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        
        /* KEYMAP HANDLING */
 
        void register_actions ();
-       void install_keybindings ();
 
        int ensure_cursor (jack_nframes_t* pos);
 
@@ -919,25 +921,25 @@ class Editor : public PublicEditor
        void temporal_zoom_selection ();
        void temporal_zoom_session ();
        void temporal_zoom (gdouble scale);
-       void temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, string op);
+       void temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, const string & op);
        void temporal_zoom_to_frame (bool coarser, jack_nframes_t frame);
 
        void amplitude_zoom (gdouble scale);
        void amplitude_zoom_step (bool in);
 
-       void insert_region_list_drag (ARDOUR::AudioRegion&);
+       void insert_region_list_drag (ARDOUR::AudioRegion&, int x, int y);
        void insert_region_list_selection (float times);
 
        void insert_sndfile (bool as_tracks);
        void embed_audio ();    // inserts into region list
-       int  reject_because_rate_differs (string path, SF_INFO& finfo, string action, bool multiple_pending);
+       int  reject_because_rate_differs (const string & path, SF_INFO& finfo, const string & action, bool multiple_pending);
 
        void do_embed_sndfiles (vector<string> paths, bool split);
        void embed_sndfile (string path, bool split, bool multiple_files, bool& check_sr);
 
        void do_insert_sndfile (vector<string> path, bool multi, jack_nframes_t frame);
        void insert_paths_as_new_tracks (std::vector<std::string> paths, bool multi); // inserts files as new tracks
-       void insert_sndfile_into (string path, bool multi, AudioTimeAxisView* tv, jack_nframes_t& frame, bool prompt=true);
+       void insert_sndfile_into (const string & path, bool multi, AudioTimeAxisView* tv, jack_nframes_t& frame, bool prompt=true);
        static void* _insert_sndfile_thread (void*);
        void*  insert_sndfile_thread (void*);
 
@@ -1024,23 +1026,23 @@ class Editor : public PublicEditor
        Editing::SnapMode snap_mode;
        double snap_threshold;
 
-       void soundfile_chosen_for_insert (string selection, bool split_channels);
-       void soundfile_chosen_for_embed (string selection, bool split_channels);
-       void soundfile_chosen_for_import (string selection, bool split_channels);
+       void soundfile_chosen_for_insert (const string & selection, bool split_channels);
+       void soundfile_chosen_for_embed (const string & selection, bool split_channels);
+       void soundfile_chosen_for_import (const string & selection, bool split_channels);
 
-       void handle_gui_changes (string, void *);
+       void handle_gui_changes (const string &, void *);
 
        void    hide_all_tracks (bool with_select);
 
-       void route_list_selected (gint row, gint col, GdkEvent* ev);
-       void route_list_unselected (gint row, gint col, GdkEvent* ev);
+       void route_display_selection_changed ();
        void redisplay_route_list();
-       gint route_list_reordered ();
+       void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
        bool ignore_route_list_reorder;
-       void queue_route_list_reordered (gint row, gint col);
+       bool no_route_list_redisplay;
+       void queue_route_list_reordered ();
 
        struct DragInfo {
-           GnomeCanvasItem* item;
+         ArdourCanvas::Item* item;
            void* data;
            jack_nframes_t last_frame_position;
            int32_t pointer_frame_offset;
@@ -1052,8 +1054,8 @@ class Editor : public PublicEditor
            double cumulative_y_drag;
            double current_pointer_x;
            double current_pointer_y;
-           void (Editor::*motion_callback)(GnomeCanvasItem*, GdkEvent*);
-           void (Editor::*finished_callback)(GnomeCanvasItem*, GdkEvent*);
+         void (Editor::*motion_callback)(ArdourCanvas::Item*, GdkEvent*);
+         void (Editor::*finished_callback)(ArdourCanvas::Item*, GdkEvent*);
            TimeAxisView* last_trackview;
            bool x_constrained;
            bool copy;
@@ -1072,57 +1074,57 @@ class Editor : public PublicEditor
 
        LineDragInfo current_line_drag_info;
 
-       void start_grab (GdkEvent*, GdkCursor* cursor = 0);
-       bool end_grab (GnomeCanvasItem*, GdkEvent*);
+       void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
+       bool end_grab (ArdourCanvas::Item*, GdkEvent*);
 
        Gtk::Menu fade_context_menu;
-       void popup_fade_context_menu (int, int, GnomeCanvasItem*, ItemType);
-
-       void start_fade_in_grab (GnomeCanvasItem*, GdkEvent*);
-       void start_fade_out_grab (GnomeCanvasItem*, GdkEvent*);
-       void fade_in_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
-       void fade_out_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
-       void fade_in_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
-       void fade_out_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
+       void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
+
+       void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
+       void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+       void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+       void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+       void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
        
        std::set<ARDOUR::Playlist*> motion_frozen_playlists;
-       void region_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
-       void region_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
-       void region_copy_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
-
-       void cursor_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
-       void cursor_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
-       void marker_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
-       void marker_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
-       void control_point_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
-       void control_point_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
-       void line_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
-       void line_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
-
-       void tempo_marker_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
-       void tempo_marker_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
-       void meter_marker_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
-       void meter_marker_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
-
-       gint mouse_rename_region (GnomeCanvasItem*, GdkEvent*);
-
-       void start_region_grab (GnomeCanvasItem*, GdkEvent*);
-       void start_region_copy_grab (GnomeCanvasItem*, GdkEvent*);
-       void start_region_brush_grab (GnomeCanvasItem*, GdkEvent*);
-       void start_selection_grab (GnomeCanvasItem*, GdkEvent*);
-       void start_cursor_grab (GnomeCanvasItem*, GdkEvent*);
-       void start_marker_grab (GnomeCanvasItem*, GdkEvent*);
-       void start_control_point_grab (GnomeCanvasItem*, GdkEvent*);
-       void start_line_grab_from_regionview (GnomeCanvasItem*, GdkEvent*);
-       void start_line_grab_from_line (GnomeCanvasItem*, GdkEvent*);
+       void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+       void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+       void region_copy_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+
+       void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+       void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+       void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+       void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+       void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+       void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+       void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+       void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+
+       void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+       void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+       void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+       void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+
+       gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
+
+       void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
+       void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
        void start_line_grab (AutomationLine *, GdkEvent*);
-       void start_tempo_marker_grab (GnomeCanvasItem*, GdkEvent*);
-       void start_meter_marker_grab (GnomeCanvasItem*, GdkEvent*);
+       void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
 
        void region_view_item_click (AudioRegionView&, GdkEventButton*);
 
-       void remove_gain_control_point (GnomeCanvasItem*, GdkEvent*);
-       void remove_control_point (GnomeCanvasItem*, GdkEvent*);
+       void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
+       void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
 
        void mouse_brush_insert_region (AudioRegionView*, jack_nframes_t pos);
        void brush (jack_nframes_t);
@@ -1132,76 +1134,53 @@ class Editor : public PublicEditor
 
        /* Canvas event handlers */
 
-       gint canvas_crossfade_view_event (GdkEvent* event);
-       gint canvas_fade_in_event (GdkEvent* event);
-       gint canvas_fade_in_handle_event (GdkEvent* event);
-       gint canvas_fade_out_event (GdkEvent* event);
-       gint canvas_fade_out_handle_event (GdkEvent* event);
-       gint canvas_region_view_event (GdkEvent* event);
-       gint canvas_region_view_name_highlight_event (GdkEvent* event);
-       gint canvas_region_view_name_event (GdkEvent* event);
-       gint canvas_stream_view_event (GdkEvent* event);
-       gint canvas_marker_event (GdkEvent* event);
-       gint canvas_zoom_rect_event (GdkEvent* event);
-       gint canvas_selection_rect_event (GdkEvent* event);
-       gint canvas_selection_start_trim_event (GdkEvent* event);
-       gint canvas_selection_end_trim_event (GdkEvent* event);
-       gint canvas_control_point_event (GdkEvent* event);
-       gint canvas_line_event (GdkEvent* event);
-       gint canvas_tempo_marker_event (GdkEvent* event);
-       gint canvas_meter_marker_event (GdkEvent* event);
-       gint canvas_tempo_bar_event (GdkEvent* event);
-       gint canvas_meter_bar_event (GdkEvent* event);
-       gint canvas_marker_bar_event (GdkEvent* event);
-       gint canvas_range_marker_bar_event (GdkEvent* event);
-       gint canvas_transport_marker_bar_event (GdkEvent* event);
-       gint canvas_imageframe_item_view_event(GdkEvent* event) ;
-       gint canvas_imageframe_view_event(GdkEvent* event) ;
-       gint canvas_imageframe_start_handle_event(GdkEvent* event) ;
-       gint canvas_imageframe_end_handle_event(GdkEvent* event) ;
-       gint canvas_marker_time_axis_view_event(GdkEvent* event) ;
-       gint canvas_markerview_item_view_event(GdkEvent* event) ;
-       gint canvas_markerview_start_handle_event(GdkEvent* event) ;
-       gint canvas_markerview_end_handle_event(GdkEvent* event) ;
-       gint canvas_automation_track_event(GdkEvent* event) ;
-
-#if 0
-       gint canvas_crossfade_view_event (GnomeCanvasItem* item, GdkEvent* event, CrossfadeView*);
-       gint canvas_fade_in_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
-       gint canvas_fade_in_handle_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
-       gint canvas_fade_out_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
-       gint canvas_fade_out_handle_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
-       gint canvas_region_view_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
-       gint canvas_stream_view_event (GnomeCanvasItem* item, GdkEvent* event, AudioTimeAxisView*);
-       gint canvas_automation_track_event (GnomeCanvasItem* item, GdkEvent* event, AutomationTimeAxisView*);
-       gint canvas_marker_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_zoom_rect_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_selection_rect_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_selection_start_trim_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_selection_end_trim_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_control_point_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_line_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_tempo_marker_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_meter_marker_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_tempo_bar_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_meter_bar_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_marker_bar_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_range_marker_bar_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_transport_marker_bar_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_region_view_name_highlight_event (GnomeCanvasItem* item, GdkEvent* event);
-       gint canvas_region_view_name_event (GnomeCanvasItem* item, GdkEvent* event);
-#endif 
-
-       gint canvas_copy_region_event (GdkEvent* event);
-       gint canvas_playhead_cursor_event (GdkEvent* event);
-       gint canvas_edit_cursor_event (GdkEvent* event);
-       gint track_canvas_event (GdkEvent* event);
-
-       gint track_canvas_button_press_event (GdkEventButton *);
-       gint track_canvas_button_release_event (GdkEventButton *);
+       bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
+       bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
+       bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
+       bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
+       bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
+       bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
+       bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
+       bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
+       bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
+       bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
+       bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
+       bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
+       bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
+       bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioTimeAxisView*);
+       bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
+       bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
+       bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
+       bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
+       bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
+
+       bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
+       bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
+       bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
+       bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
+       bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
+
+       bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
+       bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
+       bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
+       bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
+       bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
+       bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
+       bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
+       bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
+
+       /* non-public event handlers */
+
+       bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
+       bool canvas_edit_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
+       bool track_canvas_event (GdkEvent* event, ArdourCanvas::Item*);
+       bool track_canvas_scroll (GdkEventScroll* event);
+
+       bool track_canvas_button_press_event (GdkEventButton *);
+       bool track_canvas_button_release_event (GdkEventButton *);
        
-       void track_canvas_allocate (GtkAllocation* alloc);
-       void time_canvas_allocate (GtkAllocation* alloc);
+       void track_canvas_allocate (Gtk::Allocation alloc);
+       void time_canvas_allocate (Gtk::Allocation alloc);
 
        void set_edit_cursor (GdkEvent* event);
        void set_playhead_cursor (GdkEvent* event);
@@ -1224,16 +1203,9 @@ class Editor : public PublicEditor
        void fake_handle_new_duration ();
        void handle_new_duration ();
        void initialize_canvas ();
-       void reset_scrolling_region (GtkAllocation* alloc = 0);
+       void reset_scrolling_region (Gtk::Allocation* alloc = 0);
        void scroll_canvas ();
 
-        /* sub-event loop handling */
-
-        int32_t sub_event_loop_status;
-        void run_sub_event_loop ();
-        void finish_sub_event_loop (int status);
-        gint finish_sub_event_loop_on_delete (GdkEventAny*, int32_t status);
-       
        /* display control */
        
        bool _show_measures;
@@ -1245,12 +1217,12 @@ class Editor : public PublicEditor
 
        ARDOUR::TempoMap::BBTPointList *current_bbt_points;
        
-       typedef vector<GnomeCanvasItem*> TimeLineList;
+       typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
        TimeLineList free_measure_lines;
        TimeLineList used_measure_lines;
 
-       GnomeCanvasItem* time_line_group;
-       GnomeCanvasItem* get_time_line ();
+       ArdourCanvas::Group* time_line_group;
+       ArdourCanvas::SimpleLine* get_time_line ();
        void hide_measures ();
        void draw_measures ();
        void draw_time_bars ();
@@ -1260,15 +1232,15 @@ class Editor : public PublicEditor
        void mouse_add_new_tempo_event (jack_nframes_t where);
        void mouse_add_new_meter_event (jack_nframes_t where);
 
-       void remove_tempo_marker (GnomeCanvasItem*);
-       void remove_meter_marker (GnomeCanvasItem*);
+       void remove_tempo_marker (ArdourCanvas::Item*);
+       void remove_meter_marker (ArdourCanvas::Item*);
        gint real_remove_tempo_marker (ARDOUR::TempoSection*);
        gint real_remove_meter_marker (ARDOUR::MeterSection*);
        
        void edit_tempo_section (ARDOUR::TempoSection*);
        void edit_meter_section (ARDOUR::MeterSection*);
-       void edit_tempo_marker (GnomeCanvasItem*);
-       void edit_meter_marker (GnomeCanvasItem*);
+       void edit_tempo_marker (ArdourCanvas::Item*);
+       void edit_meter_marker (ArdourCanvas::Item*);
        
        void marker_menu_edit ();
        void marker_menu_remove ();
@@ -1284,10 +1256,10 @@ class Editor : public PublicEditor
        void update_loop_range_view (bool visibility=false);
        void update_punch_range_view (bool visibility=false);
         gint new_transport_marker_menu_popdown (GdkEventAny*);
-       void marker_context_menu (GdkEventButton*, GnomeCanvasItem*);
-       void tm_marker_context_menu (GdkEventButton*, GnomeCanvasItem*);
-       void transport_marker_context_menu (GdkEventButton*, GnomeCanvasItem*);
-       void new_transport_marker_context_menu (GdkEventButton*, GnomeCanvasItem*);
+       void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
+       void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
+       void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
+       void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void build_marker_menu ();
        void build_tm_marker_menu ();
        void build_transport_marker_menu ();
@@ -1297,7 +1269,7 @@ class Editor : public PublicEditor
        Gtk::Menu* marker_menu;
        Gtk::Menu* transport_marker_menu;
        Gtk::Menu* new_transport_marker_menu;
-       GnomeCanvasItem* marker_menu_item;
+       ArdourCanvas::Item* marker_menu_item;
 
        typedef list<Marker*> Marks;
        Marks metric_marks;
@@ -1356,25 +1328,25 @@ class Editor : public PublicEditor
        Gtk::Label               edit_mode_label;
        Gtk::VBox                edit_mode_box;
 
-       gint edit_mode_selection_done (GdkEventAny*);
+       void edit_mode_selection_done ();
 
        Gtk::ComboBoxText snap_type_selector;
        Gtk::Label               snap_type_label;
        Gtk::VBox                snap_type_box;
 
-       gint snap_type_selection_done (GdkEventAny*);
+       void snap_type_selection_done ();
 
        Gtk::ComboBoxText               snap_mode_selector;
        Gtk::Label               snap_mode_label;
        Gtk::VBox                snap_mode_box;
 
-       gint snap_mode_selection_done (GdkEventAny*);
-
+       void snap_mode_selection_done ();
+       
        Gtk::ComboBoxText zoom_focus_selector;
        Gtk::Label               zoom_focus_label;
        Gtk::VBox                zoom_focus_box;
        
-       gint zoom_focus_selection_done (GdkEventAny*);
+       void zoom_focus_selection_done ();
 
        Gtk::Label          zoom_indicator_label;
        Gtk::HBox           zoom_indicator_box;
@@ -1411,9 +1383,9 @@ class Editor : public PublicEditor
                SelectionMove
        } selection_op;
 
-       void start_selection_op (GnomeCanvasItem* item, GdkEvent* event, SelectionOp);
-       void drag_selection (GnomeCanvasItem* item, GdkEvent* event);
-       void end_selection_op (GnomeCanvasItem* item, GdkEvent* event);
+       void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
+       void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
+       void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
        void cancel_selection ();
 
        void region_selection_op (void (ARDOUR::Region::*pmf)(void));
@@ -1422,38 +1394,33 @@ class Editor : public PublicEditor
 
        bool audio_region_selection_covers (jack_nframes_t where);
 
-       Gtk::VPaned  route_group_vpane;
-       Gtk::Frame   route_list_frame;
-       Gtk::Frame   edit_group_list_frame;
-
        /* transport range select process */
        enum RangeMarkerOp {
                CreateRangeMarker,
                CreateTransportMarker
        } range_marker_op;
 
-       void start_range_markerbar_op (GnomeCanvasItem* item, GdkEvent* event, RangeMarkerOp);
-       void drag_range_markerbar_op (GnomeCanvasItem* item, GdkEvent* event);
-       void end_range_markerbar_op (GnomeCanvasItem* item, GdkEvent* event);
+       void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
+       void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
+       void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
 
-       
-       GnomeCanvasItem      *range_bar_drag_rect;
-       GnomeCanvasItem      *transport_bar_drag_rect;
-       GnomeCanvasItem      *marker_drag_line;
-       GnomeCanvasPoints    *marker_drag_line_points;
-       GnomeCanvasItem      *range_marker_drag_rect;
+       ArdourCanvas::SimpleRect*  range_bar_drag_rect;
+       ArdourCanvas::SimpleRect*  transport_bar_drag_rect;
+       ArdourCanvas::Line*        marker_drag_line;
+       ArdourCanvas::Points       marker_drag_line_points;
+       ArdourCanvas::SimpleRect*  range_marker_drag_rect;
 
        void update_marker_drag_item (ARDOUR::Location *);
        
-       GnomeCanvasItem      *transport_bar_range_rect;
-       GnomeCanvasItem      *transport_bar_preroll_rect;
-       GnomeCanvasItem      *transport_bar_postroll_rect;
-       GnomeCanvasItem      *transport_loop_range_rect;
-       GnomeCanvasItem      *transport_punch_range_rect;
-       GnomeCanvasItem      *transport_punchin_line;
-       GnomeCanvasItem      *transport_punchout_line;
-       GnomeCanvasItem      *transport_preroll_rect;
-       GnomeCanvasItem      *transport_postroll_rect;
+       ArdourCanvas::SimpleRect     *transport_bar_range_rect;
+       ArdourCanvas::SimpleRect     *transport_bar_preroll_rect;
+       ArdourCanvas::SimpleRect     *transport_bar_postroll_rect;
+       ArdourCanvas::SimpleRect     *transport_loop_range_rect;
+       ArdourCanvas::SimpleRect     *transport_punch_range_rect;
+       ArdourCanvas::SimpleLine     *transport_punchin_line;
+       ArdourCanvas::SimpleLine     *transport_punchout_line;
+       ArdourCanvas::SimpleRect     *transport_preroll_rect;
+       ArdourCanvas::SimpleRect     *transport_postroll_rect;
 
        ARDOUR::Location*  transport_loop_location();
        ARDOUR::Location*  transport_punch_location();
@@ -1462,30 +1429,44 @@ class Editor : public PublicEditor
        
        /* object rubberband select process */
        
-       void start_rubberband_select (GnomeCanvasItem* item, GdkEvent* event);
-       void drag_rubberband_select (GnomeCanvasItem* item, GdkEvent* event);
-       void end_rubberband_select (GnomeCanvasItem* item, GdkEvent* event);
+       void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
+       void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
+       void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
 
        bool select_all_within (jack_nframes_t start, jack_nframes_t end, gdouble topy, gdouble boty, bool add);
        
-       GnomeCanvasItem   *rubberband_rect;
+       ArdourCanvas::SimpleRect   *rubberband_rect;
        
        /* mouse zoom process */
 
-       void start_mouse_zoom (GnomeCanvasItem* item, GdkEvent* event);
-       void drag_mouse_zoom (GnomeCanvasItem* item, GdkEvent* event);
-       void end_mouse_zoom (GnomeCanvasItem* item, GdkEvent* event);
+       void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
+       void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
+       void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
 
-       GnomeCanvasItem   *zoom_rect;
+       ArdourCanvas::SimpleRect   *zoom_rect;
        void reposition_zoom_rect (jack_nframes_t start, jack_nframes_t end);
        
        /* diskstream/route display management */
 
-       Gtk::TreeView          route_list;
-       Gtk::ScrolledWindow route_list_scroller;
-       Gtk::Menu          *route_list_menu;
+       struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
+           RouteDisplayModelColumns() { 
+                   add (text);
+                   add (tv);
+           }
+           Gtk::TreeModelColumn<Glib::ustring>  text;
+           Gtk::TreeModelColumn<TimeAxisView*>    tv;
+       };
+
+       RouteDisplayModelColumns    route_display_columns;
+       Glib::RefPtr<Gtk::ListStore> route_display_model;
+       Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
+
+       gint route_list_compare_func (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
+       Gtkmm2ext::DnDTreeView  route_list_display; 
+       Gtk::ScrolledWindow     route_list_scroller;
+       Gtk::Menu*              route_list_menu;
 
-       void route_list_column_click (gint);
+       void route_list_column_click ();
        void build_route_list_menu ();
        void select_all_routes ();
        void unselect_all_routes ();
@@ -1496,13 +1477,27 @@ class Editor : public PublicEditor
 
        /* edit group management */
 
-       Gtk::Button         edit_group_list_button;
-       Gtk::Label          edit_group_list_button_label;
-       Gtk::TreeView       edit_group_list;
-       Gtk::ScrolledWindow edit_group_list_scroller;
-       Gtk::Menu          *edit_group_list_menu;
-       Gtk::VBox           edit_group_vbox;
+        struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
+                GroupListModelColumns () {
+                      add (is_active);
+                       add (text);
+                      add (routegroup);
+                }
+               Gtk::TreeModelColumn<bool> is_active;
+               Gtk::TreeModelColumn<std::string> text;
+               Gtk::TreeModelColumn<ARDOUR::RouteGroup*>   routegroup;
+       };
+
+       GroupListModelColumns group_columns;
+       Glib::RefPtr<Gtk::ListStore> group_model;
+       Glib::RefPtr<Gtk::TreeSelection> group_selection;
 
+       Gtk::Button            edit_group_list_button;
+       Gtk::Label             edit_group_list_button_label;
+       Gtkmm2ext::DnDTreeView edit_group_display;
+       Gtk::ScrolledWindow    edit_group_list_scroller;
+       Gtk::Menu*             edit_group_list_menu;
+       Gtk::VBox              edit_group_vbox;
 
        void edit_group_list_column_click (gint);
        void build_edit_group_list_menu ();
@@ -1511,19 +1506,13 @@ class Editor : public PublicEditor
        void new_edit_group ();
        void edit_group_list_button_clicked ();
        gint edit_group_list_button_press_event (GdkEventButton* ev);
-       void edit_group_selected (gint row, gint col, GdkEvent* ev);
-       void edit_group_unselected (gint row, gint col, GdkEvent* ev);
+       void edit_group_selection_changed ();
        void fake_add_edit_group (ARDOUR::RouteGroup* group);
        void add_edit_group (ARDOUR::RouteGroup* group);
        void group_flags_changed (void*, ARDOUR::RouteGroup*);
 
        Gtk::VBox           list_vpacker;
 
-       static GdkPixmap* check_pixmap;
-       static GdkBitmap* check_mask;
-       static GdkPixmap* empty_pixmap;
-       static GdkBitmap* empty_mask;
-
        /* autoscrolling */
 
        int autoscroll_timeout_tag;
@@ -1544,14 +1533,14 @@ class Editor : public PublicEditor
                ContentsTrim,
        } trim_op;
 
-       void start_trim (GnomeCanvasItem*, GdkEvent*);
+       void start_trim (ArdourCanvas::Item*, GdkEvent*);
        void point_trim (GdkEvent*);
-       void trim_motion_callback (GnomeCanvasItem*, GdkEvent*);
+       void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
        void single_contents_trim (AudioRegionView&, jack_nframes_t, bool, bool, bool);
        void single_start_trim (AudioRegionView&, jack_nframes_t, bool, bool);
        void single_end_trim (AudioRegionView&, jack_nframes_t, bool, bool);
 
-       void trim_finished_callback (GnomeCanvasItem*, GdkEvent*);
+       void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
        void thaw_region_after_trim (AudioRegionView& rv);
        
        void trim_region_to_edit_cursor ();
@@ -1562,36 +1551,50 @@ class Editor : public PublicEditor
        /* Drag-n-Drop */
 
        int convert_drop_to_paths (std::vector<std::string>& paths,
-                                  GdkDragContext     *context,
+                                  const Glib::RefPtr<Gdk::DragContext>& context,
                                   gint                x,
                                   gint                y,
-                                  GtkSelectionData   *data,
+                                  const Gtk::SelectionData& data,
                                   guint               info,
                                   guint               time);
 
-       void  track_canvas_drag_data_received  (GdkDragContext     *context,
+       void  track_canvas_drag_data_received  (const Glib::RefPtr<Gdk::DragContext>& context,
                                                gint                x,
                                                gint                y,
-                                               GtkSelectionData   *data,
+                                               const Gtk::SelectionData& data,
                                                guint               info,
                                                guint               time);
-
-       void  region_list_display_drag_data_received  (GdkDragContext     *context,
+       
+       void  region_list_display_drag_data_received  (const Glib::RefPtr<Gdk::DragContext>& context,
                                                       gint                x,
                                                       gint                y,
-                                                      GtkSelectionData   *data,
+                                                      const Gtk::SelectionData& data,
                                                       guint               info,
                                                       guint               time);
-       
+
+
+       void  drop_paths  (const Glib::RefPtr<Gdk::DragContext>& context,
+                          gint                x,
+                          gint                y,
+                          const Gtk::SelectionData& data,
+                          guint               info,
+                          guint               time);
+
+       void  drop_regions  (const Glib::RefPtr<Gdk::DragContext>& context,
+                            gint                x,
+                            gint                y,
+                            const Gtk::SelectionData& data,
+                            guint               info,
+                            guint               time);
+
        /* audio export */
 
        ExportDialog *export_dialog;
        void export_range (jack_nframes_t start, jack_nframes_t end);
 
-       int write_region_selection(AudioRegionSelection&);
+       int  write_region_selection(AudioRegionSelection&);
        bool write_region (string path, ARDOUR::AudioRegion&);
        void export_region ();
-       void write_a_region ();
        void bounce_region_selection ();
        void bounce_range_selection ();
        void external_edit_region ();
@@ -1613,11 +1616,11 @@ class Editor : public PublicEditor
        UndoHistory visual_history;
        UndoCommand current_visual_command;
 
-       void begin_reversible_visual_command (string cmd_name);
+       void begin_reversible_visual_command (const string & cmd_name);
        void commit_reversible_visual_command ();
 
        void update_title ();   
-       void update_title_s (string snapshot_name);
+       void update_title_s (const string & snapshot_name);
 
        struct State {
            Selection* selection;
@@ -1656,13 +1659,13 @@ class Editor : public PublicEditor
        /* edit menu */
 
        Gtk::Menu* edit_menu;
-       void edit_menu_map_handler ();
+       bool edit_menu_map_handler (GdkEventAny*);
 
        jack_nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
 
-       void time_fx_motion (GnomeCanvasItem*, GdkEvent*);
-       void start_time_fx (GnomeCanvasItem*, GdkEvent*);
-       void end_time_fx (GnomeCanvasItem*, GdkEvent*);
+       void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
+       void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
+       void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
 
        struct TimeStretchDialog : public ArdourDialog {
            ARDOUR::Session::TimeStretchRequest request;
@@ -1705,8 +1708,8 @@ class Editor : public PublicEditor
        void current_mixer_strip_hidden ();
        void current_mixer_strip_removed ();
 
-       void detach_tearoff (Gtk::Box* b, Gtk::Widget* w);
-       void reattach_tearoff (Gtk::Box* b, Gtk::Widget* w, int32_t n);
+       void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
+       void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
 
        /* nudging tracks */
 
@@ -1717,42 +1720,42 @@ class Editor : public PublicEditor
        bool _xfade_visibility;
        
        /* <CMT Additions> */
-       void handle_new_imageframe_time_axis_view(std::string track_name, void* src) ;
-       void handle_new_imageframe_marker_time_axis_view(std::string track_name, TimeAxisView* marked_track) ;
-
-       void start_imageframe_grab(GnomeCanvasItem*, GdkEvent*) ;
-       void start_markerview_grab(GnomeCanvasItem*, GdkEvent*) ;
-
-       void imageframe_drag_motion_callback(GnomeCanvasItem*, GdkEvent*) ;
-       void markerview_drag_motion_callback(GnomeCanvasItem*, GdkEvent*) ;
-       void timeaxis_item_drag_finished_callback(GnomeCanvasItem*, GdkEvent*) ;
-
-       gint canvas_imageframe_item_view_event(GnomeCanvasItem* item, GdkEvent* event, ImageFrameView* ifv);
-       gint canvas_imageframe_view_event(GnomeCanvasItem* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
-       gint canvas_imageframe_start_handle_event(GnomeCanvasItem* item, GdkEvent* event, ImageFrameView* ifv);
-       gint canvas_imageframe_end_handle_event(GnomeCanvasItem* item, GdkEvent* event, ImageFrameView* ifv);
-
-       gint canvas_marker_time_axis_view_event(GnomeCanvasItem* item, GdkEvent* event, MarkerTimeAxis* mta);
-       gint canvas_markerview_item_view_event(GnomeCanvasItem* item, GdkEvent* event, MarkerView* mv);
-       gint canvas_markerview_start_handle_event(GnomeCanvasItem* item, GdkEvent* event, MarkerView* mv);
-       gint canvas_markerview_end_handle_event(GnomeCanvasItem* item, GdkEvent* event, MarkerView* mv);
-
-       void imageframe_start_handle_op(GnomeCanvasItem* item, GdkEvent* event) ;
-       void imageframe_end_handle_op(GnomeCanvasItem* item, GdkEvent* event) ;
-       void imageframe_start_handle_trim_motion(GnomeCanvasItem* item, GdkEvent* event) ;
-       void imageframe_start_handle_end_trim(GnomeCanvasItem* item, GdkEvent* event) ;
-       void imageframe_end_handle_trim_motion(GnomeCanvasItem* item, GdkEvent* event) ;
-       void imageframe_end_handle_end_trim(GnomeCanvasItem* item, GdkEvent* event) ;
+       void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
+       void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
+
+       void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
+       void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
+
+       void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
+       void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
+       void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
+
+       gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
+       gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
+       gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
+       gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
+
+       gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
+       gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
+       gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
+       gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
+
+       void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
        
-       void markerview_item_start_handle_op(GnomeCanvasItem* item, GdkEvent* event) ;
-       void markerview_item_end_handle_op(GnomeCanvasItem* item, GdkEvent* event) ;
-       void markerview_start_handle_trim_motion(GnomeCanvasItem* item, GdkEvent* event) ;
-       void markerview_start_handle_end_trim(GnomeCanvasItem* item, GdkEvent* event) ;
-       void markerview_end_handle_trim_motion(GnomeCanvasItem* item, GdkEvent* event) ;
-       void markerview_end_handle_end_trim(GnomeCanvasItem* item, GdkEvent* event) ;
+       void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
+       void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
 
-       void popup_imageframe_edit_menu(int button, int32_t time, GnomeCanvasItem* ifv, bool with_frame) ;
-       void popup_marker_time_axis_edit_menu(int button, int32_t time, GnomeCanvasItem* ifv, bool with_frame) ;
+       void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
+       void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
 
        ImageFrameSocketHandler* image_socket_listener ;
        /* </CMT Additions> */
@@ -1811,9 +1814,9 @@ class Editor : public PublicEditor
        typedef std::map<Editing::ColorID,std::string> ColorStyleMap;
        void init_colormap ();
 
-       /* GTK2 stuff */
+       bool on_key_press_event (GdkEventKey*);
 
-       Glib::RefPtr<Gtk::UIManager> ui_manager;
+       void session_state_saved (string);
 };
 
 #endif /* __ardour_editor_h__ */