diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index d514209d8..e4274f421 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -15,7 +15,7 @@ EPGPlus.page_up Seite vor EPGPlus.prev_bouquet Bouquet zurück EPGPlus.record Aufnahme EPGPlus.refresh_epg Aktualisieren -EPGPlus.remind Vormerken +EPGPlus.remind Umschalten EPGPlus.scroll_mode Scroll-Modus EPGPlus.stretch_mode Stretch-Modus EPGPlus.swap_mode Blättern diff --git a/src/driver/colorgradient.cpp b/src/driver/colorgradient.cpp index e41087365..56e9de484 100644 --- a/src/driver/colorgradient.cpp +++ b/src/driver/colorgradient.cpp @@ -64,15 +64,15 @@ fb_pixel_t* CColorGradient::gradientColorToTransparent(fb_pixel_t col, fb_pixel_ { if (bSize < 1) return gradientBuf; - + unsigned long _bSize = (unsigned long) bSize; if (gradientBuf == NULL) { - gradientBuf = (fb_pixel_t*) malloc(bSize * sizeof(fb_pixel_t)); + gradientBuf = (fb_pixel_t*) malloc(_bSize * sizeof(fb_pixel_t)); if (gradientBuf == NULL) { dprintf(DEBUG_NORMAL, "[%s:%d] malloc error\n", __func__, __LINE__); return NULL; } } - memset((void*)gradientBuf, '\0', bSize * sizeof(fb_pixel_t)); + memset((void*)gradientBuf, '\0', _bSize * sizeof(fb_pixel_t)); int start_box = 0; int end_box = bSize; @@ -87,7 +87,7 @@ fb_pixel_t* CColorGradient::gradientColorToTransparent(fb_pixel_t col, fb_pixel_ uint8_t g = (uint8_t)((col & 0x0000FF00) >> 8); uint8_t b = (uint8_t) (col & 0x000000FF); - gradientBuf[i] = ((tr << 24) & 0xFF000000) | + gradientBuf[i] = ((unsigned int)(tr << 24) & 0xFF000000) | ((r << 16) & 0x00FF0000) | ((g << 8) & 0x0000FF00) | ( b & 0x000000FF); @@ -99,15 +99,15 @@ fb_pixel_t* CColorGradient::gradientOneColor(fb_pixel_t col, fb_pixel_t *gradien { if (bSize < 1) return gradientBuf; - + unsigned long _bSize = (unsigned long) bSize; if (gradientBuf == NULL) { - gradientBuf = (fb_pixel_t*) malloc(bSize * sizeof(fb_pixel_t)); + gradientBuf = (fb_pixel_t*) malloc(_bSize * sizeof(fb_pixel_t)); if (gradientBuf == NULL) { dprintf(DEBUG_NORMAL, "[%s:%d] malloc error\n", __func__, __LINE__); return NULL; } } - memset((void*)gradientBuf, '\0', bSize * sizeof(fb_pixel_t)); + memset((void*)gradientBuf, '\0', _bSize * sizeof(fb_pixel_t)); HsvColor hsv; uint8_t min_v=0, max_v=0, col_s=0; @@ -180,26 +180,22 @@ fb_pixel_t* CColorGradient::gradientOneColor(fb_pixel_t col, fb_pixel_t *gradien fb_pixel_t* CColorGradient::gradientColorToColor(fb_pixel_t start_col,fb_pixel_t end_col, fb_pixel_t *gradientBuf, int bSize, int mode, int /*intensity*/) { + unsigned long _bSize = (unsigned long) bSize; if (gradientBuf == NULL) { - gradientBuf = (fb_pixel_t*) malloc(bSize * sizeof(fb_pixel_t)); + gradientBuf = (fb_pixel_t*) malloc(_bSize * sizeof(fb_pixel_t)); if (gradientBuf == NULL) { dprintf(DEBUG_NORMAL, "[%s:%d] malloc error\n", __func__, __LINE__); return NULL; } } - memset((void*)gradientBuf, '\0', bSize * sizeof(fb_pixel_t)); + memset((void*)gradientBuf, '\0', _bSize * sizeof(fb_pixel_t)); int start_box = 0; int end_box = bSize; - fb_pixel_t temp_col = end_col; - end_col = start_col; - start_col = temp_col; - + std::swap(start_col,end_col); if (mode == gradientDark2Light){ - temp_col = start_col; - start_col = end_col; - end_col = temp_col; + std::swap(start_col,end_col); } uint8_t start_tr = (uint8_t)((start_col & 0xFF000000) >> 24); @@ -226,7 +222,7 @@ fb_pixel_t* CColorGradient::gradientColorToColor(fb_pixel_t start_col,fb_pixel_t uint8_t g = limitChar((int)((float)start_g + gStep*(float)i)); uint8_t b = limitChar((int)((float)start_b + bStep*(float)i)); - gradientBuf[i] = ((tr << 24) & 0xFF000000) | + gradientBuf[i] = ((unsigned int)(tr << 24) & 0xFF000000) | ((r << 16) & 0x00FF0000) | ((g << 8) & 0x0000FF00) | ( b & 0x000000FF); diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index ed48a1a16..4913114a8 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -409,7 +410,7 @@ int CRCInput::messageLoop( bool anyKeyCancels, int timeout ) if ( timeout == -1 ) timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU]; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout == 0 ? 0xFFFF : timeout); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); while (doLoop) { @@ -439,7 +440,7 @@ int CRCInput::messageLoop( bool anyKeyCancels, int timeout ) if ( anyKeyCancels ) doLoop = false; else - timeoutEnd = CRCInput::calcTimeoutEnd( timeout ); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } } } @@ -539,17 +540,15 @@ int CRCInput::checkTimers() return _id; } - - -int64_t CRCInput::calcTimeoutEnd(const int timeout_in_seconds) +int64_t CRCInput::calcTimeoutEnd(const int _timeout_in_seconds) { - return time_monotonic_us() + ((uint64_t)timeout_in_seconds * (uint64_t) 1000000); + uint64_t timeout_in_seconds = (_timeout_in_seconds == 0) ? INT_MAX : _timeout_in_seconds; + return time_monotonic_us() + (timeout_in_seconds * 1000000); } int64_t CRCInput::calcTimeoutEnd_MS(const int timeout_in_milliseconds) { - uint64_t timeNow = time_monotonic_us(); - return ( timeNow + timeout_in_milliseconds * 1000 ); + return time_monotonic_us() + (timeout_in_milliseconds * 1000); } void CRCInput::getMsgAbsoluteTimeout(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint64_t *TimeoutEnd, bool bAllowRepeatLR) diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index 80ed35c7d..7095d2641 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -169,10 +169,10 @@ void CVolume::setVolume(const neutrino_msg_t key) if (do_vol) setvol(g_settings.current_volume); - timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_VOLUMEBAR] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_VOLUMEBAR]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_VOLUMEBAR]); } else if (msg == NeutrinoMessages::EVT_VOLCHANGED) { - timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_VOLUMEBAR] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_VOLUMEBAR]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_VOLUMEBAR]); } else if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::unhandled) { g_RCInput->postMsg(msg, data); diff --git a/src/gui/bedit/Makefile.am b/src/gui/bedit/Makefile.am index e07422406..269ac532a 100644 --- a/src/gui/bedit/Makefile.am +++ b/src/gui/bedit/Makefile.am @@ -19,5 +19,5 @@ noinst_LIBRARIES = libneutrino_gui_bedit.a libneutrino_gui_bedit_a_SOURCES = \ bouqueteditor_bouquets.cpp \ bouqueteditor_channels.cpp \ - bouqueteditor_chanselect.cpp - + bouqueteditor_chanselect.cpp \ + bouqueteditor_globals.cpp diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index a5b2d6ebc..69ee284ab 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -1,24 +1,24 @@ /* - Neutrino-GUI - DBoxII-Project + neutrino bouquet editor - bouquets editor Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2009,2011,2013,2016 Stefan Seyfried + Copyright (C) 2017 Sven Hoefer License: GPL - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifdef HAVE_CONFIG_H @@ -27,46 +27,49 @@ #include #include -#include "bouqueteditor_channels.h" -#include "bouqueteditor_bouquets.h" #include #include #include - #include +#include #include #include -#include #include +#include "bouqueteditor_bouquets.h" +#include "bouqueteditor_channels.h" + extern CBouquetManager *g_bouquetManager; CBEBouquetWidget::CBEBouquetWidget() { - frameBuffer = CFrameBuffer::getInstance(); - iconoffset = 0; origPosition = 0; newPosition = 0; - listmaxshow = 0; bouquetsChanged = 0; - width = 0; - height = 0; - x = 0; - y = 0; selected = 0; liststart = 0; state = beDefault; Bouquets = NULL; - iheight = 0; - ButtonHeight = footer.getHeight(); - fheight = 0; - theight = 0; + + int iw, ih; + action_icon_width = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, &action_icon_width, &ih); + + status_icon_width = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_HIDDEN, &iw, &ih); + status_icon_width = std::max(status_icon_width, iw); + frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &iw, &ih); + status_icon_width = std::max(status_icon_width, iw); + frameBuffer->getIconSize(NEUTRINO_ICON_AUDIO, &iw, &ih); + status_icon_width = std::max(status_icon_width, iw); + frameBuffer->getIconSize(NEUTRINO_ICON_VIDEO, &iw, &ih); + status_icon_width = std::max(status_icon_width, iw); } void CBEBouquetWidget::paintItem(int pos) { - int ypos = y + theight + pos*iheight; + int ypos = y + header_height + pos*item_height; unsigned int current = liststart + pos; bool i_selected = current == selected; @@ -84,79 +87,91 @@ void CBEBouquetWidget::paintItem(int pos) else { bool has_channels = true; - if(current < Bouquets->size()) - has_channels = (!(*Bouquets)[current]->tvChannels.empty() ) || (!(*Bouquets)[current]->radioChannels.empty()); + if (current < Bouquets->size()) + has_channels = (!(*Bouquets)[current]->tvChannels.empty()) || (!(*Bouquets)[current]->radioChannels.empty()); if (!has_channels) color = COL_MENUCONTENTINACTIVE_TEXT; } if (i_radius) - frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, item_height, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius); - if (current < Bouquets->size()) { + if (current < Bouquets->size()) + { if ((i_selected) && (state == beMoving)) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, item_height); + else + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, x + OFFSET_INNER_MID, ypos, item_height); + + int text_offset = 2*OFFSET_INNER_MID + action_icon_width; + item_font->RenderString(x + text_offset, ypos + item_height, width - text_offset - SCROLLBAR_WIDTH - 5*OFFSET_INNER_MID - 4*status_icon_width, (*Bouquets)[current]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[current]->Name, color); if ((*Bouquets)[current]->bHidden) - frameBuffer->paintIcon(NEUTRINO_ICON_HIDDEN, x + OFFSET_INNER_MID + iconoffset, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_HIDDEN, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - status_icon_width, ypos, item_height); if ((*Bouquets)[current]->bLocked != g_settings.parentallock_defaultlocked) - frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + 2*iconoffset, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + width - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - 2*status_icon_width, ypos, item_height); - if (!(*Bouquets)[current]->tvChannels.empty() ) { - frameBuffer->paintIcon(NEUTRINO_ICON_VIDEO, x + OFFSET_INNER_MID + 3*iconoffset, ypos, iheight); - } + if (!(*Bouquets)[current]->radioChannels.empty()) + frameBuffer->paintIcon(NEUTRINO_ICON_AUDIO, x + width - SCROLLBAR_WIDTH - 3*OFFSET_INNER_MID - 3*status_icon_width, ypos, item_height); - if (!(*Bouquets)[current]->radioChannels.empty()) { - frameBuffer->paintIcon(NEUTRINO_ICON_AUDIO, x + OFFSET_INNER_MID + 4*iconoffset, ypos, iheight); - } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 5*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 5*iconoffset, (*Bouquets)[current]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[current]->Name, color); + if (!(*Bouquets)[current]->tvChannels.empty()) + frameBuffer->paintIcon(NEUTRINO_ICON_VIDEO, x + width - SCROLLBAR_WIDTH - 4*OFFSET_INNER_MID - 4*status_icon_width, ypos, item_height); } } -void CBEBouquetWidget::paint() +void CBEBouquetWidget::paintItems() { - liststart = (selected/listmaxshow)*listmaxshow; + liststart = (selected/items_count)*items_count; - for(unsigned int count=0;countsize(), listmaxshow, selected); - paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, iheight*listmaxshow, total_pages, current_page); + getScrollBarData(&total_pages, ¤t_page, Bouquets->size(), items_count, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, body_height, total_pages, current_page); +} + +void CBEBouquetWidget::paintBody() +{ + PaintBoxRel(x, y + header_height, width, body_height, COL_MENUCONTENT_PLUS_0, RADIUS_NONE, CORNER_NONE, CC_SHADOW_ON); } void CBEBouquetWidget::paintHead() { - CComponentsHeader header(x, y, width, theight, LOCALE_BOUQUETLIST_HEAD, "" /*no header icon*/, CComponentsHeader::CC_BTN_EXIT); + header.setCaption(LOCALE_BOUQUETLIST_HEAD); + header.setIcon(NEUTRINO_ICON_SETTINGS); + header.setDimensionsAll(x, y, width, header_height); + header.setCorner(RADIUS_LARGE, CORNER_TOP); + header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true); header.paint(CC_SAVE_SCREEN_NO); } -const struct button_label CBEBouquetWidgetButtons[6] = +const struct button_label CBEBouquetWidgetButtons[] = { - { NEUTRINO_ICON_BUTTON_RED , LOCALE_BOUQUETEDITOR_DELETE }, - { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD }, - { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE }, - { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_RENAME}, - { NEUTRINO_ICON_BUTTON_PAUSE , LOCALE_BOUQUETEDITOR_HIDE }, - { NEUTRINO_ICON_BUTTON_STOP , LOCALE_BOUQUETEDITOR_LOCK } + { NEUTRINO_ICON_BUTTON_RED, LOCALE_BOUQUETEDITOR_DELETE }, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_BOUQUETEDITOR_ADD }, + { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE }, + { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_BOUQUETEDITOR_RENAME }, + { NEUTRINO_ICON_BUTTON_PAUSE, LOCALE_BOUQUETEDITOR_HIDE }, + { NEUTRINO_ICON_BUTTON_STOP, LOCALE_BOUQUETEDITOR_LOCK } }; void CBEBouquetWidget::paintFoot() { size_t numbuttons = sizeof(CBEBouquetWidgetButtons)/sizeof(CBEBouquetWidgetButtons[0]); - footer.paintButtons(x, y+height, width, ButtonHeight, numbuttons, CBEBouquetWidgetButtons, width/numbuttons-2*OFFSET_INNER_MID); + + footer.setCorner(RADIUS_LARGE, CORNER_BOTTOM); + footer.enableShadow(CC_SHADOW_ON, -1, true); + footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEBouquetWidgetButtons); } void CBEBouquetWidget::hide() { - frameBuffer->paintBackgroundBoxRel(x,y, width,height); - footer.kill(); + frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW); } void CBEBouquetWidget::updateSelection(unsigned int newpos) @@ -167,16 +182,22 @@ void CBEBouquetWidget::updateSelection(unsigned int newpos) unsigned int prev_selected = selected; selected = newpos; - if (state == beDefault) { + if (state == beDefault) + { unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) { - paint(); - } else { + liststart = (selected/items_count)*items_count; + if (oldliststart != liststart) + { + paintItems(); + } + else + { paintItem(prev_selected - liststart); paintItem(selected - liststart); } - } else { + } + else + { internalMoveBouquet(prev_selected, selected); } } @@ -191,58 +212,26 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* if (parent) parent->hide(); - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); - - int icol_w, icol_h; - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); - iconoffset = std::max(iconoffset, icol_w); - - frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); - iconoffset = std::max(iconoffset, icol_w); - - frameBuffer->getIconSize(NEUTRINO_ICON_HIDDEN, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); - iconoffset = std::max(iconoffset, icol_w); - - frameBuffer->getIconSize(NEUTRINO_ICON_VIDEO, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); - iconoffset = std::max(iconoffset, icol_w); - - frameBuffer->getIconSize(NEUTRINO_ICON_AUDIO, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); - iconoffset = std::max(iconoffset, icol_w); - - width = frameBuffer->getScreenWidthRel(); - height = frameBuffer->getScreenHeightRel() - ButtonHeight; - - listmaxshow = (height-theight)/iheight; - height = theight+listmaxshow*iheight; // recalc height - - x = getScreenStartX(width); - y = getScreenStartY(height + ButtonHeight); - Bouquets = &g_bouquetManager->Bouquets; + paintHead(); - paint(); + paintBody(); paintFoot(); + paintItems(); bouquetsChanged = false; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); - bool loop=true; + bool loop = true; while (loop) { - g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); + g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); - if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + if (msg <= CRCInput::RC_MaxRC) + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); - if ((msg == CRCInput::RC_timeout) || - (msg == (neutrino_msg_t)g_settings.key_channelList_cancel)) + if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t)g_settings.key_channelList_cancel)) { if (state == beDefault) { @@ -250,21 +239,28 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* { int result = ShowMsg(LOCALE_BOUQUETEDITOR_NAME, LOCALE_BOUQUETEDITOR_SAVECHANGES, CMsgBox::mbrYes, CMsgBox::mbYesNoCancel, NULL, 600); - switch( result ) + switch(result) { - case CMsgBox::mbrYes : + case CMsgBox::mbrYes: + { loop=false; saveChanges(); - break; - case CMsgBox::mbrNo : + break; + } + case CMsgBox::mbrNo: + { loop=false; discardChanges(); - break; - case CMsgBox::mbrCancel : + break; + } + case CMsgBox::mbrCancel: + { paintHead(); - paint(); + paintBody(); paintFoot(); - break; + paintItems(); + break; + } } } else @@ -280,84 +276,95 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup || msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown) { - int new_selected = UpDownKey(*Bouquets, msg, listmaxshow, selected); + int new_selected = UpDownKey(*Bouquets, msg, items_count, selected); updateSelection(new_selected); } - else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) { - if (!(Bouquets->empty())) { + else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) + { + if (!(Bouquets->empty())) + { int new_selected = msg == (neutrino_msg_t) g_settings.key_list_start ? 0 : Bouquets->size() - 1; updateSelection(new_selected); } } - else if(msg==CRCInput::RC_red) + else if (msg == CRCInput::RC_red) { if (state == beDefault) deleteBouquet(); } - else if(msg==CRCInput::RC_green) + else if (msg == CRCInput::RC_green) { if (state == beDefault) addBouquet(); } - else if(msg==CRCInput::RC_yellow) + else if (msg == CRCInput::RC_yellow) { if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */ { - liststart = (selected/listmaxshow)*listmaxshow; + liststart = (selected/items_count)*items_count; if (state == beDefault) beginMoveBouquet(); + else if (state == beMoving) + finishMoveBouquet(); paintItem(selected - liststart); } } - else if(msg==CRCInput::RC_blue) + else if (msg == CRCInput::RC_blue) { if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */ { if (state == beDefault) - renameBouquet(); + renameBouquet(); } } - - else if(msg==CRCInput::RC_pause) + else if (msg == CRCInput::RC_pause) { if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */ { if (state == beDefault) - switchHideBouquet(); + switchHideBouquet(); } } - else if(msg==CRCInput::RC_stop) + else if (msg == CRCInput::RC_stop) { if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */ { if (state == beDefault) - switchLockBouquet(); + switchLockBouquet(); } } - else if(msg==CRCInput::RC_ok) + else if (msg == CRCInput::RC_ok) { if (state == beDefault) { if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */ { std::string ChannelWidgetCaption=(*Bouquets)[selected]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[selected]->Name; - if (!(*Bouquets)[selected]->tvChannels.empty() ) { - ChannelWidgetCaption = ChannelWidgetCaption+ " => TV"; +#if 0 + if (!(*Bouquets)[selected]->tvChannels.empty()) + { + ChannelWidgetCaption = ChannelWidgetCaption + " => TV"; if (!(*Bouquets)[selected]->radioChannels.empty()) - ChannelWidgetCaption = ChannelWidgetCaption+ "/Radio"; + ChannelWidgetCaption = ChannelWidgetCaption + " / Radio"; } - else if (!(*Bouquets)[selected]->radioChannels.empty()) { - ChannelWidgetCaption = ChannelWidgetCaption+ " => Radio"; + else if (!(*Bouquets)[selected]->radioChannels.empty()) + { + ChannelWidgetCaption = ChannelWidgetCaption + " => Radio"; } +#endif CBEChannelWidget* channelWidget = new CBEChannelWidget(ChannelWidgetCaption, selected); - channelWidget->exec( this, ""); + channelWidget->exec(this, ""); + selected = channelWidget->getBouquet(); if (channelWidget->hasChanged()) bouquetsChanged = true; delete channelWidget; paintHead(); - paint(); + paintBody(); paintFoot(); + paintItems(); + + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } } else if (state == beMoving) @@ -365,13 +372,13 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* finishMoveBouquet(); } } - else if( CRCInput::isNumeric(msg) ) + else if (CRCInput::isNumeric(msg)) { if (state == beDefault) { //kein pushback - wenn man versehentlich wo draufkommt is die edit-arbeit umsonst //selected = oldselected; - //g_RCInput->postMsg( msg, data ); + //g_RCInput->postMsg(msg, data); //loop=false; } else if (state == beMoving) @@ -385,7 +392,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* } else { - CNeutrinoApp::getInstance()->handleMsg( msg, data ); + CNeutrinoApp::getInstance()->handleMsg(msg, data); } } hide(); @@ -405,13 +412,13 @@ void CBEBouquetWidget::deleteBouquet() if (selected >= Bouquets->size()) selected = Bouquets->empty() ? 0 : (Bouquets->size() - 1); bouquetsChanged = true; - paint(); + paintItems(); } void CBEBouquetWidget::addBouquet() { std::string newName = inputName("", LOCALE_BOUQUETEDITOR_BOUQUETNAME); - if (!(newName.empty())) + if (!newName.empty()) { g_bouquetManager->addBouquet(newName, true); Bouquets = &g_bouquetManager->Bouquets; @@ -419,8 +426,9 @@ void CBEBouquetWidget::addBouquet() bouquetsChanged = true; } paintHead(); - paint(); + paintBody(); paintFoot(); + paintItems(); } void CBEBouquetWidget::beginMoveBouquet() @@ -438,27 +446,29 @@ void CBEBouquetWidget::finishMoveBouquet() Bouquets = &g_bouquetManager->Bouquets; bouquetsChanged = bouquetsChanged | true; } - paint(); + paintItems(); } void CBEBouquetWidget::cancelMoveBouquet() { state = beDefault; - internalMoveBouquet( newPosition, origPosition); + internalMoveBouquet(newPosition, origPosition); bouquetsChanged = bouquetsChanged | false; } -void CBEBouquetWidget::internalMoveBouquet( unsigned int fromPosition, unsigned int toPosition) +void CBEBouquetWidget::internalMoveBouquet(unsigned int fromPosition, unsigned int toPosition) { - if ( (int) toPosition == -1 ) return; - if ( toPosition == Bouquets->size()) return; + if ((int) toPosition == -1) + return; + if (toPosition == Bouquets->size()) + return; g_bouquetManager->moveBouquet(fromPosition, toPosition); Bouquets = &g_bouquetManager->Bouquets; //bouquetsChanged = true; selected = toPosition; newPosition = toPosition; - paint(); + paintItems(); } void CBEBouquetWidget::renameBouquet() @@ -474,22 +484,23 @@ void CBEBouquetWidget::renameBouquet() bouquetsChanged = true; } paintHead(); - paint(); + paintBody(); paintFoot(); + paintItems(); } void CBEBouquetWidget::switchHideBouquet() { bouquetsChanged = true; (*Bouquets)[selected]->bHidden = !(*Bouquets)[selected]->bHidden; - paint(); + paintItems(); } void CBEBouquetWidget::switchLockBouquet() { bouquetsChanged = true; g_bouquetManager->setBouquetLock((*Bouquets)[selected], !(*Bouquets)[selected]->bLocked); - paint(); + paintItems(); } std::string CBEBouquetWidget::inputName(const char * const defaultName, const neutrino_locale_t caption) diff --git a/src/gui/bedit/bouqueteditor_bouquets.h b/src/gui/bedit/bouqueteditor_bouquets.h index 0fa55f470..9aa27dc2c 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.h +++ b/src/gui/bedit/bouqueteditor_bouquets.h @@ -1,47 +1,39 @@ /* - Neutrino-GUI - DBoxII-Project + neutrino bouquet editor - bouquets editor Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - 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. - + Copyright (C) 2017 Sven Hoefer License: GPL - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifndef __bouqueteditor_bouquets__ #define __bouqueteditor_bouquets__ -#include - -#include -#include -#include -#include -#include #include -class CFrameBuffer; +#include +#include +#include +#include +#include +#include + +#include "bouqueteditor_globals.h" + /* class for handling when bouquets changed. */ /* This class should be a temporarily work around */ /* and should be replaced by standard neutrino event handlers */ @@ -52,41 +44,29 @@ public: virtual void onBouquetsChanged() {}; }; -class CBEBouquetWidget : public CMenuTarget, public CListHelpers +class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelpers { - private: - - CFrameBuffer *frameBuffer; - CComponentsFooter footer; enum { beDefault, beMoving } state; - unsigned int selected; - unsigned int origPosition; - unsigned int newPosition; + unsigned int selected; + unsigned int origPosition; + unsigned int newPosition; - unsigned int liststart; - unsigned int listmaxshow; - int fheight; // Fonthoehe Bouquetlist-Inhalt - int theight; // Fonthoehe Bouquetlist-Titel + unsigned int liststart; - int ButtonHeight; - int iconoffset; - int iheight; // item height - //std::string name; - bool bouquetsChanged; - int width; - int height; - int x; - int y; + int iconoffset; + + bool bouquetsChanged; - void paintItem(int pos); - void paint(); void paintHead(); + void paintBody(); + void paintItem(int pos); + void paintItems(); void paintFoot(); void hide(); void updateSelection(unsigned int newpos); @@ -96,7 +76,7 @@ class CBEBouquetWidget : public CMenuTarget, public CListHelpers void beginMoveBouquet(); void finishMoveBouquet(); void cancelMoveBouquet(); - void internalMoveBouquet( unsigned int fromPosition, unsigned int toPosition); + void internalMoveBouquet(unsigned int fromPosition, unsigned int toPosition); void renameBouquet(); void switchHideBouquet(); void switchLockBouquet(); @@ -104,7 +84,7 @@ class CBEBouquetWidget : public CMenuTarget, public CListHelpers void saveChanges(); void discardChanges(); - std::string inputName(const char * const defaultName, const neutrino_locale_t caption); + std::string inputName(const char* const defaultName, const neutrino_locale_t caption); public: CBEBouquetWidget(); @@ -114,5 +94,4 @@ class CBEBouquetWidget : public CMenuTarget, public CListHelpers int exec(CMenuTarget* parent, const std::string & actionKey); }; - #endif diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index f345322bf..ac5a260cd 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -1,81 +1,55 @@ /* - Neutrino-GUI - DBoxII-Project + neutrino bouquet editor - channels editor Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - Copyright (C) 2011 CoolStream International Ltd Copyright (C) 2009,2011,2013,2016 Stefan Seyfried + Copyright (C) 2017 Sven Hoefer License: GPL - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifdef HAVE_CONFIG_H #include #endif -#include -#include "bouqueteditor_channels.h" - #include #include #include #include -#include "bouqueteditor_chanselect.h" #include #include -#include #include - -#include +#include +#include #include +#include + +#include "bouqueteditor_channels.h" +#include "bouqueteditor_chanselect.h" extern CBouquetManager *g_bouquetManager; CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bouquet) { - int icol_w, icol_h; - frameBuffer = CFrameBuffer::getInstance(); selected = 0; - iconoffset = 0; origPosition = 0; newPosition = 0; - listmaxshow = 0; - numwidth = 0; - info_height = 0; channelsChanged = false; - width = 0; - height = 0; - x = 0; - y = 0; - - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); - footerHeight= footer.getHeight(); - - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h+2); - iconoffset = std::max(iconoffset, icol_w); - - frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h+2); - iconoffset = std::max(iconoffset, icol_w); - liststart = 0; state = beDefault; caption = Caption; @@ -84,6 +58,20 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou dline = NULL; ibox = NULL; Channels = NULL; + + int iw, ih; + action_icon_width = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, &action_icon_width, &ih); + + status_icon_width = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED, &iw, &ih); + status_icon_width = std::max(status_icon_width, iw); + frameBuffer->getIconSize(NEUTRINO_ICON_STREAMING, &iw, &ih); + status_icon_width = std::max(status_icon_width, iw); + frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &iw, &ih); + status_icon_width = std::max(status_icon_width, iw); + + header.addContextButton(CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT); } CBEChannelWidget::~CBEChannelWidget() @@ -94,7 +82,7 @@ CBEChannelWidget::~CBEChannelWidget() void CBEChannelWidget::paintItem(int pos) { - int ypos = y+ theight+0 + pos*iheight; + int ypos = y + header_height + pos*item_height; unsigned int current = liststart + pos; bool i_selected = current == selected; @@ -107,11 +95,9 @@ void CBEChannelWidget::paintItem(int pos) if (i_selected) { - if (current < Channels->size()) - { - initItem2DetailsLine(pos, current); - paintDetails(current); - } + if (current < Channels->size() || Channels->empty()) + paintDetails(pos, current); + i_radius = RADIUS_LARGE; } else @@ -121,174 +107,189 @@ void CBEChannelWidget::paintItem(int pos) } if (i_radius) - frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius); - if ((current == selected) && (state == beMoving)) { - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight); - } - if (current < Channels->size()) { - if ((*Channels)[current]->bLocked) { - frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + iconoffset, ypos, iheight); - } - //FIXME numwidth ? we not show chan numbers - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, (*Channels)[current]->getName(), color); - if((*Channels)[current]->scrambled) - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); + if (current < Channels->size()) + { + if ((i_selected) && (state == beMoving)) + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, item_height); + else + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, x + OFFSET_INNER_MID, ypos, item_height); + + int text_offset = 2*OFFSET_INNER_MID + action_icon_width; + item_font->RenderString(x + text_offset, ypos + item_height, width - text_offset - SCROLLBAR_WIDTH - 3*OFFSET_INNER_MID - 2*status_icon_width, (*Channels)[current]->getName(), color); + + if ((*Channels)[current]->scrambled) + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - status_icon_width, ypos, item_height); else if (!(*Channels)[current]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - status_icon_width, ypos, item_height); + + if ((*Channels)[current]->bLocked) + frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + width - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - 2*status_icon_width, ypos, item_height); } } -void CBEChannelWidget::paint() +void CBEChannelWidget::paintItems() { - liststart = (selected/listmaxshow)*listmaxshow; - int lastnum = liststart + listmaxshow; + liststart = (selected/items_count)*items_count; - numwidth = 0; - int maxDigitWidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getMaxDigitWidth(); - int _lastnum = lastnum; - while (_lastnum) { - numwidth += maxDigitWidth; - _lastnum /= 10; - } - - for(unsigned int count=0;countsize(), listmaxshow, selected); - paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, iheight*listmaxshow, total_pages, current_page); + getScrollBarData(&total_pages, ¤t_page, Channels->size(), items_count, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, body_height, total_pages, current_page); +} + +void CBEChannelWidget::paintBody() +{ + PaintBoxRel(x, y + header_height, width, body_height, COL_MENUCONTENT_PLUS_0, RADIUS_NONE, CORNER_NONE, CC_SHADOW_ON); } void CBEChannelWidget::paintHead() { - CComponentsHeader header(x, y, width, theight, caption, "" /*no header icon*/, CComponentsHeader::CC_BTN_EXIT); + header.setCaption(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio")); + header.setIcon(NULL); // trick the cc-header + header.setIcon(mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO); + header.setDimensionsAll(x, y, width, header_height); + header.setCorner(RADIUS_LARGE, CORNER_TOP); + header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true); header.paint(CC_SAVE_SCREEN_NO); } -const struct button_label CBEChannelWidgetButtons[6] = +const struct button_label CBEChannelWidgetButtons[] = { - { NEUTRINO_ICON_BUTTON_RED , LOCALE_BOUQUETEDITOR_DELETE }, - { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_BOUQUETEDITOR_ADD }, - { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE }, - { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_BOUQUETEDITOR_RENAME }, + { NEUTRINO_ICON_BUTTON_RED, LOCALE_BOUQUETEDITOR_DELETE }, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_BOUQUETEDITOR_ADD }, + { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETEDITOR_MOVE }, + { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_BOUQUETEDITOR_RENAME }, { NEUTRINO_ICON_BUTTON_DUMMY_SMALL, LOCALE_BOUQUETEDITOR_SWITCHMODE }, - //{ NEUTRINO_ICON_BUTTON_FORWARD , LOCALE_BOUQUETEDITOR_MOVE_TO }, // TODO upgrade - { NEUTRINO_ICON_BUTTON_STOP , LOCALE_BOUQUETEDITOR_LOCK } +// { NEUTRINO_ICON_BUTTON_FORWARD, LOCALE_BOUQUETEDITOR_MOVE_TO }, // TODO upgrade + { NEUTRINO_ICON_BUTTON_STOP, LOCALE_BOUQUETEDITOR_LOCK } }; void CBEChannelWidget::paintFoot() { size_t numbuttons = sizeof(CBEChannelWidgetButtons)/sizeof(CBEChannelWidgetButtons[0]); - footer.paintButtons(x, y + (height-footerHeight), width, footerHeight, numbuttons, CBEChannelWidgetButtons, width/numbuttons-2*OFFSET_INNER_MID); + + footer.enableShadow(CC_SHADOW_ON, -1, true); + footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEChannelWidgetButtons); +} + +void CBEChannelWidget::paintDetails(int pos, int current) +{ + int xpos = x - DETAILSLINE_WIDTH; + int ypos1 = y + header_height + pos*item_height; + int ypos2 = y + height - info_height - OFFSET_SHADOW; + int ypos1a = ypos1 + (item_height/2); + int ypos2a = ypos2 + (info_height/2); + + if (dline) + dline->kill(); + + if (pos >= 0) + { + if (dline == NULL) + dline = new CComponentsDetailsLine(); + + if (dline) + { + dline->setDimensionsAll(xpos, ypos1a, ypos2a, item_height/2, info_height - RADIUS_LARGE*2); + dline->paint(CC_SAVE_SCREEN_NO); + } + + if (ibox == NULL) + { + ibox = new CComponentsInfoBox(); + + if (ibox) + { + ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); + ibox->setTextColor(COL_MENUCONTENTDARK_TEXT); + ibox->setFrameThickness(FRAME_WIDTH_MIN); + ibox->setCorner(RADIUS_LARGE); + ibox->enableShadow(CC_SHADOW_ON); + } + } + + if (ibox) + { + if (ibox->isPainted()) + ibox->hide(); + + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setText(getInfoText(current), CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, info_font); + ibox->paint(CC_SAVE_SCREEN_NO); + } + } +} + +void CBEChannelWidget::hide() +{ + frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW); + + if (dline) + dline->kill(); + if (ibox) + ibox->kill(); } std::string CBEChannelWidget::getInfoText(int index) { std::string res = ""; - + + if (Channels->empty()) + return res; + std::string satname = CServiceManager::getInstance()->GetSatelliteName((*Channels)[index]->getSatellitePosition()); + if (IS_WEBTV((*Channels)[index]->getChannelID())) + satname = "WebTV"; transponder t; CServiceManager::getInstance()->GetTransponder((*Channels)[index]->getTransponderId(), t); std::string desc = t.description(); - if((*Channels)[index]->pname) - desc = desc + " (" + std::string((*Channels)[index]->pname) + ")"; - else - desc = desc + " (" + satname + ")"; - - res = satname + " " + desc; - - return res; -} - -void CBEChannelWidget::paintDetails(int index) -{ - //details line - dline->paint(CC_SAVE_SCREEN_NO); - - std::string str = getInfoText(index); - - //info box - ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); - ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); - ibox->setTextColor(COL_MENUCONTENTDARK_TEXT); - ibox->paint(CC_SAVE_SCREEN_NO); -} - -void CBEChannelWidget::initItem2DetailsLine (int pos, int /*ch_index*/) -{ - int xpos = x - DETAILSLINE_WIDTH; - int ypos1 = y + theight+0 + pos*iheight; - int ypos2 = y + height + OFFSET_INTER; - int ypos1a = ypos1 + (fheight/2); - int ypos2a = ypos2 + (info_height/2); - - if (dline) - dline->kill(); //kill details line - - // init Line if detail info (and not valid list pos) - if (pos >= 0) + if ((*Channels)[index]->pname) { - if (dline == NULL) - dline = new CComponentsDetailsLine(xpos, ypos1a, ypos2a, fheight/2, info_height-RADIUS_LARGE*2); - dline->setYPos(ypos1a); - - //infobox - if (ibox == NULL){ - ibox = new CComponentsInfoBox(); - } - - if (ibox->isPainted()) - ibox->hide(); - - ibox->setDimensionsAll(x, ypos2, width, info_height); - ibox->setFrameThickness(FRAME_WIDTH_MIN); -#if 0 - ibox->paint(false,true); -#endif - ibox->setCorner(RADIUS_LARGE); - ibox->disableShadow(); + if (desc.empty()) + desc = std::string((*Channels)[index]->pname); + else + desc += " (" + std::string((*Channels)[index]->pname) + ")"; } -} + if (!(*Channels)[index]->getDesc().empty()) + desc += "\n" + (*Channels)[index]->getDesc(); -void CBEChannelWidget::clearItem2DetailsLine() -{ - if (dline) - dline->kill(); //kill details line - if (ibox) - ibox->kill(); //kill info box -} + res = satname + " - " + desc; -void CBEChannelWidget::hide() -{ - frameBuffer->paintBackgroundBoxRel(x,y, width,height+footerHeight); - clearItem2DetailsLine (); + return res; } void CBEChannelWidget::updateSelection(unsigned int newpos) { - if (newpos == selected || newpos == (unsigned int)-1) - return; + if (newpos == selected || newpos == (unsigned int)-1) + return; - unsigned int prev_selected = selected; - selected = newpos; + unsigned int prev_selected = selected; + selected = newpos; - if (state == beDefault) { - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) { - paint(); - } else { - paintItem(prev_selected - liststart); - paintItem(selected - liststart); - } - } else { - internalMoveChannel(prev_selected, selected); - } + if (state == beDefault) + { + unsigned int oldliststart = liststart; + liststart = (selected/items_count)*items_count; + if (oldliststart != liststart) + { + paintItems(); + } + else + { + paintItem(prev_selected - liststart); + paintItem(selected - liststart); + } + } + else + { + internalMoveChannel(prev_selected, selected); + } } int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*/) @@ -301,43 +302,32 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* if (parent) parent->hide(); - width = frameBuffer->getScreenWidthRel(); - info_height = 2*iheight + 4; - height = frameBuffer->getScreenHeightRel() - info_height; - listmaxshow = (height-theight-footerHeight-0)/iheight; - height = theight+footerHeight+listmaxshow*iheight; // recalc height - - x = getScreenStartX(width); - if (x < DETAILSLINE_WIDTH) - x = DETAILSLINE_WIDTH; - y = getScreenStartY(height + info_height); - - mode = CZapitClient::MODE_TV; if (g_bouquetManager->Bouquets[bouquet]->tvChannels.empty()) mode = CZapitClient::MODE_RADIO; else if (g_bouquetManager->Bouquets[bouquet]->radioChannels.empty()) mode = CZapitClient::MODE_TV; + Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); paintHead(); - paint(); + paintBody(); paintFoot(); + paintItems(); channelsChanged = false; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); - bool loop=true; + bool loop = true; while (loop) { - g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); + g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); - if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + if (msg <= CRCInput::RC_MaxRC) + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); - if ((msg == CRCInput::RC_timeout) || - (msg == (neutrino_msg_t)g_settings.key_channelList_cancel)) + if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t)g_settings.key_channelList_cancel)) { if (state == beDefault) { @@ -351,33 +341,39 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup || msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown) { - int new_selected = UpDownKey(*Channels, msg, listmaxshow, selected); + int new_selected = UpDownKey(*Channels, msg, items_count, selected); updateSelection(new_selected); } - else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) { - if (!(Channels->empty())) { - int new_selected = msg == (neutrino_msg_t) g_settings.key_list_start ? 0 : Channels->size() - 1; - updateSelection(new_selected); - } - } - else if(msg==CRCInput::RC_red) + else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) + { + if (!(Channels->empty())) + { + int new_selected = msg == (neutrino_msg_t) g_settings.key_list_start ? 0 : Channels->size() - 1; + updateSelection(new_selected); + } + } + else if (msg == CRCInput::RC_red) { if (state == beDefault) deleteChannel(); } - else if(msg==CRCInput::RC_green) + else if (msg == CRCInput::RC_green) { if (state == beDefault) addChannel(); + + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } - else if(msg==CRCInput::RC_yellow) + else if (msg == CRCInput::RC_yellow) { - liststart = (selected/listmaxshow)*listmaxshow; + liststart = (selected/items_count)*items_count; if (state == beDefault) beginMoveChannel(); + else if (state == beMoving) + finishMoveChannel(); paintItem(selected - liststart); } - else if(msg==CRCInput::RC_blue) + else if (msg == CRCInput::RC_blue) { if (selected < Channels->size()) /* Channels->size() might be 0 */ { @@ -385,7 +381,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* renameChannel(); } } - else if(msg==CRCInput::RC_stop) + else if (msg == CRCInput::RC_stop) { if (selected < Channels->size()) /* Channels->size() might be 0 */ { @@ -394,7 +390,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* } } /* TODO upgrade - else if (msg == CRCInput::RC_forward ) + else if (msg == CRCInput::RC_forward) { if (selected < Channels->size()) { @@ -403,38 +399,76 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* } } */ - else if( msg == (neutrino_msg_t) g_settings.key_tvradio_mode || msg==CRCInput::RC_tv ) { - if (mode == CZapitClient::MODE_TV) + else if (msg == (neutrino_msg_t) g_settings.key_tvradio_mode || msg == CRCInput::RC_tv || msg == CRCInput::RC_radio) + { + if (msg == CRCInput::RC_radio) mode = CZapitClient::MODE_RADIO; - else + else if (msg == CRCInput::RC_tv) mode = CZapitClient::MODE_TV; + else // g_settings.key_tvradio_mode + { + if (mode == CZapitClient::MODE_TV) + mode = CZapitClient::MODE_RADIO; + else + mode = CZapitClient::MODE_TV; + } Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); selected = 0; paintHead(); - paint(); + paintBody(); paintFoot(); + paintItems(); } + else if (msg == CRCInput::RC_left || msg == CRCInput::RC_right) + { + unsigned int bouquet_size = g_bouquetManager->Bouquets.size(); - else if(msg==CRCInput::RC_ok) + if (msg == CRCInput::RC_left) + { + if (bouquet == 0) + bouquet = bouquet_size - 1; + else + bouquet--; + } + else + { + if (bouquet < bouquet_size - 1) + bouquet++; + else + bouquet = 0; + } + + Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); + caption = g_bouquetManager->Bouquets[bouquet]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[bouquet]->Name; + + selected = 0; + paintHead(); + paintBody(); + paintFoot(); + paintItems(); + } + else if (msg == CRCInput::RC_ok) { if (state == beDefault) { if (selected < Channels->size()) /* Channels.size() might be 0 */ g_Zapit->zapTo_serviceID((*Channels)[selected]->getChannelID()); - } else if (state == beMoving) { + } + else if (state == beMoving) + { finishMoveChannel(); } } - else if( CRCInput::isNumeric(msg) ) + else if (CRCInput::isNumeric(msg)) { if (state == beDefault) { //kein pushback - wenn man versehentlich wo draufkommt is die edit-arbeit umsonst //selected = oldselected; - //g_RCInput->postMsg( msg, data ); + //g_RCInput->postMsg(msg, data); //loop=false; } else if (state == beMoving) @@ -448,7 +482,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* } else { - CNeutrinoApp::getInstance()->handleMsg( msg, data ); + CNeutrinoApp::getInstance()->handleMsg(msg, data); } } hide(); @@ -470,7 +504,7 @@ void CBEChannelWidget::deleteChannel() if (selected >= Channels->size()) selected = Channels->empty() ? 0 : (Channels->size() - 1); channelsChanged = true; - paint(); + paintItems(); } void CBEChannelWidget::renameChannel() @@ -479,7 +513,7 @@ void CBEChannelWidget::renameChannel() if (newName != (*Channels)[selected]->getName()) { - if(newName.empty()) + if (newName.empty()) (*Channels)[selected]->setUserName(""); else (*Channels)[selected]->setUserName(newName); @@ -487,8 +521,9 @@ void CBEChannelWidget::renameChannel() channelsChanged = true; } paintHead(); - paint(); + paintBody(); paintFoot(); + paintItems(); } void CBEChannelWidget::switchLockChannel() @@ -513,8 +548,9 @@ void CBEChannelWidget::addChannel() } delete channelSelectWidget; paintHead(); - paint(); + paintBody(); paintFoot(); + paintItems(); } void CBEChannelWidget::beginMoveChannel() @@ -528,13 +564,13 @@ void CBEChannelWidget::finishMoveChannel() { state = beDefault; channelsChanged = channelsChanged | true; - paint(); + paintItems(); } void CBEChannelWidget::cancelMoveChannel() { state = beDefault; - internalMoveChannel( newPosition, origPosition); + internalMoveChannel(newPosition, origPosition); channelsChanged = channelsChanged | false; } /* TODO upgrade (taken from channellist.cpp) @@ -543,25 +579,26 @@ void CBEChannelWidget::moveChannelToBouquet() if (addChannelToBouquet()) deleteChannel(false); else - paint(); + paintItems(); paintHead(); } */ -void CBEChannelWidget::internalMoveChannel( unsigned int fromPosition, unsigned int toPosition) +void CBEChannelWidget::internalMoveChannel(unsigned int fromPosition, unsigned int toPosition) { - if ( (int) toPosition == -1 ) return; - if ( toPosition == Channels->size()) return; + if ((int) toPosition == -1) + return; + if (toPosition == Channels->size()) + return; - g_bouquetManager->Bouquets[bouquet]->moveService(fromPosition, toPosition, - mode == CZapitClient::MODE_TV ? 1 : 2); + g_bouquetManager->Bouquets[bouquet]->moveService(fromPosition, toPosition, mode == CZapitClient::MODE_TV ? 1 : 2); //channelsChanged = true; Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); selected = toPosition; newPosition = toPosition; - paint(); + paintItems(); } std::string CBEChannelWidget::inputName(const char * const defaultName, const neutrino_locale_t _caption) @@ -578,5 +615,5 @@ std::string CBEChannelWidget::inputName(const char * const defaultName, const ne bool CBEChannelWidget::hasChanged() { - return (channelsChanged); + return channelsChanged; } diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index 8ee180710..e8a9b521c 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -1,95 +1,70 @@ /* - Neutrino-GUI - DBoxII-Project + neutrino bouquet editor - channels editor Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - 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. - + Copyright (C) 2017 Sven Hoefer License: GPL - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifndef __bouqueteditor_channels__ #define __bouqueteditor_channels__ -#include -#include +#include + #include +#include +#include +#include +#include #include -#include -#include -#include +#include "bouqueteditor_globals.h" -class CFrameBuffer; -class CBEChannelWidget : public CMenuTarget, public CListHelpers +class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelpers { - private: - CFrameBuffer *frameBuffer; CComponentsDetailsLine *dline; CComponentsInfoBox *ibox; - CComponentsFooter footer; + enum state_ { beDefault, beMoving } state; - unsigned int selected; - unsigned int origPosition; - unsigned int newPosition; + unsigned int selected; + unsigned int origPosition; + unsigned int newPosition; + unsigned int liststart; - unsigned int liststart; - unsigned int listmaxshow; - unsigned int numwidth; - int fheight; - int theight; - int iconoffset; - int iheight; // item height - int footerHeight; - int info_height; - - std::string caption; - bool channelsChanged; + bool channelsChanged; + std::string caption; CZapitClient::channelsMode mode; unsigned int bouquet; - int width; - int height; - int x; - int y; - - void paintItem(int pos); - void paintDetails(int index); - void initItem2DetailsLine (int pos, int ch_index); - void clearItem2DetailsLine (); - void paint(); void paintHead(); + void paintBody(); + void paintItem(int pos); + void paintItems(); void paintFoot(); + void paintDetails(int pos, int current); void hide(); void updateSelection(unsigned int newpos); @@ -101,10 +76,10 @@ class CBEChannelWidget : public CMenuTarget, public CListHelpers void finishMoveChannel(); void cancelMoveChannel(); void moveChannelToBouquet(); - void internalMoveChannel( unsigned int fromPosition, unsigned int toPosition); + void internalMoveChannel(unsigned int fromPosition, unsigned int toPosition); std::string getInfoText(int index); - std::string inputName(const char * const defaultName, const neutrino_locale_t caption); + std::string inputName(const char* const defaultName, const neutrino_locale_t caption); public: CBEChannelWidget( const std::string & Caption, unsigned int Bouquet); @@ -114,6 +89,7 @@ class CBEChannelWidget : public CMenuTarget, public CListHelpers ZapitChannelList * Channels; int exec(CMenuTarget* parent, const std::string & actionKey); bool hasChanged(); + unsigned int getBouquet() { return bouquet; }; }; #endif diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index e02c467c0..09766df53 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -1,32 +1,23 @@ /* - Neutrino-GUI - DBoxII-Project + neutrino bouquet editor - channel selection Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - 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. - + Copyright (C) 2017 Sven Hoefer License: GPL - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifdef HAVE_CONFIG_H @@ -34,47 +25,41 @@ #endif #include + #include #include -#include "bouqueteditor_chanselect.h" #include #include #include - - -#include #include +#include + +#include "bouqueteditor_chanselect.h" extern CBouquetManager *g_bouquetManager; CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, CZapitBouquet* Bouquet, CZapitClient::channelsMode Mode) - :CListBox(Caption.c_str()) { - int icol_w, icol_h; - + caption = Caption; bouquet = Bouquet; mode = Mode; - iconoffset = 0; - info_height = 0; - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); - footerHeight= footer.getHeight(); - - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_GREEN, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h+2); - iconoffset = std::max(iconoffset, icol_w); - - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_OKAY, &icol_w, &icol_h); - ButtonHeight = std::max(footerHeight, icol_h+4); - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_HOME, &icol_w, &icol_h); - ButtonHeight = std::max(footerHeight, icol_h+4); - + selected = 0; liststart = 0; channellist_sort_mode = SORT_ALPHA; bouquetChannels = NULL; dline = NULL; - ibox = new CComponentsInfoBox(); + ibox = NULL; + + int iw, ih; + action_icon_width = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, &action_icon_width, &ih); + + status_icon_width = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED, &iw, &ih); + status_icon_width = std::max(status_icon_width, iw); + frameBuffer->getIconSize(NEUTRINO_ICON_STREAMING, &iw, &ih); + status_icon_width = std::max(status_icon_width, iw); } CBEChannelSelectWidget::~CBEChannelSelectWidget() @@ -83,12 +68,358 @@ CBEChannelSelectWidget::~CBEChannelSelectWidget() delete ibox; } -uint CBEChannelSelectWidget::getItemCount() +void CBEChannelSelectWidget::paintItem(int pos) { - return Channels.size(); + int ypos = y + header_height + pos*item_height; + unsigned int current = liststart + pos; + + bool i_selected = current == selected; + int i_radius = RADIUS_NONE; + + fb_pixel_t color; + fb_pixel_t bgcolor; + + getItemColors(color, bgcolor, i_selected); + + if (i_selected) + { + if (current < Channels.size() || Channels.empty()) + paintDetails(pos, current); + + i_radius = RADIUS_LARGE; + } + else + { + if (current < Channels.size() && (Channels[current]->flags & CZapitChannel::NOT_PRESENT)) + color = COL_MENUCONTENTINACTIVE_TEXT; + } + + if (i_radius) + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius); + + if (current < Channels.size()) + { + if (isChannelInBouquet(current)) + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, x + OFFSET_INNER_MID, ypos, item_height); + else + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, x + OFFSET_INNER_MID, ypos, item_height); + + int text_offset = 2*OFFSET_INNER_MID + action_icon_width; + item_font->RenderString(x + text_offset, ypos + item_height, width - text_offset - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - status_icon_width, Channels[current]->getName(), color); + + if (Channels[current]->scrambled) + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - status_icon_width, ypos, item_height); + else if (!Channels[current]->getUrl().empty()) + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - status_icon_width, ypos, item_height); + } } -bool CBEChannelSelectWidget::isChannelInBouquet( int index) +void CBEChannelSelectWidget::paintItems() +{ + liststart = (selected/items_count)*items_count; + + for(unsigned int count = 0; count < items_count; count++) + paintItem(count); + + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, Channels.size(), items_count, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, body_height, total_pages, current_page); +} + +void CBEChannelSelectWidget::paintBody() +{ + PaintBoxRel(x, y + header_height, width, body_height, COL_MENUCONTENT_PLUS_0, RADIUS_NONE, CORNER_NONE, CC_SHADOW_ON); +} + +void CBEChannelSelectWidget::paintHead() +{ + header.setCaption(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio")); + header.setIcon(NULL); // trick the cc-header + header.setIcon(mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO); + header.setDimensionsAll(x, y, width, header_height); + header.setCorner(RADIUS_LARGE, CORNER_TOP); + header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true); + header.paint(CC_SAVE_SCREEN_NO); +} + +struct button_label CBEChannelSelectButtons[] = +{ + { NEUTRINO_ICON_BUTTON_RED, LOCALE_CHANNELLIST_FOOT_SORT_ALPHA }, + { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_BOUQUETEDITOR_SWITCH }, + { NEUTRINO_ICON_BUTTON_HOME, LOCALE_BOUQUETEDITOR_RETURN } +}; + +void CBEChannelSelectWidget::paintFoot() +{ + switch (channellist_sort_mode) + { + case SORT_FREQ: + { + CBEChannelSelectButtons[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_FREQ; + break; + } + case SORT_SAT: + { + CBEChannelSelectButtons[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_SAT; + break; + } + case SORT_CH_NUMBER: + { + CBEChannelSelectButtons[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_CHNUM; + break; + } + case SORT_ALPHA: + default: + { + CBEChannelSelectButtons[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_ALPHA; + break; + } + } + + const short numbuttons = sizeof(CBEChannelSelectButtons)/sizeof(CBEChannelSelectButtons[0]); + + footer.enableShadow(CC_SHADOW_ON, -1, true); + footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEChannelSelectButtons); +} + +void CBEChannelSelectWidget::paintDetails(int pos, int current) +{ + int xpos = x - DETAILSLINE_WIDTH; + int ypos1 = y + header_height + pos*item_height; + int ypos2 = y + height - info_height - OFFSET_SHADOW; + int ypos1a = ypos1 + (item_height/2); + int ypos2a = ypos2 + (info_height/2); + + if (dline) + dline->kill(); + + if (pos >= 0) + { + if (dline == NULL) + dline = new CComponentsDetailsLine(); + + if (dline) + { + dline->setDimensionsAll(xpos, ypos1a, ypos2a, item_height/2, info_height - RADIUS_LARGE*2); + dline->paint(CC_SAVE_SCREEN_NO); + } + + if (ibox == NULL) + { + ibox = new CComponentsInfoBox(); + + if (ibox) + { + ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); + ibox->setTextColor(COL_MENUCONTENTDARK_TEXT); + ibox->setFrameThickness(FRAME_WIDTH_MIN); + ibox->setCorner(RADIUS_LARGE); + ibox->enableShadow(CC_SHADOW_ON); + } + } + + if (ibox) + { + if (ibox->isPainted()) + ibox->hide(); + + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setText(getInfoText(current), CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, info_font); + ibox->paint(CC_SAVE_SCREEN_NO); + } + } +} + +void CBEChannelSelectWidget::hide() +{ + frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW); + + if (dline) + dline->kill(); + if (ibox) + ibox->kill(); +} + +std::string CBEChannelSelectWidget::getInfoText(int index) +{ + std::string res = ""; + + if (Channels.empty()) + return res; + + std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition()); + if (IS_WEBTV(Channels[index]->getChannelID())) + satname = "WebTV"; + transponder t; + CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t); + std::string desc = t.description(); + if (Channels[index]->pname) + { + if (desc.empty()) + desc = std::string(Channels[index]->pname); + else + desc += " (" + std::string(Channels[index]->pname) + ")"; + } + if (!Channels[index]->getDesc().empty()) + desc += "\n" + Channels[index]->getDesc(); + + res = satname + " - " + desc; + + return res; +} + +void CBEChannelSelectWidget::updateSelection(unsigned int newpos) +{ + if (newpos == selected || newpos == (unsigned int)-1) + return; + + unsigned int prev_selected = selected; + selected = newpos; + + unsigned int oldliststart = liststart; + liststart = (selected/items_count)*items_count; + if (oldliststart != liststart) + { + paintItems(); + } + else + { + paintItem(prev_selected - liststart); + paintItem(selected - liststart); + } +} + +int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*/) +{ + neutrino_msg_t msg; + neutrino_msg_data_t data; + + int res = menu_return::RETURN_REPAINT; + selected = 0; + + if (parent) + parent->hide(); + + bouquetChannels = mode == CZapitClient::MODE_TV ? &(bouquet->tvChannels) : &(bouquet->radioChannels); + + Channels.clear(); + + if (mode == CZapitClient::MODE_RADIO) + CServiceManager::getInstance()->GetAllRadioChannels(Channels); + else + CServiceManager::getInstance()->GetAllTvChannels(Channels); + + sort(Channels.begin(), Channels.end(), CmpChannelByChName()); + + paintHead(); + paintBody(); + paintFoot(); + paintItems(); + + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + + channelChanged = false; + bool loop = true; + while (loop) + { + g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); + + if (msg <= CRCInput::RC_MaxRC) + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + + if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t)g_settings.key_channelList_cancel) || (msg == CRCInput::RC_home)) + { + loop = false; + } + else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup || + msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown) + { + int new_selected = UpDownKey(Channels, msg, items_count, selected); + updateSelection(new_selected); + } + else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) + { + if (!Channels.empty()) + { + int new_selected = msg == (neutrino_msg_t) g_settings.key_list_start ? 0 : Channels.size() - 1; + updateSelection(new_selected); + } + } + else if (msg == CRCInput::RC_ok || msg == CRCInput::RC_green) + { + if (selected < Channels.size()) + selectChannel(); + } + else if (msg == CRCInput::RC_red) + { + if (selected < Channels.size()) + sortChannels(); + } + else if (CNeutrinoApp::getInstance()->listModeKey(msg)) + { + // do nothing + } + else + { + CNeutrinoApp::getInstance()->handleMsg(msg, data); + } + } + + hide(); + return res; +} + +void CBEChannelSelectWidget::sortChannels() +{ + channellist_sort_mode++; + if (channellist_sort_mode >= SORT_END) + channellist_sort_mode = SORT_ALPHA; + switch (channellist_sort_mode) + { + case SORT_FREQ: + { + sort(Channels.begin(), Channels.end(), CmpChannelByFreq()); + break; + } + case SORT_SAT: + { + sort(Channels.begin(), Channels.end(), CmpChannelBySat()); + break; + } + case SORT_CH_NUMBER: + { + sort(Channels.begin(), Channels.end(), CmpChannelByChNum()); + break; + } + case SORT_ALPHA: + default: + { + sort(Channels.begin(), Channels.end(), CmpChannelByChName()); + break; + } + } + paintFoot(); + paintItems(); +} + +void CBEChannelSelectWidget::selectChannel() +{ + channelChanged = true; + + if (isChannelInBouquet(selected)) + bouquet->removeService(Channels[selected]); + else + bouquet->addService(Channels[selected]); + + bouquetChannels = mode == CZapitClient::MODE_TV ? &(bouquet->tvChannels) : &(bouquet->radioChannels); + + paintItem(selected - liststart); + g_RCInput->postMsg(CRCInput::RC_down, 0); +} + +bool CBEChannelSelectWidget::isChannelInBouquet(int index) { for (unsigned int i=0; i< bouquetChannels->size(); i++) { @@ -100,223 +431,5 @@ bool CBEChannelSelectWidget::isChannelInBouquet( int index) bool CBEChannelSelectWidget::hasChanged() { - return modified; -} - -void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselected) -{ - int ypos = y+ theight + paintNr*iheight; - int i_radius = RADIUS_NONE; - - fb_pixel_t color; - fb_pixel_t bgcolor; - - getItemColors(color, bgcolor, pselected); - - if (pselected) - { - if (itemNr < getItemCount()) - { - initItem2DetailsLine (paintNr, itemNr); - paintDetails(itemNr); - } - i_radius = RADIUS_LARGE; - } - else - { - if (itemNr < getItemCount() && (Channels[itemNr]->flags & CZapitChannel::NOT_PRESENT)) - color = COL_MENUCONTENTINACTIVE_TEXT; - } - - if (i_radius) - frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius); - - if(itemNr < getItemCount()) - { - if( isChannelInBouquet(itemNr)) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, x + OFFSET_INNER_MID, ypos, iheight); - else - frameBuffer->paintBoxRel(x + OFFSET_INNER_MID, ypos, iconoffset, iheight, bgcolor); - - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, Channels[itemNr]->getName(), color); - if(Channels[itemNr]->scrambled) - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); - else if (!Channels[itemNr]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); - } -} - -void CBEChannelSelectWidget::onOkKeyPressed() -{ - if (selected >= Channels.size()) - return; - setModified(); - if (isChannelInBouquet(selected)) - bouquet->removeService(Channels[selected]); - else - bouquet->addService(Channels[selected]); - - bouquetChannels = mode == CZapitClient::MODE_TV ? &(bouquet->tvChannels) : &(bouquet->radioChannels); - - paintItem( selected, selected - liststart, false); - g_RCInput->postMsg( CRCInput::RC_down, 0 ); -} - -void CBEChannelSelectWidget::onRedKeyPressed() -{ - if (selected >= Channels.size()) - return; - - channellist_sort_mode++; - if(channellist_sort_mode > SORT_END) - channellist_sort_mode = 0; - switch(channellist_sort_mode) - { - case SORT_ALPHA: - sort(Channels.begin(), Channels.end(), CmpChannelByChName()); - break; - case SORT_FREQ: - sort(Channels.begin(), Channels.end(), CmpChannelByFreq()); - break; - case SORT_SAT: - sort(Channels.begin(), Channels.end(), CmpChannelBySat()); - break; - case SORT_CH_NUMBER: - sort(Channels.begin(), Channels.end(), CmpChannelByChNum()); - break; - default: - sort(Channels.begin(), Channels.end(), CmpChannelByChName()); - break; - } - paintFoot(); - paint(); -} - -int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & actionKey) -{ - width = frameBuffer->getScreenWidthRel(); - info_height = 2*iheight + 4; - height = frameBuffer->getScreenHeightRel() - info_height; - listmaxshow = (height-theight-footerHeight-0)/iheight; - height = theight+footerHeight+listmaxshow*iheight; // recalc height - - x = getScreenStartX(width); - if (x < DETAILSLINE_WIDTH) - x = DETAILSLINE_WIDTH; - y = getScreenStartY(height + info_height); - - bouquetChannels = mode == CZapitClient::MODE_TV ? &(bouquet->tvChannels) : &(bouquet->radioChannels); - - Channels.clear(); - if (mode == CZapitClient::MODE_RADIO) - CServiceManager::getInstance()->GetAllRadioChannels(Channels); - else - CServiceManager::getInstance()->GetAllTvChannels(Channels); - - sort(Channels.begin(), Channels.end(), CmpChannelByChName()); - - return CListBox::exec(parent, actionKey); -} - -const struct button_label CBEChannelSelectButtons[] = -{ - { NEUTRINO_ICON_BUTTON_RED, LOCALE_CHANNELLIST_FOOT_SORT_ALPHA}, - { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_BOUQUETEDITOR_SWITCH }, - { NEUTRINO_ICON_BUTTON_HOME, LOCALE_BOUQUETEDITOR_RETURN } -}; - -void CBEChannelSelectWidget::paintFoot() -{ - const short numbuttons = sizeof(CBEChannelSelectButtons)/sizeof(CBEChannelSelectButtons[0]); - struct button_label Button[numbuttons]; - for (int i = 0; i < numbuttons; i++) - Button[i] = CBEChannelSelectButtons[i]; - - switch (channellist_sort_mode) { - case SORT_ALPHA: - Button[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_ALPHA; - break; - case SORT_FREQ: - Button[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_FREQ; - break; - case SORT_SAT: - Button[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_SAT; - break; - case SORT_CH_NUMBER: - Button[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_CHNUM; - break; - default: - Button[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_ALPHA; - break; - } - - footer.paintButtons(x, y + (height-footerHeight), width, footerHeight, numbuttons, Button, width/numbuttons-2*OFFSET_INNER_MID); -} - -std::string CBEChannelSelectWidget::getInfoText(int index) -{ - std::string res = ""; - - std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition()); - transponder t; - CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t); - std::string desc = t.description(); - if(Channels[index]->pname) - desc = desc + " (" + std::string(Channels[index]->pname) + ")"; - else - desc = desc + " (" + satname + ")"; - - res = satname + " " + desc; - - return res; -} - -void CBEChannelSelectWidget::paintDetails(int index) -{ - //details line - dline->paint(CC_SAVE_SCREEN_NO); - - std::string str = getInfoText(index); - - //info box - ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); - ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); - ibox->setTextColor(COL_MENUCONTENTDARK_TEXT); - ibox->paint(false); -} - -void CBEChannelSelectWidget::initItem2DetailsLine (int pos, int /*ch_index*/) -{ - int xpos = x - DETAILSLINE_WIDTH; - int ypos1 = y + theight+0 + pos*iheight; - int ypos2 = y + height + OFFSET_INTER; - int ypos1a = ypos1 + (fheight/2); - int ypos2a = ypos2 + (info_height/2); - - if (dline) - dline->kill(); //kill details line - - // init Line if detail info (and not valid list pos) - if (pos >= 0) - { - if (dline == NULL) - dline = new CComponentsDetailsLine(xpos, ypos1a, ypos2a, fheight/2, info_height-RADIUS_LARGE*2); - dline->setYPos(ypos1a); - - //infobox - if (ibox){ - ibox->setDimensionsAll(x, ypos2, width, info_height); - ibox->setFrameThickness(FRAME_WIDTH_MIN); - ibox->setCorner(RADIUS_LARGE); - ibox->disableShadow(); - } - } -} - -void CBEChannelSelectWidget::hide() -{ - dline->kill(); //kill details line - ibox->kill(); - CListBox::hide(); + return channelChanged; } diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index 519b16397..bf7b9e6f6 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.h +++ b/src/gui/bedit/bouqueteditor_chanselect.h @@ -1,76 +1,84 @@ /* - Neutrino-GUI - DBoxII-Project + neutrino bouquet editor - channel selection Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - 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. - + Copyright (C) 2017 Sven Hoefer License: GPL - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifndef __bouqueteditor_chanselect__ #define __bouqueteditor_chanselect__ -#include +#include + #include +#include +#include +#include +#include #include -#include -#include -#include +#include "bouqueteditor_globals.h" -class CBEChannelSelectWidget : public CListBox +class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CListHelpers { private: - - CZapitBouquet * bouquet; - short int channellist_sort_mode; - enum{SORT_ALPHA,SORT_FREQ,SORT_SAT,SORT_CH_NUMBER, SORT_END}; - CZapitClient::channelsMode mode; - bool isChannelInBouquet( int index); CComponentsDetailsLine *dline; CComponentsInfoBox *ibox; - CComponentsFooter footer; - uint getItemCount(); - void paintItem(uint32_t itemNr, int paintNr, bool selected); - void paintDetails(int index); - void initItem2DetailsLine (int pos, int ch_index); + + enum { + SORT_ALPHA, + SORT_FREQ, + SORT_SAT, + SORT_CH_NUMBER, + SORT_END + }; + + unsigned int selected; + unsigned int liststart; + + CZapitClient::channelsMode mode; + CZapitBouquet * bouquet; + short int channellist_sort_mode; + bool isChannelInBouquet(int index); + + bool channelChanged; + std::string caption; + + void paintHead(); + void paintBody(); + void paintItem(int pos); + void paintItems(); void paintFoot(); - void onOkKeyPressed(); - void onRedKeyPressed(); + void paintDetails(int pos, int current); void hide(); + void updateSelection(unsigned int newpos); + + void sortChannels(); + void selectChannel(); - int footerHeight; - int info_height; - std::string getInfoText(int index); - public: - ZapitChannelList Channels; - ZapitChannelList * bouquetChannels; + public: CBEChannelSelectWidget(const std::string & Caption, CZapitBouquet* Bouquet, CZapitClient::channelsMode Mode); ~CBEChannelSelectWidget(); + + ZapitChannelList Channels; + ZapitChannelList * bouquetChannels; int exec(CMenuTarget* parent, const std::string & actionKey); bool hasChanged(); }; diff --git a/src/gui/bedit/bouqueteditor_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp new file mode 100644 index 000000000..62f51c1d9 --- /dev/null +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -0,0 +1,62 @@ +/* + neutrino bouquet editor - globals + + Copyright (C) 2017 Sven Hoefer + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include + +#include "bouqueteditor_globals.h" + +class CFrameBuffer; + +CBEGlobals::CBEGlobals() +{ + frameBuffer = CFrameBuffer::getInstance(); + + item_font = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]; + info_font = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]; + + width = frameBuffer->getScreenWidthRel(); + height = frameBuffer->getScreenHeightRel(); + + header_height = header.getHeight(); + item_height = item_font->getHeight(); + footer_height = footer.getHeight(); + info_height = 2*info_font->getHeight() + 2*OFFSET_INNER_SMALL; + + items_count = (height - header_height - footer_height - OFFSET_INTER - info_height - 2*OFFSET_SHADOW) / item_height; + body_height = items_count*item_height; + height = header_height + body_height + footer_height + OFFSET_INTER + info_height + 2*OFFSET_SHADOW; // recalc height + + x = getScreenStartX(width); + y = getScreenStartY(height); + + timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU]; +} + +CBEGlobals::~CBEGlobals() +{ +} diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h new file mode 100644 index 000000000..ea02ea8d1 --- /dev/null +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -0,0 +1,63 @@ +/* + neutrino bouquet editor - globals + + Copyright (C) 2017 Sven Hoefer + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef __bouqueteditor_globals__ +#define __bouqueteditor_globals__ + +#include +#include + +class CFrameBuffer; + +class CBEGlobals +{ + public: + CBEGlobals(); + ~CBEGlobals(); + + CFrameBuffer *frameBuffer; + + int x; + int y; + int width; + int height; + + int header_height; + int body_height; + int item_height; + int footer_height; + int info_height; + + CComponentsHeader header; + CComponentsFooter footer; + + unsigned int items_count; + + Font *item_font; + Font *info_font; + + int action_icon_width; + int status_icon_width; + + int timeout; +}; + +#endif diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 7ea3d68c7..dcb686ca5 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -252,7 +252,7 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent) int res = -1; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); neutrino_msg_t msg; neutrino_msg_data_t data; @@ -269,7 +269,7 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent) g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); if ( ( msg == CRCInput::RC_timeout ) || ( msg == CRCInput::RC_home) ) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 9a23f8c62..fb62b4b07 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -460,14 +460,15 @@ int CBouquetList::show(bool bShowChannelList) unsigned int chn= 0; int pos= lmaxpos; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); + int timeout = g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]; + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); bool loop=true; while (loop) { g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); if((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetFadeTimer())) { if(fader.FadeDone()) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 1d2bc6cf6..22455a328 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -617,14 +617,15 @@ int CChannelList::show() int zapOnExit = false; bool bShowBouquetList = false; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); + int timeout = g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]; + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); bool loop=true; bool dont_hide = false; while (loop) { g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); bool empty = (*chanlist).empty(); if((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetFadeTimer())) { @@ -646,7 +647,7 @@ int CChannelList::show() selected = selected_in_new_mode; } if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else loop=false; @@ -698,7 +699,7 @@ int CChannelList::show() loop = false; } else { paint(); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } } } @@ -733,7 +734,7 @@ int CChannelList::show() else { if (ret != 0) paint(); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } } else if (!empty && msg == (neutrino_msg_t) g_settings.key_list_start) { diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index 82dd27cca..0ff9adcbf 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -53,12 +53,14 @@ void CComponentsDetailsLine::initVarDline( const int& x_pos, const int& y_pos_to col_shadow = color_shadow; col_body = color_line; + shadow_w = 1; + //CComponentsDetailsLine y_down = y_pos_down; - h_mark_top = h_mark_top_; - h_mark_down = h_mark_down_; - shadow_w = 1; + // reduce two times the shadow width, to avoid shadow overlaps + h_mark_top = h_mark_top_ - 2*shadow_w; + h_mark_down = h_mark_down_ - 2*shadow_w; //CComponentsDetailsLine dl_w = CFrameBuffer::getInstance()->scale2Res(3); @@ -96,9 +98,6 @@ void CComponentsDetailsLine::paint(bool do_save_bg) int sw = shadow_w; - // reduce two times the shadow width, to avoid shadow overlaps - h_mark_down -= 2*sw; - int y_mark_top = y-h_mark_top/2; int y_mark_down = y_down-h_mark_down/2; int dx_c = dl_w%2; //correction for odd values diff --git a/src/gui/components/cc_detailsline.h b/src/gui/components/cc_detailsline.h index 66197f51f..48f44635e 100644 --- a/src/gui/components/cc_detailsline.h +++ b/src/gui/components/cc_detailsline.h @@ -67,9 +67,9 @@ class CComponentsDetailsLine : public CComponents ///set property: lowest y position void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; ///set property: height of top marker - void setHMarkTop(const int& h_mark_top_){h_mark_top = h_mark_top_;}; + void setHMarkTop(const int& h_mark_top_){h_mark_top = h_mark_top_ - 2*shadow_w;}; ///property: height of bottom marker - void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; + void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_ - 2*shadow_w;}; ///set all positions and dimensions of details line at once void setDimensionsAll(const int& x_pos,const int& y_pos, const int& y_pos_down, const int& h_mark_top_ , const int& h_mark_down_) {setXPos(x_pos); setYPos(y_pos); setYPosDown(y_pos_down); setHMarkTop(h_mark_top_); setHMarkDown(h_mark_down_);} diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index 2ab97231b..5f301b172 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -103,8 +103,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) bool doLoop = true; int timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU]; - - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout == 0 ? 0xFFFF : timeout); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); uint32_t updateTimer = g_RCInput->addTimer(5*1000*1000, false); while (doLoop) @@ -122,7 +121,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) ( msg == CRCInput::RC_home ) || ( msg == CRCInput::RC_ok ) ) { if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else doLoop = false; @@ -150,7 +149,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) if ((msg <= CRCInput::RC_MaxRC) && (data == 0)) /* <- button pressed */ { - timeoutEnd = CRCInput::calcTimeoutEnd( timeout ); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } } } diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 6cda52b95..4f399be4f 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -934,14 +934,15 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque this->paint(); - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); + int timeout = g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]; + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); bool loop = true; while (loop) { g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); if (msg <= CRCInput::RC_MaxRC) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); if ((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetFadeTimer())) @@ -953,7 +954,7 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque { if (fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index c9608314f..6df3eb6d7 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -904,13 +904,15 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start bool loop = true; bool epgTextSwitchClear = true; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + + int timeout = g_settings.timing[SNeutrinoSettings::TIMING_EPG]; + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); while (loop) { g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); scrollCount = medlinecount; @@ -1053,7 +1055,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start bigFonts = g_settings.bigFonts; show(channel_id,epgData.eventID,&epgData.epg_times.startzeit,false); showPos=0; - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } else { printf("no network devices available\n"); @@ -1084,7 +1086,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start epgData.epg_times.startzeit + epgData.epg_times.dauer, epgData.title, epgData.eventID, TIMERD_APIDS_CONF, true, recDir, &evtlist); m.exec(NULL, ""); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } else if (doRecord) { @@ -1105,11 +1107,11 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ), TIMERD_APIDS_CONF, true, epgData.epg_times.startzeit - (ANNOUNCETIME + 120) > time(NULL), recDir, true); ShowMsg(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTRECORD_MSG, CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_INFO); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } } else { ShowMsg(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTRECORD_MSG, CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_INFO); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } } } @@ -1169,7 +1171,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start epgData.eventID, epgData.epg_times.startzeit, 0); ShowMsg(LOCALE_TIMER_EVENTTIMED_TITLE, LOCALE_TIMER_EVENTTIMED_MSG, CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_INFO); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } else printf("timerd not available\n"); @@ -1227,7 +1229,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start case CRCInput::RC_ok: case CRCInput::RC_timeout: if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else loop = false; @@ -1235,7 +1237,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start default: if (msg == (neutrino_msg_t)g_settings.key_channelList_cancel) { if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else loop = false; diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 7f17c199d..97d9a5bc4 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -378,7 +378,8 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna int oldselected = selected; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + int timeout = g_settings.timing[SNeutrinoSettings::TIMING_EPG]; + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); bool loop = true; while (loop) @@ -386,7 +387,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); if((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetFadeTimer())) { if(fader.FadeDone()) @@ -396,7 +397,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna { selected = oldselected; if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else loop = false; @@ -492,7 +493,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna hide(); recDirs.exec(NULL,""); paint(evtlist[selected].channelID); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } else { @@ -529,7 +530,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna evtlist[selected].startTime + evtlist[selected].duration, evtlist[selected].description, evtlist[selected].eventID, TIMERD_APIDS_CONF, true, "", &evtlist); m.exec(NULL, ""); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } timerlist.clear(); g_Timerd->getTimerList (timerlist); @@ -559,7 +560,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna g_Timerd->getTimerList (timerlist); paint(evtlist[selected].channelID ); paintFoot(evtlist[selected].channelID ); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } else if (msg == (neutrino_msg_t)g_settings.key_channelList_cancel) { @@ -573,7 +574,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna } else { selected = oldselected; if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else loop = false; @@ -609,7 +610,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna infozone_background = false; paint(channel_id); paintFoot(channel_id); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } else if (msg == CRCInput::RC_epg) { @@ -652,7 +653,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna infozone_background = false; paint(channel_id); paintFoot(channel_id); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } } } @@ -662,7 +663,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna oldEventID = -1; infozone_background = false; in_search = findEvents(channel_id, channelname); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } else if (CNeutrinoApp::getInstance()->listModeKey(msg)) { g_RCInput->postMsg (msg, 0); diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 676247dcd..04230bd79 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -638,7 +638,8 @@ bool CFileBrowser::exec(const char * const dirname) unsigned int oldselected = selected; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_FILEBROWSER]); + int timeout = g_settings.timing[SNeutrinoSettings::TIMING_FILEBROWSER]; + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); bool loop=true; while (loop) @@ -647,7 +648,7 @@ bool CFileBrowser::exec(const char * const dirname) neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat; if (msg <= CRCInput::RC_MaxRC) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_FILEBROWSER]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); if(!CRCInput::isNumeric(msg)) { @@ -948,7 +949,8 @@ bool CFileBrowser::playlist_manager(CFileList &playlist, unsigned int playing) paint(); paintFoot(); - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_FILEBROWSER]); + int timeout = g_settings.timing[SNeutrinoSettings::TIMING_FILEBROWSER]; + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); bool loop=true; while (loop) @@ -958,7 +960,7 @@ bool CFileBrowser::playlist_manager(CFileList &playlist, unsigned int playing) neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat; if (msg <= CRCInput::RC_MaxRC) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_FILEBROWSER]); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); if(!CRCInput::isNumeric(msg)) { diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 9f6a4ed64..8a1feb8bd 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -1328,7 +1328,7 @@ int CHDDMenuHandler::checkDevice(std::string dev) progress->showGlobalStatus(100); progress->showStatusMessageUTF(buf); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); loop = true; while (loop) { diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 5a08f725f..5d545260d 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -921,18 +921,16 @@ void CInfoViewer::setInfobarTimeout(int timeout_ext) //define timeouts switch (mode) { - case NeutrinoMessages::mode_tv: - case NeutrinoMessages::mode_webtv: - timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + timeout_ext); - break; case NeutrinoMessages::mode_radio: - timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_RADIO] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_RADIO] + timeout_ext); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_RADIO] + timeout_ext); break; case NeutrinoMessages::mode_ts: - timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_MOVIE] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_MOVIE] + timeout_ext); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_MOVIE] + timeout_ext); break; + case NeutrinoMessages::mode_tv: + case NeutrinoMessages::mode_webtv: default: - timeoutEnd = CRCInput::calcTimeoutEnd(6 + timeout_ext); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + timeout_ext); break; } } @@ -1060,7 +1058,7 @@ void CInfoViewer::loop(bool show_dot) } } if(fader.StartFadeOut()) - timeoutEnd = CRCInput::calcTimeoutEnd (1); + timeoutEnd = CRCInput::calcTimeoutEnd(1); else res = messages_return::cancel_info; } else if ((g_settings.mode_left_right_key_tv == SNeutrinoSettings::VZAP) && ((msg == CRCInput::RC_right) || (msg == CRCInput::RC_left ))) { @@ -1257,7 +1255,7 @@ void CInfoViewer::showSubchan () } else g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString (x + 10, y + dy - 2, dx - 20, text, COL_MENUCONTENT_TEXT); - uint64_t timeoutEnd_tmp = CRCInput::calcTimeoutEnd (2); + uint64_t timeoutEnd_tmp = CRCInput::calcTimeoutEnd(2); int res = messages_return::none; neutrino_msg_t msg; diff --git a/src/gui/lua/lua_hintbox.cpp b/src/gui/lua/lua_hintbox.cpp index eec52f441..f7609ab4d 100644 --- a/src/gui/lua/lua_hintbox.cpp +++ b/src/gui/lua/lua_hintbox.cpp @@ -138,7 +138,7 @@ int CLuaInstHintbox::HintboxExec(lua_State *L) timeout = 5; /// default timeout 5 sec //timeout = g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR]; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout ); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); int res = messages_return::none; diff --git a/src/gui/network_setup.cpp b/src/gui/network_setup.cpp index 05eb80617..45d19a739 100644 --- a/src/gui/network_setup.cpp +++ b/src/gui/network_setup.cpp @@ -787,7 +787,7 @@ void CNetworkSetup::testNetworkSettings() } } - ShowMsg(LOCALE_NETWORKMENU_TEST, text, CMsgBox::mbrBack, CMsgBox::mbBack); // UTF-8 + ShowMsg(LOCALE_NETWORKMENU_TEST, text, CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_NETWORK, MSGBOX_MIN_WIDTH, NO_TIMEOUT, false, CMsgBox::AUTO_WIDTH | CMsgBox::AUTO_HIGH); } int CNetworkSetup::showWlanList() diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index f93435db6..d92d86225 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -305,14 +305,14 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) paintWindowSize(old_window_width, old_window_height); - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool loop=true; while (loop) { g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); if ( msg == CRCInput::RC_ok ) { memset(window_size_value, 0, sizeof(window_size_value)); @@ -1066,6 +1066,8 @@ void COsdSetup::showOsdTimeoutSetup(CMenuWidget* menu_timeout) { CMenuOptionNumberChooser *ch = new CMenuOptionNumberChooser(timing_setting[i].name, &g_settings.timing[i], true, 0, 240); ch->setNumberFormat(nf); + ch->setLocalizedValue(0); + ch->setLocalizedValueName(LOCALE_OPTIONS_OFF); ch->setHint("", timing_setting[i].hint); menu_timeout->addItem(ch); } @@ -1245,7 +1247,7 @@ void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar) } //channellist -void COsdSetup::showOsdChanlistSetup(CMenuWidget *menu_chanlist, bool hint_paint) +void COsdSetup::showOsdChanlistSetup(CMenuWidget *menu_chanlist) { CMenuOptionChooser * mc; @@ -1254,45 +1256,38 @@ void COsdSetup::showOsdChanlistSetup(CMenuWidget *menu_chanlist, bool hint_paint // channellist additional mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_ADDITIONAL, &g_settings.channellist_additional, CHANNELLIST_ADDITIONAL_OPTIONS, CHANNELLIST_ADDITIONAL_OPTION_COUNT, true); - if(hint_paint) - mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_ADDITIONAL); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_ADDITIONAL); menu_chanlist->addItem(mc); // epg align mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_EPGTEXT_ALIGN, &g_settings.channellist_epgtext_align_right, CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS, CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS_COUNT, true); - if(hint_paint) - mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EPG_ALIGN); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EPG_ALIGN); menu_chanlist->addItem(mc); // extended channel list mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_EXTENDED, &g_settings.theme.progressbar_design_channellist, PROGRESSBAR_COLOR_OPTIONS, PROGRESSBAR_COLOR_OPTION_COUNT, true, this); - if(hint_paint) - mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EXTENDED); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EXTENDED); menu_chanlist->addItem(mc); // show infobox mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_SHOW_INFOBOX, &g_settings.channellist_show_infobox, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, channellistNotifier); - if(hint_paint) - mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_INFOBOX); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_INFOBOX); menu_chanlist->addItem(mc); // foot mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_FOOT, &g_settings.channellist_foot, CHANNELLIST_FOOT_OPTIONS, CHANNELLIST_FOOT_OPTIONS_COUNT, g_settings.channellist_show_infobox); - if(hint_paint) - mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_FOOT); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_FOOT); menu_chanlist->addItem(mc); channellistNotifier->addItem(mc); //show channel logo mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_SHOW_CHANNELLOGO, &g_settings.channellist_show_channellogo, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - if(hint_paint) - mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELLOGO); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELLOGO); menu_chanlist->addItem(mc); //show numbers mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_SHOW_CHANNELNUMBER, &g_settings.channellist_show_numbers, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - if(hint_paint) - mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELNUMBER); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELNUMBER); menu_chanlist->addItem(mc); } @@ -1515,7 +1510,7 @@ int COsdSetup::showContextChanlistMenu(CChannelList *parent_channellist) menu_chanlist->enableFade(false); menu_chanlist->setSelected(cselected); - showOsdChanlistSetup(menu_chanlist, false); + showOsdChanlistSetup(menu_chanlist); menu_chanlist->addItem(new CMenuSeparator(CMenuSeparator::LINE)); CMenuWidget *fontSettingsSubMenu = new CMenuWidget(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_KEYBINDING); @@ -1533,7 +1528,7 @@ int COsdSetup::showContextChanlistMenu(CChannelList *parent_channellist) fontSettingsSubMenu->addItem(new CMenuForwarder(LOCALE_OPTIONS_DEFAULT, true, NULL, this, font_sizes_groups[i].actionkey)); CMenuForwarder * mf = new CMenuDForwarder(LOCALE_FONTMENU_HEAD, true, NULL, fontSettingsSubMenu, NULL, CRCInput::RC_red); -// mf->setHint("", LOCALE_MENU_HINT_FONTS);//FIXME menu restoreScreen + mf->setHint("", LOCALE_MENU_HINT_FONTS); menu_chanlist->addItem(mf); int res = menu_chanlist->exec(NULL, ""); diff --git a/src/gui/osd_setup.h b/src/gui/osd_setup.h index dbaaa2451..cdea56535 100644 --- a/src/gui/osd_setup.h +++ b/src/gui/osd_setup.h @@ -71,7 +71,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver void showOsdTimeoutSetup(CMenuWidget *menu_timeout); void showOsdMenusSetup(CMenuWidget *menu_menus); void showOsdInfobarSetup(CMenuWidget *menu_infobar); - void showOsdChanlistSetup(CMenuWidget *menu_chanlist, bool hint_paint = true); + void showOsdChanlistSetup(CMenuWidget *menu_chanlist); void showOsdEventlistSetup(CMenuWidget *menu_eventlist); void showOsdVolumeSetup(CMenuWidget *menu_volume); void showOsdInfoclockSetup(CMenuWidget *menu_infoclock); diff --git a/src/gui/pipsetup.cpp b/src/gui/pipsetup.cpp index d6120cec2..32365e019 100644 --- a/src/gui/pipsetup.cpp +++ b/src/gui/pipsetup.cpp @@ -121,14 +121,14 @@ int CPipSetup::exec(CMenuTarget* parent, const std::string &) paint(); - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool loop=true; while (loop) { g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); if ((msg == (neutrino_msg_t) g_settings.key_pip_setup) || (msg == CRCInput::RC_timeout) || (msg == CRCInput::RC_ok)) { diff --git a/src/gui/screensetup.cpp b/src/gui/screensetup.cpp index 5c1e29647..2ffd55c76 100644 --- a/src/gui/screensetup.cpp +++ b/src/gui/screensetup.cpp @@ -96,8 +96,7 @@ int CScreenSetup::exec(CMenuTarget* parent, const std::string &) selected = 0; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings -::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool loop=true; while (loop) @@ -105,8 +104,7 @@ int CScreenSetup::exec(CMenuTarget* parent, const std::string &) g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd, true ); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings -::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); switch ( msg ) { diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index aadc472ad..66d825e65 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -858,7 +858,7 @@ int CTimerList::show() int res = menu_return::RETURN_REPAINT; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool loop=true; bool update=true; @@ -884,7 +884,7 @@ int CTimerList::show() } if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); if ((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetFadeTimer())) { @@ -900,7 +900,7 @@ int CTimerList::show() { //Exit after timeout or cancel key if (fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else diff --git a/src/gui/widget/colorchooser.cpp b/src/gui/widget/colorchooser.cpp index 9cee6d6f9..9253752cb 100644 --- a/src/gui/widget/colorchooser.cpp +++ b/src/gui/widget/colorchooser.cpp @@ -151,14 +151,14 @@ int CColorChooser::exec(CMenuTarget* parent, const std::string &) int selected = 0; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool loop=true; while (loop) { g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); int val = (*value[selected]); switch ( msg ) { diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index c08b31be5..ec9cd854e 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -208,7 +208,7 @@ int CHintBox::exec() if (timeout == NO_TIMEOUT || timeout == DEFAULT_TIMEOUT) timeout = HINTBOX_DEFAULT_TIMEOUT; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout ); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); if (timeout > 0) enableTimeOutBar(); diff --git a/src/gui/widget/keyboard_input.cpp b/src/gui/widget/keyboard_input.cpp index 7e910d618..bcc80d5f0 100644 --- a/src/gui/widget/keyboard_input.cpp +++ b/src/gui/widget/keyboard_input.cpp @@ -567,7 +567,7 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) paint(); paintKeyboard(); - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool loop=true; while (loop) @@ -580,7 +580,7 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true); if (msg <= CRCInput::RC_MaxRC) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); if (msg==CRCInput::RC_left) { @@ -635,7 +635,7 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) { if ((inputString->getValue() != oldval) && (ShowMsg(title, LOCALE_MESSAGEBOX_DISCARD, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbCancel) == CMsgBox::mbrCancel)) { - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); continue; } diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index ce70e8d8f..1b0dce605 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -778,7 +778,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) int pos = selected; int retval = menu_return::RETURN_REPAINT; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool bAllowRepeatLR_override = keyActionMap.find(CRCInput::RC_left) != keyActionMap.end() || keyActionMap.find(CRCInput::RC_right) != keyActionMap.end(); do { @@ -790,7 +790,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) int handled= false; if ( msg <= CRCInput::RC_MaxRC ) { - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); std::map::iterator it = keyActionMap.find(msg); if (it != keyActionMap.end()) { @@ -998,7 +998,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) } if(msg == CRCInput::RC_timeout) { if(fade && fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; continue; } @@ -1007,7 +1007,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) if ( msg <= CRCInput::RC_MaxRC ) { // recalculate timeout for RC-keys - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); } frameBuffer->blit(); } @@ -1074,7 +1074,7 @@ void CMenuWidget::hide() info_box->kill(); if (details_line) details_line->hide(); - frameBuffer->paintBackgroundBoxRel(x, y, full_width, full_height/* + footer_height*/); // full_height includes footer_height : see calcSize + frameBuffer->paintBackgroundBoxRel(x, y, full_width, full_height); // full_height includes footer_height : see calcSize //paintHint(-1); } paintHint(-1); @@ -1136,11 +1136,11 @@ void CMenuWidget::calcSize() hint_height = 0; if(g_settings.show_menu_hints && has_hints) { int lines = 2; - int text_height = 2*OFFSET_INNER_MID + lines*g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight(); + int text_height = 2*OFFSET_INNER_SMALL + lines*g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight(); /* assuming all hint icons has the same size ! */ int icon_width, icon_height; frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &icon_width, &icon_height); - icon_height += 2*OFFSET_INNER_MID; + icon_height += 2*OFFSET_INNER_SMALL; hint_height = std::max(icon_height, text_height); } /* set the max height to 9/10 of usable screen height @@ -1198,11 +1198,13 @@ void CMenuWidget::calcSize() // shrink menu if less items height = std::min(height, hheight + maxItemHeight); /* - Always add a bottom offset. + Always add a bottom separator offset. Most menus has an upper offset too, which is added with the intro-items */ - height += OFFSET_INNER_MID; + CMenuItem *separator = new CMenuSeparator(); + height += separator->getHeight(); + delete separator; //scrollbar width scrollbar_width=0; @@ -1210,7 +1212,7 @@ void CMenuWidget::calcSize() scrollbar_width = SCROLLBAR_WIDTH; full_width = width + scrollbar_width + OFFSET_SHADOW; - full_height = height + footer_height + OFFSET_SHADOW/* + OFFSET_INTER*/; // hintbox is handled separately + full_height = height + footer_height + OFFSET_SHADOW; // hintbox is handled separately /* + DETAILSLINE_WIDTH for the hintbox connection line * + center_offset for symmetry @@ -1294,7 +1296,10 @@ void CMenuWidget::setMenuPos(const int& menu_width) int scr_y = frameBuffer->getScreenY(); int scr_w = frameBuffer->getScreenWidth(); int scr_h = frameBuffer->getScreenHeight(); - int real_h = full_height/* + footer_height*/ + hint_height; // full_height includes footer_height : see calcSize + int hint_h = 0; + if (hint_height) + hint_h = OFFSET_INTER + hint_height + OFFSET_SHADOW; + int real_h = full_height + hint_h; // full_height includes footer_height : see calcSize int x_old = x; int y_old = y; //configured positions @@ -1414,20 +1419,23 @@ void CMenuWidget::saveScreen() return; delete[] background; - saveScreen_height = full_height/* + footer_height*/; // full_height includes footer_height : see calcSize + int hint_h = 0; + if (hint_height) + hint_h = OFFSET_INTER + hint_height + OFFSET_SHADOW; + saveScreen_height = full_height + hint_h; // full_height includes footer_height : see calcSize saveScreen_width = full_width; saveScreen_y = y; saveScreen_x = x; background = new fb_pixel_t [saveScreen_height * saveScreen_width]; if(background) - frameBuffer->SaveScreen(saveScreen_x /*-DETAILSLINE_WIDTH*/, saveScreen_y, saveScreen_width, saveScreen_height, background); + frameBuffer->SaveScreen(saveScreen_x, saveScreen_y, saveScreen_width, saveScreen_height, background); } void CMenuWidget::restoreScreen() { if(background) { if(savescreen) - frameBuffer->RestoreScreen(saveScreen_x /*-DETAILSLINE_WIDTH*/, saveScreen_y, saveScreen_width, saveScreen_height, background); + frameBuffer->RestoreScreen(saveScreen_x, saveScreen_y, saveScreen_width, saveScreen_height, background); } } diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 7e78de2ab..ade80cafd 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -361,6 +361,8 @@ private: void setNumberFormat(std::string format) { numberFormat = format; } void setNumberFormat(std::string (*fun)(int)) { numberFormatFunction = fun; } void setNumericInput(bool _numeric_input) { numeric_input = _numeric_input; } + void setLocalizedValue(int special_value) { localized_value = special_value; } + void setLocalizedValueName(neutrino_locale_t special_value_name) { localized_value_name = special_value_name; } }; class CMenuOptionChooserOptions diff --git a/src/gui/widget/shellwindow.cpp b/src/gui/widget/shellwindow.cpp index f2b641f5a..60af07803 100644 --- a/src/gui/widget/shellwindow.cpp +++ b/src/gui/widget/shellwindow.cpp @@ -283,7 +283,7 @@ void CShellWindow::showResult() neutrino_msg_t msg; neutrino_msg_data_t data; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); if (!exit) { diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index a0c789a86..b4b8a30c8 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -407,7 +407,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) paint(); - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool loop=true; while (loop) @@ -422,7 +422,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true ); if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); if ((msg == NeutrinoMessages::EVT_TIMER) && (data == smstimer)) msg = CRCInput::RC_right; @@ -493,7 +493,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) string tmp_name = name == NONEXISTANT_LOCALE ? head : g_Locale->getText(name); if ((trim (*valueString) != trim(oldval)) && (ShowMsg(tmp_name, LOCALE_MESSAGEBOX_DISCARD, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbCancel) == CMsgBox::mbrCancel)) { - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); continue; } diff --git a/src/gui/widget/stringinput_ext.cpp b/src/gui/widget/stringinput_ext.cpp index 0de0282d9..aa11a805f 100644 --- a/src/gui/widget/stringinput_ext.cpp +++ b/src/gui/widget/stringinput_ext.cpp @@ -187,7 +187,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) paint(); frameBuffer->blit(); - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool loop=true; while (loop) @@ -281,7 +281,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) *cancel = false; } else if(erg==CMsgBox::mbrCancel){ - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); } } else { loop=false;