summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-09-18 18:04:25 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-09-28 17:42:11 -0400
commitebb43508f1ab75b7d7467e0e95cdd1c816cf3183 (patch)
tree7c94c5715fa54a70cc769292d8a27fac140e7323
parent25011161e0a0ad77b77db787af35e24bdf10a040 (diff)
add new action and loop marker menu item for setting up loop record
-rw-r--r--gtk2_ardour/editor.h5
-rw-r--r--gtk2_ardour/editor_actions.cc3
-rw-r--r--gtk2_ardour/editor_markers.cc15
-rw-r--r--gtk2_ardour/editor_ops.cc54
4 files changed, 71 insertions, 6 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 3f10d05797..a0a27a66b4 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1457,7 +1457,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_loop_from_selection (bool play);
void set_punch_from_selection ();
void set_punch_from_region ();
+ void set_punch_from_loop ();
+ void setup_loop_record ();
+
void set_session_start_from_playhead ();
void set_session_end_from_playhead ();
void set_session_extents_from_selection ();
@@ -1684,7 +1687,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
void tempo_or_meter_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
- void build_range_marker_menu (bool, bool);
+ void build_range_marker_menu (bool, bool, bool);
void build_marker_menu (ARDOUR::Location *);
void build_tempo_or_meter_marker_menu (bool);
void build_new_transport_marker_menu ();
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 50b5480458..30939c0813 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -306,6 +306,9 @@ Editor::register_actions ()
reg_sens (editor_actions, "set-punch-from-edit-range", _("Set Punch from Selection"), sigc::mem_fun(*this, &Editor::set_punch_from_selection));
reg_sens (editor_actions, "set-session-from-edit-range", _("Set Session Start/End from Selection"), sigc::mem_fun(*this, &Editor::set_session_extents_from_selection));
+ reg_sens (editor_actions, "set-punch-from-loop", _("Set Punch from Loop"), sigc::mem_fun(*this, &Editor::set_punch_from_loop));
+ reg_sens (editor_actions, "setup-loop-record", _("Setup Loop Record"), sigc::mem_fun(*this, &Editor::setup_loop_record));
+
/* 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));
reg_sens (editor_actions, "play-from-edit-point", _("Play From Edit Point"), sigc::mem_fun(*this, &Editor::play_from_edit_point));
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index a8663edf6f..8eac1ddcc3 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -834,7 +834,7 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
if (loc == transport_loop_location() || loc == transport_punch_location() || loc->is_session_range ()) {
if (transport_marker_menu == 0) {
- build_range_marker_menu (loc == transport_loop_location() || loc == transport_punch_location(), loc->is_session_range());
+ build_range_marker_menu (loc == transport_loop_location(), loc == transport_punch_location(), loc->is_session_range());
}
marker_menu_item = item;
@@ -864,7 +864,7 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
} else if (loc->is_range_marker()) {
if (range_marker_menu == 0) {
- build_range_marker_menu (false, false);
+ build_range_marker_menu (false, false, false);
}
marker_menu_item = item;
range_marker_menu->popup (1, ev->time);
@@ -922,11 +922,11 @@ Editor::build_marker_menu (Location* loc)
}
void
-Editor::build_range_marker_menu (bool loop_or_punch, bool session)
+Editor::build_range_marker_menu (bool loop, bool punch, bool session)
{
using namespace Menu_Helpers;
- bool const loop_or_punch_or_session = loop_or_punch | session;
+ bool const loop_or_punch_or_session = loop | punch | session;
Menu *markerMenu = new Menu;
if (loop_or_punch_or_session) {
@@ -940,7 +940,12 @@ Editor::build_range_marker_menu (bool loop_or_punch, bool session)
items.push_back (MenuElem (_("Play Range"), sigc::mem_fun(*this, &Editor::marker_menu_play_range)));
items.push_back (MenuElem (_("Locate to Marker"), sigc::mem_fun(*this, &Editor::marker_menu_set_playhead)));
items.push_back (MenuElem (_("Play from Marker"), sigc::mem_fun(*this, &Editor::marker_menu_play_from)));
- items.push_back (MenuElem (_("Loop Range"), sigc::mem_fun(*this, &Editor::marker_menu_loop_range)));
+
+ if (!loop) {
+ items.push_back (MenuElem (_("Loop Range"), sigc::mem_fun(*this, &Editor::marker_menu_loop_range)));
+ } else {
+ items.push_back (MenuElem (_("Setup Loop Record"), sigc::mem_fun(*this, &Editor::setup_loop_record)));
+ }
items.push_back (MenuElem (_("Set Marker from Playhead"), sigc::mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
if (!Profile->get_sae()) {
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index cc67e02ee8..c7a46d0ad3 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -6266,6 +6266,60 @@ Editor::set_punch_from_selection ()
}
void
+Editor::set_punch_from_loop ()
+{
+ if (_session == 0) {
+ return;
+ }
+
+ Location* tll;
+
+ if ((tll = transport_loop_location()) == 0) {
+ return;
+ }
+
+ set_punch_range (tll->start(), tll->end(), _("set punch range from loop"));
+}
+
+void
+Editor::setup_loop_record ()
+{
+ if (_session == 0) {
+ return;
+ }
+
+ Location * looploc = _session->locations()->auto_loop_location();
+
+ if (!looploc) {
+ return;
+ }
+
+ set_punch_range (looploc->start(), looploc->end(), _("setup loop recording"));
+
+ Glib::RefPtr<Action> action = ActionManager::get_action ("Transport", "TogglePunch");
+
+ if (action) {
+
+ Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(action);
+
+ if (!tact) {
+ return;
+ }
+
+ /* drive the other two actions from this one */
+
+ Glib::RefPtr<Action> in_action = ActionManager::get_action ("Transport", "TogglePunchIn");
+ Glib::RefPtr<Action> out_action = ActionManager::get_action ("Transport", "TogglePunchOut");
+
+ if (in_action && out_action) {
+ Glib::RefPtr<ToggleAction> tiact = Glib::RefPtr<ToggleAction>::cast_dynamic(in_action);
+ Glib::RefPtr<ToggleAction> toact = Glib::RefPtr<ToggleAction>::cast_dynamic(out_action);
+ tiact->set_active (true);
+ toact->set_active (true);
+ }
+ }
+}
+void
Editor::set_session_extents_from_selection ()
{
if (_session == 0) {