Remove internal edit mode and add "content" tool.
[ardour.git] / gtk2_ardour / editor_actions.cc
index 2dde2b1977128cca913bc2c2d6a43e13d2f07db0..7c3365f91be0c8c213650591af2fb83cf11af2b1 100644 (file)
 #include <gio/gio.h>
 #include <gtk/gtkiconfactory.h>
 
-
-#include "pbd/filesystem.h"
 #include "pbd/file_utils.h"
-#include "pbd/search_path.h"
 
 #include "gtkmm2ext/tearoff.h"
+#include "gtkmm2ext/utils.h"
 
-#include "ardour/ardour.h"
 #include "ardour/filesystem_paths.h"
 #include "ardour/profile.h"
 #include "ardour/session.h"
+#include "ardour/types.h"
+
+#include "canvas/canvas.h"
+#include "canvas/pixbuf.h"
 
 #include "actions.h"
 #include "ardour_ui.h"
@@ -49,6 +50,7 @@ using namespace Gtk;
 using namespace Glib;
 using namespace std;
 using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Editing;
 
@@ -82,65 +84,66 @@ Editor::register_actions ()
        RefPtr<Action> act;
 
        editor_actions = ActionGroup::create (X_("Editor"));
+       editor_menu_actions = ActionGroup::create (X_("EditorMenu"));
 
        /* non-operative menu items for menu bar */
 
-       ActionManager::register_action (editor_actions, X_("AlignMenu"), _("Align"));
-       ActionManager::register_action (editor_actions, X_("Autoconnect"), _("Autoconnect"));
-       ActionManager::register_action (editor_actions, X_("Crossfades"), _("Crossfades"));
-       ActionManager::register_action (editor_actions, X_("Edit"), _("Edit"));
-       ActionManager::register_action (editor_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker"));
-       ActionManager::register_action (editor_actions, X_("EditSelectRangeOptions"), _("Select Range Operations"));
-       ActionManager::register_action (editor_actions, X_("EditSelectRegionOptions"), _("Select Regions"));
-       ActionManager::register_action (editor_actions, X_("EditPointMenu"), _("Edit Point"));
-       ActionManager::register_action (editor_actions, X_("FadeMenu"), _("Fade"));
-       ActionManager::register_action (editor_actions, X_("LatchMenu"), _("Latch"));
-       ActionManager::register_action (editor_actions, X_("RegionMenu"), _("Region"));
-       ActionManager::register_action (editor_actions, X_("RegionMenuLayering"), _("Layering"));
-       ActionManager::register_action (editor_actions, X_("RegionMenuPosition"), _("Position"));
-       ActionManager::register_action (editor_actions, X_("RegionMenuEdit"), _("Edit"));
-       ActionManager::register_action (editor_actions, X_("RegionMenuTrim"), _("Trim"));
-       ActionManager::register_action (editor_actions, X_("RegionMenuGain"), _("Gain"));
-       ActionManager::register_action (editor_actions, X_("RegionMenuRanges"), _("Ranges"));
-       ActionManager::register_action (editor_actions, X_("RegionMenuFades"), _("Fades"));
-       ActionManager::register_action (editor_actions, X_("RegionMenuMIDI"), _("MIDI"));
-       ActionManager::register_action (editor_actions, X_("RegionMenuDuplicate"), _("Duplicate"));
-       ActionManager::register_action (editor_actions, X_("Link"), _("Link"));
-       ActionManager::register_action (editor_actions, X_("ZoomFocusMenu"), _("Zoom Focus"));
-       ActionManager::register_action (editor_actions, X_("LocateToMarker"), _("Locate to Markers"));
-       ActionManager::register_action (editor_actions, X_("MarkerMenu"), _("Markers"));
-       ActionManager::register_action (editor_actions, X_("MeterFalloff"), _("Meter falloff"));
-       ActionManager::register_action (editor_actions, X_("MeterHold"), _("Meter hold"));
-       ActionManager::register_action (editor_actions, X_("MIDI"), _("MIDI Options"));
-       ActionManager::register_action (editor_actions, X_("MiscOptions"), _("Misc Options"));
-       ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring"));
-       ActionManager::register_action (editor_actions, X_("MoveActiveMarkMenu"), _("Active Mark"));
-       ActionManager::register_action (editor_actions, X_("MovePlayHeadMenu"), _("Playhead"));
-       ActionManager::register_action (editor_actions, X_("PlayMenu"), _("Play"));
-       ActionManager::register_action (editor_actions, X_("PrimaryClockMenu"), _("Primary Clock"));
-       ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown"));
-       ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations"));
-       ActionManager::register_action (editor_actions, X_("RegionGainMenu"), _("Gain"));
-       ActionManager::register_action (editor_actions, X_("RulerMenu"), _("Rulers"));
-       ActionManager::register_action (editor_actions, X_("SavedViewMenu"), _("Views"));
-       ActionManager::register_action (editor_actions, X_("ScrollMenu"), _("Scroll"));
-       ActionManager::register_action (editor_actions, X_("SecondaryClockMenu"), _("Secondary Clock"));
-       ActionManager::register_action (editor_actions, X_("Select"), _("Select"));
-       ActionManager::register_action (editor_actions, X_("SelectMenu"), _("Select"));
-       ActionManager::register_action (editor_actions, X_("SeparateMenu"), _("Separate"));
-       ActionManager::register_action (editor_actions, X_("SetLoopMenu"), _("Loop"));
-       ActionManager::register_action (editor_actions, X_("SetPunchMenu"), _("Punch"));
-       ActionManager::register_action (editor_actions, X_("Solo"), _("Solo"));
-       ActionManager::register_action (editor_actions, X_("Subframes"), _("Subframes"));
-       ActionManager::register_action (editor_actions, X_("SyncMenu"), _("Sync"));
-       ActionManager::register_action (editor_actions, X_("TempoMenu"), _("Tempo"));
-       ActionManager::register_action (editor_actions, X_("Timecode"), _("Timecode fps"));
-       ActionManager::register_action (editor_actions, X_("TrackHeightMenu"), _("Height"));
-       ActionManager::register_action (editor_actions, X_("TrackMenu"), _("Track"));
-       ActionManager::register_action (editor_actions, X_("Tools"), _("Tools"));
-       ActionManager::register_action (editor_actions, X_("View"), _("View"));
-       ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("Zoom Focus"));
-       ActionManager::register_action (editor_actions, X_("ZoomMenu"), _("Zoom"));
+       ActionManager::register_action (editor_menu_actions, X_("AlignMenu"), _("Align"));
+       ActionManager::register_action (editor_menu_actions, X_("Autoconnect"), _("Autoconnect"));
+       ActionManager::register_action (editor_menu_actions, X_("Crossfades"), _("Crossfades"));
+       ActionManager::register_action (editor_menu_actions, X_("Edit"), _("Edit"));
+       ActionManager::register_action (editor_menu_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker"));
+       ActionManager::register_action (editor_menu_actions, X_("EditSelectRangeOptions"), _("Select Range Operations"));
+       ActionManager::register_action (editor_menu_actions, X_("EditSelectRegionOptions"), _("Select Regions"));
+       ActionManager::register_action (editor_menu_actions, X_("EditPointMenu"), _("Edit Point"));
+       ActionManager::register_action (editor_menu_actions, X_("FadeMenu"), _("Fade"));
+       ActionManager::register_action (editor_menu_actions, X_("LatchMenu"), _("Latch"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenu"), _("Region"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenuLayering"), _("Layering"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenuPosition"), _("Position"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenuEdit"), _("Edit"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenuTrim"), _("Trim"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenuGain"), _("Gain"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenuRanges"), _("Ranges"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenuFades"), _("Fades"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenuMIDI"), _("MIDI"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionMenuDuplicate"), _("Duplicate"));
+       ActionManager::register_action (editor_menu_actions, X_("Link"), _("Link"));
+       ActionManager::register_action (editor_menu_actions, X_("ZoomFocusMenu"), _("Zoom Focus"));
+       ActionManager::register_action (editor_menu_actions, X_("LocateToMarker"), _("Locate to Markers"));
+       ActionManager::register_action (editor_menu_actions, X_("MarkerMenu"), _("Markers"));
+       ActionManager::register_action (editor_menu_actions, X_("MeterFalloff"), _("Meter falloff"));
+       ActionManager::register_action (editor_menu_actions, X_("MeterHold"), _("Meter hold"));
+       ActionManager::register_action (editor_menu_actions, X_("MIDI"), _("MIDI Options"));
+       ActionManager::register_action (editor_menu_actions, X_("MiscOptions"), _("Misc Options"));
+       ActionManager::register_action (editor_menu_actions, X_("Monitoring"), _("Monitoring"));
+       ActionManager::register_action (editor_menu_actions, X_("MoveActiveMarkMenu"), _("Active Mark"));
+       ActionManager::register_action (editor_menu_actions, X_("MovePlayHeadMenu"), _("Playhead"));
+       ActionManager::register_action (editor_menu_actions, X_("PlayMenu"), _("Play"));
+       ActionManager::register_action (editor_menu_actions, X_("PrimaryClockMenu"), _("Primary Clock"));
+       ActionManager::register_action (editor_menu_actions, X_("Pullup"), _("Pullup / Pulldown"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionEditOps"), _("Region operations"));
+       ActionManager::register_action (editor_menu_actions, X_("RegionGainMenu"), _("Gain"));
+       ActionManager::register_action (editor_menu_actions, X_("RulerMenu"), _("Rulers"));
+       ActionManager::register_action (editor_menu_actions, X_("SavedViewMenu"), _("Views"));
+       ActionManager::register_action (editor_menu_actions, X_("ScrollMenu"), _("Scroll"));
+       ActionManager::register_action (editor_menu_actions, X_("SecondaryClockMenu"), _("Secondary Clock"));
+       ActionManager::register_action (editor_menu_actions, X_("Select"), _("Select"));
+       ActionManager::register_action (editor_menu_actions, X_("SelectMenu"), _("Select"));
+       ActionManager::register_action (editor_menu_actions, X_("SeparateMenu"), _("Separate"));
+       ActionManager::register_action (editor_menu_actions, X_("SetLoopMenu"), _("Loop"));
+       ActionManager::register_action (editor_menu_actions, X_("SetPunchMenu"), _("Punch"));
+       ActionManager::register_action (editor_menu_actions, X_("Solo"), _("Solo"));
+       ActionManager::register_action (editor_menu_actions, X_("Subframes"), _("Subframes"));
+       ActionManager::register_action (editor_menu_actions, X_("SyncMenu"), _("Sync"));
+       ActionManager::register_action (editor_menu_actions, X_("TempoMenu"), _("Tempo"));
+       ActionManager::register_action (editor_menu_actions, X_("Timecode"), _("Timecode fps"));
+       ActionManager::register_action (editor_menu_actions, X_("TrackHeightMenu"), _("Height"));
+       ActionManager::register_action (editor_menu_actions, X_("TrackMenu"), _("Track"));
+       ActionManager::register_action (editor_menu_actions, X_("Tools"), _("Tools"));
+       ActionManager::register_action (editor_menu_actions, X_("View"), _("View"));
+       ActionManager::register_action (editor_menu_actions, X_("ZoomFocus"), _("Zoom Focus"));
+       ActionManager::register_action (editor_menu_actions, X_("ZoomMenu"), _("Zoom"));
 
        register_region_actions ();
 
@@ -148,6 +151,11 @@ Editor::register_actions ()
 
        ActionManager::register_action (editor_actions, "escape", _("Break drag or deselect all"), sigc::mem_fun (*this, &Editor::escape));
 
+       /* We don't bother registering "unlock" because it would be insensitive
+          when required. Editor::unlock() must be invoked directly.
+       */
+       ActionManager::register_action (editor_actions, "lock", _("Lock"), sigc::mem_fun (*this, &Editor::lock));
+
        toggle_reg_sens (editor_actions, "show-editor-mixer", _("Show Editor Mixer"), sigc::mem_fun (*this, &Editor::editor_mixer_button_toggled));
        toggle_reg_sens (editor_actions, "show-editor-list", _("Show Editor List"), sigc::mem_fun (*this, &Editor::editor_list_button_toggled));
 
@@ -183,11 +191,15 @@ Editor::register_actions ()
        reg_sens (editor_actions, "playhead-to-range-start", _("Playhead to Range Start"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_to_selection_start), playhead_cursor));
        reg_sens (editor_actions, "playhead-to-range-end", _("Playhead to Range End"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_to_selection_end), playhead_cursor));
 
-       reg_sens (editor_actions, "select-all", _("Select All"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all), Selection::Set));
+       reg_sens (editor_actions, "select-all-objects", _("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), Selection::Set));
+       reg_sens (editor_actions, "select-all-tracks", _("Select All Tracks"), sigc::mem_fun(*this, &Editor::select_all_tracks));
        reg_sens (editor_actions, "deselect-all", _("Deselect All"), sigc::mem_fun(*this, &Editor::deselect_all));
        reg_sens (editor_actions, "invert-selection", _("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection));
+
        reg_sens (editor_actions, "select-all-after-edit-cursor", _("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true));
+       reg_sens (editor_actions, "alternate-select-all-after-edit-cursor", _("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true));
        reg_sens (editor_actions, "select-all-before-edit-cursor", _("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false));
+       reg_sens (editor_actions, "alternate-select-all-before-edit-cursor", _("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false));
 
        reg_sens (editor_actions, "select-all-between-cursors", _("Select All Overlapping Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), false));
        reg_sens (editor_actions, "select-all-within-cursors", _("Select All Inside Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), true));
@@ -227,23 +239,32 @@ Editor::register_actions ()
                reg_sens (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::goto_nth_marker), i - 1));
        }
 
-       reg_sens (editor_actions, "jump-forward-to-mark", _("Jump Forward to Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark));
-       reg_sens (editor_actions, "jump-backward-to-mark", _("Jump Backward to Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark));
+       reg_sens (editor_actions, "jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark));
+       reg_sens (editor_actions, "alternate-jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark));
+       reg_sens (editor_actions, "jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark));
+       reg_sens (editor_actions, "alternate-jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark));
+
        reg_sens (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(*this, &Editor::add_location_from_playhead_cursor));
+       reg_sens (editor_actions, "alternate-add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(*this, &Editor::add_location_from_playhead_cursor));
 
-       reg_sens (editor_actions, "nudge-next-forward", _("Nudge Next Forward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), true, false));
-       reg_sens (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), true, false));
+       reg_sens (editor_actions, "remove-location-from-playhead", _("Remove Mark at Playhead"), sigc::mem_fun(*this, &Editor::remove_location_at_playhead_cursor));
+       reg_sens (editor_actions, "alternate-remove-location-from-playhead", _("Remove Mark at Playhead"), sigc::mem_fun(*this, &Editor::remove_location_at_playhead_cursor));
+
+       reg_sens (editor_actions, "nudge-next-forward", _("Nudge Next Later"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), true, false));
+       reg_sens (editor_actions, "nudge-next-backward", _("Nudge Next Earlier"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), true, false));
 
        reg_sens (editor_actions, "nudge-playhead-forward", _("Nudge Playhead Forward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), false, true));
        reg_sens (editor_actions, "nudge-playhead-backward", _("Nudge Playhead Backward"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), false, true));
-       reg_sens (editor_actions, "playhead-forward-to-grid", _("Forward to Grid"), sigc::mem_fun(*this, &Editor::playhead_forward_to_grid));
-       reg_sens (editor_actions, "playhead-backward-to-grid", _("Backward to Grid"), sigc::mem_fun(*this, &Editor::playhead_backward_to_grid));
+       reg_sens (editor_actions, "playhead-forward-to-grid", _("Playhead To Next Grid"), sigc::mem_fun(*this, &Editor::playhead_forward_to_grid));
+       reg_sens (editor_actions, "playhead-backward-to-grid", _("Playhead To Previous Grid"), sigc::mem_fun(*this, &Editor::playhead_backward_to_grid));
 
        reg_sens (editor_actions, "temporal-zoom-out", _("Zoom Out"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), true));
        reg_sens (editor_actions, "temporal-zoom-in", _("Zoom In"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), false));
        reg_sens (editor_actions, "zoom-to-session", _("Zoom to Session"), sigc::mem_fun(*this, &Editor::temporal_zoom_session));
        reg_sens (editor_actions, "zoom-to-region", _("Zoom to Region"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_to_region), false));
        reg_sens (editor_actions, "zoom-to-region-both-axes", _("Zoom to Region (Width and Height)"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_to_region), true));
+       reg_sens (editor_actions, "zoom-to-range", _("Zoom to Range"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), false));
+       reg_sens (editor_actions, "zoom-to-range-both-axes", _("Zoom to Range (Width and Height)"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), true));
        reg_sens (editor_actions, "toggle-zoom", _("Toggle Zoom State"), sigc::mem_fun(*this, &Editor::swap_visual_state));
 
        reg_sens (editor_actions, "expand-tracks", _("Expand Track Height"), sigc::bind (sigc::mem_fun (*this, &Editor::tav_zoom_step), false));
@@ -274,8 +295,11 @@ Editor::register_actions ()
        reg_sens (editor_actions, "playhead-to-edit", _("Playhead to Active Mark"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_align), true));
        reg_sens (editor_actions, "edit-to-playhead", _("Active Mark to Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_align), false));
 
+       toggle_reg_sens (editor_actions, "toggle-skip-playback", _("Use Skip Ranges"), sigc::mem_fun(*this, &Editor::toggle_skip_playback));
+
        reg_sens (editor_actions, "set-loop-from-edit-range", _("Set Loop from Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::set_loop_from_edit_range), false));
        reg_sens (editor_actions, "set-punch-from-edit-range", _("Set Punch from Edit Range"), sigc::mem_fun(*this, &Editor::set_punch_from_edit_range));
+       reg_sens (editor_actions, "set-session-from-edit-range", _("Set Session Start/End from Edit Range"), sigc::mem_fun(*this, &Editor::set_session_extents_from_selection));
 
        /* this is a duplicated action so that the main menu can use a different label */
        reg_sens (editor_actions, "main-menu-play-selected-regions", _("Play Selected Regions"), sigc::mem_fun (*this, &Editor::play_selected_region));
@@ -287,10 +311,13 @@ Editor::register_actions ()
        reg_sens (editor_actions, "set-playhead", _("Playhead to Mouse"), sigc::mem_fun(*this, &Editor::set_playhead_cursor));
        reg_sens (editor_actions, "set-edit-point", _("Active Marker to Mouse"), sigc::mem_fun(*this, &Editor::set_edit_point));
 
-       reg_sens (editor_actions, "duplicate-range", _("Duplicate Range"), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), false));
+       reg_sens (editor_actions, "duplicate-range", _("Duplicate Range"), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_range), false));
 
        undo_action = reg_sens (editor_actions, "undo", S_("Command|Undo"), sigc::bind (sigc::mem_fun(*this, &Editor::undo), 1U));
+
        redo_action = reg_sens (editor_actions, "redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
+       redo_action = reg_sens (editor_actions, "alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
+       redo_action = reg_sens (editor_actions, "alternate-alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
 
        reg_sens (editor_actions, "export-audio", _("Export Audio"), sigc::mem_fun(*this, &Editor::export_audio));
        reg_sens (editor_actions, "export-range", _("Export Range"), sigc::mem_fun(*this, &Editor::export_range));
@@ -309,23 +336,32 @@ Editor::register_actions ()
 
        reg_sens (editor_actions, "editor-cut", _("Cut"), sigc::mem_fun(*this, &Editor::cut));
        reg_sens (editor_actions, "editor-delete", _("Delete"), sigc::mem_fun(*this, &Editor::delete_));
+       reg_sens (editor_actions, "alternate-editor-delete", _("Delete"), sigc::mem_fun(*this, &Editor::delete_));
 
        reg_sens (editor_actions, "editor-copy", _("Copy"), sigc::mem_fun(*this, &Editor::copy));
        reg_sens (editor_actions, "editor-paste", _("Paste"), sigc::mem_fun(*this, &Editor::keyboard_paste));
 
+       reg_sens (editor_actions, "editor-fade-range", _("Fade Range Selection"), sigc::mem_fun(*this, &Editor::fade_range));
+
        reg_sens (editor_actions, "set-tempo-from-edit-range", _("Set Tempo from Edit Range = Bar"), sigc::mem_fun(*this, &Editor::use_range_as_bar));
 
        toggle_reg_sens (editor_actions, "toggle-log-window", _("Log"),
                        sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::toggle_errors));
 
-       reg_sens (editor_actions, "tab-to-transient-forwards", _("Move Forward to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
-       reg_sens (editor_actions, "tab-to-transient-backwards", _("Move Backwards to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
+       reg_sens (editor_actions, "alternate-tab-to-transient-forwards", _("Move to Next Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
+       reg_sens (editor_actions, "alternate-tab-to-transient-backwards", _("Move to Previous Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
+       reg_sens (editor_actions, "tab-to-transient-forwards", _("Move to Next Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
+       reg_sens (editor_actions, "tab-to-transient-backwards", _("Move to Previous Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
 
        reg_sens (editor_actions, "crop", _("Crop"), sigc::mem_fun(*this, &Editor::crop_region_to_selection));
 
        reg_sens (editor_actions, "start-range", _("Start Range"), sigc::mem_fun(*this, &Editor::keyboard_selection_begin));
        reg_sens (editor_actions, "finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), false));
-       reg_sens (editor_actions, "finish-add-range", _("Finish Add Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), true));
+
+       reg_sens (editor_actions, "alt-start-range", _("Start Range"), sigc::mem_fun(*this, &Editor::keyboard_selection_begin));
+       reg_sens (editor_actions, "alt-finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), false));
+
+//     reg_sens (editor_actions, "finish-add-range", _("Finish Add Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), true));
 
        reg_sens (
                editor_actions,
@@ -372,7 +408,8 @@ Editor::register_actions ()
        }
        ActionManager::track_selection_sensitive_actions.push_back (act);
 
-       reg_sens (editor_actions, "fit-tracks", _("Fit Selected Tracks"), sigc::mem_fun(*this, &Editor::fit_selected_tracks));
+       act = reg_sens (editor_actions, "fit-tracks", _("Fit Selected Tracks"), sigc::mem_fun(*this, &Editor::fit_selected_tracks));
+       ActionManager::track_selection_sensitive_actions.push_back (act);
 
        act = reg_sens (editor_actions, "track-height-largest", _("Largest"), sigc::bind (
                                sigc::mem_fun(*this, &Editor::set_track_height), HeightLargest));
@@ -402,9 +439,18 @@ Editor::register_actions ()
        radio_reg_sens (zoom_actions, zoom_group, "zoom-focus-mouse", _("Zoom Focus Mouse"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusMouse));
        radio_reg_sens (zoom_actions, zoom_group, "zoom-focus-edit", _("Zoom Focus Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusEdit));
 
+       ActionManager::register_action (editor_actions, X_("cycle-zoom-focus"), _("Next Zoom Focus"), sigc::mem_fun (*this, &Editor::cycle_zoom_focus));
+
+
        Glib::RefPtr<ActionGroup> mouse_mode_actions = ActionGroup::create (X_("MouseMode"));
        RadioAction::Group mouse_mode_group;
 
+       act = ActionManager::register_toggle_action (mouse_mode_actions, "set-mouse-mode-object-range", _("Smart Object Mode"), sigc::mem_fun (*this, &Editor::mouse_mode_object_range_toggled));       
+       smart_mode_action = Glib::RefPtr<ToggleAction>::cast_static (act);
+       smart_mode_button.set_related_action (smart_mode_action);
+       smart_mode_button.set_text (_("Smart"));
+       smart_mode_button.set_name ("mouse mode button");
+
        act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseObject));
        mouse_move_button.set_related_action (act);
        mouse_move_button.set_image (::get_icon("tool_object"));
@@ -420,19 +466,6 @@ Editor::register_actions ()
        mouse_draw_button.set_image (::get_icon("midi_tool_pencil"));
        mouse_draw_button.set_name ("mouse mode button");
 
-       act = ActionManager::register_toggle_action (mouse_mode_actions, "set-mouse-mode-object-range", _("Link Object / Range Tools"), sigc::mem_fun (*this, &Editor::mouse_mode_object_range_toggled));       
-       smart_mode_action = Glib::RefPtr<ToggleAction>::cast_static (act);
-
-       act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("Gain Tool"), sigc::bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseGain)); 
-       mouse_gain_button.set_related_action (act);
-       mouse_gain_button.set_image (::get_icon("tool_gain"));
-       mouse_gain_button.set_name ("mouse mode button");
-
-       act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-zoom", _("Zoom Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseZoom));   
-       mouse_zoom_button.set_related_action (act);
-       mouse_zoom_button.set_image (::get_icon("tool_zoom"));
-       mouse_zoom_button.set_name ("mouse mode button");
-
        act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-audition", _("Audition Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition));       
        mouse_audition_button.set_related_action (act);
        mouse_audition_button.set_image (::get_icon("tool_audition"));
@@ -443,26 +476,33 @@ Editor::register_actions ()
        mouse_timefx_button.set_image (::get_icon("tool_stretch"));
        mouse_timefx_button.set_name ("mouse mode button");
 
-       ActionManager::register_action (editor_actions, "step-mouse-mode", _("Step Mouse Mode"), sigc::bind (sigc::mem_fun(*this, &Editor::step_mouse_mode), true));
+       act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-content", _("Content Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseContent));  
+       mouse_content_button.set_related_action (act);
+       mouse_content_button.set_image (::get_icon("tool_content"));
+       mouse_content_button.set_name ("mouse mode button");
 
-       act = ActionManager::register_toggle_action (mouse_mode_actions, "toggle-internal-edit", _("Edit MIDI"), sigc::mem_fun(*this, &Editor::toggle_internal_editing));
-       internal_edit_button.set_related_action (act);
-       internal_edit_button.set_image (::get_icon("tool_note"));
-       internal_edit_button.set_name ("mouse mode button");
+       if(!Profile->get_mixbus()) {
+               act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-cut", _("Cut Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseCut));
+               mouse_cut_button.set_related_action (act);
+               mouse_cut_button.set_image (::get_icon("tool_cut"));
+               mouse_cut_button.set_name ("mouse mode button");
+       }
+       
+       ActionManager::register_action (editor_actions, "step-mouse-mode", _("Step Mouse Mode"), sigc::bind (sigc::mem_fun(*this, &Editor::step_mouse_mode), true));
 
        RadioAction::Group edit_point_group;
        ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-playhead"), _("Playhead"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
-       ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
-       ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-selected-marker"), _("Marker"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
+       ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtMouse)));
+       ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-selected-marker"), _("Marker"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtSelectedMarker)));
 
        ActionManager::register_action (editor_actions, "cycle-edit-point", _("Change Edit Point"), sigc::bind (sigc::mem_fun (*this, &Editor::cycle_edit_point), false));
        ActionManager::register_action (editor_actions, "cycle-edit-point-with-marker", _("Change Edit Point Including Marker"), sigc::bind (sigc::mem_fun (*this, &Editor::cycle_edit_point), true));
-       if (!Profile->get_sae()) {
-               ActionManager::register_action (editor_actions, "set-edit-splice", _("Splice"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Splice));
-       }
+
+//     ActionManager::register_action (editor_actions, "set-edit-splice", _("Splice"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Splice));
+       ActionManager::register_action (editor_actions, "set-edit-ripple", _("Ripple"), bind (mem_fun (*this, &Editor::set_edit_mode), Ripple));
        ActionManager::register_action (editor_actions, "set-edit-slide", _("Slide"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Slide));
        ActionManager::register_action (editor_actions, "set-edit-lock", _("Lock"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Lock));
-       ActionManager::register_action (editor_actions, "toggle-edit-mode", _("Toggle Edit Mode"), sigc::mem_fun (*this, &Editor::cycle_edit_mode));
+       ActionManager::register_action (editor_actions, "cycle-edit-mode", _("Cycle Edit Mode"), sigc::mem_fun (*this, &Editor::cycle_edit_mode));
 
        ActionManager::register_action (editor_actions, X_("SnapTo"), _("Snap to"));
        ActionManager::register_action (editor_actions, X_("SnapMode"), _("Snap Mode"));
@@ -530,26 +570,64 @@ Editor::register_actions ()
        ruler_timecode_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-timecode-ruler"), _("Timecode"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_timecode)));
        ruler_minsec_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-minsec-ruler"), _("Min:Sec"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_minsec)));
 
+       ActionManager::register_action (editor_menu_actions, X_("VideoMonitorMenu"), _("Video Monitor"));
+
+       ruler_video_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-video-ruler"), _("Video"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_video_timeline)));
+       xjadeo_proc_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("ToggleJadeo"), _("Video Monitor"), sigc::mem_fun (*this, &Editor::set_xjadeo_proc)));
+
+       xjadeo_ontop_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-ontop"), _("Always on Top"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 1)));
+       xjadeo_timecode_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 2)));
+       xjadeo_frame_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-frame"), _("Frame number"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 3)));
+       xjadeo_osdbg_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-osdbg"), _("Timecode Background"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 4)));
+       xjadeo_fullscreen_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-fullscreen"), _("Fullscreen"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 5)));
+       xjadeo_letterbox_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-letterbox"), _("Letterbox"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 6)));
+       xjadeo_zoom_100 = reg_sens (editor_actions, "zoom-vmon-100", _("Original Size"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 7));
+
        /* set defaults here */
 
        no_ruler_shown_update = true;
-       ruler_meter_action->set_active (true);
-       ruler_tempo_action->set_active (true);
-       ruler_marker_action->set_active (true);
-       ruler_range_action->set_active (false);
-       ruler_loop_punch_action->set_active (true);
-       ruler_loop_punch_action->set_active (true);
-       if (Profile->get_sae()) {
+       
+       if (Profile->get_trx()) {
+               ruler_marker_action->set_active (true);
+               ruler_meter_action->set_active (false);
+               ruler_tempo_action->set_active (false);
+               ruler_range_action->set_active (false);
+               ruler_loop_punch_action->set_active (false);
+               ruler_loop_punch_action->set_active (false);
                ruler_bbt_action->set_active (true);
                ruler_cd_marker_action->set_active (false);
                ruler_timecode_action->set_active (false);
                ruler_minsec_action->set_active (true);
-       } else {
+       } else {        
+               ruler_marker_action->set_active (true);
+               ruler_meter_action->set_active (true);
+               ruler_tempo_action->set_active (true);
+               ruler_range_action->set_active (true);
+               ruler_loop_punch_action->set_active (true);
+               ruler_loop_punch_action->set_active (true);
                ruler_bbt_action->set_active (false);
                ruler_cd_marker_action->set_active (true);
                ruler_timecode_action->set_active (true);
                ruler_minsec_action->set_active (false);
        }
+
+       ruler_video_action->set_active (false);
+       xjadeo_proc_action->set_active (false);
+       xjadeo_proc_action->set_sensitive (false);
+       xjadeo_ontop_action->set_active (false);
+       xjadeo_ontop_action->set_sensitive (false);
+       xjadeo_timecode_action->set_active (false);
+       xjadeo_timecode_action->set_sensitive (false);
+       xjadeo_frame_action->set_active (false);
+       xjadeo_frame_action->set_sensitive (false);
+       xjadeo_osdbg_action->set_active (false);
+       xjadeo_osdbg_action->set_sensitive (false);
+       xjadeo_fullscreen_action->set_active (false);
+       xjadeo_fullscreen_action->set_sensitive (false);
+       xjadeo_letterbox_action->set_active (false);
+       xjadeo_letterbox_action->set_sensitive (false);
+       xjadeo_zoom_100->set_sensitive (false);
+
        ruler_samples_action->set_active (false);
        no_ruler_shown_update = false;
 
@@ -613,6 +691,10 @@ Editor::register_actions ()
        act = ActionManager::register_action (editor_actions, X_("importFromSession"), _("Import From Session"), sigc::mem_fun(*this, &Editor::session_import_dialog));
        ActionManager::write_sensitive_actions.push_back (act);
 
+
+       act = ActionManager::register_action (editor_actions, X_("bring-into-session"), _("Bring all media into session folder"), sigc::mem_fun(*this, &Editor::bring_all_sources_into_session));
+       ActionManager::write_sensitive_actions.push_back (act);
+
        ActionManager::register_toggle_action (editor_actions, X_("ToggleSummary"), _("Show Summary"), sigc::mem_fun (*this, &Editor::set_summary));
 
        ActionManager::register_toggle_action (editor_actions, X_("ToggleGroupTabs"), _("Show Group Tabs"), sigc::mem_fun (*this, &Editor::set_group_tabs));
@@ -625,12 +707,16 @@ Editor::register_actions ()
        Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
        tact->set_active (true);
 
+       ActionManager::register_action (editor_actions, X_("toggle-midi-input-active"), _("Toggle MIDI Input Active for Editor-Selected Tracks/Busses"), 
+                                  sigc::bind (sigc::mem_fun (*this, &Editor::toggle_midi_input_active), false));
+
        ActionManager::add_action_group (rl_actions);
        ActionManager::add_action_group (ruler_actions);
        ActionManager::add_action_group (zoom_actions);
        ActionManager::add_action_group (mouse_mode_actions);
        ActionManager::add_action_group (snap_actions);
        ActionManager::add_action_group (editor_actions);
+       ActionManager::add_action_group (editor_menu_actions);
 }
 
 void
@@ -640,14 +726,27 @@ Editor::load_bindings ()
        
         key_bindings.set_action_map (editor_action_map);
 
-       sys::path binding_file;
-       SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path();
+       std::string binding_file;
 
-       if (find_file_in_search_path (spath, "editor.bindings", binding_file)) {
-                key_bindings.load (binding_file.to_string());
-               info << string_compose (_("Loaded editor bindings from %1"), binding_file.to_string()) << endmsg;
+       if (find_file (ardour_config_search_path(), "editor.bindings", binding_file)) {
+                key_bindings.load (binding_file);
+               info << string_compose (_("Loaded editor bindings from %1"), binding_file) << endmsg;
         } else {
-               error << string_compose (_("Could not find editor.bindings in search path %1"), spath.to_string()) << endmsg;
+               error << string_compose (_("Could not find editor.bindings in search path %1"), ardour_config_search_path().to_string()) << endmsg;
+       }
+}
+
+void
+Editor::toggle_skip_playback ()
+{
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), "toggle-skip-playback");
+
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               bool s = Config->get_skip_playback ();
+               if (tact->get_active() != s) {
+                       Config->set_skip_playback (tact->get_active());
+               }
        }
 }
 
@@ -691,6 +790,9 @@ Editor::toggle_ruler_visibility (RulerType rt)
        case ruler_time_cd_marker:
                action = "toggle-cd-marker-ruler";
                break;
+       case ruler_video_timeline:
+               action = "toggle-video-ruler";
+               break;
        }
 
        Glib::RefPtr<Action> act = ActionManager::get_action (X_("Rulers"), action);
@@ -722,6 +824,133 @@ Editor::set_group_tabs ()
        }
 }
 
+void
+Editor::set_close_video_sensitive (bool onoff)
+{
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Main"), X_("CloseVideo"));
+       if (act) {
+               act->set_sensitive (onoff);
+       }
+}
+
+void
+Editor::set_xjadeo_sensitive (bool onoff)
+{
+       xjadeo_proc_action->set_sensitive(onoff);
+}
+
+void
+Editor::toggle_xjadeo_proc (int state)
+{
+       switch(state) {
+               case 1:
+                       xjadeo_proc_action->set_active(true);
+                       break;
+               case 0:
+                       xjadeo_proc_action->set_active(false);
+                       break;
+               default:
+                       xjadeo_proc_action->set_active(!xjadeo_proc_action->get_active());
+                       break;
+       }
+       bool onoff = xjadeo_proc_action->get_active();
+       xjadeo_ontop_action->set_sensitive(onoff);
+       xjadeo_timecode_action->set_sensitive(onoff);
+       xjadeo_frame_action->set_sensitive(onoff);
+       xjadeo_osdbg_action->set_sensitive(onoff);
+       xjadeo_fullscreen_action->set_sensitive(onoff);
+       xjadeo_letterbox_action->set_sensitive(onoff);
+       xjadeo_zoom_100->set_sensitive(onoff);
+}
+
+void
+Editor::set_xjadeo_proc ()
+{
+       if (xjadeo_proc_action->get_active()) {
+               ARDOUR_UI::instance()->video_timeline->open_video_monitor();
+       } else {
+               ARDOUR_UI::instance()->video_timeline->close_video_monitor();
+       }
+}
+
+void
+Editor::toggle_xjadeo_viewoption (int what, int state)
+{
+       Glib::RefPtr<Gtk::ToggleAction> action;
+       switch (what) {
+               case 1:
+                       action = xjadeo_ontop_action;
+                       break;
+               case 2:
+                       action = xjadeo_timecode_action;
+                       break;
+               case 3:
+                       action = xjadeo_frame_action;
+                       break;
+               case 4:
+                       action = xjadeo_osdbg_action;
+                       break;
+               case 5:
+                       action = xjadeo_fullscreen_action;
+                       break;
+               case 6:
+                       action = xjadeo_letterbox_action;
+                       break;
+               case 7:
+                       return;
+               default:
+                       return;
+       }
+
+       switch(state) {
+               case 1:
+                       action->set_active(true);
+                       break;
+               case 0:
+                       action->set_active(false);
+                       break;
+               default:
+                       action->set_active(!action->get_active());
+                       break;
+       }
+}
+
+void
+Editor::set_xjadeo_viewoption (int what)
+{
+       Glib::RefPtr<Gtk::ToggleAction> action;
+       switch (what) {
+               case 1:
+                       action = xjadeo_ontop_action;
+                       break;
+               case 2:
+                       action = xjadeo_timecode_action;
+                       break;
+               case 3:
+                       action = xjadeo_frame_action;
+                       break;
+               case 4:
+                       action = xjadeo_osdbg_action;
+                       break;
+               case 5:
+                       action = xjadeo_fullscreen_action;
+                       break;
+               case 6:
+                       action = xjadeo_letterbox_action;
+                       break;
+               case 7:
+                       ARDOUR_UI::instance()->video_timeline->control_video_monitor(what, 0);
+                       return;
+               default:
+                       return;
+       }
+       if (action->get_active()) {
+               ARDOUR_UI::instance()->video_timeline->control_video_monitor(what, 1);
+       } else {
+               ARDOUR_UI::instance()->video_timeline->control_video_monitor(what, 0);
+       }
+}
+
 void
 Editor::toggle_measure_visibility ()
 {
@@ -848,7 +1077,7 @@ Editor::snap_type_action (SnapType type)
                break;
        default:
                fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap-to type", (int) type) << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        act = ActionManager::get_action (X_("Snap"), action);
@@ -965,94 +1194,94 @@ Editor::prev_snap_choice ()
 {
        switch (_snap_type) {
        case Editing::SnapToCDFrame:
-               set_snap_to (Editing::SnapToTimecodeFrame);
+               set_snap_to (Editing::SnapToRegionBoundary);
                break;
        case Editing::SnapToTimecodeFrame:
-               set_snap_to (Editing::SnapToTimecodeSeconds);
+               set_snap_to (Editing::SnapToCDFrame);
                break;
        case Editing::SnapToTimecodeSeconds:
-               set_snap_to (Editing::SnapToTimecodeMinutes);
+               set_snap_to (Editing::SnapToTimecodeFrame);
                break;
        case Editing::SnapToTimecodeMinutes:
-               set_snap_to (Editing::SnapToSeconds);
+               set_snap_to (Editing::SnapToTimecodeSeconds);
                break;
        case Editing::SnapToSeconds:
-               set_snap_to (Editing::SnapToMinutes);
+               set_snap_to (Editing::SnapToTimecodeMinutes);
                break;
        case Editing::SnapToMinutes:
-               set_snap_to (Editing::SnapToBeatDiv128);
+               set_snap_to (Editing::SnapToSeconds);
                break;
        case Editing::SnapToBeatDiv128:
-               set_snap_to (Editing::SnapToBeatDiv64);
+               set_snap_to (Editing::SnapToMinutes);
                break;
        case Editing::SnapToBeatDiv64:
-               set_snap_to (Editing::SnapToBeatDiv32);
+               set_snap_to (Editing::SnapToBeatDiv128);
                break;
        case Editing::SnapToBeatDiv32:
-               set_snap_to (Editing::SnapToBeatDiv28);
+               set_snap_to (Editing::SnapToBeatDiv64);
                break;
        case Editing::SnapToBeatDiv28:
-               set_snap_to (Editing::SnapToBeatDiv24);
+               set_snap_to (Editing::SnapToBeatDiv32);
                break;
        case Editing::SnapToBeatDiv24:
-               set_snap_to (Editing::SnapToBeatDiv20);
+               set_snap_to (Editing::SnapToBeatDiv28);
                break;
        case Editing::SnapToBeatDiv20:
-               set_snap_to (Editing::SnapToBeatDiv16);
+               set_snap_to (Editing::SnapToBeatDiv24);
                break;
        case Editing::SnapToBeatDiv16:
-               set_snap_to (Editing::SnapToBeatDiv14);
+               set_snap_to (Editing::SnapToBeatDiv20);
                break;
        case Editing::SnapToBeatDiv14:
-               set_snap_to (Editing::SnapToBeatDiv12);
+               set_snap_to (Editing::SnapToBeatDiv16);
                break;
        case Editing::SnapToBeatDiv12:
-               set_snap_to (Editing::SnapToBeatDiv10);
+               set_snap_to (Editing::SnapToBeatDiv14);
                break;
        case Editing::SnapToBeatDiv10:
-               set_snap_to (Editing::SnapToBeatDiv8);
+               set_snap_to (Editing::SnapToBeatDiv12);
                break;
        case Editing::SnapToBeatDiv8:
-               set_snap_to (Editing::SnapToBeatDiv7);
+               set_snap_to (Editing::SnapToBeatDiv10);
                break;
        case Editing::SnapToBeatDiv7:
-               set_snap_to (Editing::SnapToBeatDiv6);
+               set_snap_to (Editing::SnapToBeatDiv8);
                break;
        case Editing::SnapToBeatDiv6:
-               set_snap_to (Editing::SnapToBeatDiv5);
+               set_snap_to (Editing::SnapToBeatDiv7);
                break;
        case Editing::SnapToBeatDiv5:
-               set_snap_to (Editing::SnapToBeatDiv4);
+               set_snap_to (Editing::SnapToBeatDiv6);
                break;
        case Editing::SnapToBeatDiv4:
-               set_snap_to (Editing::SnapToBeatDiv3);
+               set_snap_to (Editing::SnapToBeatDiv5);
                break;
        case Editing::SnapToBeatDiv3:
-               set_snap_to (Editing::SnapToBeatDiv2);
+               set_snap_to (Editing::SnapToBeatDiv4);
                break;
        case Editing::SnapToBeatDiv2:
-               set_snap_to (Editing::SnapToBeat);
+               set_snap_to (Editing::SnapToBeatDiv3);
                break;
        case Editing::SnapToBeat:
-               set_snap_to (Editing::SnapToBar);
+               set_snap_to (Editing::SnapToBeatDiv2);
                break;
        case Editing::SnapToBar:
-               set_snap_to (Editing::SnapToMark);
+               set_snap_to (Editing::SnapToBeat);
                break;
        case Editing::SnapToMark:
-               set_snap_to (Editing::SnapToRegionStart);
+               set_snap_to (Editing::SnapToBar);
                break;
        case Editing::SnapToRegionStart:
-               set_snap_to (Editing::SnapToRegionEnd);
+               set_snap_to (Editing::SnapToMark);
                break;
        case Editing::SnapToRegionEnd:
-               set_snap_to (Editing::SnapToRegionSync);
+               set_snap_to (Editing::SnapToRegionStart);
                break;
        case Editing::SnapToRegionSync:
-               set_snap_to (Editing::SnapToRegionBoundary);
+               set_snap_to (Editing::SnapToRegionEnd);
                break;
        case Editing::SnapToRegionBoundary:
-               set_snap_to (Editing::SnapToCDFrame);
+               set_snap_to (Editing::SnapToRegionSync);
                break;
        }
 }
@@ -1244,7 +1473,7 @@ Editor::snap_mode_action (SnapMode mode)
                break;
        default:
                fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap mode type", (int) mode) << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        act = ActionManager::get_action (X_("Editor"), action);
@@ -1308,7 +1537,7 @@ Editor::edit_point_action (EditPoint ep)
                break;
        default:
                fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible edit point type", (int) ep) << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        act = ActionManager::get_action (X_("Editor"), action);
@@ -1366,7 +1595,7 @@ Editor::zoom_focus_action (ZoomFocus focus)
                break;
        default:
                fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible focus type", (int) focus) << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        act = ActionManager::get_action (X_("Zoom"), action);
@@ -1419,21 +1648,17 @@ Editor::parameter_changed (std::string p)
        ENSURE_GUI_THREAD (*this, &Editor::parameter_changed, p)
 
        if (p == "auto-loop") {
-               update_loop_range_view (true);
+               update_loop_range_view ();
        } else if (p == "punch-in") {
-               update_punch_range_view (true);
+               update_punch_range_view ();
        } else if (p == "punch-out") {
-               update_punch_range_view (true);
+               update_punch_range_view ();
        } else if (p == "timecode-format") {
                update_just_timecode ();
-       } else if (p == "xfades-visible") {
-               update_xfade_visibility ();
        } else if (p == "show-region-fades") {
                update_region_fade_visibility ();
        } else if (p == "edit-mode") {
-               edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
-       } else if (p == "subframes-per-frame") {
-               update_just_timecode ();
+               edit_mode_selector.set_text (edit_mode_to_string (Config->get_edit_mode()));
        } else if (p == "show-track-meters") {
                toggle_meter_updating();
        } else if (p == "show-summary") {
@@ -1473,7 +1698,9 @@ Editor::parameter_changed (std::string p)
        } else if (p == "timecode-offset" || p == "timecode-offset-negative") {
                update_just_timecode ();
        } else if (p == "show-zoom-tools") {
-               _zoom_tearoff->set_visible (Config->get_show_zoom_tools(), true);
+               if (_zoom_tearoff) {
+                       _zoom_tearoff->set_visible (Config->get_show_zoom_tools(), true);
+               }
        } else if (p == "sound-midi-notes") {
                Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("sound-midi-notes"));
 
@@ -1484,13 +1711,38 @@ Editor::parameter_changed (std::string p)
                                tact->set_active (s);
                        }
                }
+       } else if (p == "show-region-gain") {
+               set_gain_envelope_visibility ();
+       } else if (p == "remote-model") {
+               if (_routes) {
+                       _routes->reset_remote_control_ids ();
+               }
+       } else if (p == "use-tooltips") {
+
+               /* this doesn't really belong here but it has to go somewhere */
+
+               if (Config->get_use_tooltips()) {
+                       Gtkmm2ext::enable_tooltips ();
+               } else {
+                       Gtkmm2ext::disable_tooltips ();
+               }
+       } else if (p == "skip-playback") {
+               Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-skip-playback"));
+
+               if (act) {
+                       bool s = Config->get_skip_playback ();
+                       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+                       if (tact->get_active () != s) {
+                               tact->set_active (s);
+                       }
+               }
        }
 }
 
 void
 Editor::reset_focus ()
 {
-       track_canvas->grab_focus();
+       _track_canvas->grab_focus();
 }
 
 void
@@ -1506,16 +1758,6 @@ Editor::reset_canvas_action_sensitivity (bool onoff)
        }
 }
 
-void
-Editor::toggle_internal_editing ()
-{
-       Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("MouseMode"), X_("toggle-internal-edit"));
-       if (act) {
-               Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act);
-               set_internal_edit (tact->get_active());
-       }
-}
-
 void
 Editor::register_region_actions ()
 {
@@ -1547,6 +1789,8 @@ Editor::register_region_actions ()
        /* Toggle `locked' status of selected regions */
        toggle_reg_sens (_region_actions, "toggle-region-lock", _("Lock"), sigc::mem_fun(*this, &Editor::toggle_region_lock));
 
+       toggle_reg_sens (_region_actions, "toggle-region-video-lock", _("Lock to Video"), sigc::mem_fun(*this, &Editor::toggle_region_video_lock));
+
        toggle_reg_sens (
                _region_actions,
                "toggle-region-lock-style",
@@ -1599,15 +1843,15 @@ Editor::register_region_actions ()
                _region_actions, "toggle-region-fades", _("Fades"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_region_fades), 0)
                );
 
-       /* Open the dialogue to duplicate selected regions */
-       reg_sens (_region_actions, "duplicate-region", _("Duplicate"), sigc::bind (sigc::mem_fun (*this, &Editor::duplicate_dialog), false));
+       /* Duplicate selected regions */
+       reg_sens (_region_actions, "duplicate-region", _("Duplicate"), sigc::bind (sigc::mem_fun (*this, &Editor::duplicate_range), false));
 
        /* Open the dialogue to duplicate selected regions multiple times */
        reg_sens (
                _region_actions,
                "multi-duplicate-region",
                _("Multi-Duplicate..."),
-               sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_dialog), true)
+               sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_range), true)
                );
 
        /* Fill tracks with selected regions */
@@ -1655,7 +1899,10 @@ Editor::register_region_actions ()
                );
 
        reg_sens (_region_actions, "set-fade-in-length", _("Set Fade In Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), true));
+       reg_sens (_region_actions, "alternate-set-fade-in-length", _("Set Fade In Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), true));
        reg_sens (_region_actions, "set-fade-out-length", _("Set Fade Out Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), false));
+       reg_sens (_region_actions, "alternate-set-fade-out-length", _("Set Fade Out Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), false));
+
        reg_sens (_region_actions, "set-tempo-from-region", _("Set Tempo from Region = Bar"), sigc::mem_fun (*this, &Editor::set_tempo_from_region));
 
        reg_sens (
@@ -1684,13 +1931,6 @@ Editor::register_region_actions ()
 
        reg_sens (_region_actions, "reset-region-scale-amplitude", _("Reset Gain"), sigc::mem_fun (*this, &Editor::reset_region_scale_amplitude));
 
-       toggle_reg_sens (
-               _region_actions,
-               "toggle-region-gain-envelope-visible",
-               _("Envelope Visible"),
-               sigc::mem_fun (*this, &Editor::toggle_gain_envelope_visibility)
-               );
-
        toggle_reg_sens (
                _region_actions,
                "toggle-region-gain-envelope-active",
@@ -1699,26 +1939,32 @@ Editor::register_region_actions ()
                );
 
        reg_sens (_region_actions, "quantize-region", _("Quantize..."), sigc::mem_fun (*this, &Editor::quantize_region));
+       reg_sens (_region_actions, "legatize-region", _("Legatize"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), false));
+       reg_sens (_region_actions, "remove-overlap", _("Remove Overlap"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), true));
        reg_sens (_region_actions, "insert-patch-change", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), false));
        reg_sens (_region_actions, "insert-patch-change-context", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), true));
-       reg_sens (_region_actions, "fork-region", _("Fork"), sigc::mem_fun (*this, &Editor::fork_region));
+       reg_sens (_region_actions, "fork-region", _("Unlink from other copies"), sigc::mem_fun (*this, &Editor::fork_region));
        reg_sens (_region_actions, "strip-region-silence", _("Strip Silence..."), sigc::mem_fun (*this, &Editor::strip_region_silence));
        reg_sens (_region_actions, "set-selection-from-region", _("Set Range Selection"), sigc::mem_fun (*this, &Editor::set_selection_from_region));
 
-       reg_sens (_region_actions, "nudge-forward", _("Nudge Forward"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false));
-       reg_sens (_region_actions, "nudge-backward", _("Nudge Backward"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false));
+       reg_sens (_region_actions, "nudge-forward", _("Nudge Later"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false));
+       reg_sens (_region_actions, "alternate-nudge-forward", _("Nudge Later"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false));
+       reg_sens (_region_actions, "nudge-backward", _("Nudge Earlier"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false));
+       reg_sens (_region_actions, "alternate-nudge-backward", _("Nudge Earlier"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false));
+
+       reg_sens (_region_actions, "sequence-regions", _("Sequence Regions"), sigc::mem_fun (*this, &Editor::sequence_regions));
 
        reg_sens (
                _region_actions,
                "nudge-forward-by-capture-offset",
-               _("Nudge Forward by Capture Offset"),
+               _("Nudge Later by Capture Offset"),
                sigc::mem_fun (*this, &Editor::nudge_forward_capture_offset)
                );
 
        reg_sens (
                _region_actions,
                "nudge-backward-by-capture-offset",
-               _("Nudge Backward by Capture Offset"),
+               _("Nudge Earlier by Capture Offset"),
                sigc::mem_fun (*this, &Editor::nudge_backward_capture_offset)
                );