From 689d33ddd5aae00ad7c3f0356f91335d268e8f07 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 14 May 2021 18:37:41 -0600 Subject: [PATCH] get line for region markers functioning and visible --- gtk2_ardour/marker.cc | 35 +++++++++++++++++++++++++++++------ gtk2_ardour/region_view.cc | 13 +++++++++++-- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 661c905565..33329d9ae4 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -363,19 +363,36 @@ ArdourMarker::setup_line () { if (_shown && (_selected || _line_shown)) { - if (_track_canvas_line == 0) { + ArdourCanvas::Item* line_parent; - _track_canvas_line = new ArdourCanvas::Line (editor.get_cursor_scroll_group()); + if (_type == RegionCue) { + line_parent = group; + } else { + line_parent = editor.get_cursor_scroll_group(); + } + + if (_track_canvas_line == 0) { + _track_canvas_line = new ArdourCanvas::Line (line_parent); _track_canvas_line->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), group, this)); } + /* discover where our group origin is in canvas coordinates */ + ArdourCanvas::Duple g = group->canvas_origin(); - ArdourCanvas::Duple d = _track_canvas_line->canvas_to_item (ArdourCanvas::Duple (g.x + _shift, 0)); + ArdourCanvas::Duple d; + + if (_type == RegionCue) { + /* line top is at the top of the region view/track (g.y in canvas coords */ + d = line_parent->canvas_to_item (ArdourCanvas::Duple (g.x + _shift, g.y)); + } else { + /* line top is at the top of the canvas (0 in canvas coords) */ + d = line_parent->canvas_to_item (ArdourCanvas::Duple (g.x + _shift, 0)); + } _track_canvas_line->set_x0 (d.x); _track_canvas_line->set_x1 (d.x); _track_canvas_line->set_y0 (d.y); - _track_canvas_line->set_y1 (_line_height > 0 ? _line_height : ArdourCanvas::COORD_MAX); + _track_canvas_line->set_y1 (_line_height > 0 ? d.y + _line_height : ArdourCanvas::COORD_MAX); _track_canvas_line->set_outline_color ( _selected ? UIConfiguration::instance().color ("entered marker") : _color ); _track_canvas_line->raise_to_top (); _track_canvas_line->show (); @@ -535,12 +552,18 @@ ArdourMarker::set_color_rgba (uint32_t c) mark->set_fill_color (_selected ? UIConfiguration::instance().color ("entered marker") : _color); mark->set_outline_color ( _selected ? UIConfiguration::instance().color ("entered marker") : _color ); - if (_track_canvas_line && !_selected) { + if (_track_canvas_line && ((_type == RegionCue) || !_selected)) { _track_canvas_line->set_outline_color (_color); } if (_name_item) { - _name_item->set_color (contrasting_text_color (_color)); + if (_name_background) { + /* make sure text stands out over bg color */ + _name_item->set_color (contrasting_text_color (_color)); + } else { + /* make sure text is same color as everything else */ + _name_item->set_color (_color); + } } if (_name_background) { diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index eca52c87ef..165da2556f 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -541,9 +541,10 @@ RegionView::update_cue_markers () const samplepos_t start = region()->start(); const samplepos_t end = region()->start() + region()->length(); - const Gtkmm2ext::SVAModifier alpha = UIConfiguration::instance().modifier (X_("region marker")); - const uint32_t color = Gtkmm2ext::HSV (get_fill_color()).opposite().mod (alpha).color(); + const Gtkmm2ext::SVAModifier alpha = UIConfiguration::instance().modifier (X_("region mark")); + const uint32_t color = Gtkmm2ext::HSV (UIConfiguration::instance().color ("region mark")).mod (alpha).color(); + cerr << "marker color will be 0x" << std::hex << color << " based on " << get_fill_color() << std::dec << endl; /* We assume that if the region has multiple sources, any of them will * be appropriate as the origin of cue markers. We use the first one. @@ -593,6 +594,11 @@ RegionView::update_cue_markers () ArdourMarker* mark = new ArdourMarker (trackview.editor(), *group, color , c->text(), ArdourMarker::RegionCue, c->position() - start, false); 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 ())); if (show_cue_markers) { mark->show (); @@ -947,6 +953,9 @@ RegionView::set_height (double h) (*i)->set_y1 (h + 1); } + for (ViewCueMarkers::iterator v = _cue_markers.begin(); v != _cue_markers.end(); ++v) { + (*v)->view_marker->set_line_height (h - (1.5 * UIConfiguration::instance().get_ui_scale())); + } } /** Remove old coverage frame and make new ones, if we're in a LayerDisplay mode