From e63ad99ba92e24ae108eb82db0a98e5073834d2c Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 16 Jan 2014 16:01:33 +0100 Subject: [PATCH] Set row size to 20px minimum in file list if browsing directories --- src/browsedialog.cpp | 3 ++- src/selector.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/browsedialog.cpp b/src/browsedialog.cpp index fa421b9..7766d24 100644 --- a/src/browsedialog.cpp +++ b/src/browsedialog.cpp @@ -60,6 +60,7 @@ bool BrowseDialog::exec() const int topBarHeight = gmenu2x->skinConfInt["topBarHeight"]; rowHeight = gmenu2x->font->getHeight() + 1; // gp2x=15+1 / pandora=19+1 + rowHeight = constrain(rowHeight, 20, 40); numRows = (gmenu2x->resY - topBarHeight - 20) / rowHeight; clipRect = (SDL_Rect) { 0, @@ -271,7 +272,7 @@ void BrowseDialog::paint() icon = iconFile; } 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); if (ts.available() && ts.pressed() diff --git a/src/selector.cpp b/src/selector.cpp index 9a08202..eb4c43c 100644 --- a/src/selector.cpp +++ b/src/selector.cpp @@ -81,6 +81,8 @@ int Selector::exec(int startSelection) { tie(top, height) = gmenu2x->getContentArea(); int fontheight = gmenu2x->font->getHeight(); + if (link->getSelectorBrowser()) + fontheight = constrain(fontheight, 20, 40); unsigned int nb_elements = height / fontheight; bg.convertToDisplayFormat(); @@ -126,11 +128,13 @@ int Selector::exec(int startSelection) { iY = i-firstElement; if (fl.isDirectory(i)) { 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 gmenu2x->s->write(gmenu2x->font, titles[i - fl.dirCount()], 4, - top + (iY * fontheight), - Font::HAlignLeft, Font::VAlignTop); + top + (iY * fontheight) + (fontheight / 2), + Font::HAlignLeft, Font::VAlignMiddle); } gmenu2x->s->clearClipRect();