forward scroll events from track control headers to the canvas, to get consistent scroll behaviour (whatever that behaviour is)

This commit is contained in:
Paul Davis 2014-06-09 10:02:38 -04:00
parent 95f2b4ba17
commit d36afa6b8b
6 changed files with 25 additions and 63 deletions

View file

@ -495,11 +495,9 @@ Editor::Editor ()
controls_layout.add (*h);
controls_layout.set_name ("EditControlsBase");
controls_layout.add_events (Gdk::SCROLL_MASK);
controls_layout.signal_scroll_event().connect (sigc::mem_fun(*this, &Editor::control_layout_scroll), false);
controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|Gdk::SCROLL_MASK);
controls_layout.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::edit_controls_button_release));
controls_layout.signal_scroll_event().connect (sigc::mem_fun(*this, &Editor::control_layout_scroll), false);
_cursors = new MouseCursors;
@ -3878,26 +3876,14 @@ Editor::transport_punch_location()
bool
Editor::control_layout_scroll (GdkEventScroll* ev)
{
if (Keyboard::some_magic_widget_has_focus()) {
return false;
}
/* Just forward to the normal canvas scroll method. The coordinate
systems are different but since the canvas is always larger than the
track headers, and aligned with the trackview area, this will work.
switch (ev->direction) {
case GDK_SCROLL_UP:
scroll_tracks_up_line ();
return true;
break;
case GDK_SCROLL_DOWN:
scroll_tracks_down_line ();
return true;
default:
/* no left/right handling yet */
break;
}
return false;
In the not too distant future this layout is going away anyway and
headers will be on the canvas.
*/
return canvas_scroll_event (ev);
}
void

View file

@ -1402,6 +1402,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/* Canvas event handlers */
bool canvas_scroll_event (GdkEventScroll* event);
bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
@ -1458,7 +1459,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
bool track_canvas_scroll (GdkEventScroll* event);
bool track_canvas_scroll_event (GdkEventScroll* event);
bool track_canvas_button_press_event (GdkEventButton* event);
bool track_canvas_button_release_event (GdkEventButton* event);
bool track_canvas_motion_notify_event (GdkEventMotion* event);

View file

@ -236,7 +236,7 @@ Editor::initialize_canvas ()
handlers.
*/
_track_canvas->signal_scroll_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_scroll_event));
_track_canvas->signal_scroll_event().connect (sigc::mem_fun (*this, &Editor::canvas_scroll_event));
_track_canvas->signal_motion_notify_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_motion_notify_event));
_track_canvas->signal_button_press_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_button_press_event));
_track_canvas->signal_button_release_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_button_release_event));

View file

@ -60,6 +60,10 @@ using Gtkmm2ext::Keyboard;
bool
Editor::track_canvas_scroll (GdkEventScroll* ev)
{
if (Keyboard::some_magic_widget_has_focus()) {
return false;
}
framepos_t xdelta;
int direction = ev->direction;
@ -156,7 +160,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
}
bool
Editor::track_canvas_scroll_event (GdkEventScroll *event)
Editor::canvas_scroll_event (GdkEventScroll *event)
{
_track_canvas->grab_focus();
return track_canvas_scroll (event);
@ -1010,7 +1014,7 @@ Editor::canvas_note_event (GdkEvent *event, ArdourCanvas::Item* item)
}
bool
Editor::canvas_drop_zone_event (GdkEvent* event)
Editor::canvas_drop_zone_event (GdkEvent* /*event*/)
{
return true;
}

View file

@ -318,6 +318,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual void reset_focus () = 0;
virtual bool canvas_scroll_event (GdkEventScroll* event) = 0;
virtual bool canvas_control_point_event (GdkEvent* event, ArdourCanvas::Item*, ControlPoint*) = 0;
virtual bool canvas_line_event (GdkEvent* event, ArdourCanvas::Item*, AutomationLine*) = 0;
virtual bool canvas_selection_rect_event (GdkEvent* event, ArdourCanvas::Item*, SelectionRect*) = 0;

View file

@ -287,43 +287,14 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
bool
TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
{
switch (ev->direction) {
case GDK_SCROLL_UP:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
/* See Editor::_stepping_axis_view for notes on this hack */
Editor& e = dynamic_cast<Editor&> (_editor);
if (!e.stepping_axis_view ()) {
e.set_stepping_axis_view (this);
}
e.stepping_axis_view()->step_height (false);
return true;
} else if (Keyboard::no_modifiers_active (ev->state)) {
_editor.scroll_up_one_track();
return true;
}
break;
/* Just forward to the normal canvas scroll method. The coordinate
systems are different but since the canvas is always larger than the
track headers, and aligned with the trackview area, this will work.
case GDK_SCROLL_DOWN:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
/* See Editor::_stepping_axis_view for notes on this hack */
Editor& e = dynamic_cast<Editor&> (_editor);
if (!e.stepping_axis_view ()) {
e.set_stepping_axis_view (this);
}
e.stepping_axis_view()->step_height (true);
return true;
} else if (Keyboard::no_modifiers_active (ev->state)) {
_editor.scroll_down_one_track();
return true;
}
break;
default:
/* no handling for left/right, yet */
break;
}
return false;
In the not too distant future this layout is going away anyway and
headers will be on the canvas.
*/
return _editor.canvas_scroll_event (ev);
}
bool