mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
- timerlist: rework gui stuff
* add shadow * change some calculations to be more equal to other windows * get footerheight from paintButtons methode * change ok button to blue button in footer * blue button has same function as ok button * init members in contructor * remove unused code * change rotating colors because COL_MENUCONTENTDARK_PLUS_0 is used for shadow * replace info button with dummy if timer is not type REC or ZAP * sort member variables in header
This commit is contained in:
@@ -76,8 +76,6 @@ extern CBouquetManager *g_bouquetManager;
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define info_height 60
|
|
||||||
|
|
||||||
class CTimerListNewNotifier : public CChangeObserver
|
class CTimerListNewNotifier : public CChangeObserver
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -247,19 +245,16 @@ CTimerList::CTimerList()
|
|||||||
{
|
{
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
visible = false;
|
visible = false;
|
||||||
|
x = y = 0;
|
||||||
|
width = height = 0;
|
||||||
|
fheight = theight = 0;
|
||||||
|
footerHeight = 0;
|
||||||
selected = 0;
|
selected = 0;
|
||||||
liststart = 0;
|
liststart = 0;
|
||||||
|
listmaxshow = 0;
|
||||||
Timer = new CTimerdClient();
|
Timer = new CTimerdClient();
|
||||||
skipEventID=0;
|
skipEventID=0;
|
||||||
|
|
||||||
/* assuming all color icons must have same size */
|
|
||||||
int icol_w, icol_h, ih2;
|
|
||||||
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h);
|
|
||||||
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_OKAY, &icol_w, &ih2);
|
|
||||||
icol_h = std::max(icol_h, ih2);
|
|
||||||
|
|
||||||
//buttonHeight = 7 + std::max(icol_h+2, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight());
|
|
||||||
buttonHeight = std::max(icol_h+4, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight());
|
|
||||||
/* most probable default */
|
/* most probable default */
|
||||||
saved_dispmode = (int)CVFD::MODE_TVRADIO;
|
saved_dispmode = (int)CVFD::MODE_TVRADIO;
|
||||||
}
|
}
|
||||||
@@ -414,6 +409,16 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TimerListButtonsCount 5
|
||||||
|
struct button_label TimerListButtons[TimerListButtonsCount] =
|
||||||
|
{
|
||||||
|
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_TIMERLIST_DELETE },
|
||||||
|
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_TIMERLIST_NEW },
|
||||||
|
{ NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERLIST_RELOAD },
|
||||||
|
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_TIMERLIST_MODIFY },
|
||||||
|
{ NEUTRINO_ICON_BUTTON_INFO_SMALL, NONEXISTANT_LOCALE }
|
||||||
|
};
|
||||||
|
|
||||||
void CTimerList::updateEvents(void)
|
void CTimerList::updateEvents(void)
|
||||||
{
|
{
|
||||||
timerlist.clear();
|
timerlist.clear();
|
||||||
@@ -429,35 +434,32 @@ void CTimerList::updateEvents(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort(timerlist.begin(), timerlist.end());
|
sort(timerlist.begin(), timerlist.end());
|
||||||
width = w_max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getWidth()*56, 20);
|
|
||||||
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
||||||
|
|
||||||
int icol_w, icol_h;
|
|
||||||
frameBuffer->getIconSize(NEUTRINO_ICON_TIMER, &icol_w, &icol_h);
|
|
||||||
if(theight < icol_h)
|
|
||||||
theight = icol_h;
|
|
||||||
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &icol_w, &icol_h);
|
|
||||||
if(theight < icol_h)
|
|
||||||
theight = icol_h;
|
|
||||||
|
|
||||||
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
|
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
|
||||||
|
//get footerHeight from paintButtons
|
||||||
|
footerHeight = ::paintButtons(0, 0, 0, TimerListButtonsCount, TimerListButtons, 0, 0, "", false, COL_INFOBAR_SHADOW, NULL, 0, false);
|
||||||
|
|
||||||
height = frameBuffer->getScreenHeight() - (info_height+50);
|
width = w_max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getWidth()*56, 20);
|
||||||
|
height = frameBuffer->getScreenHeight() - (2*theight); // max height
|
||||||
|
|
||||||
|
listmaxshow = (height-theight)/(fheight*2);
|
||||||
|
height = theight+listmaxshow*fheight*2+footerHeight; // recalc height
|
||||||
|
|
||||||
listmaxshow = (height-theight-0)/(fheight*2);
|
|
||||||
height = theight+0+listmaxshow*fheight*2; // recalc height
|
|
||||||
if (timerlist.size() < listmaxshow)
|
if (timerlist.size() < listmaxshow)
|
||||||
{
|
{
|
||||||
listmaxshow=timerlist.size();
|
listmaxshow=timerlist.size();
|
||||||
height = theight+0+listmaxshow*fheight*2; // recalc height
|
height = theight+listmaxshow*fheight*2+footerHeight; // recalc height
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected==timerlist.size() && !(timerlist.empty()))
|
if (selected==timerlist.size() && !(timerlist.empty()))
|
||||||
{
|
{
|
||||||
selected=timerlist.size()-1;
|
selected=timerlist.size()-1;
|
||||||
liststart = (selected/listmaxshow)*listmaxshow;
|
liststart = (selected/listmaxshow)*listmaxshow;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = getScreenStartX(width);
|
x = getScreenStartX(width);
|
||||||
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height+ info_height)) / 2;
|
y = getScreenStartY(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -532,6 +534,8 @@ int CTimerList::show()
|
|||||||
{
|
{
|
||||||
paintItem(selected - liststart);
|
paintItem(selected - liststart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paintFoot();
|
||||||
}
|
}
|
||||||
else if ((msg == CRCInput::RC_down || msg == (unsigned int)g_settings.key_channelList_pagedown) && !(timerlist.empty()))
|
else if ((msg == CRCInput::RC_down || msg == (unsigned int)g_settings.key_channelList_pagedown) && !(timerlist.empty()))
|
||||||
{
|
{
|
||||||
@@ -560,8 +564,10 @@ int CTimerList::show()
|
|||||||
{
|
{
|
||||||
paintItem(selected - liststart);
|
paintItem(selected - liststart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paintFoot();
|
||||||
}
|
}
|
||||||
else if ((msg == CRCInput::RC_right || msg == CRCInput::RC_ok) && !(timerlist.empty()))
|
else if ((msg == CRCInput::RC_right || msg == CRCInput::RC_ok || msg==CRCInput::RC_blue) && !(timerlist.empty()))
|
||||||
{
|
{
|
||||||
if (modifyTimer()==menu_return::RETURN_EXIT_ALL)
|
if (modifyTimer()==menu_return::RETURN_EXIT_ALL)
|
||||||
{
|
{
|
||||||
@@ -669,14 +675,14 @@ void CTimerList::hide()
|
|||||||
{
|
{
|
||||||
if (visible)
|
if (visible)
|
||||||
{
|
{
|
||||||
frameBuffer->paintBackgroundBoxRel(x, y, width, height+ info_height+ 5);
|
frameBuffer->paintBackgroundBoxRel(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET);
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTimerList::paintItem(int pos)
|
void CTimerList::paintItem(int pos)
|
||||||
{
|
{
|
||||||
int ypos = y+ theight+0 + pos*fheight*2;
|
int ypos = y+ theight+ pos*fheight*2;
|
||||||
|
|
||||||
uint8_t color;
|
uint8_t color;
|
||||||
fb_pixel_t bgcolor;
|
fb_pixel_t bgcolor;
|
||||||
@@ -687,16 +693,14 @@ void CTimerList::paintItem(int pos)
|
|||||||
real_width-=15; //scrollbar
|
real_width-=15; //scrollbar
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos & 1)
|
|
||||||
{
|
|
||||||
color = COL_MENUCONTENTDARK;
|
|
||||||
bgcolor = COL_MENUCONTENTDARK_PLUS_0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
color = COL_MENUCONTENT;
|
color = COL_MENUCONTENT;
|
||||||
|
if (pos & 1)
|
||||||
|
bgcolor = COL_MENUCONTENT_PLUS_1;
|
||||||
|
else
|
||||||
bgcolor = COL_MENUCONTENT_PLUS_0;
|
bgcolor = COL_MENUCONTENT_PLUS_0;
|
||||||
}
|
//shadow
|
||||||
|
frameBuffer->paintBoxRel(x + width, ypos, SHADOW_OFFSET, 2*fheight, COL_MENUCONTENTDARK_PLUS_0);
|
||||||
|
//item
|
||||||
frameBuffer->paintBoxRel(x, ypos, real_width, 2*fheight, bgcolor);
|
frameBuffer->paintBoxRel(x, ypos, real_width, 2*fheight, bgcolor);
|
||||||
|
|
||||||
if (liststart + pos == selected)
|
if (liststart + pos == selected)
|
||||||
@@ -704,8 +708,9 @@ void CTimerList::paintItem(int pos)
|
|||||||
color = COL_MENUCONTENTSELECTED;
|
color = COL_MENUCONTENTSELECTED;
|
||||||
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
|
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
|
||||||
}
|
}
|
||||||
|
//selected item
|
||||||
frameBuffer->paintBoxRel(x,ypos, real_width, 2*fheight, bgcolor, RADIUS_MID);
|
frameBuffer->paintBoxRel(x,ypos, real_width, 2*fheight, bgcolor, RADIUS_MID);
|
||||||
|
|
||||||
if (liststart+pos<timerlist.size())
|
if (liststart+pos<timerlist.size())
|
||||||
{
|
{
|
||||||
CTimerd::responseGetTimer & timer = timerlist[liststart+pos];
|
CTimerd::responseGetTimer & timer = timerlist[liststart+pos];
|
||||||
@@ -858,24 +863,29 @@ void CTimerList::paintItem(int pos)
|
|||||||
void CTimerList::paintHead()
|
void CTimerList::paintHead()
|
||||||
{
|
{
|
||||||
CComponentsHeader header(x, y, width, theight, LOCALE_TIMERLIST_NAME, NEUTRINO_ICON_TIMER);
|
CComponentsHeader header(x, y, width, theight, LOCALE_TIMERLIST_NAME, NEUTRINO_ICON_TIMER);
|
||||||
|
header.setShadowOnOff(CC_SHADOW_ON);
|
||||||
header.paint();
|
header.paint();
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct button_label TimerListButtons[5] =
|
|
||||||
{
|
|
||||||
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_TIMERLIST_DELETE },
|
|
||||||
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_TIMERLIST_NEW },
|
|
||||||
{ NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERLIST_RELOAD },
|
|
||||||
{ NEUTRINO_ICON_BUTTON_OKAY , LOCALE_TIMERLIST_MODIFY },
|
|
||||||
{ NEUTRINO_ICON_BUTTON_INFO_SMALL, NONEXISTANT_LOCALE }
|
|
||||||
};
|
|
||||||
|
|
||||||
void CTimerList::paintFoot()
|
void CTimerList::paintFoot()
|
||||||
{
|
{
|
||||||
if (timerlist.empty())
|
CTimerd::responseGetTimer* timer=&timerlist[selected];
|
||||||
::paintButtons(x, y + height, width, 2, &(TimerListButtons[1]), width);
|
if (timer != NULL)
|
||||||
|
{
|
||||||
|
//replace info button with dummy if timer is not type REC or ZAP
|
||||||
|
if (timer->eventType == CTimerd::TIMER_RECORD || timer->eventType == CTimerd::TIMER_ZAPTO)
|
||||||
|
TimerListButtons[4].button = NEUTRINO_ICON_BUTTON_INFO_SMALL;
|
||||||
else
|
else
|
||||||
::paintButtons(x, y + height, width, 5, TimerListButtons, width);
|
TimerListButtons[4].button = NEUTRINO_ICON_BUTTON_DUMMY_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//shadow
|
||||||
|
frameBuffer->paintBoxRel(x + SHADOW_OFFSET, y + height - footerHeight, width, footerHeight + SHADOW_OFFSET, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
||||||
|
|
||||||
|
if (timerlist.empty())
|
||||||
|
::paintButtons(x, y + height - footerHeight, width, 2, &(TimerListButtons[1]), width);
|
||||||
|
else
|
||||||
|
::paintButtons(x, y + height - footerHeight, width, TimerListButtonsCount, TimerListButtons, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTimerList::paint()
|
void CTimerList::paint()
|
||||||
|
@@ -46,12 +46,16 @@ class CTimerList : public CMenuTarget
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CFrameBuffer *frameBuffer;
|
CFrameBuffer *frameBuffer;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int fheight; // fontheight content
|
||||||
|
int theight; // fontheight titel
|
||||||
|
int footerHeight;
|
||||||
unsigned int selected;
|
unsigned int selected;
|
||||||
unsigned int liststart;
|
unsigned int liststart;
|
||||||
unsigned int listmaxshow;
|
unsigned int listmaxshow;
|
||||||
int fheight; // Fonthoehe Timerlist-Inhalt
|
|
||||||
int theight; // Fonthoehe Timerlist-Titel
|
|
||||||
int buttonHeight;
|
|
||||||
bool visible;
|
bool visible;
|
||||||
|
|
||||||
CTimerdClient *Timer;
|
CTimerdClient *Timer;
|
||||||
@@ -66,11 +70,6 @@ class CTimerList : public CMenuTarget
|
|||||||
int timer_apids_ac3;
|
int timer_apids_ac3;
|
||||||
int timer_apids_alt;
|
int timer_apids_alt;
|
||||||
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
|
|
||||||
int skipEventID;
|
int skipEventID;
|
||||||
|
|
||||||
void paintItem(int pos);
|
void paintItem(int pos);
|
||||||
|
Reference in New Issue
Block a user