]> git.sesse.net Git - ccbs/blobdiff - bigscreen/top5chosenscreen.cpp
Shape text using Pango and HarfBuzz; gives us nice ligatures and exotic scripts.
[ccbs] / bigscreen / top5chosenscreen.cpp
index 57a54f0a20833e77634110c77ce3a50e5375c9d7..ccfbea9f4051e6297bfee4b43b42417b3eb49dfe 100644 (file)
@@ -45,7 +45,7 @@ bool Top5ChosenScreen::check_invalidated()
 void Top5ChosenScreen::draw(unsigned char *buf, unsigned width, unsigned height)
 {
        scores_changed.reset_flag();
-       fill_background(buf, width, height);
+       fill_background(buf, "top5chosenscreen", width, height);
        set_screen_size(width, height);
 
        // fetch the top 5 chosen songs
@@ -64,29 +64,38 @@ void Top5ChosenScreen::draw(unsigned char *buf, unsigned width, unsigned height)
        
        unsigned row = 1, y = 140;
        for (std::vector<TopChosen>::const_iterator i = scores.begin(); i != scores.end(); ++i) {
+               std::string suffix;
+               if (row % 2 == 1) {
+                       suffix = ".odd";
+               } else {
+                       suffix = ".even";
+               }
+
                char str[16];
-               std::string theme_element = "data";
-               std::string heading_theme_element = "rowheading";
+               std::string heading_theme_element = "top5chosensongs.rowheading" + suffix;
+               std::string songname_theme_element = "top5chosensongs.songname" + suffix;
+               std::string frequency_theme_element = "top5chosensongs.frequency" + suffix;
 
                // print new entries in red
                if (seen_topchosen.count(*i) == 0 && seen_topchosen.size() > 0) {
-                       theme_element = "freshdata";
-                       heading_theme_element = "freshrowheading";
+                       heading_theme_element = "top5chosensongs.freshrowheading" + suffix;
+                       songname_theme_element = "top5chosensongs.freshsongname" + suffix;
+                       frequency_theme_element = "top5chosensongs.freshfrequency" + suffix;
                }
 
                std::sprintf(str, "%u", row++);
                unsigned width = my_draw_text(str, NULL, 24.0, heading_theme_element);
                my_draw_text(str, buf, 24.0, heading_theme_element, RANK_X - width/2, y);
 
-               if (my_draw_text(i->title, NULL, 24.0, theme_element) > SONG_MAX_WIDTH) {
-                       my_draw_text(i->shorttitle, buf, 24.0, theme_element, SONG_X, y);
+               if (my_draw_text(i->title, NULL, 24.0, songname_theme_element) > SONG_MAX_WIDTH) {
+                       my_draw_text(i->shorttitle, buf, 24.0, songname_theme_element, SONG_X, y);
                } else {
-                       my_draw_text(i->title, buf, 24.0, theme_element, SONG_X, y);
+                       my_draw_text(i->title, buf, 24.0, songname_theme_element, SONG_X, y);
                }
                
                std::sprintf(str, "%u", i->frequency);
-               width = my_draw_text(str, NULL, 24.0, theme_element);
-               my_draw_text(str, buf, 24.0, theme_element, FREQUENCY_X - width/2, y);
+               width = my_draw_text(str, NULL, 24.0, frequency_theme_element);
+               my_draw_text(str, buf, 24.0, frequency_theme_element, FREQUENCY_X - width/2, y);
 
                y += 40;
        }