From 3332633d199e14cc0948ad8da521e7a6a36237ee Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 28 Jan 2016 13:43:47 -0600 Subject: Editing from a control surface must have the ability to ignore mouse location. Add mark_in and mark_out actions that explicitly use the playhead as the edit location. --- gtk2_ardour/editor.h | 4 ++-- gtk2_ardour/editor_actions.cc | 11 +++++++---- gtk2_ardour/editor_keys.cc | 10 ++++++---- libs/surfaces/control_protocol/basic_ui.cc | 4 ++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 3c89281a4a..fab6535f98 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1497,8 +1497,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void set_loop_start_from_edit_point (); void set_loop_end_from_edit_point (); - void keyboard_selection_begin (); - void keyboard_selection_finish (bool add); + void keyboard_selection_begin ( Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE ); + void keyboard_selection_finish (bool add, Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE); bool have_pending_keyboard_selection; framepos_t pending_keyboard_selection_start; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 7c14b602ad..1010dadc54 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -375,8 +375,11 @@ Editor::register_actions () 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, "start-range-from-playhead", _("Start Range from Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_begin), EDIT_IGNORE_MOUSE )); + reg_sens (editor_actions, "finish-range-from-playhead", _("Finish Range from Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), false, EDIT_IGNORE_MOUSE )); + + reg_sens (editor_actions, "start-range", _("Start Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_begin), EDIT_IGNORE_NONE)); + reg_sens (editor_actions, "finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), false, EDIT_IGNORE_NONE)); reg_sens (editor_actions, "start-punch-range", _("Start Punch Range"), sigc::mem_fun(*this, &Editor::set_punch_start_from_edit_point)); reg_sens (editor_actions, "finish-punch-range", _("Finish Punch Range"), sigc::mem_fun(*this, &Editor::set_punch_end_from_edit_point)); @@ -384,8 +387,8 @@ Editor::register_actions () reg_sens (editor_actions, "start-loop-range", _("Start Loop Range"), sigc::mem_fun(*this, &Editor::set_loop_start_from_edit_point)); reg_sens (editor_actions, "finish-loop-range", _("Finish Loop Range"), sigc::mem_fun(*this, &Editor::set_loop_end_from_edit_point)); - 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, "alt-start-range", _("Start Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_begin), EDIT_IGNORE_NONE)); + reg_sens (editor_actions, "alt-finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), false, EDIT_IGNORE_NONE)); // reg_sens (editor_actions, "finish-add-range", _("Finish Add Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), true)); diff --git a/gtk2_ardour/editor_keys.cc b/gtk2_ardour/editor_keys.cc index a2ee357436..ff4e9781cb 100644 --- a/gtk2_ardour/editor_keys.cc +++ b/gtk2_ardour/editor_keys.cc @@ -39,7 +39,7 @@ using namespace PBD; using namespace Editing; void -Editor::keyboard_selection_finish (bool /*add*/) +Editor::keyboard_selection_finish (bool /*add*/, Editing::EditIgnoreOption ign) { if (_session) { @@ -49,7 +49,7 @@ Editor::keyboard_selection_finish (bool /*add*/) if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) { end = _session->audible_frame(); } else { - end = get_preferred_edit_position(); + end = get_preferred_edit_position(ign); } //snap the selection start/end @@ -69,7 +69,7 @@ Editor::keyboard_selection_finish (bool /*add*/) } void -Editor::keyboard_selection_begin () +Editor::keyboard_selection_begin (Editing::EditIgnoreOption ign) { if (_session) { @@ -77,9 +77,11 @@ Editor::keyboard_selection_begin () framepos_t end = selection->time.end_frame(); //0 if no current selection if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) { +printf("if you don't wait a second, this wil be wrong"); start = _session->audible_frame(); } else { - start = get_preferred_edit_position(); +printf("keyboard_selection_begin:: getting pref\n"); + start = get_preferred_edit_position(ign); } //snap the selection start/end diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 5dc324edc2..f4fcec95a0 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -357,8 +357,8 @@ BasicUI::jump_by_bars (double bars) session->request_locate ( session->convert_to_frames (any) ); } -void BasicUI::mark_in () { access_action("Editor/start-range"); } -void BasicUI::mark_out () { access_action("Editor/finish-range"); } +void BasicUI::mark_in () { access_action("Editor/start-range-from-playhead"); } +void BasicUI::mark_out () { access_action("Editor/finish-range-from-playhead"); } void BasicUI::toggle_click () { access_action("Transport/ToggleClick"); } void BasicUI::midi_panic () { access_action("MIDI/panic"); } -- cgit v1.2.3