diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 37e4ab3958..712a8bc128 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -715,6 +715,7 @@ private: void set_show_lines (bool); void set_selected (bool); + void set_entered (bool); void setup_lines (); void set_name (const std::string&); diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 643bb77876..ef53630453 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -631,6 +631,15 @@ Editor::LocationMarkers::set_selected (bool s) } } +void +Editor::LocationMarkers::set_entered (bool s) +{ + start->set_entered (s); + if (end) { + end->set_entered (s); + } +} + void Editor::LocationMarkers::setup_lines () { diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index bd18044b80..27fb7f2f8f 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1914,7 +1914,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ break; } entered_marker = marker; - marker->set_color_rgba (UIConfiguration::instance().color ("entered marker")); + marker->set_entered (true); break; case MeterMarkerItem: @@ -2044,9 +2044,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type) break; } entered_marker = 0; - if ((loc = find_location_from_marker (marker, is_start)) != 0) { - location_flags_changed (loc); - } + marker->set_entered (false); break; case MeterMarkerItem: diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 33329d9ae4..b65f8b5d8e 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -78,9 +78,11 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Container& parent, g , _track_canvas_line (0) , _type (type) , _selected (false) + , _entered (false) , _shown (false) , _line_shown (false) , _color (rgba) + , pre_enter_color (rgba) , _points_color (rgba) , _left_label_limit (DBL_MAX) , _right_label_limit (DBL_MAX) @@ -351,6 +353,27 @@ ArdourMarker::set_selected (bool s) mark->set_outline_color ( _selected ? UIConfiguration::instance().color ("entered marker") : _color ); } +void +ArdourMarker::set_entered (bool yn) +{ + /* if the pointer moves from the polygon to the line, we will get 2 + enter events in a row, which confuses color management. Catch this. + */ + + if (yn == _entered) { + return; + } + + _entered = yn; + + if (yn) { + pre_enter_color = _color; + set_color_rgba (UIConfiguration::instance().color ("entered marker")); + } else { + set_color_rgba (pre_enter_color); + } +} + void ArdourMarker::set_show_line (bool s) { diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h index 872bbe9bfb..564eb91f1f 100644 --- a/gtk2_ardour/marker.h +++ b/gtk2_ardour/marker.h @@ -77,6 +77,7 @@ public: ArdourCanvas::Item& the_item() const; void set_selected (bool); + void set_entered (bool); void set_show_line (bool); void set_line_height (double); @@ -125,9 +126,11 @@ protected: Type _type; int name_height; bool _selected; + bool _entered; bool _shown; bool _line_shown; uint32_t _color; + uint32_t pre_enter_color; uint32_t _points_color; double _left_label_limit; ///< the number of pixels available to the left of this marker for a label double _right_label_limit; ///< the number of pixels available to the right of this marker for a label diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index 165da2556f..c6c6cf1170 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -592,13 +592,14 @@ RegionView::update_cue_markers () /* Create a new ViewCueMarker */ - ArdourMarker* mark = new ArdourMarker (trackview.editor(), *group, color , c->text(), ArdourMarker::RegionCue, c->position() - start, false); + ArdourMarker* mark = new ArdourMarker (trackview.editor(), *group, color , c->text(), ArdourMarker::RegionCue, c->position() - start, true); mark->set_points_color (color); mark->set_show_line (true); /* make sure the line has a clean end, before the frame of the region view */ mark->set_line_height (trackview.current_height() - (1.5 * UIConfiguration::instance ().get_ui_scale ())); + mark->the_item().raise_to_top (); if (show_cue_markers) { mark->show (); @@ -619,6 +620,7 @@ RegionView::update_cue_markers () } (*existing)->view_marker->set_position (c->position() - start); + (*existing)->view_marker->the_item().raise_to_top (); } }