redesign color mgmt when entering/leaving markers of various kinds

This commit is contained in:
Paul Davis 2021-05-18 14:46:25 -06:00
parent a5a2f111ee
commit 91ec860b3b
6 changed files with 41 additions and 5 deletions

View File

@ -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&);

View File

@ -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 ()
{

View File

@ -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:

View File

@ -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)
{

View File

@ -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

View File

@ -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 ();
}
}