+ // Find out how wide each column has to be. First try unlimited width (ie.
+ // long titles for everything); if that gets too long, try again with short
+ // titles for chosen songs.
+ unsigned width[16], num_scores;
+ unsigned max_num_width = my_draw_text("8888", NULL, 22.0);
+ unsigned mode;
+ for (mode = 0; mode < 2; ++mode) {
+ for (unsigned i = 0; i < 16; ++i)
+ width[i] = 0;
+
+ for (std::vector<Player>::const_iterator i = group.players.begin(); i != group.players.end(); ++i) {
+ unsigned col = 1;
+ width[0] = std::max(width[0], my_draw_text(i->nick, NULL, 18.0));
+
+ for (std::vector<Score>::const_iterator j = i->scores.begin(); j != i->scores.end(); ++j, ++col) {
+ if (j->chosen) {
+ width[col] = std::max(width[col], my_draw_text((mode == 0) ? j->song.title : j->song.short_title, NULL, 12.0) +
+ max_num_width + 10);
+ } else {
+ width[col] = std::max(width[col], my_draw_text(j->song.short_title, NULL, 12.0));
+ width[col] = std::max(width[col], max_num_width);
+ }
+ }
+ }