]> git.sesse.net Git - ccbs/blobdiff - bigscreen/groupscreen.cpp
Make "mode" a local variable to the for loop, now that we don't need it anymore.
[ccbs] / bigscreen / groupscreen.cpp
index cd6c86edccdb596660452a30fbd2096de61ae758..96afeecb3363cd47ac8bec5a210e5064b163f562 100644 (file)
@@ -64,8 +64,8 @@ void GroupScreen::draw(unsigned char *buf)
        // titles for chosen songs.
        unsigned width[16], num_scores;
        unsigned max_num_width = my_draw_text("8888", NULL, 22.0);
-       unsigned mode, sumwidth;
-       for (mode = 0; mode < 2; ++mode) {
+       unsigned sumwidth;
+       for (unsigned mode = 0; mode < 2; ++mode) {
                for (unsigned i = 0; i < 16; ++i)
                        width[i] = 0;
 
@@ -152,7 +152,13 @@ void GroupScreen::draw(unsigned char *buf)
                        unsigned this_width = my_draw_text(text, NULL, 22.0);
                        if (j->chosen) {
                                my_draw_text_deferred(td, text, 22.0, x + max_num_width - this_width, y);
-                               my_draw_text_deferred(td, (mode == 0) ? j->song.title : j->song.short_title, 12.0, x + max_num_width + 10, y);
+
+                               // draw the long name if we can, otherwise use the short one
+                               if (my_draw_text(j->song.title, NULL, 12.0) > width[col]) {
+                                       my_draw_text_deferred(td, j->song.short_title, 12.0, x + max_num_width + 10, y);
+                               } else {
+                                       my_draw_text_deferred(td, j->song.title, 12.0, x + max_num_width + 10, y);
+                               }
                        } else {
                                my_draw_text_deferred(td, text, 22.0, x + width[col] / 2 - this_width / 2, y);
                        }