eventlist: use footer instance at heap

Some settings were never applied on runtime.
This ensures re assign possible changed settings (e.g. colors).
This commit is contained in:
2022-03-04 20:33:32 +01:00
parent 82a04ed87c
commit 96174bc313
2 changed files with 16 additions and 9 deletions

View File

@@ -121,7 +121,7 @@ CEventList::CEventList()
header = NULL; header = NULL;
pb = NULL; pb = NULL;
navibar = NULL; navibar = NULL;
footer.enableShadow(CC_SHADOW_ON, -1, true); footer = NULL;
} }
CEventList::~CEventList() CEventList::~CEventList()
@@ -140,6 +140,9 @@ void CEventList::ResetModules()
if (pb){ if (pb){
delete pb; pb = NULL; delete pb; pb = NULL;
} }
if (footer){
delete footer; footer = NULL;
}
} }
void CEventList::UpdateTimerList(void) void CEventList::UpdateTimerList(void)
@@ -704,7 +707,6 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
void CEventList::hide() void CEventList::hide()
{ {
ResetModules(); ResetModules();
footer.kill();
frameBuffer->paintBackgroundBoxRel(x, y, full_width + OFFSET_SHADOW, height + OFFSET_SHADOW); frameBuffer->paintBackgroundBoxRel(x, y, full_width + OFFSET_SHADOW, height + OFFSET_SHADOW);
} }
@@ -1071,15 +1073,20 @@ void CEventList::paintFoot(t_channel_id channel_id)
btn_cnt++; btn_cnt++;
// paint footer only on changed content // paint footer only on changed content
size_t btn_size = 0; if (!footer)
if (footer.getButtonChainObject())
{ {
btn_size = footer.getButtonChainObject()->size(); footer = new CComponentsFooter();
footer->enableShadow(CC_SHADOW_ON, -1, true);
}
size_t btn_size = 0;
if (footer->getButtonChainObject())
{
btn_size = footer->getButtonChainObject()->size();
if (btn_cnt == (int)btn_size) if (btn_cnt == (int)btn_size)
{ {
for(size_t i=0; i < btn_size; i++) for(size_t i=0; i < btn_size; i++)
{ {
CComponentsButton *btn = static_cast<CComponentsButton*> (footer.getButtonChainObject()->getCCItem(i)); CComponentsButton *btn = static_cast<CComponentsButton*> (footer->getButtonChainObject()->getCCItem(i));
if (g_Locale->getString(buttons[i].locale) != btn->getCaptionString()) if (g_Locale->getString(buttons[i].locale) != btn->getCaptionString())
{ {
btn->setCaption(buttons[i].locale); btn->setCaption(buttons[i].locale);
@@ -1090,8 +1097,8 @@ void CEventList::paintFoot(t_channel_id channel_id)
} }
} }
if (!footer.isPainted() || btn_cnt != (int)btn_size) if (!footer->isPainted() || btn_cnt != (int)btn_size)
footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, full_width, footer_height, btn_cnt, buttons); footer->paintButtons(x, y + height - OFFSET_SHADOW - footer_height, full_width, footer_height, btn_cnt, buttons);
} }
// -- Eventlist Menu Handler Class // -- Eventlist Menu Handler Class

View File

@@ -79,7 +79,7 @@ class CEventList : public CListHelpers
CFrameBuffer *frameBuffer; CFrameBuffer *frameBuffer;
CChannelEventList evtlist; CChannelEventList evtlist;
CTimerd::TimerList timerlist; CTimerd::TimerList timerlist;
CComponentsFooter footer; CComponentsFooter *footer;
void readEvents(const t_channel_id channel_id); void readEvents(const t_channel_id channel_id);
unsigned int selected; unsigned int selected;
unsigned int current_event; unsigned int current_event;