diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in
index 740271fa4a..81f9c55e27 100644
--- a/gtk2_ardour/ardour.menus.in
+++ b/gtk2_ardour/ardour.menus.in
@@ -123,6 +123,9 @@
+
+
+
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 45200c7ab4..ff9e332b24 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -582,6 +582,11 @@ ARDOUR_UI::install_dependent_actions ()
ActionManager::session_sensitive_actions.push_back (act);
}
+ act = ActionManager::register_action (common_actions, "jump-to-loop-start", _("Jump to Loop Start"), sigc::bind(sigc::mem_fun(*editor, &PublicEditor::jump_to_loop_marker), true));
+ ActionManager::session_sensitive_actions.push_back (act);
+ act = ActionManager::register_action (common_actions, "jump-to-loop-end", _("Jump to Loop End"), sigc::bind(sigc::mem_fun(*editor, &PublicEditor::jump_to_loop_marker), false));
+ ActionManager::session_sensitive_actions.push_back (act);
+
act = ActionManager::register_action (common_actions, X_("addExistingAudioFiles"), _("Import"), sigc::mem_fun (*editor, &PublicEditor::external_audio_dialog));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 90e134b18f..e57766bed7 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -1421,6 +1421,7 @@ Editor::set_session (Session *t)
_session->locations()->added.connect (_session_connections, invalidator (*this), boost::bind (&Editor::add_new_location, this, _1), gui_context());
_session->locations()->removed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::location_gone, this, _1), gui_context());
_session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::refresh_location_display, this), gui_context());
+ _session->auto_loop_location_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::loop_location_changed, this, _1), gui_context ());
_session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context());
_playhead_cursor->track_canvas_item().reparent ((ArdourCanvas::Item*) get_cursor_scroll_group());
@@ -1434,6 +1435,8 @@ Editor::set_session (Session *t)
Config->map_parameters (pc);
_session->config.map_parameters (pc);
+ loop_location_changed (_session->locations()->auto_loop_location ());
+
//tempo_map_changed (PropertyChange (0));
reset_metric_marks ();
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index e0f6d22caf..a4d79c3d95 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -708,11 +708,13 @@ private:
void add_new_location (ARDOUR::Location*);
ArdourCanvas::Container* add_new_location_internal (ARDOUR::Location*);
void location_gone (ARDOUR::Location*);
+ void loop_location_changed (ARDOUR::Location*);
void remove_marker (ArdourCanvas::Item&);
void remove_marker (ArdourMarker*);
gint really_remove_global_marker (ARDOUR::Location* loc);
gint really_remove_region_marker (ArdourMarker*);
void goto_nth_marker (int nth);
+ void jump_to_loop_marker (bool start);
void trigger_script (int nth);
void trigger_script_by_name (const std::string script_name, const std::string args = "");
void toggle_marker_lines ();
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index a48d4cda30..32471ada42 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -945,6 +945,14 @@ Editor::location_gone (Location *location)
}
}
+void
+Editor::loop_location_changed (Location* l)
+{
+ bool s = 0 != l;
+ ActionManager::get_action (X_("Common"), X_("jump-to-loop-start"))->set_sensitive (s);
+ ActionManager::get_action (X_("Common"), X_("jump-to-loop-end"))->set_sensitive (s);
+}
+
void
Editor::tempo_map_marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
{
@@ -1950,6 +1958,24 @@ Editor::goto_nth_marker (int n)
}
}
+void
+Editor::jump_to_loop_marker (bool start)
+{
+ if (!_session) {
+ return;
+ }
+ Location* l = _session->locations ()->auto_loop_location ();
+ if (!l) {
+ return;
+ }
+
+ if (start) {
+ _session->request_locate (l->start_sample());
+ } else {
+ _session->request_locate (l->end_sample());
+ }
+}
+
void
Editor::toggle_marker_menu_glue ()
{
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 32754c195f..2cf6796130 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -244,6 +244,7 @@ public:
virtual void rec_with_count_in () = 0;
virtual void maybe_locate_with_edit_preroll (samplepos_t location) = 0;
virtual void goto_nth_marker (int nth) = 0;
+ virtual void jump_to_loop_marker (bool start) = 0;
virtual void trigger_script (int nth) = 0;
virtual void add_location_from_playhead_cursor () = 0;
virtual void remove_location_at_playhead_cursor () = 0;