diff --git a/gtk2_ardour/editing_context.h b/gtk2_ardour/editing_context.h index a5bedeb720..cc174e5552 100644 --- a/gtk2_ardour/editing_context.h +++ b/gtk2_ardour/editing_context.h @@ -340,6 +340,9 @@ public: virtual ArdourCanvas::GtkCanvasViewport* get_canvas_viewport() const = 0; virtual ArdourCanvas::Canvas* get_canvas() const = 0; + virtual size_t push_canvas_cursor (Gdk::Cursor*); + virtual void pop_canvas_cursor (); + protected: static Glib::RefPtr _midi_actions; @@ -347,8 +350,6 @@ public: friend class CursorContext; std::vector _cursor_stack; virtual void set_canvas_cursor (Gdk::Cursor*); - virtual size_t push_canvas_cursor (Gdk::Cursor*); - virtual void pop_canvas_cursor (); Editing::GridType pre_internal_grid_type; Editing::SnapMode pre_internal_snap_mode; diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index 9ab7a93707..ed5551a65c 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -4670,3 +4670,9 @@ MidiView::set_note_range (uint8_t low, uint8_t high) { _midi_context.apply_note_range (low, high, true); } + +void +MidiView::set_visibility_note_range (MidiViewBackground::VisibleNoteRange nvr, bool) +{ + _midi_context.set_note_visibility_range_style (nvr); +} diff --git a/gtk2_ardour/midi_view.h b/gtk2_ardour/midi_view.h index ec19c6bbb3..71a9615821 100644 --- a/gtk2_ardour/midi_view.h +++ b/gtk2_ardour/midi_view.h @@ -300,7 +300,7 @@ class MidiView : public virtual sigc::trackable void show_list_editor (); void set_note_range (uint8_t low, uint8_t high); - virtual void set_visibility_note_range (MidiViewBackground::VisibleNoteRange, bool) {}; + virtual void set_visibility_note_range (MidiViewBackground::VisibleNoteRange, bool); typedef std::set Selection; Selection const & selection () const { diff --git a/gtk2_ardour/prh.cc b/gtk2_ardour/prh.cc index c22c05df2b..23e039ad29 100644 --- a/gtk2_ardour/prh.cc +++ b/gtk2_ardour/prh.cc @@ -615,17 +615,18 @@ PianoRollHeader::motion_handler (GdkEventMotion* ev) Gdk::Cursor m_Cursor; double scroomer_top = max(1.0, (1.0 - ((_adj.get_value()+_adj.get_page_size()) / 127.0)) * get().height()); double scroomer_bottom = (1.0 - (_adj.get_value () / 127.0)) * get().height(); + if (evd.y > scroomer_top - 5 && evd.y < scroomer_top + 5){ m_Cursor = Gdk::Cursor (Gdk::TOP_SIDE); -// XXX _canvas->set_cursor(m_Cursor); + _view.editing_context().push_canvas_cursor (&m_Cursor); _scroomer_state = TOP; }else if (evd.y > scroomer_bottom - 5 && evd.y < scroomer_bottom + 5){ m_Cursor = Gdk::Cursor (Gdk::BOTTOM_SIDE); -// XXXX _canvas->set_cursor(m_Cursor); + _view.editing_context().push_canvas_cursor (&m_Cursor); _scroomer_state = BOTTOM; }else { _scroomer_state = MOVE; -// XXXX _canvas->set_cursor(); + _view.editing_context().pop_canvas_cursor (); } } @@ -718,7 +719,7 @@ PianoRollHeader::button_press_handler (GdkEventButton* ev) if (ev->button == 1 && ev->x <= _scroomer_size){ if (ev->type == GDK_2BUTTON_PRESS) { - _view.set_note_range (MidiStreamView::ContentsRange, false); + _view.set_visibility_note_range (MidiStreamView::ContentsRange, false); return true; } @@ -774,9 +775,8 @@ PianoRollHeader::button_release_handler (GdkEventButton* ev) { Duple evd (canvas_to_item (Duple (ev->x, ev->y))); - if (_scroomer_drag){ - _scroomer_drag = false; - } + _scroomer_drag = false; + int note = _view.midi_context().y_to_note(evd.y); if (false /*editor().current_mouse_mode() == Editing::MouseRange*/) { //Todo: this mode is buggy, and of questionable utility anyway @@ -839,7 +839,7 @@ bool PianoRollHeader::leave_handler (GdkEventCrossing*) { if (!_scroomer_drag){ -// XXX _canvas->set_cursor(); + _view.editing_context().pop_canvas_cursor (); } invalidate_note_range(_highlighted_note, _highlighted_note);