From 135e064fbb7f399498616e18c00e13ccd70eb34e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 26 May 2011 17:57:21 +0000 Subject: [PATCH] Flip MIDI region view's verbose canvas cursor to above the mouse pointer if it is near the bottom of the canvas (#3842). git-svn-id: svn://localhost/ardour2/branches/3.0@9603 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_region_view.cc | 9 +++++++++ gtk2_ardour/public_editor.h | 1 + 2 files changed, 10 insertions(+) diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 3f0453e3e1..ca62e2dd05 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -3434,6 +3434,15 @@ MidiRegionView::show_verbose_cursor (string const & text, double xoffset, double wx += xoffset; wy += yoffset; + /* Flip the cursor above the mouse pointer if it would overlap the bottom of the canvas */ + + double x1, y1, x2, y2; + trackview.editor().verbose_cursor()->canvas_item()->get_bounds (x1, y1, x2, y2); + + if ((wy + y2 - y1) > trackview.editor().canvas_height()) { + wy -= (y2 - y1) + 2 * yoffset; + } + trackview.editor().verbose_cursor()->set (text, wx, wy); trackview.editor().verbose_cursor()->show (); } diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index b5db8377d3..84194f2b35 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -258,6 +258,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { virtual void show_window () = 0; virtual framepos_t leftmost_position() const = 0; virtual framecnt_t current_page_frames() const = 0; + virtual double canvas_height () const = 0; virtual void temporal_zoom_step (bool coarser) = 0; virtual void scroll_tracks_down_line () = 0; virtual void scroll_tracks_up_line () = 0;