summaryrefslogtreecommitdiff
path: root/gtk2_ardour/canvas-note-event.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-03-05 23:00:49 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-03-05 23:00:49 +0000
commitf649d775bc4f1e8721214e81619099de46810783 (patch)
tree8d07557453dd81462f8963afe247234403fb557a /gtk2_ardour/canvas-note-event.cc
parentfb2ef7cb9a6d903181da3b1d4681dc3faa778d1a (diff)
prevent trim cursors appearing, and prevent note trimming, when in a MIDI note that is too small on-screen. avoids silliness with trim cursors appearing while drawing small notes on screen, though really, it would nice to avoid them appearing ever in a note that was just added. not sure how to do that.
git-svn-id: svn://localhost/ardour2/branches/3.0@9077 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/canvas-note-event.cc')
-rw-r--r--gtk2_ardour/canvas-note-event.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/gtk2_ardour/canvas-note-event.cc b/gtk2_ardour/canvas-note-event.cc
index 0e1afcc017..e05c6956ad 100644
--- a/gtk2_ardour/canvas-note-event.cc
+++ b/gtk2_ardour/canvas-note-event.cc
@@ -292,7 +292,14 @@ CanvasNoteEvent::set_mouse_fractions (GdkEvent* ev)
_mouse_y_fraction = yf;
if (notify) {
- _region.note_mouse_position (_mouse_x_fraction, _mouse_y_fraction, set_cursor);
+ if (big_enough_to_trim()) {
+ _region.note_mouse_position (_mouse_x_fraction, _mouse_y_fraction, set_cursor);
+ } else {
+ /* pretend the mouse is in the middle, because this is not big enough
+ to trim right now.
+ */
+ _region.note_mouse_position (0.5, 0.5, set_cursor);
+ }
}
}
@@ -347,6 +354,12 @@ CanvasNoteEvent::mouse_near_ends () const
(_mouse_x_fraction >= 0.75 && _mouse_x_fraction < 1.0);
}
+bool
+CanvasNoteEvent::big_enough_to_trim () const
+{
+ return (x2() - x1()) > 10; /* canvas units, really pixels */
+}
+
} // namespace Canvas
} // namespace Gnome