channellist.cpp : fix biggest chan number in list

Origin commit data
------------------
Branch: ni/coolstream
Commit: 6cfd4da52e
Author: no@ma.il <one@localhost.(none)>
Date: 2012-04-24 (Tue, 24 Apr 2012)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
no@ma.il
2012-04-24 12:55:18 +02:00
parent 09f59c9230
commit be33fea8ef

View File

@@ -32,6 +32,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sstream>
#include <gui/channellist.h>
@@ -1899,10 +1900,19 @@ void CChannelList::paintHead()
void CChannelList::paint()
{
liststart = (selected/listmaxshow)*listmaxshow;
//FIXME do we need to find biggest chan number in list ?
numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("0000");
zapit_list_it_t chan_it;
std::stringstream ss;
std::string chan_width;
int chan_nr_max = 1;
unsigned int nr = 0;
for (chan_it=chanlist.begin(); chan_it!=chanlist.end(); ++chan_it) {
chan_nr_max = std::max(chan_nr_max, chanlist[nr++]->number);
}
ss << chan_nr_max;
ss >> chan_width;
numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(chan_width.c_str());
liststart = (selected/listmaxshow)*listmaxshow;
updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow));
frameBuffer->paintBoxRel(x, y+theight, width, height-footerHeight-theight, COL_MENUCONTENT_PLUS_0, 0, CORNER_BOTTOM);