Do not re-parent ruler markers depending on ruler visibility

Previously CD-markers and Arrangement-markers were shown
in the default Maker ruler when CD or Arrangement ruler
were hidden.

This also fixes a bug that could result in marker-labels
being cut short. Editor::update_marker_labels calculates
overlap with other markes in the same group; but re-parenting
did not update the sorted_marker_lists[group] index.
This commit is contained in:
Robin Gareus 2023-08-29 21:53:50 +02:00
parent 24ae92ce1e
commit 2f16f87e4f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 9 additions and 21 deletions

View File

@ -761,7 +761,7 @@ private:
void set_color (std::string const&);
};
static void reparent_location_markers (LocationMarkers*, ArdourCanvas::Item*);
void reparent_location_markers (LocationMarkers*, ArdourCanvas::Item*);
LocationMarkers* find_location_markers (ARDOUR::Location*) const;
ARDOUR::Location* find_location_from_marker (ArdourMarker*, bool& is_start) const;

View File

@ -460,35 +460,23 @@ Editor::reparent_location_markers (LocationMarkers* lam, ArdourCanvas::Item* new
{
if (lam->start && lam->start->get_parent() != new_parent) {
lam->start->reparent (*new_parent);
remove_sorted_marker (lam->start);
_sorted_marker_lists[new_parent].push_back (lam->start);
}
if (lam->end && lam->end->get_parent() != new_parent) {
lam->end->reparent (*new_parent);
remove_sorted_marker (lam->end);
_sorted_marker_lists[new_parent].push_back (lam->end);
}
}
void Editor::ensure_marker_updated (LocationMarkers* lam, Location* location)
{
if (location->is_cd_marker()) {
if (ruler_cd_marker_action->get_active ()) {
reparent_location_markers (lam, cd_marker_group);
} else if (location->is_mark()) {
reparent_location_markers (lam, marker_group);
} else {
reparent_location_markers (lam, range_marker_group);
}
return;
}
if (location->is_section()) {
if (ruler_section_action->get_active ()) {
reparent_location_markers (lam, section_marker_group);
} else {
reparent_location_markers (lam, marker_group);
}
return;
}
if (location->is_mark() || location->matches (Location::Flags(0))) {
reparent_location_markers (lam, cd_marker_group);
} else if (location->is_section()) {
reparent_location_markers (lam, section_marker_group);
} else if (location->is_mark() || location->matches (Location::Flags(0))) {
reparent_location_markers (lam, marker_group);
}
}