size various ArdourDropdowns according to the pixel width, not character length,...
[ardour.git] / gtk2_ardour / editor.cc
index e3d1bc03982b1bd7a4e086391ac66379c69a0e85..65230bf33396b75f5ad6b6e572aa48e377a2d91a 100644 (file)
 #include "tempo_lines.h"
 #include "time_axis_view.h"
 #include "utils.h"
+#include "verbose_cursor.h"
 
 #include "i18n.h"
 
@@ -141,9 +142,9 @@ const double Editor::timebar_height = 15.0;
 
 static const gchar *_snap_type_strings[] = {
        N_("CD Frames"),
-       N_("Timecode Frames"),
-       N_("Timecode Seconds"),
-       N_("Timecode Minutes"),
+       N_("TC Frames"),
+       N_("TC Seconds"),
+       N_("TC Minutes"),
        N_("Seconds"),
        N_("Minutes"),
        N_("Beats/128"),
@@ -187,6 +188,14 @@ static const gchar *_edit_point_strings[] = {
        0
 };
 
+static const gchar *_edit_mode_strings[] = {
+       N_("Slide"),
+       N_("Splice"),
+       N_("Ripple"),
+       N_("Lock"),
+       0
+};
+
 static const gchar *_zoom_focus_strings[] = {
        N_("Left"),
        N_("Right"),
@@ -263,7 +272,6 @@ Editor::Editor ()
 
          /* tool bar related */
 
-       , zoom_range_clock (new AudioClock (X_("zoomrange"), false, X_("zoom range"), true, false, true))
        , toolbar_selection_clock_table (2,3)
        , _mouse_mode_tearoff (0)
        , automation_mode_button (_("mode"))
@@ -311,6 +319,7 @@ Editor::Editor ()
        snap_type_strings =  I18N (_snap_type_strings);
        snap_mode_strings =  I18N (_snap_mode_strings);
        zoom_focus_strings = I18N (_zoom_focus_strings);
+       edit_mode_strings = I18N (_edit_mode_strings);
        edit_point_strings = I18N (_edit_point_strings);
 #ifdef USE_RUBBERBAND
        rb_opt_strings = I18N (_rb_opt_strings);
@@ -393,8 +402,6 @@ Editor::Editor ()
 
        _scroll_callbacks = 0;
 
-       zoom_range_clock->ValueChanged.connect (sigc::mem_fun(*this, &Editor::zoom_adjustment_changed));
-
        bbt_label.set_name ("EditorRulerLabel");
        bbt_label.set_size_request (-1, (int)timebar_height);
        bbt_label.set_alignment (1.0, 0.5);
@@ -746,6 +753,8 @@ Editor::Editor ()
        _last_region_menu_was_main = false;
        _popup_region_menu_item = 0;
 
+       _ignore_follow_edits = false;
+
        _show_marker_lines = false;
 
         /* Button bindings */
@@ -760,9 +769,14 @@ Editor::Editor ()
         }
 
        constructed = true;
-       instant_save ();
+
+       /* grab current parameter state */
+       boost::function<void (string)> pc (boost::bind (&Editor::ui_parameter_changed, this, _1));
+       ARDOUR_UI::config()->map_parameters (pc);
 
        setup_fade_images ();
+
+       instant_save ();
 }
 
 Editor::~Editor()
@@ -914,23 +928,6 @@ Editor::instant_save ()
        }
 }
 
-void
-Editor::zoom_adjustment_changed ()
-{
-       if (_session == 0) {
-               return;
-       }
-
-       framecnt_t fpu = llrintf (zoom_range_clock->current_duration() / _visible_canvas_width);
-       bool clamped = clamp_samples_per_pixel (fpu);
-       
-       if (clamped) {
-               zoom_range_clock->set ((framepos_t) floor (fpu * _visible_canvas_width));
-       }
-
-       temporal_zoom (fpu);
-}
-
 void
 Editor::control_vertical_zoom_in_all ()
 {
@@ -1248,7 +1245,6 @@ Editor::set_session (Session *t)
                return;
        }
 
-       zoom_range_clock->set_session (_session);
        _playlist_selector->set_session (_session);
        nudge_clock->set_session (_session);
        _summary->set_session (_session);
@@ -1851,7 +1847,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
        select_menu->set_name ("ArdourContextMenu");
 
        select_items.push_back (MenuElem (_("Select All in Track"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_in_track), Selection::Set)));
-       select_items.push_back (MenuElem (_("Select All"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all), Selection::Set)));
+       select_items.push_back (MenuElem (_("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), Selection::Set)));
        select_items.push_back (MenuElem (_("Invert Selection in Track"), sigc::mem_fun(*this, &Editor::invert_selection_in_track)));
        select_items.push_back (MenuElem (_("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection)));
        select_items.push_back (SeparatorElem());
@@ -1928,7 +1924,7 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
        select_menu->set_name ("ArdourContextMenu");
 
        select_items.push_back (MenuElem (_("Select All in Track"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_in_track), Selection::Set)));
-       select_items.push_back (MenuElem (_("Select All"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all), Selection::Set)));
+       select_items.push_back (MenuElem (_("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), Selection::Set)));
        select_items.push_back (MenuElem (_("Invert Selection in Track"), sigc::mem_fun(*this, &Editor::invert_selection_in_track)));
        select_items.push_back (MenuElem (_("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection)));
        select_items.push_back (SeparatorElem());
@@ -2773,7 +2769,7 @@ Editor::setup_toolbar ()
 {
        HBox* mode_box = manage(new HBox);
        mode_box->set_border_width (2);
-       mode_box->set_spacing(4);
+       mode_box->set_spacing(2);
 
        HBox* mouse_mode_box = manage (new HBox);
        HBox* mouse_mode_hbox = manage (new HBox);
@@ -2781,8 +2777,9 @@ Editor::setup_toolbar ()
        Alignment* mouse_mode_align = manage (new Alignment);
 
        Glib::RefPtr<SizeGroup> mouse_mode_size_group = SizeGroup::create (SIZE_GROUP_BOTH);
-//     mouse_mode_size_group->add_widget (smart_mode_button);
+       //mouse_mode_size_group->add_widget (smart_mode_button);
        mouse_mode_size_group->add_widget (mouse_move_button);
+       mouse_mode_size_group->add_widget (mouse_cut_button);
        mouse_mode_size_group->add_widget (mouse_select_button);
        mouse_mode_size_group->add_widget (mouse_zoom_button);
        mouse_mode_size_group->add_widget (mouse_gain_button);
@@ -2791,9 +2788,13 @@ Editor::setup_toolbar ()
        mouse_mode_size_group->add_widget (mouse_draw_button);
        mouse_mode_size_group->add_widget (internal_edit_button);
 
-       /* make them just a bit bigger */
-       mouse_move_button.set_size_request (-1, 30);
-
+       if (!ARDOUR::Profile->get_small_screen()) {
+               /* make them just a bit bigger */
+               mouse_move_button.set_size_request (24, 30);
+       } else {
+               /* make them just a bit taller */
+               mouse_move_button.set_size_request (-1, 30);
+       }
        mouse_mode_hbox->set_spacing (2);
 
        if (!ARDOUR::Profile->get_trx()) {
@@ -2802,6 +2803,7 @@ Editor::setup_toolbar ()
 
        mouse_mode_hbox->pack_start (mouse_move_button, false, false);
        mouse_mode_hbox->pack_start (mouse_select_button, false, false);
+       mouse_mode_hbox->pack_start (mouse_cut_button, false, false);
        mouse_mode_hbox->pack_start (mouse_zoom_button, false, false);
 
        if (!ARDOUR::Profile->get_trx()) {
@@ -2809,7 +2811,7 @@ Editor::setup_toolbar ()
                mouse_mode_hbox->pack_start (mouse_timefx_button, false, false);
                mouse_mode_hbox->pack_start (mouse_audition_button, false, false);
                mouse_mode_hbox->pack_start (mouse_draw_button, false, false);
-               mouse_mode_hbox->pack_start (internal_edit_button, false, false, 8);
+               mouse_mode_hbox->pack_start (internal_edit_button, false, false, 4);
        }
 
        mouse_mode_vbox->pack_start (*mouse_mode_hbox);
@@ -2819,14 +2821,7 @@ Editor::setup_toolbar ()
 
        mouse_mode_box->pack_start (*mouse_mode_align, false, false);
 
-       edit_mode_strings.push_back (edit_mode_to_string (Slide));
-       if (!Profile->get_sae()) {
-               edit_mode_strings.push_back (edit_mode_to_string (Splice));
-       }
-       edit_mode_strings.push_back (edit_mode_to_string (Lock));
-
        edit_mode_selector.set_name ("mouse mode button");
-       edit_mode_selector.set_size_request (65, -1);
        edit_mode_selector.add_elements (ArdourButton::Inset);
 
        if (!ARDOUR::Profile->get_trx()) {
@@ -2838,7 +2833,7 @@ Editor::setup_toolbar ()
        _mouse_mode_tearoff->set_name ("MouseModeBase");
        _mouse_mode_tearoff->tearoff_window().signal_key_press_event().connect (sigc::bind (sigc::ptr_fun (relay_key_press), &_mouse_mode_tearoff->tearoff_window()), false);
 
-       if (Profile->get_sae()) {
+       if (Profile->get_sae() || Profile->get_mixbus() ) {
                _mouse_mode_tearoff->set_can_be_torn_off (false);
        }
 
@@ -2880,17 +2875,20 @@ Editor::setup_toolbar ()
        zoom_out_full_button.set_related_action (act);
 
        zoom_focus_selector.set_name ("zoom button");
-       zoom_focus_selector.set_size_request (80, -1);
 //     zoom_focus_selector.add_elements (ArdourButton::Inset);
 
-       if (!ARDOUR::Profile->get_trx()) {
+       if (ARDOUR::Profile->get_mixbus()) {
                _zoom_box.pack_start (zoom_out_button, false, false);
                _zoom_box.pack_start (zoom_in_button, false, false);
                _zoom_box.pack_start (zoom_out_full_button, false, false);
-               _zoom_box.pack_start (zoom_focus_selector, false, false);
-       } else {
+       } else if (ARDOUR::Profile->get_trx()) {
                mode_box->pack_start (zoom_out_button, false, false);
                mode_box->pack_start (zoom_in_button, false, false);
+       } else {
+               _zoom_box.pack_start (zoom_out_button, false, false);
+               _zoom_box.pack_start (zoom_in_button, false, false);
+               _zoom_box.pack_start (zoom_out_full_button, false, false);
+               _zoom_box.pack_start (zoom_focus_selector, false, false);
        }
 
        /* Track zoom buttons */
@@ -2933,19 +2931,20 @@ Editor::setup_toolbar ()
                                                            &_zoom_tearoff->tearoff_window(), 0));
        } 
 
+       if (Profile->get_sae() || Profile->get_mixbus() ) {
+               _zoom_tearoff->set_can_be_torn_off (false);
+       }
+
        snap_box.set_spacing (2);
        snap_box.set_border_width (2);
 
        snap_type_selector.set_name ("mouse mode button");
-       snap_type_selector.set_size_request (140, -1);
        snap_type_selector.add_elements (ArdourButton::Inset);
 
        snap_mode_selector.set_name ("mouse mode button");
-       snap_mode_selector.set_size_request (85, -1);
        snap_mode_selector.add_elements (ArdourButton::Inset);
 
        edit_point_selector.set_name ("mouse mode button");
-       edit_point_selector.set_size_request (85, -1);
        edit_point_selector.add_elements (ArdourButton::Inset);
 
        snap_box.pack_start (snap_mode_selector, false, false);
@@ -2972,13 +2971,13 @@ Editor::setup_toolbar ()
        /* Pack everything in... */
 
        HBox* hbox = manage (new HBox);
-       hbox->set_spacing(10);
+       hbox->set_spacing(2);
 
        _tools_tearoff = manage (new TearOff (*hbox));
        _tools_tearoff->set_name ("MouseModeBase");
        _tools_tearoff->tearoff_window().signal_key_press_event().connect (sigc::bind (sigc::ptr_fun (relay_key_press), &_tools_tearoff->tearoff_window()), false);
 
-       if (Profile->get_sae()) {
+       if (Profile->get_sae() || Profile->get_mixbus()) {
                _tools_tearoff->set_can_be_torn_off (false);
        }
 
@@ -2991,7 +2990,7 @@ Editor::setup_toolbar ()
        _tools_tearoff->Visible.connect (sigc::bind (sigc::mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
                                                     &_tools_tearoff->tearoff_window(), 0));
 
-       toolbar_hbox.set_spacing (10);
+       toolbar_hbox.set_spacing (2);
        toolbar_hbox.set_border_width (1);
 
        toolbar_hbox.pack_start (*_mouse_mode_tearoff, false, false);
@@ -3032,16 +3031,21 @@ Editor::build_edit_point_menu ()
        edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtPlayhead], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtPlayhead)));
        edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtSelectedMarker], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtSelectedMarker)));
        edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtMouse], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtMouse)));
+
+       set_size_request_to_display_given_text (edit_point_selector, edit_point_strings, 30, 2);
 }
 
 void
 Editor::build_edit_mode_menu ()
 {
        using namespace Menu_Helpers;
+       
+       edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Slide], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Slide)));
+//     edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Splice], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Splice)));
+       edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Ripple], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Ripple)));
+       edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Lock], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode)  Lock)));
 
-       edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_to_string(Slide), sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Slide)));
-       edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_to_string(Splice), sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Splice)));
-       edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_to_string(Lock), sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode)  Lock)));
+       set_size_request_to_display_given_text (edit_mode_selector, edit_mode_strings, 30, 2);
 }
 
 void
@@ -3052,6 +3056,8 @@ Editor::build_snap_mode_menu ()
        snap_mode_selector.AddMenuElem (MenuElem ( snap_mode_strings[(int)SnapOff], sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_selection_done), (SnapMode) SnapOff)));
        snap_mode_selector.AddMenuElem (MenuElem ( snap_mode_strings[(int)SnapNormal], sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_selection_done), (SnapMode) SnapNormal)));
        snap_mode_selector.AddMenuElem (MenuElem ( snap_mode_strings[(int)SnapMagnetic], sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_selection_done), (SnapMode) SnapMagnetic)));
+
+       set_size_request_to_display_given_text (snap_mode_selector, snap_mode_strings, 34, 2);
 }
 
 void
@@ -3089,6 +3095,9 @@ Editor::build_snap_type_menu ()
        snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToRegionEnd], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToRegionEnd)));
        snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToRegionSync], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToRegionSync)));
        snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToRegionBoundary], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToRegionBoundary)));
+
+       set_size_request_to_display_given_text (snap_type_selector, snap_type_strings, 34, 2);
+
 }
 
 void
@@ -3096,6 +3105,7 @@ Editor::setup_tooltips ()
 {
        ARDOUR_UI::instance()->set_tip (smart_mode_button, _("Smart Mode (add Range functions to Object mode)"));
        ARDOUR_UI::instance()->set_tip (mouse_move_button, _("Object Mode (select/move Objects)"));
+       ARDOUR_UI::instance()->set_tip (mouse_cut_button, _("Cut Mode (split Regions)"));
        ARDOUR_UI::instance()->set_tip (mouse_select_button, _("Range Mode (select/move Ranges)"));
        ARDOUR_UI::instance()->set_tip (mouse_draw_button, _("Draw/Edit MIDI Notes"));
        ARDOUR_UI::instance()->set_tip (mouse_gain_button, _("Draw Region Gain"));
@@ -3352,10 +3362,11 @@ Editor::cycle_edit_mode ()
                if (Profile->get_sae()) {
                        Config->set_edit_mode (Lock);
                } else {
-                       Config->set_edit_mode (Splice);
+                       Config->set_edit_mode (Ripple);
                }
                break;
        case Splice:
+       case Ripple:
                Config->set_edit_mode (Lock);
                break;
        case Lock:
@@ -3426,6 +3437,8 @@ Editor::build_zoom_focus_menu ()
        zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusPlayhead], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusPlayhead)));
        zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusMouse], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusMouse)));
        zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusEdit], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusEdit)));
+
+       set_size_request_to_display_given_text (zoom_focus_selector, longest (zoom_focus_strings), 30, 2);
 }
 
 void
@@ -4075,8 +4088,6 @@ Editor::reset_y_origin (double y)
 void
 Editor::reset_zoom (framecnt_t spp)
 {
-       clamp_samples_per_pixel (spp);
-
        if (spp == samples_per_pixel) {
                return;
        }
@@ -4168,8 +4179,7 @@ void
 Editor::use_visual_state (VisualState& vs)
 {
        PBD::Unwinder<bool> nsv (no_save_visual, true);
-
-       _routes->suspend_redisplay ();
+       DisplaySuspender ds;
 
        vertical_adjustment.set_value (vs.y_position);
 
@@ -4185,29 +4195,34 @@ Editor::use_visual_state (VisualState& vs)
        }
 
        _routes->update_visibility ();
-       _routes->resume_redisplay ();
 }
 
 /** This is the core function that controls the zoom level of the canvas. It is called
  *  whenever one or more calls are made to reset_zoom().  It executes in an idle handler.
- *  @param fpu New frames per unit; should already have been clamped so that it is sensible.
+ *  @param spp new number of samples per pixel
  */
 void
 Editor::set_samples_per_pixel (framecnt_t spp)
 {
-       clamp_samples_per_pixel (spp);
-       samples_per_pixel = spp;
-
-       if (tempo_lines) {
-               tempo_lines->tempo_map_changed();
+       if (spp < 1) {
+               return;
        }
 
-       /* convert fpu to frame count */
+       const framecnt_t three_days = 3 * 24 * 60 * 60 * (_session ? _session->frame_rate() : 48000);
+       const framecnt_t lots_of_pixels = 4000;
 
-       framepos_t frames = samples_per_pixel * _visible_canvas_width;
+       /* if the zoom level is greater than what you'd get trying to display 3
+        * days of audio on a really big screen, then it's too big.
+        */
+
+       if (spp * lots_of_pixels > three_days) {
+               return;
+       }
+
+       samples_per_pixel = spp;
 
-       if (samples_per_pixel != zoom_range_clock->current_duration()) {
-               zoom_range_clock->set (frames);
+       if (tempo_lines) {
+               tempo_lines->tempo_map_changed();
        }
 
        bool const showing_time_selection = selection->time.length() > 0;
@@ -4538,22 +4553,14 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
 
 /** Get regions using the following method:
  *
- *  Make a region list using the selected regions, unless
- *  the edit point is `mouse' and the mouse is over an unselected
- *  region.  In this case, use just that region.
+ *  Make a region list using:
+ *   (a) any selected regions
+ *   (b) the intersection of any selected tracks and the edit point(*)
+ *   (c) if neither exists, and edit_point == mouse, then whatever region is under the mouse
  *
- *  If the edit point is not 'mouse', and there are no regions selected,
- *  search the list of selected tracks and return regions that are under
- *  the edit point on these tracks. If there are no selected tracks and
- *  'No Selection = All Tracks' is active, search all tracks,
+ *  (*) NOTE: in this case, if 'No Selection = All Tracks' is active, search all tracks
  *
- *  The rationale here is that the mouse edit point is special in that
- *  its position describes both a time and a track; the other edit
- *  modes only describe a time.  Hence if the edit point is `mouse' we
- *  ignore selected tracks, as we assume the user means something by
- *  pointing at a particular track.  Also in this case we take note of
- *  the region directly under the edit point, as there is always just one
- *  (rather than possibly several with non-mouse edit points).
+ *  Note that we have forced the rule that selected regions and selected tracks are mutually exclusive
  */
 
 RegionSelection
@@ -4561,23 +4568,15 @@ Editor::get_regions_from_selection_and_edit_point ()
 {
        RegionSelection regions;
 
-       if (_edit_point == EditAtMouse && entered_regionview && !selection->regions.contains (entered_regionview)) {
+       if (_edit_point == EditAtMouse && entered_regionview && selection->tracks.empty() && selection->regions.empty() ) {
                regions.add (entered_regionview);
        } else {
                regions = selection->regions;
        }
 
-
-       if (regions.empty() && _edit_point != EditAtMouse) {
+       if ( regions.empty() ) {
                TrackViewList tracks = selection->tracks;
 
-               if (_route_groups->all_group_active_button().get_active() && tracks.empty()) {
-                       /* tracks is empty (no track selected), and 'No Selection = All Tracks'
-                        * is enabled, so consider all tracks
-                        */
-                       tracks = track_views; 
-               }
-
                if (!tracks.empty()) {
                        /* no region selected or entered, but some selected tracks:
                         * act on all regions on the selected tracks at the edit point
@@ -4586,6 +4585,43 @@ Editor::get_regions_from_selection_and_edit_point ()
                        get_regions_at(regions, where, tracks);
                }
        }
+
+       return regions;
+}
+
+/** Get regions using the following method:
+ *
+ *  Make a region list using:
+ *   (a) any selected regions
+ *   (b) the intersection of any selected tracks and the edit point(*)
+ *   (c) if neither exists, then whatever region is under the mouse
+ *
+ *  (*) NOTE: in this case, if 'No Selection = All Tracks' is active, search all tracks
+ *
+ *  Note that we have forced the rule that selected regions and selected tracks are mutually exclusive
+ */
+RegionSelection
+Editor::get_regions_from_selection_and_mouse (framepos_t pos)
+{
+       RegionSelection regions;
+
+       if (entered_regionview && selection->tracks.empty() && selection->regions.empty() ) {
+               regions.add (entered_regionview);
+       } else {
+               regions = selection->regions;
+       }
+
+       if ( regions.empty() ) {
+               TrackViewList tracks = selection->tracks;
+
+               if (!tracks.empty()) {
+                       /* no region selected or entered, but some selected tracks:
+                        * act on all regions on the selected tracks at the edit point
+                        */ 
+                       get_regions_at(regions, pos, tracks);
+               }
+       }
+
        return regions;
 }
 
@@ -4876,6 +4912,10 @@ Editor::add_routes (RouteList& routes)
 void
 Editor::timeaxisview_deleted (TimeAxisView *tv)
 {
+       if (tv == entered_track) {
+               entered_track = 0;
+       }
+
        if (_session && _session->deletion_in_progress()) {
                /* the situation is under control */
                return;
@@ -4887,10 +4927,6 @@ Editor::timeaxisview_deleted (TimeAxisView *tv)
 
        _routes->route_removed (tv);
 
-       if (tv == entered_track) {
-               entered_track = 0;
-       }
-
        TimeAxisView::Children c = tv->get_child_list ();
        for (TimeAxisView::Children::const_iterator i = c.begin(); i != c.end(); ++i) {
                if (entered_track == i->get()) {
@@ -5322,7 +5358,6 @@ Editor::session_going_away ()
        }
        track_views.clear ();
 
-       zoom_range_clock->set_session (0);
        nudge_clock->set_session (0);
 
        editor_list_button.set_active(false);
@@ -5508,5 +5543,9 @@ Editor::ui_parameter_changed (string parameter)
                        _cursor_stack.pop();
                }
                _cursors->set_cursor_set (ARDOUR_UI::config()->get_icon_set());
+       } else if (parameter == "draggable-playhead") {
+               if (_verbose_cursor) {
+                       playhead_cursor->set_sensitive (ARDOUR_UI::config()->get_draggable_playhead());
+               }
        }
 }