Snap new automation points on audio lanes (part of #4297).
authorCarl Hetherington <carl@carlh.net>
Sun, 13 Nov 2011 16:28:20 +0000 (16:28 +0000)
committerCarl Hetherington <carl@carlh.net>
Sun, 13 Nov 2011 16:28:20 +0000 (16:28 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10570 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/automation_time_axis.cc
gtk2_ardour/automation_time_axis.h
gtk2_ardour/editor_mouse.cc
gtk2_ardour/public_editor.h

index 4ba09120adb9a60461ee1b6773eb695c55fb4b21..7b44bac1d84511e2f542dd96b92b5fa3417bf85e 100644 (file)
@@ -558,7 +558,7 @@ AutomationTimeAxisView::build_display_menu ()
 }
 
 void
-AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* /*item*/, GdkEvent* /*event*/, framepos_t when, double y)
+AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when, double y)
 {
        if (!_line) {
                return;
@@ -578,6 +578,8 @@ AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* /*item*/, GdkE
 
        boost::shared_ptr<AutomationList> list = _line->the_list ();
 
+       _editor.snap_to_with_modifier (when, event);
+
        _session->begin_reversible_command (_("add automation event"));
        XMLNode& before = list->get_state();
 
index a48b1f9b2a79687809a7b4941e1691a6e4925498..7706ed7ee31469bb97f4429468857c03d8232dfa 100644 (file)
@@ -72,7 +72,7 @@ class AutomationTimeAxisView : public TimeAxisView {
        void set_samples_per_unit (double);
        std::string name() const { return _name; }
 
-       void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, framepos_t, double);
+       void add_automation_event (GdkEvent *, framepos_t, double);
 
        void clear_lines ();
 
index 6419591716fea2211bbe49e3e8f29a677287c975..e039983a67795ea8da0c9cc5596c5916d2eb2609 100644 (file)
@@ -1474,7 +1474,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        case AutomationTrackItem:
                                atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview);
                                if (atv) {
-                                       atv->add_automation_event (item, event, where, event->button.y);
+                                       atv->add_automation_event (event, where, event->button.y);
                                }
                                return true;
                                break;
@@ -1502,7 +1502,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 
                        case AutomationTrackItem:
                                dynamic_cast<AutomationTimeAxisView*>(clicked_axisview)->
-                                       add_automation_event (item, event, where, event->button.y);
+                                       add_automation_event (event, where, event->button.y);
                                return true;
                                break;
                        default:
index f5d7dad522a2130825c1bd130b5c61578e02c28f..d42605eb1b5af0013832b346194983a189617c3c 100644 (file)
@@ -387,6 +387,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
        virtual ARDOUR::Location* find_location_from_marker (Marker *, bool &) const = 0;
        virtual Marker* find_marker_from_location_id (PBD::ID const &, bool) const = 0;
 
+       virtual void snap_to_with_modifier (framepos_t &, GdkEvent const *, int32_t direction = 0, bool for_mark = false) = 0;
+       
        /// Singleton instance, set up by Editor::Editor()
 
        static PublicEditor* _instance;