mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
biggest chan number in list (revised)
This commit is contained in:
@@ -587,7 +587,7 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width,
|
|||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
{
|
{
|
||||||
printf("%s: Error: malloc\n", mode_str.c_str());
|
printf("%s: Error: malloc\n", mode_str.c_str());
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef FBV_SUPPORT_PNG
|
#ifdef FBV_SUPPORT_PNG
|
||||||
if ((name.find(".png") == (name.length() - 4)) && (fh_png_id(name.c_str())))
|
if ((name.find(".png") == (name.length() - 4)) && (fh_png_id(name.c_str())))
|
||||||
|
@@ -1209,8 +1209,9 @@ int CChannelList::numericZap(int key)
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
size_t maxchansize = MaxChanNr().size();
|
||||||
int sx = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(widest_number) + 14;
|
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 sy = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight() + 6;
|
||||||
|
|
||||||
int ox = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - sx)/2;
|
int ox = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - sx)/2;
|
||||||
@@ -1225,14 +1226,14 @@ int CChannelList::numericZap(int key)
|
|||||||
while(1) {
|
while(1) {
|
||||||
if (lastchan != chn) {
|
if (lastchan != chn) {
|
||||||
snprintf((char*) &valstr, sizeof(valstr), "%d", 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);
|
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;
|
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);
|
showInfo(chn);
|
||||||
@@ -1955,17 +1956,7 @@ void CChannelList::paintHead()
|
|||||||
|
|
||||||
void CChannelList::paint()
|
void CChannelList::paint()
|
||||||
{
|
{
|
||||||
zapit_list_it_t chan_it;
|
numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(MaxChanNr().c_str());
|
||||||
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;
|
liststart = (selected/listmaxshow)*listmaxshow;
|
||||||
updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow));
|
updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow));
|
||||||
@@ -2029,3 +2020,17 @@ bool CChannelList::SameTP(CZapitChannel * channel)
|
|||||||
}
|
}
|
||||||
return iscurrent;
|
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;
|
||||||
|
}
|
||||||
|
@@ -96,6 +96,7 @@ private:
|
|||||||
void hide();
|
void hide();
|
||||||
void showChannelLogo();
|
void showChannelLogo();
|
||||||
void calcSize();
|
void calcSize();
|
||||||
|
std::string MaxChanNr();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CChannelList(const char * const Name, bool historyMode = false, bool _vlist = false, bool new_mode_active = false );
|
CChannelList(const char * const Name, bool historyMode = false, bool _vlist = false, bool new_mode_active = false );
|
||||||
|
Reference in New Issue
Block a user