1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-22 12:57:31 +02:00

Wrap long subtitles to multiple lines in Dialog::writeSubTitle

Setting descriptions and help prompts now appear fully even if they are longer
than the screen allows. Translations do not need to worry about allowed text
being wider than the screen in some fonts anymore.
This commit is contained in:
Nebuleon Fumika 2014-07-24 02:52:44 +00:00 committed by Maarten ter Huurne
parent 485bab3b48
commit 15472a073e

View File

@ -31,14 +31,15 @@ void Dialog::writeTitle(const std::string &title, Surface *s)
{
if (s==NULL)
s = gmenu2x->s;
s->write(gmenu2x->font, title, 40, gmenu2x->skinConfInt["topBarHeight"] / 4, Font::HAlignLeft, Font::VAlignMiddle);
s->write(gmenu2x->font, title, 40, 0, Font::HAlignLeft, Font::VAlignTop);
}
void Dialog::writeSubTitle(const std::string &subtitle, Surface *s)
{
if (s==NULL)
s = gmenu2x->s;
s->write(gmenu2x->font, subtitle, 40, gmenu2x->skinConfInt["topBarHeight"] / 4 * 3, Font::HAlignLeft, Font::VAlignMiddle);
std::string wrapped = gmenu2x->font->wordWrap(subtitle, gmenu2x->resX - 48);
s->write(gmenu2x->font, wrapped, 40, gmenu2x->skinConfInt["topBarHeight"] - gmenu2x->font->getTextHeight(wrapped), Font::HAlignLeft, Font::VAlignTop);
}