mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
infoviewer_bb: smarter use of available space for buttons
of a button is not going to be painted, the space can be used for
other buttons which might otherwise have their text cut off
Signed-off-by: Jacek Jendrzej <crashdvb@googlemail.com>
Origin commit data
------------------
Commit: 0042ad1e7f
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-02-17 (Sun, 17 Feb 2013)
This commit is contained in:
committed by
Jacek Jendrzej
parent
65a3c616ab
commit
845cd43ebc
@@ -4,13 +4,7 @@
|
|||||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||||
Homepage: http://dbox.cyberphoria.org/
|
Homepage: http://dbox.cyberphoria.org/
|
||||||
|
|
||||||
Kommentar:
|
Copyright (C) 2012-2013 Stefan Seyfried
|
||||||
|
|
||||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
|
||||||
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
|
|
||||||
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
|
|
||||||
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
|
|
||||||
|
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -276,7 +270,7 @@ void CInfoViewerBB::getBBButtonInfo()
|
|||||||
minX = std::min(bbIconMinX, g_InfoViewer->ChanInfoX + (((g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX) * 75) / 100));
|
minX = std::min(bbIconMinX, g_InfoViewer->ChanInfoX + (((g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX) * 75) / 100));
|
||||||
int MaxBr = minX - (g_InfoViewer->ChanInfoX + 10);
|
int MaxBr = minX - (g_InfoViewer->ChanInfoX + 10);
|
||||||
bbButtonMaxX = g_InfoViewer->ChanInfoX + 10;
|
bbButtonMaxX = g_InfoViewer->ChanInfoX + 10;
|
||||||
int br = 0;
|
int br = 0, count = 0;
|
||||||
for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) {
|
for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) {
|
||||||
if ((i == CInfoViewerBB::BUTTON_SUBS) && (g_RemoteControl->subChannels.empty())) { // no subchannels
|
if ((i == CInfoViewerBB::BUTTON_SUBS) && (g_RemoteControl->subChannels.empty())) { // no subchannels
|
||||||
bbButtonInfo[i].paint = false;
|
bbButtonInfo[i].paint = false;
|
||||||
@@ -284,15 +278,17 @@ void CInfoViewerBB::getBBButtonInfo()
|
|||||||
// continue;
|
// continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
count++;
|
||||||
bbButtonInfo[i].paint = true;
|
bbButtonInfo[i].paint = true;
|
||||||
br += bbButtonInfo[i].w;
|
br += bbButtonInfo[i].w;
|
||||||
bbButtonInfo[i].x = bbButtonMaxX;
|
bbButtonInfo[i].x = bbButtonMaxX;
|
||||||
bbButtonMaxX += bbButtonInfo[i].w;
|
bbButtonMaxX += bbButtonInfo[i].w;
|
||||||
bbButtonMaxW = std::max(bbButtonMaxW, bbButtonInfo[i].w);
|
bbButtonMaxW = std::max(bbButtonMaxW, bbButtonInfo[i].w);
|
||||||
}
|
}
|
||||||
if (br > MaxBr) { // TODO: Cut to long strings
|
|
||||||
printf("[infoviewer.cpp - %s, line #%d] width ColorButtons (%d) > MaxBr (%d)\n", __FUNCTION__, __LINE__, br, MaxBr);
|
|
||||||
}
|
}
|
||||||
|
if (br > MaxBr)
|
||||||
|
printf("[infoviewer_bb:%s#%d] width br (%d) > MaxBr (%d) count %d\n", __func__, __LINE__, br, MaxBr, count);
|
||||||
#if 0
|
#if 0
|
||||||
int Btns = 0;
|
int Btns = 0;
|
||||||
// counting buttons
|
// counting buttons
|
||||||
@@ -321,14 +317,25 @@ void CInfoViewerBB::getBBButtonInfo()
|
|||||||
bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].w + rest;
|
bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].w + rest;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
|
||||||
bbButtonMaxX = g_InfoViewer->ChanInfoX + 10;
|
bbButtonMaxX = g_InfoViewer->ChanInfoX + 10;
|
||||||
int step = MaxBr / 4;
|
int step = MaxBr / 4;
|
||||||
bbButtonInfo[CInfoViewerBB::BUTTON_EPG].x = bbButtonMaxX;
|
if (count > 0) { /* avoid div-by-zero :-) */
|
||||||
bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].x = bbButtonMaxX + step;
|
step = MaxBr / count;
|
||||||
bbButtonInfo[CInfoViewerBB::BUTTON_SUBS].x = bbButtonMaxX + 2*step;
|
count = 0;
|
||||||
bbButtonInfo[CInfoViewerBB::BUTTON_FEAT].x = bbButtonMaxX + 3*step;
|
for (int i = 0; i < BUTTON_MAX; i++) {
|
||||||
#endif
|
if (!bbButtonInfo[i].paint)
|
||||||
|
continue;
|
||||||
|
bbButtonInfo[i].x = bbButtonMaxX + step * count;
|
||||||
|
// printf("%s: i = %d count = %d b.x = %d\n", __func__, i, count, bbButtonInfo[i].x);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("[infoviewer_bb:%s#%d: count <= 0???\n", __func__, __LINE__);
|
||||||
|
bbButtonInfo[BUTTON_EPG].x = bbButtonMaxX;
|
||||||
|
bbButtonInfo[BUTTON_AUDIO].x = bbButtonMaxX + step;
|
||||||
|
bbButtonInfo[BUTTON_SUBS].x = bbButtonMaxX + 2*step;
|
||||||
|
bbButtonInfo[BUTTON_FEAT].x = bbButtonMaxX + 3*step;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoViewerBB::showBBButtons(const int modus)
|
void CInfoViewerBB::showBBButtons(const int modus)
|
||||||
|
Reference in New Issue
Block a user