1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-17 23:10:17 +02:00

Set row size to 20px minimum in file list if browsing directories

This commit is contained in:
Paul Cercueil 2014-01-16 16:01:33 +01:00
parent 408a991a9d
commit e63ad99ba9
2 changed files with 9 additions and 4 deletions

View File

@ -60,6 +60,7 @@ bool BrowseDialog::exec()
const int topBarHeight = gmenu2x->skinConfInt["topBarHeight"]; const int topBarHeight = gmenu2x->skinConfInt["topBarHeight"];
rowHeight = gmenu2x->font->getHeight() + 1; // gp2x=15+1 / pandora=19+1 rowHeight = gmenu2x->font->getHeight() + 1; // gp2x=15+1 / pandora=19+1
rowHeight = constrain(rowHeight, 20, 40);
numRows = (gmenu2x->resY - topBarHeight - 20) / rowHeight; numRows = (gmenu2x->resY - topBarHeight - 20) / rowHeight;
clipRect = (SDL_Rect) { clipRect = (SDL_Rect) {
0, 0,
@ -271,7 +272,7 @@ void BrowseDialog::paint()
icon = iconFile; icon = iconFile;
} }
icon->blit(gmenu2x->s, 5, offsetY); icon->blit(gmenu2x->s, 5, offsetY);
gmenu2x->s->write(gmenu2x->font, (*fl)[i], 24, offsetY + 8, gmenu2x->s->write(gmenu2x->font, (*fl)[i], 24, offsetY + rowHeight / 2,
Font::HAlignLeft, Font::VAlignMiddle); Font::HAlignLeft, Font::VAlignMiddle);
if (ts.available() && ts.pressed() if (ts.available() && ts.pressed()

View File

@ -81,6 +81,8 @@ int Selector::exec(int startSelection) {
tie(top, height) = gmenu2x->getContentArea(); tie(top, height) = gmenu2x->getContentArea();
int fontheight = gmenu2x->font->getHeight(); int fontheight = gmenu2x->font->getHeight();
if (link->getSelectorBrowser())
fontheight = constrain(fontheight, 20, 40);
unsigned int nb_elements = height / fontheight; unsigned int nb_elements = height / fontheight;
bg.convertToDisplayFormat(); bg.convertToDisplayFormat();
@ -126,11 +128,13 @@ int Selector::exec(int startSelection) {
iY = i-firstElement; iY = i-firstElement;
if (fl.isDirectory(i)) { if (fl.isDirectory(i)) {
gmenu2x->sc["imgs/folder.png"]->blit(gmenu2x->s, 4, top + (iY * fontheight)); gmenu2x->sc["imgs/folder.png"]->blit(gmenu2x->s, 4, top + (iY * fontheight));
gmenu2x->s->write(gmenu2x->font, fl[i], 21, top+(iY * fontheight), Font::HAlignLeft, Font::VAlignMiddle); gmenu2x->s->write(gmenu2x->font, fl[i], 21,
top + (iY * fontheight) + (fontheight / 2),
Font::HAlignLeft, Font::VAlignMiddle);
} else } else
gmenu2x->s->write(gmenu2x->font, titles[i - fl.dirCount()], 4, gmenu2x->s->write(gmenu2x->font, titles[i - fl.dirCount()], 4,
top + (iY * fontheight), top + (iY * fontheight) + (fontheight / 2),
Font::HAlignLeft, Font::VAlignTop); Font::HAlignLeft, Font::VAlignMiddle);
} }
gmenu2x->s->clearClipRect(); gmenu2x->s->clearClipRect();