diff options
author | Carl Hetherington <carl@carlh.net> | 2010-11-15 22:55:39 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-11-15 22:55:39 +0000 |
commit | ee76685f8d3cd04ffa5905def8f760aeda8faa10 (patch) | |
tree | 4e16f6fb54a03064c06bb8d2d1de43e8ef774400 /gtk2_ardour | |
parent | 90172686b92b53cc5ab1d60c0e6daecb65d17d3d (diff) |
Modify region trim cursor if a region can only be trimmed in one direction.
git-svn-id: svn://localhost/ardour2/branches/3.0@8045 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 39 | ||||
-rwxr-xr-x | gtk2_ardour/icons/trim_left_cursor_right_only.png | bin | 0 -> 578 bytes | |||
-rwxr-xr-x | gtk2_ardour/icons/trim_right_cursor_left_only.png | bin | 0 -> 564 bytes |
5 files changed, 31 insertions, 22 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 8f954895df..22a4f9e805 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -214,6 +214,8 @@ Gdk::Cursor* Editor::selector_cursor = 0; Gdk::Cursor* Editor::trimmer_cursor = 0; Gdk::Cursor* Editor::left_side_trim_cursor = 0; Gdk::Cursor* Editor::right_side_trim_cursor = 0; +Gdk::Cursor* Editor::left_side_trim_right_only_cursor = 0; +Gdk::Cursor* Editor::right_side_trim_left_only_cursor = 0; Gdk::Cursor* Editor::fade_in_cursor = 0; Gdk::Cursor* Editor::fade_out_cursor = 0; Gdk::Cursor* Editor::grabber_cursor = 0; @@ -1312,6 +1314,16 @@ Editor::build_cursors () } { + Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_left_cursor_right_only")); + left_side_trim_right_only_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 5, 11); + } + + { + Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_right_cursor_left_only")); + right_side_trim_left_only_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 23, 11); + } + + { Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("fade_in_cursor")); fade_in_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 0, 0); } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 10a6b57e34..a3b7cd3628 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -456,6 +456,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD static Gdk::Cursor* trimmer_cursor; static Gdk::Cursor* right_side_trim_cursor; static Gdk::Cursor* left_side_trim_cursor; + static Gdk::Cursor* right_side_trim_left_only_cursor; + static Gdk::Cursor* left_side_trim_right_only_cursor; static Gdk::Cursor* fade_in_cursor; static Gdk::Cursor* fade_out_cursor; static Gdk::Cursor* selector_cursor; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 5c7f03ec37..653fdc3204 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1575,31 +1575,16 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ break; case RegionViewNameHighlight: - if (is_drawable() && mouse_mode == MouseObject && !internal_editing()) { + if (is_drawable() && mouse_mode == MouseObject && !internal_editing() && entered_regionview) { set_canvas_cursor_for_region_view (event->crossing.x, entered_regionview); _over_region_trim_target = true; } break; case LeftFrameHandle: - if (is_drawable() && mouse_mode == MouseObject && !internal_editing()) { - if (entered_regionview) { - Trimmable::CanTrim ct = entered_regionview->region()->can_trim(); - if ((ct & Trimmable::EndTrimEarlier) || (ct & Trimmable::EndTrimLater)) { - set_canvas_cursor (left_side_trim_cursor); - } - } - } - break; - case RightFrameHandle: - if (is_drawable() && mouse_mode == MouseObject && !internal_editing()) { - if (entered_regionview) { - Trimmable::CanTrim ct = entered_regionview->region()->can_trim(); - if ((ct & Trimmable::FrontTrimEarlier) || (ct & Trimmable::FrontTrimLater)) { - set_canvas_cursor (right_side_trim_cursor); - } - } + if (is_drawable() && mouse_mode == MouseObject && !internal_editing() && entered_regionview) { + set_canvas_cursor_for_region_view (event->crossing.x, entered_regionview); } break; @@ -2728,11 +2713,21 @@ Editor::set_canvas_cursor_for_region_view (double x, RegionView* rv) double x1, x2, y1, y2; g->get_bounds (x1, y1, x2, y2); + /* Halfway across the region */ double const h = (x1 + x2) / 2; - if (x1 < x && x <= h) { - set_canvas_cursor (left_side_trim_cursor); - } else if (h < x && x <= x2) { - set_canvas_cursor (right_side_trim_cursor); + Trimmable::CanTrim ct = rv->region()->can_trim (); + if (x <= h) { + if (ct & Trimmable::FrontTrimEarlier) { + set_canvas_cursor (left_side_trim_cursor); + } else { + set_canvas_cursor (left_side_trim_right_only_cursor); + } + } else { + if (ct & Trimmable::EndTrimLater) { + set_canvas_cursor (right_side_trim_cursor); + } else { + set_canvas_cursor (right_side_trim_left_only_cursor); + } } } diff --git a/gtk2_ardour/icons/trim_left_cursor_right_only.png b/gtk2_ardour/icons/trim_left_cursor_right_only.png Binary files differnew file mode 100755 index 0000000000..4812510f7b --- /dev/null +++ b/gtk2_ardour/icons/trim_left_cursor_right_only.png diff --git a/gtk2_ardour/icons/trim_right_cursor_left_only.png b/gtk2_ardour/icons/trim_right_cursor_left_only.png Binary files differnew file mode 100755 index 0000000000..e0b7bdbefb --- /dev/null +++ b/gtk2_ardour/icons/trim_right_cursor_left_only.png |