All useage of ArdourPrompter checks for a valid result.
[ardour.git] / gtk2_ardour / audio_time_axis.cc
index c4bd90d332a5dba0e99dd1bf424cdabefab69838..013635f9549c22408366fd09e0de3d8d78e9da94 100644 (file)
 
 #include <pbd/error.h>
 #include <pbd/stl_delete.h>
+#include <pbd/whitespace.h>
 
-#include <gtkmmext/utils.h>
-#include <gtkmmext/selector.h>
-#include <gtkmmext/gtk_ui.h>
-#include <gtkmmext/stop_signal.h>
-#include <gtkmmext/bindable_button.h>
+#include <gtkmm2ext/bindable_button.h>
+#include <gtkmm2ext/gtk_ui.h>
+#include <gtkmm2ext/selector.h>
+#include <gtkmm2ext/stop_signal.h>
+#include <gtkmm2ext/utils.h>
 
-#include <ardour/session.h>
-#include <ardour/session_playlist.h>
 #include <ardour/audioplaylist.h>
 #include <ardour/diskstream.h>
-#include <ardour/utils.h>
-#include <ardour/playlist.h>
-#include <ardour/ladspa_plugin.h>
 #include <ardour/insert.h>
+#include <ardour/ladspa_plugin.h>
 #include <ardour/location.h>
 #include <ardour/panner.h>
+#include <ardour/playlist.h>
+#include <ardour/session.h>
+#include <ardour/session_playlist.h>
+#include <ardour/utils.h>
 
 #include "ardour_ui.h"
-#include "public_editor.h"
 #include "audio_time_axis.h"
-#include "streamview.h"
-#include "canvas-simplerect.h"
-#include "playlist_selector.h"
-#include "plugin_selector.h"
-#include "plugin_ui.h"
-#include "regionview.h"
 #include "automation_gain_line.h"
 #include "automation_pan_line.h"
 #include "automation_time_axis.h"
-#include "redirect_automation_time_axis.h"
+#include "canvas_impl.h"
+#include "crossfade_view.h"
+#include "enums.h"
 #include "gain_automation_time_axis.h"
+#include "gui_thread.h"
+#include "keyboard.h"
 #include "pan_automation_time_axis.h"
+#include "playlist_selector.h"
+#include "plugin_selector.h"
+#include "plugin_ui.h"
+#include "point_selection.h"
+#include "prompter.h"
+#include "public_editor.h"
 #include "redirect_automation_line.h"
+#include "redirect_automation_time_axis.h"
+#include "regionview.h"
+#include "rgb_macros.h"
 #include "selection.h"
-#include "point_selection.h"
-#include "enums.h"
+#include "simplerect.h"
+#include "streamview.h"
 #include "utils.h"
-#include "keyboard.h"
-#include "rgb_macros.h"
-#include "prompter.h"
-#include "crossfade_view.h"
-#include "gui_thread.h"
 
 #include <ardour/audio_track.h>
 
 #include "i18n.h"
 
 using namespace ARDOUR;
-using namespace SigC;
+//using namespace sigc;
 using namespace LADSPA;
 using namespace Gtk;
 using namespace Editing;
@@ -99,7 +101,7 @@ static const gchar * small_x_xpm[] = {
 "           ",
 "           "};
 
-AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Widget *canvas)
+AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Canvas& canvas)
        : AxisView(sess),
          RouteUI(rt, sess, _("m"), _("s"), _("r")), // mute, solo, and record
          TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
@@ -109,9 +111,8 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
          playlist_button (_("p")), 
          size_button (_("h")), // height
          automation_button (_("a")),
-         visual_button (_("v")),
-         redirect_window ("redirect window"),
-         redirect_display (1)
+         visual_button (_("v"))
+
 {
        _has_state = true;
        subplugin_menu.set_name ("ArdourContextMenu");
@@ -148,39 +149,33 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
        visual_button.set_name ("TrackVisualButton");
        hide_button.set_name ("TrackRemoveButton");
 
-       hide_button.add (*(manage (new Pixmap (small_x_xpm))));
-       
-       _route.mute_changed.connect (slot (*this, &RouteUI::mute_changed));
-       _route.solo_changed.connect (slot (*this, &RouteUI::solo_changed));
-       _route.solo_safe_changed.connect (slot (*this, &RouteUI::solo_changed));
-
-       _route.panner().Changed.connect (slot (*this, &AudioTimeAxisView::update_pans));
-
-       solo_button->button_press_event.connect (slot (*this, &RouteUI::solo_press));
-       solo_button->button_release_event.connect (slot (*this, &RouteUI::solo_release));
-       mute_button->button_press_event.connect (slot (*this, &RouteUI::mute_press));
-       mute_button->button_release_event.connect (slot (*this, &RouteUI::mute_release));
-       rec_enable_button->button_press_event.connect (slot (*this, &RouteUI::rec_enable_press));
-       edit_group_button.button_release_event.connect (slot (*this, &AudioTimeAxisView::edit_click));
-       playlist_button.clicked.connect (slot (*this, &AudioTimeAxisView::playlist_click));
-       automation_button.clicked.connect (slot (*this, &AudioTimeAxisView::automation_click));
-       size_button.button_release_event.connect (slot (*this, &AudioTimeAxisView::size_click));
-       visual_button.clicked.connect (slot (*this, &AudioTimeAxisView::visual_click));
-       hide_button.clicked.connect (slot (*this, &AudioTimeAxisView::hide_click));
-
-       name_entry.activate.connect (slot (*this, &AudioTimeAxisView::name_entry_activated));
-       name_entry.focus_out_event.connect (slot (*this, &AudioTimeAxisView::name_entry_focus_out_handler));
-       name_entry.button_press_event.connect (slot (*this, &AudioTimeAxisView::name_entry_button_press_handler));
-       name_entry.button_release_event.connect (slot (*this, &AudioTimeAxisView::name_entry_button_release_handler));
-       name_entry.key_release_event.connect (slot (*this, &AudioTimeAxisView::name_entry_key_release_handler));
+       hide_button.add (*(manage (new Image (Gdk::Pixbuf::create_from_xpm_data(small_x_xpm)))));
        
+       _route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
+       _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
+       _route.solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
+
+       _route.panner().Changed.connect (mem_fun(*this, &AudioTimeAxisView::update_pans));
+
+       solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press));
+       solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release));
+       mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press));
+       mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release));
+       rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
+       edit_group_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::edit_click), false);
+       playlist_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::playlist_click));
+       automation_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::automation_click));
+       size_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::size_click), false);
+       visual_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::visual_click));
+       hide_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::hide_click));
+
        if (is_audio_track()) {
-               controls_table.attach (*rec_enable_button, 6, 7, 0, 1, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
+               controls_table.attach (*rec_enable_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
        }
-       controls_table.attach (*mute_button, 7, 8, 0, 1, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
-       controls_table.attach (*solo_button, 8, 9, 0, 1, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_FILL|GTK_EXPAND, 0, 0);
+       controls_table.attach (*mute_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+       controls_table.attach (*solo_button, 8, 9, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::FILL|Gtk::EXPAND, 0, 0);
 
-       controls_table.attach (edit_group_button, 7, 8, 1, 2, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
+       controls_table.attach (edit_group_button, 7, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
 
        ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
        ARDOUR_UI::instance()->tooltips().set_tip(*solo_button,_("Solo"));
@@ -194,26 +189,26 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
        
        label_view ();
 
-       controls_table.attach (hide_button, 0, 1, 1, 2, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND);
-       controls_table.attach (visual_button, 1, 2, 1, 2, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND);
-       controls_table.attach (size_button, 2, 3, 1, 2, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND);
-       controls_table.attach (automation_button, 3, 4, 1, 2, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND);
+       controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
+       controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
+       controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
+       controls_table.attach (automation_button, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
 
        if (is_audio_track()) {
-               controls_table.attach (playlist_button, 6, 7, 1, 2, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND);
+               controls_table.attach (playlist_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
 
        }
 
        /* remove focus from the buttons */
        
-       automation_button.unset_flags (GTK_CAN_FOCUS);
-       solo_button->unset_flags (GTK_CAN_FOCUS);
-       mute_button->unset_flags (GTK_CAN_FOCUS);
-       edit_group_button.unset_flags (GTK_CAN_FOCUS);
-       size_button.unset_flags (GTK_CAN_FOCUS);
-       playlist_button.unset_flags (GTK_CAN_FOCUS);
-       hide_button.unset_flags (GTK_CAN_FOCUS);
-       visual_button.unset_flags (GTK_CAN_FOCUS);
+       automation_button.unset_flags (Gtk::CAN_FOCUS);
+       solo_button->unset_flags (Gtk::CAN_FOCUS);
+       mute_button->unset_flags (Gtk::CAN_FOCUS);
+       edit_group_button.unset_flags (Gtk::CAN_FOCUS);
+       size_button.unset_flags (Gtk::CAN_FOCUS);
+       playlist_button.unset_flags (Gtk::CAN_FOCUS);
+       hide_button.unset_flags (Gtk::CAN_FOCUS);
+       visual_button.unset_flags (Gtk::CAN_FOCUS);
 
        /* map current state of the route */
 
@@ -222,27 +217,26 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
        mute_changed(0);
        redirects_changed (0);
        reset_redirect_automation_curves ();
-       edit_group_menu_radio_group = 0;
        y_position = -1;
 
        ensure_xml_node ();
 
        set_state (*xml_node);
        
-       _route.mute_changed.connect (slot (*this, &RouteUI::mute_changed));
-       _route.solo_changed.connect (slot (*this, &RouteUI::solo_changed));
-       _route.redirects_changed.connect (slot (*this, &AudioTimeAxisView::redirects_changed));
+       _route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
+       _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
+       _route.redirects_changed.connect (mem_fun(*this, &AudioTimeAxisView::redirects_changed));
 
-       _route.name_changed.connect (slot (*this, &AudioTimeAxisView::route_name_changed));
+       _route.name_changed.connect (mem_fun(*this, &AudioTimeAxisView::route_name_changed));
 
        if (is_audio_track()) {
 
                /* track */
 
-               audio_track()->FreezeChange.connect (slot (*this, &AudioTimeAxisView::map_frozen));
+               audio_track()->FreezeChange.connect (mem_fun(*this, &AudioTimeAxisView::map_frozen));
 
-               audio_track()->diskstream_changed.connect (slot (*this, &AudioTimeAxisView::diskstream_changed));
-               get_diskstream()->speed_changed.connect (slot (*this, &AudioTimeAxisView::speed_changed));
+               audio_track()->diskstream_changed.connect (mem_fun(*this, &AudioTimeAxisView::diskstream_changed));
+               get_diskstream()->speed_changed.connect (mem_fun(*this, &AudioTimeAxisView::speed_changed));
 
                controls_ebox.set_name ("AudioTrackControlsBaseUnselected");
                controls_base_selected_name = "AudioTrackControlsBaseSelected";
@@ -250,7 +244,7 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
 
                /* ask for notifications of any new RegionViews */
 
-               view->AudioRegionViewAdded.connect (slot (*this, &AudioTimeAxisView::region_view_added));
+               view->AudioRegionViewAdded.connect (mem_fun(*this, &AudioTimeAxisView::region_view_added));
 
                view->attach ();
 
@@ -267,7 +261,7 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
                controls_base_unselected_name = "BusControlsBaseUnselected";
        }
 
-       editor.ZoomChanged.connect (slot (*this, &AudioTimeAxisView::reset_samples_per_unit));
+       editor.ZoomChanged.connect (mem_fun(*this, &AudioTimeAxisView::reset_samples_per_unit));
 }
 
 AudioTimeAxisView::~AudioTimeAxisView ()
@@ -323,8 +317,8 @@ AudioTimeAxisView::set_playlist (AudioPlaylist *newplaylist)
        state_changed_connection.disconnect ();
        
        if ((pl = dynamic_cast<AudioPlaylist*> (playlist())) != 0) {
-               state_changed_connection = pl->StateChanged.connect (slot (*this, &AudioTimeAxisView::playlist_state_changed));
-               modified_connection = pl->Modified.connect (slot (*this, &AudioTimeAxisView::playlist_modified));
+               state_changed_connection = pl->StateChanged.connect (mem_fun(*this, &AudioTimeAxisView::playlist_state_changed));
+               modified_connection = pl->Modified.connect (mem_fun(*this, &AudioTimeAxisView::playlist_modified));
        }
 }
 
@@ -347,10 +341,10 @@ AudioTimeAxisView::edit_click (GdkEventButton *ev)
 
        items.clear ();
        items.push_back (RadioMenuElem (edit_group_menu_radio_group, _("No group"), 
-                                  bind (slot (*this, &AudioTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
+                                  bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
        
        if (_route.edit_group() == 0) {
-               static_cast<RadioMenuItem*>(items.back())->set_active ();
+               static_cast<RadioMenuItem*>(&items.back())->set_active ();
        }
 
        _session.foreach_edit_group (this, &AudioTimeAxisView::add_edit_group_menu_item);
@@ -366,9 +360,9 @@ AudioTimeAxisView::add_edit_group_menu_item (RouteGroup *eg)
 
        MenuList &items = edit_group_menu.items();
        items.push_back (RadioMenuElem (edit_group_menu_radio_group,
-                                       eg->name(), bind (slot (*this, &AudioTimeAxisView::set_edit_group_from_menu), eg)));
+                                       eg->name(), bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), eg)));
        if (_route.edit_group() == eg) {
-               static_cast<RadioMenuItem*>(items.back())->set_active ();
+               static_cast<RadioMenuItem*>(&items.back())->set_active ();
        }
 }
 
@@ -382,7 +376,7 @@ AudioTimeAxisView::set_edit_group_from_menu (RouteGroup *eg)
 void
 AudioTimeAxisView::playlist_state_changed (Change ignored)
 {
-       // ENSURE_GUI_THREAD (bind (slot (*this, &AudioTimeAxisView::playlist_state_changed), ignored));
+       // ENSURE_GUI_THREAD (bind (mem_fun(*this, &AudioTimeAxisView::playlist_state_changed), ignored));
        // why are we here ?
 }
 
@@ -486,30 +480,26 @@ AudioTimeAxisView::show_timestretch (jack_nframes_t start, jack_nframes_t end)
 #endif
 
        if (timestretch_rect == 0) {
-               timestretch_rect = gtk_canvas_item_new (GTK_CANVAS_GROUP(canvas_display),
-                                                       gtk_canvas_simplerect_get_type(),
-                                                       "x1", 0.0,
-                                                       "y1", 0.0,
-                                                       "x2", 0.0,
-                                                       "y2", 0.0,
-                                                       "fill_color_rgba", color_map[cTimeStretchFill],
-                                                       "outline_color_rgba" , color_map[cTimeStretchOutline],
-                                                       NULL);
-       }
-
-       gtk_canvas_item_show (timestretch_rect);
-       gtk_canvas_item_raise_to_top (timestretch_rect);
-       
+               timestretch_rect = new SimpleRect (*canvas_display);
+               timestretch_rect->property_x1() =  0.0;
+               timestretch_rect->property_y1() =  0.0;
+               timestretch_rect->property_x2() =  0.0;
+               timestretch_rect->property_y2() =  0.0;
+               timestretch_rect->property_fill_color_rgba() =  color_map[cTimeStretchFill];
+               timestretch_rect->property_outline_color_rgba() = color_map[cTimeStretchOutline];
+       }
+
+       timestretch_rect->show ();
+       timestretch_rect->raise_to_top ();
+
        x1 = start / editor.get_current_zoom();
        x2 = (end - 1) / editor.get_current_zoom();
        y2 = height - 2;
        
-       gtk_object_set (GTK_OBJECT(timestretch_rect), 
-                       "x1", x1,
-                       "y1", 1.0,
-                       "x2", x2,
-                       "y2", y2,
-                       NULL);
+       timestretch_rect->property_x1() = x1;
+       timestretch_rect->property_y1() = 1.0;
+       timestretch_rect->property_x2() = x2;
+       timestretch_rect->property_y2() = y2;
 }
 
 void
@@ -518,7 +508,7 @@ AudioTimeAxisView::hide_timestretch ()
        TimeAxisView::hide_timestretch ();
 
        if (timestretch_rect) {
-               gtk_canvas_item_hide (timestretch_rect);
+               timestretch_rect->hide ();
        }
 }
 
@@ -713,12 +703,12 @@ AudioTimeAxisView::build_display_menu ()
        display_menu->set_name ("ArdourContextMenu");
        
        items.push_back (MenuElem (_("Height"), *size_menu));
-       items.push_back (MenuElem (_("Color"), slot (*this, &AudioTimeAxisView::select_track_color)));
+       items.push_back (MenuElem (_("Color"), mem_fun(*this, &AudioTimeAxisView::select_track_color)));
 
 
        items.push_back (SeparatorElem());
-       items.push_back (MenuElem (_("Hide all crossfades"), slot (*this, &AudioTimeAxisView::hide_all_xfades)));
-       items.push_back (MenuElem (_("Show all crossfades"), slot (*this, &AudioTimeAxisView::show_all_xfades)));
+       items.push_back (MenuElem (_("Hide all crossfades"), mem_fun(*this, &AudioTimeAxisView::hide_all_xfades)));
+       items.push_back (MenuElem (_("Show all crossfades"), mem_fun(*this, &AudioTimeAxisView::show_all_xfades)));
        items.push_back (SeparatorElem());
 
 
@@ -727,24 +717,24 @@ AudioTimeAxisView::build_display_menu ()
        automation_action_menu->set_name ("ArdourContextMenu");
        
        automation_items.push_back (MenuElem (_("show all automation"),
-                                             slot (*this, &AudioTimeAxisView::show_all_automation)));
+                                             mem_fun(*this, &AudioTimeAxisView::show_all_automation)));
 
        automation_items.push_back (MenuElem (_("show existing automation"),
-                                             slot (*this, &AudioTimeAxisView::show_existing_automation)));
+                                             mem_fun(*this, &AudioTimeAxisView::show_existing_automation)));
 
        automation_items.push_back (MenuElem (_("hide all automation"),
-                                             slot (*this, &AudioTimeAxisView::hide_all_automation)));
+                                             mem_fun(*this, &AudioTimeAxisView::hide_all_automation)));
 
        automation_items.push_back (SeparatorElem());
 
        automation_items.push_back (CheckMenuElem (_("gain"), 
-                                                  slot (*this, &AudioTimeAxisView::toggle_gain_track)));
-       gain_automation_item = static_cast<CheckMenuItem*> (automation_items.back());
+                                                  mem_fun(*this, &AudioTimeAxisView::toggle_gain_track)));
+       gain_automation_item = static_cast<CheckMenuItem*> (&automation_items.back());
        gain_automation_item->set_active(show_gain_automation);
 
        automation_items.push_back (CheckMenuElem (_("pan"),
-                                                  slot (*this, &AudioTimeAxisView::toggle_pan_track)));
-       pan_automation_item = static_cast<CheckMenuItem*> (automation_items.back());
+                                                  mem_fun(*this, &AudioTimeAxisView::toggle_pan_track)));
+       pan_automation_item = static_cast<CheckMenuItem*> (&automation_items.back());
        pan_automation_item->set_active(show_pan_automation);
 
        automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu));
@@ -755,19 +745,19 @@ AudioTimeAxisView::build_display_menu ()
        MenuList& waveform_items = waveform_menu->items();
        waveform_menu->set_name ("ArdourContextMenu");
        
-       waveform_items.push_back (CheckMenuElem (_("Show waveforms"), slot (*this, &AudioTimeAxisView::toggle_waveforms)));
-       waveform_item = static_cast<CheckMenuItem *> (waveform_items.back());
+       waveform_items.push_back (CheckMenuElem (_("Show waveforms"), mem_fun(*this, &AudioTimeAxisView::toggle_waveforms)));
+       waveform_item = static_cast<CheckMenuItem *> (&waveform_items.back());
        ignore_toggle = true;
        waveform_item->set_active (editor.show_waveforms());
        ignore_toggle = false;
 
        RadioMenuItem::Group group;
 
-       waveform_items.push_back (RadioMenuElem (group, _("Traditional"), bind (slot (*this, &AudioTimeAxisView::set_waveform_shape), Traditional)));
-       traditional_item = static_cast<RadioMenuItem *> (waveform_items.back());
+       waveform_items.push_back (RadioMenuElem (group, _("Traditional"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Traditional)));
+       traditional_item = static_cast<RadioMenuItem *> (&waveform_items.back());
 
-       waveform_items.push_back (RadioMenuElem (group, _("Rectified"), bind (slot (*this, &AudioTimeAxisView::set_waveform_shape), Rectified)));
-       rectified_item = static_cast<RadioMenuItem *> (waveform_items.back());
+       waveform_items.push_back (RadioMenuElem (group, _("Rectified"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Rectified)));
+       rectified_item = static_cast<RadioMenuItem *> (&waveform_items.back());
 
        items.push_back (MenuElem (_("Waveform"), *waveform_menu));
 
@@ -779,29 +769,29 @@ AudioTimeAxisView::build_display_menu ()
 
                RadioMenuItem::Group align_group;
                
-               alignment_items.push_back (RadioMenuElem (align_group, _("align with existing material"), bind (slot (*this, &AudioTimeAxisView::set_align_style), ExistingMaterial)));
-               align_existing_item = dynamic_cast<RadioMenuItem*>(alignment_items.back());
+               alignment_items.push_back (RadioMenuElem (align_group, _("align with existing material"), bind (mem_fun(*this, &AudioTimeAxisView::set_align_style), ExistingMaterial)));
+               align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
                if (get_diskstream()->alignment_style() == ExistingMaterial) {
                        align_existing_item->set_active();
                }
-               alignment_items.push_back (RadioMenuElem (align_group, _("align with capture time"), bind (slot (*this, &AudioTimeAxisView::set_align_style), CaptureTime)));
-               align_capture_item = dynamic_cast<RadioMenuItem*>(alignment_items.back());
+               alignment_items.push_back (RadioMenuElem (align_group, _("align with capture time"), bind (mem_fun(*this, &AudioTimeAxisView::set_align_style), CaptureTime)));
+               align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
                if (get_diskstream()->alignment_style() == CaptureTime) {
                        align_capture_item->set_active();
                }
                
                items.push_back (MenuElem (_("Alignment"), *alignment_menu));
 
-               get_diskstream()->AlignmentStyleChanged.connect (slot (*this, &AudioTimeAxisView::align_style_changed));
+               get_diskstream()->AlignmentStyleChanged.connect (mem_fun(*this, &AudioTimeAxisView::align_style_changed));
        }
 
        items.push_back (SeparatorElem());
-       items.push_back (CheckMenuElem (_("Active"), slot (*this, &RouteUI::toggle_route_active)));
-       route_active_menu_item = dynamic_cast<CheckMenuItem *> (items.back());
+       items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active)));
+       route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
        route_active_menu_item->set_active (_route.active());
 
        items.push_back (SeparatorElem());
-       items.push_back (MenuElem (_("Remove"), slot (*this, &RouteUI::remove_this_route)));
+       items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
 
 }
 
@@ -832,6 +822,7 @@ void
 AudioTimeAxisView::rename_current_playlist ()
 {
        ArdourPrompter prompter (true);
+       string name;
 
        AudioPlaylist *pl;
        DiskStream *ds;
@@ -842,15 +833,17 @@ AudioTimeAxisView::rename_current_playlist ()
 
        prompter.set_prompt (_("Name for playlist"));
        prompter.set_initial_text (pl->name());
-       prompter.done.connect (Main::quit.slot());
-       prompter.show_all ();
 
-       Main::run ();
-
-       if (prompter.status == Gtkmmext::Prompter::entered) {
-               string name;
+       switch (prompter.run ()) {
+       case Gtk::RESPONSE_ACCEPT:
                prompter.get_result (name);
-               pl->set_name (name);
+               if (name.length()) {
+                       pl->set_name (name);
+               }
+               break;
+
+       default:
+               break;
        }
 }
 
@@ -869,29 +862,31 @@ AudioTimeAxisView::use_copy_playlist ()
 {
        AudioPlaylist *pl;
        DiskStream *ds;
+       string name;
 
        if (((ds = get_diskstream()) == 0) || ((pl = ds->playlist()) == 0)) {
                return;
        }
-
+       
        ArdourPrompter prompter (true);
        string new_name = Playlist::bump_name (pl->name(), _session);
-
+       
        prompter.set_prompt (_("Name for playlist"));
        prompter.set_initial_text (new_name);
-       prompter.done.connect (Main::quit.slot());
        prompter.show_all ();
 
-       Main::run ();
-
-       if (prompter.status == Gtkmmext::Prompter::entered) {
-               string name;
+       switch (prompter.run ()) {
+       case Gtk::RESPONSE_ACCEPT:
                prompter.get_result (name);
+               if (name.length()) {
+                       ds->use_copy_playlist ();
+                       pl = ds->playlist();
+                       pl->set_name (name);
+               }
+               break;
 
-               ds->use_copy_playlist ();
-
-               pl = ds->playlist();
-               pl->set_name (name);
+       default:
+               break;
        }
 }
 
@@ -900,6 +895,7 @@ AudioTimeAxisView::use_new_playlist ()
 {
        AudioPlaylist *pl;
        DiskStream *ds;
+       string name;
 
        if (((ds = get_diskstream()) == 0) || ((pl = ds->playlist()) == 0)) {
                return;
@@ -910,19 +906,19 @@ AudioTimeAxisView::use_new_playlist ()
 
        prompter.set_prompt (_("Name for playlist"));
        prompter.set_initial_text (new_name);
-       prompter.done.connect (Main::quit.slot());
-       prompter.show_all ();
-
-       Main::run ();
-
-       if (prompter.status == Gtkmmext::Prompter::entered) {
-               string name;
+       
+       switch (prompter.run ()) {
+       case Gtk::RESPONSE_ACCEPT:
                prompter.get_result (name);
+               if (name.length()) {
+                       ds->use_new_playlist ();
+                       pl = ds->playlist();
+                       pl->set_name (name);
+               }
+               break;
 
-               ds->use_new_playlist ();
-
-               pl = ds->playlist();
-               pl->set_name (name);
+       default:
+               break;
        }
 }      
 
@@ -943,7 +939,7 @@ void
 AudioTimeAxisView::toggle_waveforms ()
 {
        if (view && waveform_item && !ignore_toggle) {
-               view->set_show_waveforms (waveform_item->is_active());
+               view->set_show_waveforms (waveform_item->get_active());
        }
 }
 
@@ -976,13 +972,13 @@ AudioTimeAxisView::set_waveform_shape (WaveformShape shape)
 void
 AudioTimeAxisView::speed_changed ()
 {
-       Gtkmmext::UI::instance()->call_slot (slot (*this, &AudioTimeAxisView::reset_samples_per_unit));
+       Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &AudioTimeAxisView::reset_samples_per_unit));
 }
 
 void
 AudioTimeAxisView::diskstream_changed (void *src)
 {
-       Gtkmmext::UI::instance()->call_slot (slot (*this, &AudioTimeAxisView::update_diskstream_display));
+       Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &AudioTimeAxisView::update_diskstream_display));
 }      
 
 void
@@ -1040,9 +1036,9 @@ AudioTimeAxisView::get_selectables (jack_nframes_t start, jack_nframes_t end, do
                speed = get_diskstream()->speed();
        }
        
-       jack_nframes_t start_adjusted = (jack_nframes_t) (start * speed);
-       jack_nframes_t end_adjusted = (jack_nframes_t) (end * speed);
-       
+       jack_nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
+       jack_nframes_t end_adjusted   = session_frame_to_track_frame(end, speed);
+
        if (view && touched (top, bot)) {
                view->get_selectables (start_adjusted, end_adjusted, results);
        }
@@ -1096,59 +1092,11 @@ AudioTimeAxisView::playlist () const
        }
 }
 
-gint 
-AudioTimeAxisView::name_entry_button_press_handler (GdkEventButton *ev)
-{
-       if (ev->button == 3) {
-               return stop_signal (name_entry, "button_press_event");
-       }
-       return FALSE;
-}
-
-gint 
-AudioTimeAxisView::name_entry_button_release_handler (GdkEventButton *ev)
-{
-       return FALSE;
-}
-
-gint
-AudioTimeAxisView::name_entry_focus_out_handler (GdkEventFocus* ev)
-{
-       name_entry_changed ();
-       return TRUE;
-}
-
-gint
-AudioTimeAxisView::name_entry_key_release_handler (GdkEventKey* ev)
-{
-       switch (ev->keyval) {
-       case GDK_Tab:
-       case GDK_Up:
-       case GDK_Down:
-               name_entry_changed ();
-               return TRUE;
-
-       default:
-               return FALSE;
-       }
-}
-
-void
-AudioTimeAxisView::name_entry_activated ()
-{
-       /* this should drop focus from the entry,
-          and cause a call to name_entry_changed()
-       */
-       controls_ebox.grab_focus();
-}
-
 void
 AudioTimeAxisView::name_entry_changed ()
 {
        string x;
 
-       ARDOUR_UI::generic_focus_out_event (0);
-
        x = name_entry.get_text ();
        
        if (x == _route.name()) {
@@ -1179,7 +1127,7 @@ AudioTimeAxisView::visual_click ()
 void
 AudioTimeAxisView::hide_click ()
 {
-       editor.unselect_strip_in_display (*this);
+       editor.hide_track_in_display (*this);
 }
 
 Region*
@@ -1201,15 +1149,20 @@ AudioTimeAxisView::add_gain_automation_child ()
        XMLProperty* prop;
        AutomationLine* line;
 
-       gain_track = new GainAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, _("gain"),
+       gain_track = new GainAutomationTimeAxisView (_session,
+                                                    _route,
+                                                    editor,
+                                                    *this,
+                                                    parent_canvas,
+                                                    _("gain"),
                                                     _route.gain_automation_curve());
        
-       
-       line = new AutomationGainLine ("automation gain", _session, *gain_track,
-                                                  gain_track->canvas_display,
-                                                  _route.gain_automation_curve(),
-                                                  PublicEditor::canvas_control_point_event,
-                                                  PublicEditor::canvas_line_event);
+       line = new AutomationGainLine ("automation gain",
+                                      _session,
+                                      *gain_track,
+                                      *gain_track->canvas_display,
+                                      _route.gain_automation_curve());
+
        line->set_line_color (color_map[cAutomationLine]);
        
 
@@ -1217,7 +1170,7 @@ AudioTimeAxisView::add_gain_automation_child ()
 
        add_child (gain_track);
 
-       gain_track->Hiding.connect (slot (*this, &AudioTimeAxisView::gain_hidden));
+       gain_track->Hiding.connect (mem_fun(*this, &AudioTimeAxisView::gain_hidden));
 
        bool hideit = true;
        
@@ -1247,7 +1200,7 @@ AudioTimeAxisView::add_pan_automation_child ()
        
        add_child (pan_track);
 
-       pan_track->Hiding.connect (slot (*this, &AudioTimeAxisView::pan_hidden));
+       pan_track->Hiding.connect (mem_fun(*this, &AudioTimeAxisView::pan_hidden));
 
        ensure_xml_node ();
        bool hideit = true;
@@ -1286,10 +1239,8 @@ AudioTimeAxisView::update_pans ()
                AutomationLine* line;
 
                line = new AutomationPanLine ("automation pan", _session, *pan_track,
-                                             pan_track->canvas_display, 
-                                             (*p)->automation(),
-                                             PublicEditor::canvas_control_point_event,
-                                             PublicEditor::canvas_line_event);
+                                             *pan_track->canvas_display, 
+                                             (*p)->automation());
 
                if (p == _route.panner().begin()) {
                        /* first line is a nice orange */
@@ -1312,7 +1263,7 @@ AudioTimeAxisView::toggle_gain_track ()
        if (showit != gain_track->marked_for_display()) {
                if (showit) {
                        gain_track->set_marked_for_display (true);
-                       gtk_canvas_item_show (gain_track->canvas_display);
+                       gain_track->canvas_display->show();
                        gain_track->get_state_node()->add_property ("shown", X_("yes"));
                } else {
                        gain_track->set_marked_for_display (false);
@@ -1348,7 +1299,7 @@ AudioTimeAxisView::toggle_pan_track ()
        if (showit != pan_track->marked_for_display()) {
                if (showit) {
                        pan_track->set_marked_for_display (true);
-                       gtk_canvas_item_show (pan_track->canvas_display);
+                       pan_track->canvas_display->show();
                        pan_track->get_state_node()->add_property ("shown", X_("yes"));
                } else {
                        pan_track->set_marked_for_display (false);
@@ -1447,7 +1398,7 @@ AudioTimeAxisView::add_redirect_automation_curve (Redirect *redirect, uint32_t w
 
        if ((ran = find_redirect_automation_node (redirect, what)) == 0) {
                fatal << _("programming error: ")
-                     << compose (X_("redirect automation curve for %1:%2 not registered with audio track!"),
+                     << string_compose (X_("redirect automation curve for %1:%2 not registered with audio track!"),
                                  redirect->name(), what)
                      << endmsg;
                /*NOTREACHED*/
@@ -1469,16 +1420,14 @@ AudioTimeAxisView::add_redirect_automation_curve (Redirect *redirect, uint32_t w
 
        ral = new RedirectAutomationLine (name, 
                                          *redirect, what, _session, *ran->view,
-                                         ran->view->canvas_display, redirect->automation_list (what), 
-                                         PublicEditor::canvas_control_point_event,
-                                         PublicEditor::canvas_line_event);
+                                         *ran->view->canvas_display, redirect->automation_list (what));
        
        ral->set_line_color (color_map[cRedirectAutomationLine]);
        ral->queue_reset ();
 
        ran->view->add_line (*ral);
 
-       ran->view->Hiding.connect (bind (slot (*this, &AudioTimeAxisView::redirect_automation_track_hidden), ran, redirect));
+       ran->view->Hiding.connect (bind (mem_fun(*this, &AudioTimeAxisView::redirect_automation_track_hidden), ran, redirect));
 
        if (!ran->view->marked_for_display()) {
                ran->view->hide ();
@@ -1488,7 +1437,7 @@ AudioTimeAxisView::add_redirect_automation_curve (Redirect *redirect, uint32_t w
 
        add_child (ran->view);
 
-       view->foreach_regionview (bind (slot (*this, &AudioTimeAxisView::add_ghost_to_redirect), ran->view));
+       view->foreach_regionview (bind (mem_fun(*this, &AudioTimeAxisView::add_ghost_to_redirect), ran->view));
 
        redirect->mark_automation_visible (what, true);
 }
@@ -1574,7 +1523,7 @@ AudioTimeAxisView::add_redirect_to_subplugin_menu (Redirect* r)
                string name = r->describe_parameter (*i);
                
                items.push_back (CheckMenuElem (name));
-               mitem = dynamic_cast<CheckMenuItem*> (items.back());
+               mitem = dynamic_cast<CheckMenuItem*> (&items.back());
 
                if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
                        mitem->set_active(true);
@@ -1594,7 +1543,7 @@ AudioTimeAxisView::add_redirect_to_subplugin_menu (Redirect* r)
 
                }
 
-               mitem->toggled.connect (bind (slot (*this, &AudioTimeAxisView::redirect_menu_item_toggled), rai, ran));
+               mitem->signal_toggled().connect (bind (mem_fun(*this, &AudioTimeAxisView::redirect_menu_item_toggled), rai, ran));
        }
 
        /* add the menu for this redirect, because the subplugin
@@ -1623,7 +1572,7 @@ AudioTimeAxisView::redirect_menu_item_toggled (AudioTimeAxisView::RedirectAutoma
 
                if (showit) {
                        ran->view->set_marked_for_display (true);
-                       gtk_canvas_item_show (ran->view->canvas_display);
+                       ran->view->canvas_display->show();
                } else {
                        rai->redirect->mark_automation_visible (ran->what, true);
                        ran->view->set_marked_for_display (false);
@@ -1775,8 +1724,8 @@ AudioTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
        float speed = ds->speed();
        if (speed != 1.0f) {
                for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
-                       (*i).start = (jack_nframes_t)floor( (float) (*i).start * speed);
-                       (*i).end   = (jack_nframes_t)floor( (float) (*i).end   * speed);
+                       (*i).start = session_frame_to_track_frame((*i).start, speed);
+                       (*i).end   = session_frame_to_track_frame((*i).end,   speed);
                }
        }
        
@@ -1825,7 +1774,7 @@ AudioTimeAxisView::paste (jack_nframes_t pos, float times, Selection& selection,
        }
 
        if (get_diskstream()->speed() != 1.0f)
-               pos = (jack_nframes_t) floor( (float) pos * get_diskstream()->speed() );
+               pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
        
        _session.add_undo (playlist->get_memento());
        playlist->paste (**p, pos, times);
@@ -1886,18 +1835,18 @@ AudioTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
        playlist_menu = new Menu;
        playlist_menu->set_name ("ArdourContextMenu");
 
-       playlist_items.push_back (MenuElem (compose (_("Current: %1"), get_diskstream()->playlist()->name())));
+       playlist_items.push_back (MenuElem (string_compose (_("Current: %1"), get_diskstream()->playlist()->name())));
        playlist_items.push_back (SeparatorElem());
        
-       playlist_items.push_back (MenuElem (_("Rename"), slot (*this, &AudioTimeAxisView::rename_current_playlist)));
+       playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &AudioTimeAxisView::rename_current_playlist)));
        playlist_items.push_back (SeparatorElem());
 
-       playlist_items.push_back (MenuElem (_("New"), slot (*this, &AudioTimeAxisView::use_new_playlist)));
-       playlist_items.push_back (MenuElem (_("New Copy"), slot(*this, &AudioTimeAxisView::use_copy_playlist)));
+       playlist_items.push_back (MenuElem (_("New"), mem_fun(*this, &AudioTimeAxisView::use_new_playlist)));
+       playlist_items.push_back (MenuElem (_("New Copy"), mem_fun(*this, &AudioTimeAxisView::use_copy_playlist)));
        playlist_items.push_back (SeparatorElem());
-       playlist_items.push_back (MenuElem (_("Clear Current"), slot (*this, &AudioTimeAxisView::clear_playlist)));
+       playlist_items.push_back (MenuElem (_("Clear Current"), mem_fun(*this, &AudioTimeAxisView::clear_playlist)));
        playlist_items.push_back (SeparatorElem());
-       playlist_items.push_back (MenuElem(_("Select"), slot (*this, &AudioTimeAxisView::show_playlist_selector)));
+       playlist_items.push_back (MenuElem(_("Select"), mem_fun(*this, &AudioTimeAxisView::show_playlist_selector)));
 
 }
 
@@ -1915,7 +1864,7 @@ AudioTimeAxisView::map_frozen ()
                return;
        }
 
-       ENSURE_GUI_THREAD (slot (*this, &AudioTimeAxisView::map_frozen));
+       ENSURE_GUI_THREAD (mem_fun(*this, &AudioTimeAxisView::map_frozen));
 
 
        switch (audio_track()->freeze_state()) {
@@ -1995,7 +1944,7 @@ AudioTimeAxisView::route_active_changed ()
 }
 
 XMLNode* 
-AudioTimeAxisView::get_child_xml_node (std::string childname)
+AudioTimeAxisView::get_child_xml_node (const string & childname)
 {
        return RouteUI::get_child_xml_node (childname);
 }