diff options
-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 | |||
-rw-r--r-- | libs/ardour/ardour/trimmable.h | 16 | ||||
-rw-r--r-- | libs/ardour/region.cc | 2 |
7 files changed, 40 insertions, 31 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 diff --git a/libs/ardour/ardour/trimmable.h b/libs/ardour/ardour/trimmable.h index e053a2deed..28bb9da095 100644 --- a/libs/ardour/ardour/trimmable.h +++ b/libs/ardour/ardour/trimmable.h @@ -9,14 +9,14 @@ class Trimmable { virtual ~Trimmable() {} enum CanTrim { - FrontTrimEarlier, - FrontTrimLater, - EndTrimEarlier, - EndTrimLater, - TopTrimUp, - TopTrimDown, - BottomTrimUp, - BottomTrimDown + FrontTrimEarlier = 0x1, + FrontTrimLater = 0x2, + EndTrimEarlier = 0x4, + EndTrimLater = 0x8, + TopTrimUp = 0x10, + TopTrimDown = 0x20, + BottomTrimUp = 0x40, + BottomTrimDown = 0x80 } ; virtual CanTrim can_trim() const { diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 6d4be37b6d..33338e52ea 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1607,7 +1607,7 @@ Region::can_trim () const } if (!_sources.empty()) { - if (last_frame() < _sources.front()->length (0)) { + if ((start() + length()) < _sources.front()->length (0)) { ct = CanTrim (ct | EndTrimLater); } } |