Relent a bit and make adding a route to a group which already contains that group...
[ardour.git] / gtk2_ardour / editor.cc
index 8b98273229761da22522113dd406425291c4dfdb..3c7bd3f37c7e2373d4c3d914c5c7d5421c41a7f8 100644 (file)
@@ -220,8 +220,10 @@ show_me_the_size (Requisition* r, const char* what)
 }
 
 Editor::Editor ()
+       : _join_object_range_state (JOIN_OBJECT_RANGE_NONE)
+
          /* time display buttons */
-       : minsec_label (_("Mins:Secs"))
+       , minsec_label (_("Mins:Secs"))
        , bbt_label (_("Bars:Beats"))
        , timecode_label (_("Timecode"))
        , frame_label (_("Samples"))
@@ -279,7 +281,7 @@ Editor::Editor ()
        clicked_crossfadeview = 0;
        clicked_control_point = 0;
        last_update_frame = 0;
-       _drag = 0;
+       _drags = new DragManager (this);
        current_mixer_strip = 0;
        current_bbt_points = 0;
        tempo_lines = 0;
@@ -310,7 +312,6 @@ Editor::Editor ()
        _show_waveforms_recording = true;
        show_gain_after_trim = false;
        verbose_cursor_on = true;
-       route_removal = false;
        last_item_entered = 0;
        last_item_entered_n = 0;
 
@@ -577,12 +578,11 @@ Editor::Editor ()
        summary_frame->add (*_summary);
        summary_frame->show ();
 
-       HBox* summary_hbox = manage (new HBox);
-       summary_hbox->pack_start (*summary_arrows_left, false, false);
-       summary_hbox->pack_start (*summary_frame, true, true);
-       summary_hbox->pack_start (*summary_arrows_right, false, false);
+       _summary_hbox.pack_start (*summary_arrows_left, false, false);
+       _summary_hbox.pack_start (*summary_frame, true, true);
+       _summary_hbox.pack_start (*summary_arrows_right, false, false);
        
-       editor_summary_pane->pack2(*summary_hbox);
+       editor_summary_pane->pack2 (_summary_hbox);
 
        edit_pane.pack1 (*editor_summary_pane, true, true);
        edit_pane.pack2 (the_notebook, false, true);
@@ -689,6 +689,8 @@ Editor::Editor ()
 
        Config->ParameterChanged.connect (*this, ui_bind (&Editor::parameter_changed, this, _1), gui_context());
 
+       TimeAxisView::CatchDeletion.connect (*this, ui_bind (&Editor::timeaxisview_deleted, this, _1), gui_context());
+
        _last_normalization_value = 0;
 
        constructed = true;
@@ -712,7 +714,7 @@ Editor::~Editor()
        delete _routes;
        delete _route_groups;
        delete track_canvas;
-       delete _drag;
+       delete _drags;
 }
 
 void
@@ -729,10 +731,8 @@ Editor::catch_vanishing_regionview (RegionView *rv)
           audioregionview by itself.
        */
 
-       if (_drag && rv->get_canvas_group() == _drag->item() && !_drag->ending()) {
-               _drag->end_grab (0);
-               delete _drag;
-               _drag = 0;
+       if (_drags->active() && _drags->have_item (rv->get_canvas_group()) && !_drags->ending()) {
+               _drags->abort ();
        }
 
        if (clicked_regionview == rv) {
@@ -1620,9 +1620,9 @@ Editor::add_crossfade_context_items (AudioStreamView* /*view*/, boost::shared_pt
        if (xfade->can_follow_overlap()) {
 
                if (xfade->following_overlap()) {
-                       str = _("Convert to short");
+                       str = _("Convert to Short");
                } else {
-                       str = _("Convert to full");
+                       str = _("Convert to Full");
                }
 
                items.push_back (MenuElem (str, sigc::bind (sigc::mem_fun(*this, &Editor::toggle_xfade_length), xfade)));
@@ -1679,22 +1679,22 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi
                region_menu->signal_map_event().connect (
                        sigc::bind (sigc::mem_fun(*this, &Editor::set_selected_regionview_from_map_event), sv, boost::weak_ptr<Region>(region)));
 
-               items.push_back (MenuElem (_("Rename"), sigc::mem_fun(*this, &Editor::rename_region)));
+               items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &Editor::rename_region)));
                if (mr && internal_editing()) {
                        items.push_back (MenuElem (_("List editor..."), sigc::mem_fun(*this, &Editor::show_midi_list_editor)));
                } else {
-                       items.push_back (MenuElem (_("Region editor"), sigc::mem_fun(*this, &Editor::edit_region)));
+                       items.push_back (MenuElem (_("Region Properties..."), sigc::mem_fun(*this, &Editor::edit_region)));
                }
        }
 
-       items.push_back (MenuElem (_("Raise to top layer"), sigc::mem_fun(*this, &Editor::raise_region_to_top)));
-       items.push_back (MenuElem (_("Lower to bottom layer"), sigc::mem_fun  (*this, &Editor::lower_region_to_bottom)));
+       items.push_back (MenuElem (_("Raise to Top Layer"), sigc::mem_fun(*this, &Editor::raise_region_to_top)));
+       items.push_back (MenuElem (_("Lower to Bottom Layer"), sigc::mem_fun  (*this, &Editor::lower_region_to_bottom)));
        items.push_back (SeparatorElem());
-       items.push_back (MenuElem (_("Define sync point"), sigc::mem_fun(*this, &Editor::set_region_sync_from_edit_point)));
+       items.push_back (MenuElem (_("Define Sync Point"), sigc::mem_fun(*this, &Editor::set_region_sync_from_edit_point)));
        if (_edit_point == EditAtMouse) {
                items.back ().set_sensitive (false);
        }
-       items.push_back (MenuElem (_("Remove sync point"), sigc::mem_fun(*this, &Editor::remove_region_sync)));
+       items.push_back (MenuElem (_("Remove Sync Point"), sigc::mem_fun(*this, &Editor::remove_region_sync)));
        items.push_back (SeparatorElem());
 
        items.push_back (MenuElem (_("Audition"), sigc::mem_fun(*this, &Editor::play_selected_region)));
@@ -1723,7 +1723,7 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi
        }
        region_lock_item->signal_activate().connect (sigc::mem_fun(*this, &Editor::toggle_region_lock));
 
-       items.push_back (CheckMenuElem (_("Glue to Bars&Beats")));
+       items.push_back (CheckMenuElem (_("Glue to Bars and Beats")));
        CheckMenuItem* bbt_glue_item = static_cast<CheckMenuItem*>(&items.back());
 
        switch (region_to_check->positional_lock_style()) {
@@ -1757,7 +1757,7 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi
                }
        }
 
-       items.push_back (CheckMenuElem (_("Original position"), sigc::mem_fun(*this, &Editor::naturalize)));
+       items.push_back (CheckMenuElem (_("Original Position"), sigc::mem_fun(*this, &Editor::naturalize)));
        if (region_to_check->at_natural_position()) {
                items.back().set_sensitive (false);
        }
@@ -1825,10 +1825,10 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi
        MenuList& nudge_items = nudge_menu->items();
        nudge_menu->set_name ("ArdourContextMenu");
 
-       nudge_items.push_back (MenuElem (_("Nudge fwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), false, false))));
-       nudge_items.push_back (MenuElem (_("Nudge bwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), false, false))));
-       nudge_items.push_back (MenuElem (_("Nudge fwd by capture offset"), (sigc::mem_fun(*this, &Editor::nudge_forward_capture_offset))));
-       nudge_items.push_back (MenuElem (_("Nudge bwd by capture offset"), (sigc::mem_fun(*this, &Editor::nudge_backward_capture_offset))));
+       nudge_items.push_back (MenuElem (_("Nudge Forward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), false, false))));
+       nudge_items.push_back (MenuElem (_("Nudge Backward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), false, false))));
+       nudge_items.push_back (MenuElem (_("Nudge Forward by Capture Offset"), (sigc::mem_fun(*this, &Editor::nudge_forward_capture_offset))));
+       nudge_items.push_back (MenuElem (_("Nudge Backward by Capture Offset"), (sigc::mem_fun(*this, &Editor::nudge_backward_capture_offset))));
 
        items.push_back (MenuElem (_("Nudge"), *nudge_menu));
        items.push_back (SeparatorElem());
@@ -1837,18 +1837,18 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi
        MenuList& trim_items = trim_menu->items();
        trim_menu->set_name ("ArdourContextMenu");
 
-       trim_items.push_back (MenuElem (_("Start to edit point"), sigc::mem_fun(*this, &Editor::trim_region_from_edit_point)));
+       trim_items.push_back (MenuElem (_("Start to Edit Point"), sigc::mem_fun(*this, &Editor::trim_region_from_edit_point)));
        foo_item = &trim_items.back();
        if (_edit_point == EditAtMouse) {
                foo_item->set_sensitive (false);
        }
-       trim_items.push_back (MenuElem (_("Edit point to end"), sigc::mem_fun(*this, &Editor::trim_region_to_edit_point)));
+       trim_items.push_back (MenuElem (_("Edit Point to End"), sigc::mem_fun(*this, &Editor::trim_region_to_edit_point)));
        foo_item = &trim_items.back();
        if (_edit_point == EditAtMouse) {
                foo_item->set_sensitive (false);
        }
-       trim_items.push_back (MenuElem (_("Trim To Loop"), sigc::mem_fun(*this, &Editor::trim_region_to_loop)));
-       trim_items.push_back (MenuElem (_("Trim To Punch"), sigc::mem_fun(*this, &Editor::trim_region_to_punch)));
+       trim_items.push_back (MenuElem (_("Trim to Loop"), sigc::mem_fun(*this, &Editor::trim_region_to_loop)));
+       trim_items.push_back (MenuElem (_("Trim to Punch"), sigc::mem_fun(*this, &Editor::trim_region_to_punch)));
 
        items.push_back (MenuElem (_("Trim"), *trim_menu));
        items.push_back (SeparatorElem());
@@ -1860,7 +1860,7 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi
                region_edit_menu_split_item->set_sensitive (false);
        }
 
-       items.push_back (MenuElem (_("Make mono regions"), (sigc::mem_fun(*this, &Editor::split_multichannel_region))));
+       items.push_back (MenuElem (_("Make Mono Regions"), (sigc::mem_fun(*this, &Editor::split_multichannel_region))));
        region_edit_menu_split_multichannel_item = &items.back();
 
        items.push_back (MenuElem (_("Duplicate"), (sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), false))));
@@ -1878,7 +1878,7 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi
        */
 
        string::size_type pos = 0;
-       string menu_item_name = (region) ? region->name() : _("Selected regions");
+       string menu_item_name = (region) ? region->name() : _("Selected Regions");
 
        while ((pos = menu_item_name.find ("_", pos)) != string::npos) {
                menu_item_name.replace (pos, 1, "__");
@@ -1948,9 +1948,9 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
        MenuList& play_items = play_menu->items();
        play_menu->set_name ("ArdourContextMenu");
 
-       play_items.push_back (MenuElem (_("Play from edit point"), sigc::mem_fun(*this, &Editor::play_from_edit_point)));
-       play_items.push_back (MenuElem (_("Play from start"), sigc::mem_fun(*this, &Editor::play_from_start)));
-       play_items.push_back (MenuElem (_("Play region"), sigc::mem_fun(*this, &Editor::play_selected_region)));
+       play_items.push_back (MenuElem (_("Play From Edit Point"), sigc::mem_fun(*this, &Editor::play_from_edit_point)));
+       play_items.push_back (MenuElem (_("Play From Start"), sigc::mem_fun(*this, &Editor::play_from_start)));
+       play_items.push_back (MenuElem (_("Play Region"), sigc::mem_fun(*this, &Editor::play_selected_region)));
        play_items.push_back (SeparatorElem());
        play_items.push_back (MenuElem (_("Loop Region"), sigc::mem_fun(*this, &Editor::loop_selected_region)));
 
@@ -1962,21 +1962,21 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
        MenuList& select_items = select_menu->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 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 (_("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 (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());
-       select_items.push_back (MenuElem (_("Set range to loop range"), sigc::mem_fun(*this, &Editor::set_selection_from_loop)));
-       select_items.push_back (MenuElem (_("Set range to punch range"), sigc::mem_fun(*this, &Editor::set_selection_from_punch)));
+       select_items.push_back (MenuElem (_("Set Range to Loop Range"), sigc::mem_fun(*this, &Editor::set_selection_from_loop)));
+       select_items.push_back (MenuElem (_("Set Range to Punch Range"), sigc::mem_fun(*this, &Editor::set_selection_from_punch)));
        select_items.push_back (SeparatorElem());
        select_items.push_back (MenuElem (_("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true)));
        select_items.push_back (MenuElem (_("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false)));
        select_items.push_back (MenuElem (_("Select All After Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
        select_items.push_back (MenuElem (_("Select All Before Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)));
-       select_items.push_back (MenuElem (_("Select All Between Playhead & Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), false)));
-       select_items.push_back (MenuElem (_("Select All Within Playhead & Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), true)));
-       select_items.push_back (MenuElem (_("Select Range Between Playhead & Edit Point"), sigc::mem_fun(*this, &Editor::select_range_between)));
+       select_items.push_back (MenuElem (_("Select All Between Playhead and Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), false)));
+       select_items.push_back (MenuElem (_("Select All Within Playhead and Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), true)));
+       select_items.push_back (MenuElem (_("Select Range Between Playhead and Edit Point"), sigc::mem_fun(*this, &Editor::select_range_between)));
 
        edit_items.push_back (MenuElem (_("Select"), *select_menu));
 
@@ -1995,8 +1995,6 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
        cutnpaste_items.push_back (MenuElem (_("Align"), sigc::bind (sigc::mem_fun(*this, &Editor::align), ARDOUR::SyncPoint)));
        cutnpaste_items.push_back (MenuElem (_("Align Relative"), sigc::bind (sigc::mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint)));
 
-       cutnpaste_items.push_back (SeparatorElem());
-
        edit_items.push_back (MenuElem (_("Edit"), *cutnpaste_menu));
 
        /* Adding new material */
@@ -2012,10 +2010,10 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
        nudge_menu->set_name ("ArdourContextMenu");
 
        edit_items.push_back (SeparatorElem());
-       nudge_items.push_back (MenuElem (_("Nudge entire track fwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), false, true))));
-       nudge_items.push_back (MenuElem (_("Nudge track after edit point fwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), true, true))));
-       nudge_items.push_back (MenuElem (_("Nudge entire track bwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), false, false))));
-       nudge_items.push_back (MenuElem (_("Nudge track after edit point bwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), true, false))));
+       nudge_items.push_back (MenuElem (_("Nudge Entire Track Forward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), false, true))));
+       nudge_items.push_back (MenuElem (_("Nudge Track After Edit Point Forward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), true, true))));
+       nudge_items.push_back (MenuElem (_("Nudge Entire Track Backward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), false, false))));
+       nudge_items.push_back (MenuElem (_("Nudge Track After Edit Point Backward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), true, false))));
 
        edit_items.push_back (MenuElem (_("Nudge"), *nudge_menu));
 }
@@ -2031,8 +2029,8 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
        MenuList& play_items = play_menu->items();
        play_menu->set_name ("ArdourContextMenu");
 
-       play_items.push_back (MenuElem (_("Play from edit point"), sigc::mem_fun(*this, &Editor::play_from_edit_point)));
-       play_items.push_back (MenuElem (_("Play from start"), sigc::mem_fun(*this, &Editor::play_from_start)));
+       play_items.push_back (MenuElem (_("Play From Edit Point"), sigc::mem_fun(*this, &Editor::play_from_edit_point)));
+       play_items.push_back (MenuElem (_("Play From Start"), sigc::mem_fun(*this, &Editor::play_from_start)));
        edit_items.push_back (MenuElem (_("Play"), *play_menu));
 
        /* Selection */
@@ -2041,15 +2039,15 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
        MenuList& select_items = select_menu->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 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 (_("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 (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());
-       select_items.push_back (MenuElem (_("Select all after edit point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true)));
-       select_items.push_back (MenuElem (_("Select all before edit point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false)));
-       select_items.push_back (MenuElem (_("Select all after playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
-       select_items.push_back (MenuElem (_("Select all before playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)));
+       select_items.push_back (MenuElem (_("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true)));
+       select_items.push_back (MenuElem (_("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false)));
+       select_items.push_back (MenuElem (_("Select All After Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
+       select_items.push_back (MenuElem (_("Select All Before Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)));
 
        edit_items.push_back (MenuElem (_("Select"), *select_menu));
 
@@ -2068,10 +2066,10 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
        nudge_menu->set_name ("ArdourContextMenu");
 
        edit_items.push_back (SeparatorElem());
-       nudge_items.push_back (MenuElem (_("Nudge entire track fwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), false, true))));
-       nudge_items.push_back (MenuElem (_("Nudge track after edit point fwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), true, true))));
-       nudge_items.push_back (MenuElem (_("Nudge entire track bwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), false, false))));
-       nudge_items.push_back (MenuElem (_("Nudge track after edit point bwd"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), true, false))));
+       nudge_items.push_back (MenuElem (_("Nudge Entire Track Forward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), false, true))));
+       nudge_items.push_back (MenuElem (_("Nudge Track After Edit Point Forward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), true, true))));
+       nudge_items.push_back (MenuElem (_("Nudge Entire Track Backward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), false, false))));
+       nudge_items.push_back (MenuElem (_("Nudge Track After Edit Point Backward"), (sigc::bind (sigc::mem_fun(*this, &Editor::nudge_track), true, false))));
 
        edit_items.push_back (MenuElem (_("Nudge"), *nudge_menu));
 }
@@ -2288,10 +2286,8 @@ Editor::set_state (const XMLNode& node, int /*version*/)
 
        if ((prop = node.property ("mouse-mode"))) {
                MouseMode m = str2mousemode(prop->value());
-               mouse_mode = MouseMode ((int) m + 1); /* lie, force mode switch */
                set_mouse_mode (m, true);
        } else {
-               mouse_mode = MouseGain; /* lie, to force the mode switch */
                set_mouse_mode (MouseObject, true);
        }
 
@@ -2314,6 +2310,10 @@ Editor::set_state (const XMLNode& node, int /*version*/)
                }
        }
 
+       if ((prop = node.property ("join-object-range"))) {
+               join_object_range_button.set_active (string_is_affirmative (prop->value ()));
+       }
+
        if ((prop = node.property ("edit-point"))) {
                set_edit_point_preference ((EditPoint) string_2_enum (prop->value(), _edit_point), true);
        }
@@ -2461,6 +2461,7 @@ Editor::get_state ()
        node->add_property ("region-list-sort-type", enum2str (_regions->sort_type ()));
        node->add_property ("mouse-mode", enum2str(mouse_mode));
        node->add_property ("internal-edit", _internal_editing ? "yes" : "no");
+       node->add_property ("join-object-range", join_object_range_button.get_active () ? "yes" : "no");
 
        Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
        if (act) {
@@ -2501,12 +2502,12 @@ Editor::trackview_by_y_position (double y)
 /** Snap a position to the grid, if appropriate, taking into account current
  *  grid settings and also the state of any snap modifier keys that may be pressed.
  *  @param start Position to snap.
- *  @param event Event to get current key modifier information from.
+ *  @param event Event to get current key modifier information from, or 0.
  */
 void
 Editor::snap_to_with_modifier (nframes64_t& start, GdkEvent const * event, int32_t direction, bool for_mark)
 {
-       if (!_session) {
+       if (!_session || !event) {
                return;
        }
 
@@ -2752,24 +2753,45 @@ Editor::setup_toolbar ()
        mouse_timefx_button.set_relief(Gtk::RELIEF_NONE);
        mouse_audition_button.set_relief(Gtk::RELIEF_NONE);
        // internal_edit_button.set_relief(Gtk::RELIEF_NONE);
+       join_object_range_button.set_relief(Gtk::RELIEF_NONE);
 
        HBox* mode_box = manage(new HBox);
        mode_box->set_border_width (2);
        mode_box->set_spacing(4);
-       mouse_mode_button_box.set_spacing(1);
-       mouse_mode_button_box.pack_start(mouse_move_button, true, true);
-       if (!Profile->get_sae()) {
-               mouse_mode_button_box.pack_start(mouse_select_button, true, true);
+
+       /* table containing mode buttons */
+
+       Table* mouse_mode_button_table = manage (new Table (Profile->get_sae() ? 4 : 6, 2));
+
+       int c = 0;
+
+       if (Profile->get_sae()) {
+               mouse_mode_button_table->attach (mouse_move_button, c, c + 1, 0, 1);
+               ++c;
+       } else {
+               mouse_mode_button_table->attach (mouse_move_button, c, c + 1, 0, 1);
+               mouse_mode_button_table->attach (mouse_select_button, c + 1, c + 2, 0, 1);
+               mouse_mode_button_table->attach (join_object_range_button, c, c + 2, 1, 2);
+               c += 2;
        }
-       mouse_mode_button_box.pack_start(mouse_zoom_button, true, true);
+
+       mouse_mode_button_table->attach (mouse_zoom_button, c, c + 1, 0, 1);
+       ++c;
+       
        if (!Profile->get_sae()) {
-               mouse_mode_button_box.pack_start(mouse_gain_button, true, true);
+               mouse_mode_button_table->attach (mouse_gain_button, c, c + 1, 0, 1);
+               ++c;
        }
-       mouse_mode_button_box.pack_start(mouse_timefx_button, true, true);
-       mouse_mode_button_box.pack_start(mouse_audition_button, true, true);
-       mouse_mode_button_box.pack_start(internal_edit_button, true, true);
-       mouse_mode_button_box.set_homogeneous(true);
-
+       
+       mouse_mode_button_table->attach (mouse_timefx_button, c, c + 1, 0, 1);
+       ++c;
+       
+       mouse_mode_button_table->attach (mouse_audition_button, c, c + 1, 0, 1);
+       ++c;
+       
+       mouse_mode_button_table->attach (internal_edit_button, c, c + 1, 0, 1);
+       ++c;
+       
        vector<string> edit_mode_strings;
        edit_mode_strings.push_back (edit_mode_to_string (Slide));
        if (!Profile->get_sae()) {
@@ -2781,8 +2803,8 @@ Editor::setup_toolbar ()
        set_popdown_strings (edit_mode_selector, edit_mode_strings, true);
        edit_mode_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::edit_mode_selection_done));
 
-       mode_box->pack_start(edit_mode_selector);
-       mode_box->pack_start(mouse_mode_button_box);
+       mode_box->pack_start (edit_mode_selector);
+       mode_box->pack_start (*mouse_mode_button_table);
 
        mouse_mode_tearoff = manage (new TearOff (*mode_box));
        mouse_mode_tearoff->set_name ("MouseModeBase");
@@ -2807,6 +2829,7 @@ Editor::setup_toolbar ()
        mouse_zoom_button.set_mode (false);
        mouse_timefx_button.set_mode (false);
        mouse_audition_button.set_mode (false);
+       join_object_range_button.set_mode (false);
 
        mouse_move_button.set_name ("MouseModeButton");
        mouse_select_button.set_name ("MouseModeButton");
@@ -2814,8 +2837,8 @@ Editor::setup_toolbar ()
        mouse_zoom_button.set_name ("MouseModeButton");
        mouse_timefx_button.set_name ("MouseModeButton");
        mouse_audition_button.set_name ("MouseModeButton");
-
        internal_edit_button.set_name ("MouseModeButton");
+       join_object_range_button.set_name ("MouseModeButton");
 
        mouse_move_button.unset_flags (CAN_FOCUS);
        mouse_select_button.unset_flags (CAN_FOCUS);
@@ -2824,6 +2847,7 @@ Editor::setup_toolbar ()
        mouse_timefx_button.unset_flags (CAN_FOCUS);
        mouse_audition_button.unset_flags (CAN_FOCUS);
        internal_edit_button.unset_flags (CAN_FOCUS);
+       join_object_range_button.unset_flags (CAN_FOCUS);
 
        /* Zoom */
 
@@ -4301,32 +4325,12 @@ Editor::idle_visual_changer ()
                vertical_adjustment.set_value (pending_visual_change.y_origin);
        }
 
-       nframes64_t csf=0, cef=0;
-       nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
-
-       if (_session) {
-               csf = _session->current_start_frame();
-               cef = _session->current_end_frame();
-       }
-
-       /* if we seek beyond the current end of the canvas, move the end */
-
-
-       if (last_time_origin == horizontal_adjustment.get_value() ) {
+       if (last_time_origin == horizontal_adjustment.get_value()) {
                /* changed signal not emitted */
                update_fixed_rulers ();
                redisplay_tempo (true);
        }
 
-       if (current_time_origin != pending_visual_change.time_origin) {
-               cef += current_page_frames() / 10; // Add a little extra so we can see the end marker
-               horizontal_adjustment.set_upper (cef / frames_per_unit);
-               horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit);
-       } else {
-               update_fixed_rulers();
-               redisplay_tempo (true);
-       }
-
        _summary->set_overlays_dirty ();
 
        // cerr << "Editor::idle_visual_changer () called ha v:l:u:ps:fpu = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << frames_per_unit << endl;//DEBUG
@@ -4723,7 +4727,7 @@ Editor::idle_resize ()
 void
 Editor::located ()
 {
-       ENSURE_GUI_THREAD (*this, &Editor::located)
+       ENSURE_GUI_THREAD (*this, &Editor::located);
 
        _pending_locate_request = false;
 }
@@ -4804,8 +4808,6 @@ Editor::handle_new_route (RouteList& routes)
 
                rtv->view()->RegionViewAdded.connect (sigc::mem_fun (*this, &Editor::region_view_added));
                rtv->view()->HeightChanged.connect (sigc::mem_fun (*this, &Editor::streamview_height_changed));
-
-               rtv->GoingAway.connect (*this, boost::bind (&Editor::remove_route, this, rtv), gui_context());
        }
 
        _routes->routes_added (new_views);
@@ -4820,49 +4822,62 @@ Editor::handle_new_route (RouteList& routes)
 }
 
 void
-Editor::remove_route (TimeAxisView *tv)
+Editor::timeaxisview_deleted (TimeAxisView *tv)
 {
-       ENSURE_GUI_THREAD (*this, &Editor::remove_route, tv)
-
-       TrackViewList::iterator i;
-
-       boost::shared_ptr<Route> route;
-       RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (tv);
-       if (rtav) {
-               route = rtav->route ();
+       if (_session && _session->deletion_in_progress()) {
+               /* the situation is under control */
+               return;
        }
+
+       ENSURE_GUI_THREAD (*this, &Editor::timeaxisview_deleted, tv);
                
-       TimeAxisView* next_tv = 0;
+
+       _routes->route_removed (tv);
 
        if (tv == entered_track) {
                entered_track = 0;
        }
+       
+       /* remove it from the list of track views */
+
+       TrackViewList::iterator i;
 
        if ((i = find (track_views.begin(), track_views.end(), tv)) != track_views.end()) {
+               i = track_views.erase (i);
+       }
 
-               i = track_views.erase (i);
+       /* update whatever the current mixer strip is displaying, if revelant */
 
-               if (track_views.empty()) {
-                       next_tv = 0;
-               } else if (i == track_views.end()) {
-                       next_tv = track_views.front();
-               } else {
-                      next_tv = (*i);
-               }
-       }
+       boost::shared_ptr<Route> route;
+       RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (tv);
+
+       if (rtav) {
+               route = rtav->route ();
+       } 
 
        if (current_mixer_strip && current_mixer_strip->route() == route) {
 
-               if (next_tv) {
-                       set_selected_mixer_strip (*next_tv);
-               } else {
-                       /* make the editor mixer strip go away setting the
-                        * button to inactive (which also unticks the menu option)
-                        */
+               TimeAxisView* next_tv;
 
-                       ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer");
-               }
-       }
+               if (track_views.empty()) {
+                       next_tv = 0;
+               } else if (i == track_views.end()) {
+                       next_tv = track_views.front();
+               } else {
+                       next_tv = (*i);
+               }
+               
+               
+               if (next_tv) {
+                       set_selected_mixer_strip (*next_tv);
+               } else {
+                       /* make the editor mixer strip go away setting the
+                        * button to inactive (which also unticks the menu option)
+                        */
+                       
+                       ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer");
+               }
+       } 
 }
 
 void