biggest chan number in list (revised)

Origin commit data
------------------
Branch: ni/coolstream
Commit: 441cba7d4a
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-07-07 (Sat, 07 Jul 2012)


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

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2012-07-07 21:10:10 +02:00
parent 1fc94b37ae
commit 2bdde1e0c7
3 changed files with 24 additions and 18 deletions

View File

@@ -587,7 +587,7 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width,
if (buffer == NULL)
{
printf("%s: Error: malloc\n", mode_str.c_str());
return false;
return 0;
}
#ifdef FBV_SUPPORT_PNG
if ((name.find(".png") == (name.length() - 4)) && (fh_png_id(name.c_str())))

View File

@@ -1209,8 +1209,9 @@ int CChannelList::numericZap(int key)
}
return res;
}
int sx = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(widest_number) + 14;
size_t maxchansize = MaxChanNr().size();
int fw = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(widest_number);
int sx = maxchansize * fw + (fw/2);
int sy = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight() + 6;
int ox = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - sx)/2;
@@ -1225,14 +1226,14 @@ int CChannelList::numericZap(int key)
while(1) {
if (lastchan != chn) {
snprintf((char*) &valstr, sizeof(valstr), "%d", chn);
while(strlen(valstr) < 4)
strcat(valstr,"-"); //"_"
while(strlen(valstr) < maxchansize)
strcat(valstr,"-"); //"_"
frameBuffer->paintBoxRel(ox, oy, sx, sy, COL_INFOBAR_PLUS_0);
for (int i = 3; i >= 0; i--) {
for (int i = maxchansize-1; i >= 0; i--) {
valstr[i+ 1] = 0;
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->RenderString(ox+7+ i*((sx-14)>>2), oy+sy-3, sx, &valstr[i], COL_INFOBAR);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->RenderString(ox+fw/3+ i*fw, oy+sy-3, sx, &valstr[i], COL_INFOBAR);
}
showInfo(chn);
@@ -1955,17 +1956,7 @@ void CChannelList::paintHead()
void CChannelList::paint()
{
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());
numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(MaxChanNr().c_str());
liststart = (selected/listmaxshow)*listmaxshow;
updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow));
@@ -2029,3 +2020,17 @@ bool CChannelList::SameTP(CZapitChannel * channel)
}
return iscurrent;
}
std::string CChannelList::MaxChanNr()
{
zapit_list_it_t chan_it;
std::stringstream ss;
std::string maxchansize;
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 >> maxchansize;
return maxchansize;
}

View File

@@ -96,6 +96,7 @@ private:
void hide();
void showChannelLogo();
void calcSize();
std::string MaxChanNr();
public:
CChannelList(const char * const Name, bool historyMode = false, bool _vlist = false, bool new_mode_active = false );