13
0

working and accessible canvas cursor setting

This commit is contained in:
Paul Davis 2024-02-09 15:24:29 -07:00
parent 7899829a5e
commit d356cacb2a
4 changed files with 18 additions and 11 deletions

View File

@ -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<Gtk::ActionGroup> _midi_actions;
@ -347,8 +350,6 @@ public:
friend class CursorContext;
std::vector<Gdk::Cursor*> _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;

View File

@ -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);
}

View File

@ -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<NoteBase*> Selection;
Selection const & selection () const {

View File

@ -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);