13
0

Fix Marker label ellipsis for concurrent markers

* Sort markers: range-end before range-start
* When two marker have the same position, use distance
  to next marker not on the same position
This commit is contained in:
Robin Gareus 2024-05-08 19:07:09 +02:00
parent e542a8e0a0
commit a0dc432e7a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -306,7 +306,10 @@ Editor::check_marker_label (ArdourMarker* m)
list<ArdourMarker*>::iterator prev = sorted.end ();
list<ArdourMarker*>::iterator next = i;
++next;
if (next != sorted.end()) {
++next;
}
/* Look to see if the previous marker is still behind `m' in time */
if (i != sorted.begin()) {
@ -314,7 +317,7 @@ Editor::check_marker_label (ArdourMarker* m)
prev = i;
--prev;
if ((*prev)->position() > m->position()) {
if ((*prev)->position() >= m->position()) {
/* This marker is no longer in the correct order with the previous one, so
* update all the markers in this group.
*/
@ -351,8 +354,11 @@ Editor::check_marker_label (ArdourMarker* m)
}
}
if (next != sorted.end()) {
while (next != sorted.end() && (*next)->position () == m->position ()) {
++next;
}
if (next != sorted.end()) {
/* Update just the available space between this marker and the next */
double const p = sample_to_pixel (m->position().distance ((*next)->position()).samples());
@ -373,6 +379,9 @@ Editor::check_marker_label (ArdourMarker* m)
struct MarkerComparator {
bool operator() (ArdourMarker const * a, ArdourMarker const * b) {
if (a->position() == b->position()) {
return a->label_on_left ();
}
return a->position() < b->position();
}
};
@ -420,7 +429,13 @@ Editor::update_marker_labels (ArdourCanvas::Item* group)
while (i != sorted.end()) {
if (prev != sorted.end()) {
double const p = sample_to_pixel ((*prev)->position().distance ((*i)->position()).samples());
list<ArdourMarker*>::iterator pi = prev;
while (pi != sorted.begin () && (*pi)->position () == (*i)->position()) {
--pi;
}
double const p = sample_to_pixel ((*pi)->position().distance ((*i)->position()).samples());
if ((*prev)->label_on_left()) {
(*i)->set_left_label_limit (p);
@ -430,6 +445,10 @@ Editor::update_marker_labels (ArdourCanvas::Item* group)
}
while (next != sorted.end() && (*next)->position () == (*i)->position ()) {
++next;
}
if (next != sorted.end()) {
double const p = sample_to_pixel ((*i)->position().distance ((*next)->position()).samples());