Editing from a control surface must have the ability to ignore mouse location.
authorBen Loftis <ben@harrisonconsoles.com>
Thu, 28 Jan 2016 19:43:47 +0000 (13:43 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Thu, 28 Jan 2016 19:46:33 +0000 (13:46 -0600)
Add mark_in and mark_out actions that explicitly use the playhead as the edit location.

gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_keys.cc
libs/surfaces/control_protocol/basic_ui.cc

index 3c89281a4a1a1a2eb3f4e4f696a3b09b4d955983..fab6535f98790df0d7a9b99b62c6a011d95e6aea 100644 (file)
@@ -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;
 
index 7c14b602adeff1523c33491dcf12147e509c29cc..1010dadc54e1a0a13cc1c947e3f853046d459e0c 100644 (file)
@@ -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));
 
index a2ee3574363d46ce1750170f98606b9a7751d4bb..ff4e9781cbee9985215d800bd26fd1d43f536b3d 100644 (file)
@@ -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
index 5dc324edc200e8eb722f63654ffb2fb5ed01e3c5..f4fcec95a0a77a66a516ac5735adac6c0bd8667a 100644 (file)
@@ -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"); }