diff --git a/gtk2_ardour/cue_editor.h b/gtk2_ardour/cue_editor.h index 57b9785e3f..88639c3044 100644 --- a/gtk2_ardour/cue_editor.h +++ b/gtk2_ardour/cue_editor.h @@ -102,7 +102,6 @@ class CueEditor : public EditingContext size_t push_canvas_cursor (Gdk::Cursor*); void pop_canvas_cursor (); void reset_x_origin_to_follow_playhead (); - }; #endif /* __gtk_ardour_cue_editor_h__ */ diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index 7dd70a122c..ba9c8b966d 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -1593,3 +1593,48 @@ EditingContext::start_local_tempo_map (std::shared_ptr) /* default is a no-op */ return Temporal::TempoMap::use (); } + +bool +EditingContext::typed_event (ArdourCanvas::Item* item, GdkEvent *event, ItemType type) +{ + if (!session () || session()->loading () || session()->deletion_in_progress ()) { + return false; + } + + gint ret = FALSE; + + switch (event->type) { + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + ret = button_press_handler (item, event, type); + break; + case GDK_BUTTON_RELEASE: + ret = button_release_handler (item, event, type); + break; + case GDK_MOTION_NOTIFY: + ret = motion_handler (item, event); + break; + + case GDK_ENTER_NOTIFY: + ret = enter_handler (item, event, type); + break; + + case GDK_LEAVE_NOTIFY: + ret = leave_handler (item, event, type); + break; + + case GDK_KEY_PRESS: + ret = key_press_handler (item, event, type); + break; + + case GDK_KEY_RELEASE: + ret = key_release_handler (item, event, type); + break; + + default: + break; + } + return ret; +} + diff --git a/gtk2_ardour/editing_context.h b/gtk2_ardour/editing_context.h index 05ff1686e4..d0bd4a5a1a 100644 --- a/gtk2_ardour/editing_context.h +++ b/gtk2_ardour/editing_context.h @@ -321,6 +321,8 @@ public: virtual ArdourCanvas::ScrollGroup* get_cursor_scroll_group () const = 0; virtual bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*) { return false; } + bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType); + protected: Glib::RefPtr _midi_actions; @@ -455,6 +457,19 @@ public: friend class TempoMapScope; virtual std::shared_ptr start_local_tempo_map (std::shared_ptr); virtual void end_local_tempo_map (std::shared_ptr) { /* no-op by default */ } + + virtual bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) = 0; + virtual bool button_press_handler_1 (ArdourCanvas::Item*, GdkEvent*, ItemType) = 0; + virtual bool button_press_handler_2 (ArdourCanvas::Item*, GdkEvent*, ItemType) = 0; + virtual bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) = 0; + virtual bool button_press_dispatch (GdkEventButton*) = 0; + virtual bool button_release_dispatch (GdkEventButton*) = 0; + virtual bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false) = 0; + virtual bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) = 0; + virtual bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) = 0; + virtual bool key_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) = 0; + virtual bool key_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) = 0; + }; diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 3d77b9b1e7..1b59675301 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1150,12 +1150,10 @@ private: std::weak_ptr _trimmable; std::weak_ptr _movable; - bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType); bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); bool button_press_handler_1 (ArdourCanvas::Item*, GdkEvent*, ItemType); bool button_press_handler_2 (ArdourCanvas::Item*, GdkEvent*, ItemType); bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); - bool button_double_click_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); bool button_press_dispatch (GdkEventButton*); bool button_release_dispatch (GdkEventButton*); bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false); diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 7b8d4532b1..897a38fef7 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -202,50 +202,6 @@ Editor::track_canvas_motion_notify_event (GdkEventMotion */*event*/) return false; } -bool -Editor::typed_event (ArdourCanvas::Item* item, GdkEvent *event, ItemType type) -{ - if (!session () || session()->loading () || session()->deletion_in_progress ()) { - return false; - } - - gint ret = FALSE; - - switch (event->type) { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - ret = button_press_handler (item, event, type); - break; - case GDK_BUTTON_RELEASE: - ret = button_release_handler (item, event, type); - break; - case GDK_MOTION_NOTIFY: - ret = motion_handler (item, event); - break; - - case GDK_ENTER_NOTIFY: - ret = enter_handler (item, event, type); - break; - - case GDK_LEAVE_NOTIFY: - ret = leave_handler (item, event, type); - break; - - case GDK_KEY_PRESS: - ret = key_press_handler (item, event, type); - break; - - case GDK_KEY_RELEASE: - ret = key_release_handler (item, event, type); - break; - - default: - break; - } - return ret; -} - bool Editor::canvas_region_view_event (GdkEvent *event, ArdourCanvas::Item* item, RegionView *rv) { diff --git a/gtk2_ardour/midi_cue_editor.cc b/gtk2_ardour/midi_cue_editor.cc index e2f098ca2c..a039c74659 100644 --- a/gtk2_ardour/midi_cue_editor.cc +++ b/gtk2_ardour/midi_cue_editor.cc @@ -249,3 +249,69 @@ MidiCueEditor::set_region (std::shared_ptr t, std::shared_ptr } } +bool +MidiCueEditor::button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) +{ + return true; +} + +bool +MidiCueEditor::button_press_handler_1 (ArdourCanvas::Item*, GdkEvent*, ItemType) +{ + return true; +} + +bool +MidiCueEditor::button_press_handler_2 (ArdourCanvas::Item*, GdkEvent*, ItemType) +{ + return true; +} + +bool +MidiCueEditor::button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) +{ + return true; +} + +bool +MidiCueEditor::button_press_dispatch (GdkEventButton*) +{ + return true; +} + +bool +MidiCueEditor::button_release_dispatch (GdkEventButton*) +{ + return true; +} + +bool +MidiCueEditor::motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll) +{ + return true; +} + +bool +MidiCueEditor::enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) +{ + return true; +} + +bool +MidiCueEditor::leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) +{ + return true; +} + +bool +MidiCueEditor::key_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) +{ + return true; +} + +bool +MidiCueEditor::key_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType) +{ + return true; +} + diff --git a/gtk2_ardour/midi_cue_editor.h b/gtk2_ardour/midi_cue_editor.h index 864702d01e..f30bfb3574 100644 --- a/gtk2_ardour/midi_cue_editor.h +++ b/gtk2_ardour/midi_cue_editor.h @@ -79,6 +79,18 @@ class MidiCueEditor : public CueEditor ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual, bool ensure_snap = false) const; + bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); + bool button_press_handler_1 (ArdourCanvas::Item*, GdkEvent*, ItemType); + bool button_press_handler_2 (ArdourCanvas::Item*, GdkEvent*, ItemType); + bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); + bool button_press_dispatch (GdkEventButton*); + bool button_release_dispatch (GdkEventButton*); + bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false); + bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); + bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); + bool key_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); + bool key_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); + private: Gtk::Adjustment vertical_adjustment; Gtk::Adjustment horizontal_adjustment;