diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-29 20:29:47 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-29 20:29:47 +0000 |
commit | ba418958bff3491a7565b67ce506ecb2052b7a39 (patch) | |
tree | ad6d19d933896e1dfdd74dcdf4d2c98663f9403d /gtk2_ardour | |
parent | 1d5bade8a177e8f859c8163238210f0056393b44 (diff) |
patch from dave flick to tackle a variety of cursor issues
git-svn-id: svn://localhost/ardour2/branches/3.0@12481 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 79 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 17 | ||||
-rw-r--r-- | gtk2_ardour/mouse_cursors.cc | 4 |
3 files changed, 46 insertions, 54 deletions
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 106f6868c5..1ce02457fc 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -247,61 +247,38 @@ Editor::set_current_movable (boost::shared_ptr<Movable> m) void Editor::set_canvas_cursor () { - if (_internal_editing) { + switch (mouse_mode) { + case MouseRange: + current_canvas_cursor = _cursors->selector; + break; - switch (mouse_mode) { - case MouseDraw: - current_canvas_cursor = _cursors->midi_pencil; - break; + case MouseObject: + current_canvas_cursor = which_grabber_cursor(); + break; - case MouseObject: - current_canvas_cursor = which_grabber_cursor(); - break; + case MouseDraw: + current_canvas_cursor = _cursors->midi_pencil; + break; - case MouseTimeFX: - current_canvas_cursor = _cursors->midi_resize; - break; + case MouseGain: + current_canvas_cursor = _cursors->cross_hair; + break; - default: - return; + case MouseZoom: + if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) { + current_canvas_cursor = _cursors->zoom_out; + } else { + current_canvas_cursor = _cursors->zoom_in; } + break; - } else { - - switch (mouse_mode) { - case MouseRange: - current_canvas_cursor = _cursors->selector; - break; - - case MouseObject: - current_canvas_cursor = which_grabber_cursor(); - break; - - case MouseDraw: - /* shouldn't be possible, but just cover it anyway ... */ - current_canvas_cursor = _cursors->midi_pencil; - break; - - case MouseGain: - current_canvas_cursor = _cursors->cross_hair; - break; - - case MouseZoom: - if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) { - current_canvas_cursor = _cursors->zoom_out; - } else { - current_canvas_cursor = _cursors->zoom_in; - } - break; - - case MouseTimeFX: - current_canvas_cursor = _cursors->time_fx; // just use playhead - break; + case MouseTimeFX: + current_canvas_cursor = _cursors->time_fx; // just use playhead + break; - case MouseAudition: - current_canvas_cursor = _cursors->speaker; - break; - } + case MouseAudition: + current_canvas_cursor = _cursors->speaker; + break; } switch (_join_object_range_state) { @@ -584,7 +561,7 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp (mouse_mode != MouseRange) && (mouse_mode != MouseDraw)) || ((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3) || - internal_editing()) { + (internal_editing() && mouse_mode != MouseTimeFX)) { return; } @@ -1158,8 +1135,8 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT /* drag notes if we're in internal edit mode */ _drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor); return true; - } else if ((!internal_editing() || dynamic_cast<AudioRegionView*> (clicked_regionview)) && clicked_regionview) { - /* do time-FX if we're not in internal edit mode, or we are but we clicked on an audio region */ + } else if (clicked_regionview) { + /* do time-FX */ _drags->set (new TimeFXDrag (this, item, clicked_regionview, selection->regions.by_layer()), event); return true; } diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index a88230822f..b61c4e477f 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -327,7 +327,10 @@ MidiRegionView::canvas_event(GdkEvent* ev) return trackview.editor().toggle_internal_editing_from_double_click (ev); } - if (!trackview.editor().internal_editing()) { + if ((!trackview.editor().internal_editing() && trackview.editor().current_mouse_mode() != MouseGain) || + (trackview.editor().current_mouse_mode() == MouseTimeFX) || + (trackview.editor().current_mouse_mode() == MouseZoom)) { + // handle non-draw modes elsewhere return false; } @@ -388,6 +391,13 @@ MidiRegionView::enter_notify (GdkEventCrossing* ev) group->grab_focus(); } + // if current operation is non-operational in a midi region, change the cursor to so indicate + if (trackview.editor().current_mouse_mode() == MouseGain) { + Editor* editor = dynamic_cast<Editor *> (&trackview.editor()); + pre_enter_cursor = editor->get_canvas_cursor(); + editor->set_canvas_cursor(editor->cursors()->timebar); + } + return false; } @@ -399,6 +409,11 @@ MidiRegionView::leave_notify (GdkEventCrossing*) trackview.editor().verbose_cursor()->hide (); remove_ghost_note (); + if (pre_enter_cursor) { + Editor* editor = dynamic_cast<Editor *> (&trackview.editor()); + editor->set_canvas_cursor(pre_enter_cursor); + } + return false; } diff --git a/gtk2_ardour/mouse_cursors.cc b/gtk2_ardour/mouse_cursors.cc index fa3ce331d6..98e33d77d6 100644 --- a/gtk2_ardour/mouse_cursors.cc +++ b/gtk2_ardour/mouse_cursors.cc @@ -29,7 +29,7 @@ MouseCursors::MouseCursors () { RefPtr<Pixbuf> p (::get_icon ("zoom_in_cursor")); - zoom_in = new Cursor (Display::get_default(), p, 5, 5); + zoom_in = new Cursor (Display::get_default(), p, 10, 5); } { @@ -49,7 +49,7 @@ MouseCursors::MouseCursors () { RefPtr<Bitmap> source = Bitmap::create ((char const *) speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height); RefPtr<Bitmap> mask = Bitmap::create ((char const *) speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height); - speaker = new Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot); + speaker = new Cursor (source, mask, ffg, fbg, speaker_cursor_width >> 1, speaker_cursor_height >> 1); } { |