diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-06-17 15:06:30 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-06-17 15:06:30 +0000 |
commit | fe85a922ec4a3e0cf1107adadfa50ad7b8417aa3 (patch) | |
tree | 28c6259e58192cd414a32e41b9fd3ff5bcbd8506 | |
parent | ac9589ff2c589d079a600106b59a1772ce61b624 (diff) |
new trim cursors from chrisg, fix up hotspots for said cursors, make Editor cursors public; note draw mode now trims existing notes (but without trim cursor :(
git-svn-id: svn://localhost/ardour2/branches/3.0@7270 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 40 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/icons/trim_left_cursor.png | bin | 467 -> 631 bytes | |||
-rw-r--r-- | gtk2_ardour/icons/trim_right_cursor.png | bin | 450 -> 625 bytes | |||
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 2 |
7 files changed, 36 insertions, 26 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index b923955c8d..98287553ba 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1245,12 +1245,12 @@ Editor::build_cursors () { Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_left_cursor")); - left_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 5, 17); + left_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 5, 11); } { Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_right_cursor")); - right_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 5, 17); + right_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 23, 11); } selector_cursor = new Gdk::Cursor (XTERM); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index d11bb309f2..65af453982 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -447,6 +447,27 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void begin_reversible_command (std::string cmd_name); void commit_reversible_command (); + /* handy cursors for everyone to use */ + + static Gdk::Cursor* cross_hair_cursor; + static Gdk::Cursor* trimmer_cursor; + static Gdk::Cursor* right_side_trim_cursor; + static Gdk::Cursor* left_side_trim_cursor; + static Gdk::Cursor* selector_cursor; + static Gdk::Cursor* grabber_cursor; + static Gdk::Cursor* grabber_edit_point_cursor; + static Gdk::Cursor* zoom_cursor; + static Gdk::Cursor* time_fx_cursor; + static Gdk::Cursor* fader_cursor; + static Gdk::Cursor* speaker_cursor; + static Gdk::Cursor* midi_pencil_cursor; + static Gdk::Cursor* midi_select_cursor; + static Gdk::Cursor* midi_resize_cursor; + static Gdk::Cursor* midi_erase_cursor; + static Gdk::Cursor* wait_cursor; + static Gdk::Cursor* timebar_cursor; + static Gdk::Cursor* transparent_cursor; + protected: void map_transport_state (); void map_position_change (nframes64_t); @@ -986,25 +1007,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD TrackViewList get_tracks_for_range_action () const; - static Gdk::Cursor* cross_hair_cursor; - static Gdk::Cursor* trimmer_cursor; - static Gdk::Cursor* right_side_trim_cursor; - static Gdk::Cursor* left_side_trim_cursor; - static Gdk::Cursor* selector_cursor; - static Gdk::Cursor* grabber_cursor; - static Gdk::Cursor* grabber_edit_point_cursor; - static Gdk::Cursor* zoom_cursor; - static Gdk::Cursor* time_fx_cursor; - static Gdk::Cursor* fader_cursor; - static Gdk::Cursor* speaker_cursor; - static Gdk::Cursor* midi_pencil_cursor; - static Gdk::Cursor* midi_select_cursor; - static Gdk::Cursor* midi_resize_cursor; - static Gdk::Cursor* midi_erase_cursor; - static Gdk::Cursor* wait_cursor; - static Gdk::Cursor* timebar_cursor; - static Gdk::Cursor* transparent_cursor; - static void build_cursors (); sigc::connection super_rapid_screen_update_connection; diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index d978029d2d..ee27e001fd 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1592,7 +1592,7 @@ NoteResizeDrag::NoteResizeDrag (Editor* e, ArdourCanvas::Item* i) void NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor *) { - Gdk::Cursor cursor; + Gdk::Cursor* cursor; ArdourCanvas::CanvasNote* cnote = dynamic_cast<ArdourCanvas::CanvasNote*>(_item); Drag::start_grab (event); @@ -1603,14 +1603,15 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor *) double const middle_point = region_start + cnote->x1() + (cnote->x2() - cnote->x1()) / 2.0L; if (grab_x() <= middle_point) { - cursor = Gdk::Cursor(Gdk::LEFT_SIDE); + cursor = _editor->left_side_trim_cursor; at_front = true; } else { - cursor = Gdk::Cursor(Gdk::RIGHT_SIDE); + cursor = _editor->right_side_trim_cursor; at_front = false; } + cerr << "Set cursor for note resize\n"; - _item->grab(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, cursor, event->motion.time); + _item->grab(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, *cursor, event->motion.time); if (event->motion.state & Keyboard::PrimaryModifier) { relative = false; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 8aef3f9a5e..3bf0b3d352 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -663,6 +663,13 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT } break; + case NoteItem: + if (internal_editing()) { + /* trim notes if we're in internal edit mode and near the ends of the note */ + _drags->set (new NoteResizeDrag (this, item), event); + } + return true; + case StreamItem: if (internal_editing()) { _drags->set (new RegionCreateDrag (this, item, clicked_axisview), event); diff --git a/gtk2_ardour/icons/trim_left_cursor.png b/gtk2_ardour/icons/trim_left_cursor.png Binary files differindex d8ab14daa0..7f9535195b 100644 --- a/gtk2_ardour/icons/trim_left_cursor.png +++ b/gtk2_ardour/icons/trim_left_cursor.png diff --git a/gtk2_ardour/icons/trim_right_cursor.png b/gtk2_ardour/icons/trim_right_cursor.png Binary files differindex dcaf8e8287..c06ca71580 100644 --- a/gtk2_ardour/icons/trim_right_cursor.png +++ b/gtk2_ardour/icons/trim_right_cursor.png diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index b88cdf8cbd..46748f1e7f 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -308,6 +308,7 @@ MidiRegionView::button_press (GdkEventButton* ev) _mouse_state = Pressed; return true; } + _pressed_button = ev->button; return true; @@ -347,7 +348,6 @@ MidiRegionView::button_release (GdkEventButton* ev) if (!success) { beats = 1; } - create_note_at (event_x, event_y, beats); break; } |