diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index c8ba9f33f..4140c42b0 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -2321,6 +2321,7 @@ timerlist.bouquetselect Bouquet wählen timerlist.channel Kanal timerlist.channelselect Kanal wählen timerlist.delete Löschen +timerlist.info Info timerlist.menumodify Timer bearbeiten timerlist.menunew Neuer Timer timerlist.message Nachricht @@ -2356,6 +2357,7 @@ timerlist.repeatcount Wiederholungen timerlist.repeatcount.hint_1 Anzahl der Timerausführungen timerlist.repeatcount.hint_2 0 für unbegrenzte Anzahl timerlist.save Timer speichern +timerlist.send.timer Sende Timer timerlist.standby Aktion timerlist.standby.off Aufwachen aus Standby timerlist.standby.on In Standby gehen diff --git a/data/locale/english.locale b/data/locale/english.locale index b16b50caf..df080ca1a 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2321,6 +2321,7 @@ timerlist.bouquetselect choose bouquet timerlist.channel Channel timerlist.channelselect choose channel timerlist.delete Delete +timerlist.info Info timerlist.menumodify Modify timer timerlist.menunew New timer timerlist.message Message @@ -2356,6 +2357,7 @@ timerlist.repeatcount repeats timerlist.repeatcount.hint_1 Amount of timer repeats timerlist.repeatcount.hint_2 0 for unlimited repeats timerlist.save Save timer +timerlist.send.timer Send Timer timerlist.standby Action timerlist.standby.off Leave standby timerlist.standby.on Enter standby diff --git a/lib/libdvbsub/dvbsub.cpp b/lib/libdvbsub/dvbsub.cpp index b8e945c59..7081e5ca0 100644 --- a/lib/libdvbsub/dvbsub.cpp +++ b/lib/libdvbsub/dvbsub.cpp @@ -50,7 +50,7 @@ static void clear_queue(); int dvbsub_init() { int trc; - sub_debug.set_level(2); + sub_debug.set_level(3); reader_running = true; dvbsub_stopped = 1; @@ -103,11 +103,7 @@ int dvbsub_start(int pid) pid_change_req = 1; } } -#if 0 -printf("[dvb-sub] ***************************************** start, stopped %d pid %x\n", dvbsub_stopped, dvbsub_pid); - while(!dvbsub_stopped) - usleep(10); -#endif + if(dvbsub_pid > 0) { dvbsub_stopped = 0; dvbsub_paused = false; @@ -248,11 +244,8 @@ static void* reader_thread(void * /*arg*/) set_threadname("dvbsub:reader"); dmx = new cDemux(0); -#if HAVE_TRIPLEDRAGON - dmx->Open(DMX_PES_CHANNEL, NULL, 16*1024); -#else dmx->Open(DMX_PES_CHANNEL, NULL, 64*1024); -#endif + while (reader_running) { if(dvbsub_stopped /*dvbsub_paused*/) { sub_debug.print(Debug::VERBOSE, "%s stopped\n", __FUNCTION__); @@ -310,17 +303,6 @@ static void* reader_thread(void * /*arg*/) count += len; } } -#if 0 - for(int i = 6; i < packlen - 4; i++) { - if(!memcmp(&buf[i], "\x00\x00\x01\xbd", 4)) { - int plen = getbits(&buf[i], 4*8, 16) + 6; - sub_debug.print(Debug::VERBOSE, "[subtitles] ******************* PES header at %d ?! *******************\n", i); - sub_debug.print(Debug::VERBOSE, "[subtitles] start code: %02x%02x%02x%02x len %d\n", buf[i+0], buf[i+1], buf[i+2], buf[i+3], plen); - free(buf); - continue; - } - } -#endif if(!dvbsub_stopped /*!dvbsub_paused*/) { sub_debug.print(Debug::VERBOSE, "[subtitles] *** new packet, len %d buf 0x%x pts-stc diff %lld ***\n", count, buf, get_pts_stc_delta(get_pts(buf))); @@ -400,11 +382,6 @@ static void* dvbsub_thread(void* /*arg*/) dataoffset = packet[8] + 8 + 1; if (packet[dataoffset] != 0x20) { sub_debug.print(Debug::VERBOSE, "Not a dvb subtitle packet, discard it (len %d)\n", packlen); -#if 0 - for(int i = 0; i < packlen; i++) - printf("%02X ", packet[i]); - printf("\n"); -#endif goto next_round; } diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index d0021eb7a..897f9fc49 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -32,12 +32,10 @@ extern "C" { #endif // Set these to 'true' for debug output: -static bool DebugConverter = false; +static bool DebugConverter = true; #define dbgconverter(a...) if (DebugConverter) sub_debug.print(Debug::VERBOSE, a) -// --- cDvbSubtitleBitmaps --------------------------------------------------- - class cDvbSubtitleBitmaps : public cListObject { private: @@ -61,7 +59,7 @@ cDvbSubtitleBitmaps::cDvbSubtitleBitmaps(int64_t pPts) cDvbSubtitleBitmaps::~cDvbSubtitleBitmaps() { -// dbgconverter("cDvbSubtitleBitmaps::delete: PTS: %lld rects %d\n", pts, Count()); + dbgconverter("cDvbSubtitleBitmaps::delete: PTS: %lld rects %d\n", pts, Count()); int i; if(sub.rects) { @@ -87,16 +85,7 @@ fb_pixel_t * simple_resize32(uint8_t * orgin, uint32_t * colors, int nb_colors, fb_pixel_t *cr,*l; int i,j,k,ip; -#ifndef HAVE_SPARK_HARDWARE - cr = (fb_pixel_t *) malloc(dx*dy*sizeof(fb_pixel_t)); - - if(cr == NULL) { - printf("Error: malloc\n"); - return NULL; - } -#else cr = CFrameBuffer::getInstance()->getBackBufferPointer(); -#endif l = cr; for(j = 0; j < dy; j++, l += dx) @@ -115,27 +104,8 @@ fb_pixel_t * simple_resize32(uint8_t * orgin, uint32_t * colors, int nb_colors, void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) { int i; -#ifndef HAVE_SPARK_HARDWARE - int stride = CFrameBuffer::getInstance()->getScreenWidth(true); -#if 0 - int wd = CFrameBuffer::getInstance()->getScreenWidth(); - int xstart = CFrameBuffer::getInstance()->getScreenX(); - int yend = CFrameBuffer::getInstance()->getScreenY() + CFrameBuffer::getInstance()->getScreenHeight(); - int ystart = CFrameBuffer::getInstance()->getScreenY(); -#endif - uint32_t *sublfb = CFrameBuffer::getInstance()->getFrameBufferPointer(); -#endif - -// dbgconverter("cDvbSubtitleBitmaps::Draw: %d bitmaps, x= %d, width= %d yend=%d stride %d\n", Count(), xstart, wd, yend, stride); - int sw = CFrameBuffer::getInstance()->getScreenWidth(true); int sh = CFrameBuffer::getInstance()->getScreenHeight(true); -#if 0 - double xc = (double) CFrameBuffer::getInstance()->getScreenWidth(true)/(double) 720; - double yc = (double) CFrameBuffer::getInstance()->getScreenHeight(true)/(double) 576; - xc = yc; //FIXME should we scale also to full width ? - int xf = int(xc * (double) 720); -#endif for (i = 0; i < Count(); i++) { #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0) @@ -147,28 +117,20 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) int height = sub.rects[i]->h; int xoff, yoff; -#if 0 - int nw = int(width == 1280 ? ((double) width / xc) : ((double) width * xc)); - int nh = int((double) height * yc); - - int xdiff = (wd > xf) ? ((wd - xf) / 2) : 0; - xoff = int(sub.rects[i]->x*xc + xstart + xdiff); - if(sub.rects[i]->y < 576/2) { - yoff = int(ystart + sub.rects[i]->y*yc); - } else { - yoff = int(yend - ((width == 1280 ? 704:576) - (double) (sub.rects[i]->y + height))*yc - nh); - if(yoff < ystart) - yoff = ystart; + int h2 = 576; + switch (width) + { + case 1280: h2 = 720; break; + case 1920: h2 = 1080; break; } -#endif - int h2 = (width == 1280) ? 720 : 576; + xoff = sub.rects[i]->x * sw / width; yoff = sub.rects[i]->y * sh / h2; int nw = width * sw / width; int nh = height * sh / h2; -// dbgconverter("cDvbSubtitleBitmaps::Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1, -// sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h, sub.rects[i]->nb_colors, xoff, yoff, nw, nh); + dbgconverter("cDvbSubtitleBitmaps::Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1, + sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h, sub.rects[i]->nb_colors, xoff, yoff, nw, nh); #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0) fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->pict.data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh); @@ -176,18 +138,7 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh); #endif -#ifdef HAVE_SPARK_HARDWARE - // CFrameBuffer::getInstance()->waitForIdle(); CFrameBuffer::getInstance()->blit2FB(newdata, nw, nh, xoff, yoff, 0, 0); -#else - fb_pixel_t * ptr = newdata; - for (int y2 = 0; y2 < nh; y2++) { - int y = (yoff + y2) * stride; - for (int x2 = 0; x2 < nw; x2++) - *(sublfb + xoff + x2 + y) = *ptr++; - } - free(newdata); -#endif if(min_x > xoff) min_x = xoff; @@ -199,13 +150,12 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) max_y = yoff + nh; } -// if(Count()) -// dbgconverter("cDvbSubtitleBitmaps::Draw: finish, min/max screen: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y); -// dbgconverter("\n"); + if(Count()) + dbgconverter("cDvbSubtitleBitmaps::Draw: finish, min/max screen: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y); + dbgconverter("\n"); } static int screen_w, screen_h, screen_x, screen_y; -// --- cDvbSubtitleConverter ------------------------------------------------- cDvbSubtitleConverter::cDvbSubtitleConverter(void) { @@ -254,12 +204,12 @@ cDvbSubtitleConverter::~cDvbSubtitleConverter() void cDvbSubtitleConverter::Lock(void) { - pthread_mutex_lock(&mutex); + pthread_mutex_lock(&mutex); } void cDvbSubtitleConverter::Unlock(void) { - pthread_mutex_unlock(&mutex); + pthread_mutex_unlock(&mutex); } void cDvbSubtitleConverter::Pause(bool pause) @@ -272,24 +222,21 @@ void cDvbSubtitleConverter::Pause(bool pause) Clear(); running = false; Unlock(); - //Reset(); } else { - //Reset(); running = true; } } void cDvbSubtitleConverter::Clear(void) { -// dbgconverter("cDvbSubtitleConverter::Clear: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y); if(running && (max_x-min_x > 0) && (max_y-min_y > 0)) { + dbgconverter("cDvbSubtitleConverter::Clear: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y); CFrameBuffer::getInstance()->paintBackgroundBoxRel (min_x, min_y, max_x-min_x, max_y-min_y); /* reset area to clear */ min_x = screen_w; min_y = screen_h; max_x = screen_x; - max_y = screen_h; - //CFrameBuffer::getInstance()->paintBackground(); + max_y = screen_y; } } @@ -322,18 +269,17 @@ int cDvbSubtitleConverter::Convert(const uchar *Data, int Length, int64_t pts) avpkt.data = (uint8_t*) Data; avpkt.size = Length; -// dbgconverter("cDvbSubtitleConverter::Convert: sub %x pkt %x pts %lld\n", sub, &avpkt, pts); - //avctx->sub_id = (anc_page << 16) | comp_page; //FIXME not patched ffmpeg needs this ! + dbgconverter("cDvbSubtitleConverter::Convert: sub %x pkt %x pts %lld\n", sub, &avpkt, pts); avcodec_decode_subtitle2(avctx, sub, &got_subtitle, &avpkt); -// dbgconverter("cDvbSubtitleConverter::Convert: pts %lld subs ? %s, %d bitmaps\n", pts, got_subtitle? "yes" : "no", sub->num_rects); + dbgconverter("cDvbSubtitleConverter::Convert: pts %lld subs ? %s, %d bitmaps\n", pts, got_subtitle? "yes" : "no", sub->num_rects); if(got_subtitle) { if(DebugConverter) { unsigned int i; for(i = 0; i < sub->num_rects; i++) { -// dbgconverter("cDvbSubtitleConverter::Convert: #%d at %d,%d size %d x %d colors %d\n", i+1, -// sub->rects[i]->x, sub->rects[i]->y, sub->rects[i]->w, sub->rects[i]->h, sub->rects[i]->nb_colors); + dbgconverter("cDvbSubtitleConverter::Convert: #%d at %d,%d size %d x %d colors %d\n", i+1, + sub->rects[i]->x, sub->rects[i]->y, sub->rects[i]->w, sub->rects[i]->h, sub->rects[i]->nb_colors); } } bitmaps->Add(Bitmaps); @@ -354,10 +300,7 @@ void dvbsub_get_stc(int64_t * STC); int cDvbSubtitleConverter::Action(void) { int WaitMs = WAITMS; -#if 0 - retry: - bool shown = false; -#endif + if (!running) return 0; @@ -374,12 +317,12 @@ int cDvbSubtitleConverter::Action(void) Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC); Delta /= 90; // STC and PTS are in 1/90000s -// dbgconverter("cDvbSubtitleConverter::Action: PTS: %016llx STC: %016llx (%lld) timeout: %d\n", sb->Pts(), STC, Delta, sb->Timeout()); + dbgconverter("cDvbSubtitleConverter::Action: PTS: %016llx STC: %016llx (%lld) timeout: %d\n", sb->Pts(), STC, Delta, sb->Timeout()); if (Delta <= MAXDELTA) { if (Delta <= SHOW_DELTA) { -dbgconverter("cDvbSubtitleConverter::Action: PTS: %012llx STC: %012llx (%lld) timeout: %d bmp %d/%d\n", sb->Pts(), STC, Delta, sb->Timeout(), bitmaps->Count(), sb->Index() + 1); -// dbgconverter("cDvbSubtitleConverter::Action: Got %d bitmaps, showing #%d\n", bitmaps->Count(), sb->Index() + 1); + dbgconverter("cDvbSubtitleConverter::Action: PTS: %012llx STC: %012llx (%lld) timeout: %d bmp %d/%d\n", sb->Pts(), STC, Delta, sb->Timeout(), bitmaps->Count(), sb->Index() + 1); + dbgconverter("cDvbSubtitleConverter::Action: Got %d bitmaps, showing #%d\n", bitmaps->Count(), sb->Index() + 1); if (running) { Clear(); sb->Draw(min_x, min_y, max_x, max_y); @@ -388,7 +331,6 @@ dbgconverter("cDvbSubtitleConverter::Action: PTS: %012llx STC: %012llx (%lld) ti if(sb->Count()) WaitMs = MIN_DISPLAY_TIME; bitmaps->Del(sb, true); -// shown = true; } else if (Delta < WaitMs) WaitMs = int((Delta > SHOW_DELTA) ? Delta - SHOW_DELTA : Delta); @@ -406,10 +348,6 @@ dbgconverter("cDvbSubtitleConverter::Action: PTS: %012llx STC: %012llx (%lld) ti } } Unlock(); -#if 0 -if (shown) - goto retry; -#endif if(WaitMs != WAITMS) dbgconverter("cDvbSubtitleConverter::Action: finish, WaitMs %d\n", WaitMs); diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 69ee284ab..0eac1f10f 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -135,19 +135,9 @@ void CBEBouquetWidget::paintItems() 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() { - 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); + CBEGlobals::paintHead(g_Locale->getText(LOCALE_BOUQUETLIST_HEAD), NEUTRINO_ICON_SETTINGS); } const struct button_label CBEBouquetWidgetButtons[] = @@ -164,14 +154,7 @@ void CBEBouquetWidget::paintFoot() { size_t numbuttons = sizeof(CBEBouquetWidgetButtons)/sizeof(CBEBouquetWidgetButtons[0]); - 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 + OFFSET_SHADOW, height + OFFSET_SHADOW); + CBEGlobals::paintFoot(numbuttons, CBEBouquetWidgetButtons); } void CBEBouquetWidget::updateSelection(unsigned int newpos) @@ -213,6 +196,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* parent->hide(); Bouquets = &g_bouquetManager->Bouquets; + init(); paintHead(); paintBody(); @@ -221,7 +205,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* bouquetsChanged = false; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr); bool loop = true; while (loop) @@ -229,7 +213,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); if (msg <= CRCInput::RC_MaxRC) - timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr); if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t)g_settings.key_channelList_cancel)) { @@ -364,7 +348,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* paintFoot(); paintItems(); - timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr); } } else if (state == beMoving) @@ -396,6 +380,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* } } hide(); + ResetModules(); return res; } diff --git a/src/gui/bedit/bouqueteditor_bouquets.h b/src/gui/bedit/bouqueteditor_bouquets.h index 9aa27dc2c..5d951c582 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.h +++ b/src/gui/bedit/bouqueteditor_bouquets.h @@ -64,11 +64,11 @@ class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelp bool bouquetsChanged; void paintHead(); - void paintBody(); + void paintItem(int pos); void paintItems(); void paintFoot(); - void hide(); + void updateSelection(unsigned int newpos); void deleteBouquet(); @@ -85,6 +85,7 @@ class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelp void discardChanges(); std::string inputName(const char* const defaultName, const neutrino_locale_t caption); + std::string getInfoText(int /*index*/) { return ""; }; public: CBEBouquetWidget(); @@ -92,6 +93,7 @@ class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelp //CZapitClient::BouquetList Bouquets; BouquetList * Bouquets; int exec(CMenuTarget* parent, const std::string & actionKey); + void hide(){CBEGlobals::hide();} }; #endif diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index ac5a260cd..c2d670f5a 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -55,8 +55,7 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou caption = Caption; bouquet = Bouquet; mode = CZapitClient::MODE_TV; - dline = NULL; - ibox = NULL; + Channels = NULL; int iw, ih; @@ -71,13 +70,10 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou 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() { - delete dline; - delete ibox; } void CBEChannelWidget::paintItem(int pos) @@ -143,20 +139,12 @@ void CBEChannelWidget::paintItems() 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() { - 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); + if (!header->isPainted()) + header->addContextButton(CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT); + CBEGlobals::paintHead(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio"), + mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO); } const struct button_label CBEChannelWidgetButtons[] = @@ -174,66 +162,7 @@ void CBEChannelWidget::paintFoot() { size_t numbuttons = sizeof(CBEChannelWidgetButtons)/sizeof(CBEChannelWidgetButtons[0]); - 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(); + CBEGlobals::paintFoot(numbuttons, CBEChannelWidgetButtons); } std::string CBEChannelWidget::getInfoText(int index) @@ -317,7 +246,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* channelsChanged = false; - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr); bool loop = true; while (loop) @@ -325,7 +254,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); if (msg <= CRCInput::RC_MaxRC) - timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr); if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t)g_settings.key_channelList_cancel)) { @@ -362,7 +291,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* if (state == beDefault) addChannel(); - timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr); } else if (msg == CRCInput::RC_yellow) { @@ -485,7 +414,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* CNeutrinoApp::getInstance()->handleMsg(msg, data); } } - hide(); + CBEGlobals::hide(); return res; } diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index e8a9b521c..8a1b16881 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -38,9 +38,6 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelpers { private: - CComponentsDetailsLine *dline; - CComponentsInfoBox *ibox; - enum state_ { beDefault, @@ -60,12 +57,12 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelp unsigned int bouquet; 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); void deleteChannel(); @@ -88,6 +85,7 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelp //CZapitClient::BouquetChannelList Channels; ZapitChannelList * Channels; int exec(CMenuTarget* parent, const std::string & actionKey); + void hide(){CBEGlobals::hide();} bool hasChanged(); unsigned int getBouquet() { return bouquet; }; }; diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 09766df53..4ad6606f8 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -48,8 +48,6 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, CZap liststart = 0; channellist_sort_mode = SORT_ALPHA; bouquetChannels = NULL; - dline = NULL; - ibox = NULL; int iw, ih; action_icon_width = 0; @@ -64,8 +62,6 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, CZap CBEChannelSelectWidget::~CBEChannelSelectWidget() { - delete dline; - delete ibox; } void CBEChannelSelectWidget::paintItem(int pos) @@ -128,20 +124,10 @@ void CBEChannelSelectWidget::paintItems() 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); + CBEGlobals::paintHead(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio"), + mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO); } struct button_label CBEChannelSelectButtons[] = @@ -180,66 +166,7 @@ void CBEChannelSelectWidget::paintFoot() 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(); + CBEGlobals::paintFoot(numbuttons, CBEChannelSelectButtons); } std::string CBEChannelSelectWidget::getInfoText(int index) @@ -318,7 +245,7 @@ int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & /*acti paintFoot(); paintItems(); - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr); channelChanged = false; bool loop = true; @@ -327,7 +254,7 @@ int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & /*acti g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); if (msg <= CRCInput::RC_MaxRC) - timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr); if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t)g_settings.key_channelList_cancel) || (msg == CRCInput::RC_home)) { diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index bf7b9e6f6..0bd20f880 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.h +++ b/src/gui/bedit/bouqueteditor_chanselect.h @@ -37,9 +37,6 @@ class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CListHelpers { private: - CComponentsDetailsLine *dline; - CComponentsInfoBox *ibox; - enum { SORT_ALPHA, SORT_FREQ, @@ -60,12 +57,12 @@ class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CLi std::string caption; 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); void sortChannels(); @@ -80,6 +77,7 @@ class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CLi ZapitChannelList Channels; ZapitChannelList * bouquetChannels; int exec(CMenuTarget* parent, const std::string & actionKey); + void hide(){CBEGlobals::hide();} bool hasChanged(); }; diff --git a/src/gui/bedit/bouqueteditor_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp index 62f51c1d9..8e0235edc 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -30,21 +30,37 @@ #include "bouqueteditor_globals.h" -class CFrameBuffer; CBEGlobals::CBEGlobals() { frameBuffer = CFrameBuffer::getInstance(); + timeout_ptr = &g_settings.timing[SNeutrinoSettings::TIMING_MENU]; + header = NULL; + footer = NULL; + dline = NULL; + ibox = NULL; + + init(); +} + +void CBEGlobals::init() +{ 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(); + if (!header) + header = new CComponentsHeader(); + header_height = header->getHeight(); item_height = item_font->getHeight(); - footer_height = footer.getHeight(); + + if (!footer) + footer = new CComponentsFooter(); + 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; @@ -53,10 +69,110 @@ CBEGlobals::CBEGlobals() x = getScreenStartX(width); y = getScreenStartY(height); - - timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU]; } CBEGlobals::~CBEGlobals() { + ResetModules(); +} + +void CBEGlobals::ResetModules() +{ + if (dline){ + delete dline; dline = NULL; + } + if (ibox){ + delete ibox; ibox = NULL; + } + if (header){ + delete header; header = NULL; + } + if (footer){ + delete footer; footer = NULL; + } +} + +void CBEGlobals::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 (pos >= 0) + { + if (dline == NULL) + dline = new CComponentsDetailsLine(); + dline->setDimensionsAll(xpos, ypos1a, ypos2a, item_height/2, info_height - RADIUS_LARGE*2); + + dline->paint(); + + if (ibox == NULL) + ibox = new CComponentsInfoBox(); + ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); + ibox->setTextColor(COL_MENUCONTENTDARK_TEXT); + ibox->setFrameThickness(FRAME_WIDTH_MIN); + ibox->setCorner(RADIUS_LARGE); + ibox->enableShadow(); + ibox->enableColBodyGradient(g_settings.theme.menu_Hint_gradient, COL_MENUFOOT_PLUS_0, g_settings.theme.menu_Hint_gradient_direction);// COL_MENUFOOT_PLUS_0 is default footer color + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setText(getInfoText(current), CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, info_font); + + ibox->paint(); + } + else + { + if (dline) + { + if (dline->isPainted()) + dline->hide(); + } + if (ibox) + { + if (ibox->isPainted()) + ibox->hide(); + } + } +} + +void CBEGlobals::paintBody() +{ + PaintBoxRel(x, y + header_height, width, body_height, COL_MENUCONTENT_PLUS_0, RADIUS_NONE, CORNER_NONE, CC_SHADOW_ON); +} + +void CBEGlobals::hide() +{ + frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW); + + killDetails(); +} + +void CBEGlobals::killDetails() +{ + if (dline) + dline->kill(); + if (ibox) + ibox->kill(); +} + +void CBEGlobals::paintFoot(const size_t& label_count, const struct button_label * const content) +{ + if (!footer) + footer = new CComponentsFooter(); + footer->setCorner(RADIUS_LARGE, CORNER_BOTTOM); + footer->enableShadow(CC_SHADOW_ON, -1, true); + footer->paintButtons(x, y + header_height + body_height, width, footer_height, label_count, content); +} + +void CBEGlobals::paintHead(const std::string& Caption, const char* Icon) +{ + if (!header) + header = new CComponentsHeader(); + header->setCaption(Caption); + header->setIcon(Icon); + 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); } diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h index ea02ea8d1..5b8d4f9d7 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -25,13 +25,14 @@ #include #include -class CFrameBuffer; class CBEGlobals { - public: - CBEGlobals(); - ~CBEGlobals(); + protected: + CComponentsDetailsLine *dline; + CComponentsInfoBox *ibox; + CComponentsHeader *header; + CComponentsFooter *footer; CFrameBuffer *frameBuffer; @@ -46,18 +47,31 @@ class CBEGlobals 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; + unsigned int items_count; + int* timeout_ptr; + + void init(); + + void paintHead(const std::string& Caption, const char* Icon); + void paintBody(); + void paintFoot(const size_t& label_count, const struct button_label * const content); + + virtual std::string getInfoText(int index) = 0; + void paintDetails(int pos, int current); + void killDetails(); + + public: + CBEGlobals(); + virtual ~CBEGlobals(); + + void hide(); + void ResetModules(); }; #endif diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index b8dc597f7..00cdf49df 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -89,7 +89,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const cc_body_gradient_enable = cc_body_gradient_enable_old = CC_COLGRAD_OFF/*g_settings.theme.menu_ButtonBar_gradient*/; //TODO: not complete implemented at the moment cc_body_gradient_direction = CFrameBuffer::gradientVertical; cc_body_gradient_mode = CColorGradient::gradientDark2Light; - btn_auto_frame_col = false; + btn_auto_frame_col = false; //TODO: currently global disabled corner_rad = RADIUS_LARGE; corner_type = CORNER_BOTTOM; @@ -106,103 +106,132 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const void CComponentsFooter::setButtonLabels(const struct button_label_cc * const content, const size_t& label_count, const int& chain_width, const int& label_width) { - /* clean up before init*/ + /* clean up before init */ if (btn_container) btn_container->clear(); if (label_count == 0) return; - /* set general available full basic space for button chain, - * in this case this is footer width - */ - int w_chain = width - 2*cch_offset; + /* global increments */ + size_t i = 0; + size_t l_count = label_count; - /* calculate current available space for button container depends - * of already enbedded footer objects. - * If already existing some items then subtract those width from footer width. - * ...so we have the possible usable size for button container. + /* + * Evaluate parameter 'chain_width': + * + * Set usable basic space for button container, + * Default width this is footer width minus offset left and right of button container (btn_container). + */ + int w_container = max(0, width - 2*cch_offset); + /* + * Calculate current available space for button container depends of already embedded footer objects. + * If already existing some items then subtract those width from footer width. + * ...so we have the maximal possible usable size for button container. */ if(!v_cc_items.empty()){ - for (size_t j= 0; j< size(); j++) - w_chain -= getCCItem(j)->getWidth(); + for (i = 0; i< size(); i++){ + if (getCCItem(i) != btn_container) // avoid to point on button container itself! + w_container -= getCCItem(i)->getWidth(); + } + w_container = max(0, w_container); } - - /* On defined parameter chain_width - * calculate current available space for button container depends - * of passed chain with parameter - * Consider that chain_width is not too large. + /* + * On defined parameter chain_width (means width of button container), + * compare and if required recalculate current available space for button container depends of passed chain with parameter. + * Consider that chain_width is not too large. In this case parameter chain_width will be ignored. */ - if (chain_width > 0 && chain_width <= w_chain){ - if (chain_width <= w_chain){ - w_chain = chain_width; + if (chain_width){ + if (chain_width <= w_container){ + w_container = chain_width; + }else{ + dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFooter]\t[%s - %d], NOTE: parameter chain_width is too large, defined value = %d, fallback to maximal value = %d => \033[0m\n", + __func__, __LINE__, chain_width, w_container); } } - /* initialize button container (chain object): this contains all passed (as interleaved) button label items, - * With this container we can work inside footer as primary container (in this context '=this') and the parent for the button label container (chain object). - * Button label container (chain object) itself is concurrent to the parent object for button objects. + /* + * Evaluate parameter 'label_width': + * + * button label width is auto generated, if no label width is defined. + * If is parameter label_width too large, we use maximal possible value. + */ + int w_tmp = w_container - cch_offset * ((int)l_count-1); + int w_btn = w_tmp / (int)l_count; + if (label_width && (label_width <= w_btn)) + w_btn = label_width; + w_container = min(w_container, (w_btn * (int)l_count) + cch_offset * ((int)l_count-1)); + + /* + * Initialize button container: this object contains all passed button label items, + * Button container represents the parent for button labels and is working as single child object inside footer. */ int dist = height/2-cch_offset; - int h_chain = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist; - int x_chain = width/2 - w_chain/2; - int y_chain = height/2 - h_chain/2; + int h_container = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist; + int x_container = width/2 - w_container/2; //FIXME: only centered position, other items will be overpainted + int y_container = height/2 - h_container/2; if (cch_icon_obj) - x_chain = cch_offset+cch_icon_obj->getWidth()+cch_offset; + x_container = cch_offset+cch_icon_obj->getWidth()+cch_offset; if (btn_container == NULL){ - btn_container = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body); + btn_container = new CComponentsFrmChain(x_container, y_container, w_container, h_container, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body); btn_container->setAppendOffset(0, 0); - btn_container->setCorner(this->corner_rad, this->corner_type); + //btn_container->setCorner(this->corner_rad, this->corner_type); btn_container->doPaintBg(false); } - /* Calculate usable width of button labels inside button object container - * related to available width of chain object and passed - * label_width parameter. - * Parameter is used as minimal value and will be reduced - * if it is too large. - * Too small label_width parameter will be compensated by - * button objects itself. + /* + * Reassign current available container width after initialized button labels. */ - int w_offset = int((label_count-1)*cch_offset); - int w_btn = btn_container->getWidth()/label_count - w_offset; - if (label_width){ - int w_label = label_width; - int w_defined = int(label_width*label_count); - int w_max = btn_container->getWidth() - w_offset; - while (w_defined > w_max){ - w_label--; - w_defined = int(w_label*label_count) - w_offset; - } - w_btn = w_label; - } + w_container = btn_container->getWidth(); - /* generate button objects passed from button label content - * with default width to chain object. + /* + * Primary x postion of buttons inside button container is fix, + * height and y position of button labels are calculated by button container + * dimensions and have a fix value. */ - vector v_btns; - int h_btn = /*(ccf_enable_button_bg ? */btn_container->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width; - for (size_t i= 0; i< label_count; i++){ + int x_btn = 0; + int h_btn = btn_container->getHeight()- 2*fr_thickness - ccf_button_shadow_width; + int y_btn = btn_container->getHeight()/2 - h_btn/2; + + /* + * Init button label objects + */ + for (i = 0; i < l_count; i++){ + /* + * init button label face values + */ string txt = content[i].locale == NONEXISTANT_LOCALE ? content[i].text : g_Locale->getText(content[i].locale); string icon_name = string(content[i].button); - //ignore item, if no text and icon are defined; + /* + * Ignore item, if no text and no icon is defined. + */ if (txt.empty() && icon_name.empty()){ - dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] ignore item [%zu], no icon and text defined!\n", __func__, __LINE__, i); + //l_count -= 1; + dprintf(DEBUG_NORMAL, "[CComponentsFooter]\t[%s - %d]\tignore item [%d], no icon and text defined!\n", __func__, __LINE__, i); continue; } - int y_btn = btn_container->getHeight()/2 - h_btn/2; - dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] y_btn [%d] ccf_button_shadow_width [%d]\n", __func__, __LINE__, y_btn, ccf_button_shadow_width); - CComponentsButton *btn = new CComponentsButton(0, y_btn, w_btn, h_btn, txt, icon_name, NULL, false, true, ccf_enable_button_shadow); - + /* + * Create all button label objects and add to button container + * Set properties, like position, font, key values, coler etc... + */ + CComponentsButton *btn = new CComponentsButton(x_btn, y_btn, w_btn, h_btn, txt, icon_name, btn_container, false, true, ccf_enable_button_shadow); + btn->setButtonFont(ccf_btn_font); btn->doPaintBg(ccf_enable_button_bg); + + x_btn += btn_container->getCCItem(i)->getWidth(); + x_btn += cch_offset; + btn->setButtonDirectKeys(content[i].directKeys); btn->setButtonResult(content[i].btn_result); btn->setButtonAlias(content[i].btn_alias); - btn->setButtonFont(ccf_btn_font); - //set button frames to icon color, predefined for available color buttons + btn->doPaintBg(true); + + /* + * Set button frames to icon color, predefined for available color buttons + */ if (btn_auto_frame_col){ fb_pixel_t f_col = btn->getColorFrame(); if (icon_name == NEUTRINO_ICON_BUTTON_RED) @@ -215,35 +244,47 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con f_col = COL_DARK_BLUE; btn->setColorFrame(f_col); } - - v_btns.push_back(btn); - - if (w_btn < btn->getWidth()){ - btn->setWidth(w_btn); - btn->setButtonFont(NULL); - } - - dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%u] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), (uint32_t)i, btn->getWidth(), w_btn, btn_container->getWidth()); } - /* add generated button objects to chain object. + /* + * Get the current required space for button labels after adding of all buttons. + * This is required to check possible changed dimensions after init and + * could be required if user has changed settings like font scale, font size or similar setting while runtime or + * reserved size of footer is too small. It is recommended to allocate enough space from the outset. */ - if (!v_btns.empty()){ - /*add all buttons into button container*/ - btn_container->addCCItem(v_btns); + int w_cont_used = 0; + size_t c_btns = btn_container->size(); + for (i = 0; i < c_btns; i++){ + w_cont_used += btn_container->getCCItem(i)->getWidth(); + } + w_cont_used += cch_offset * (l_count -1); + + if (w_cont_used > w_container){ + /* + * recalculate width of labels + */ + int w_used_tmp = w_cont_used; + int w_btn_tmp = w_btn; + if (w_used_tmp >= w_container){ + //w_btn_tmp = w_btn; + for (i = 0; i < c_btns; i++){ + w_btn_tmp -= c_btns; + btn_container->getCCItem(i)->setWidth(w_btn_tmp); // value = 0 forces recalculation, refresh is required + static_cast(btn_container->getCCItem(i))->Refresh(); + w_used_tmp -= max(0, btn_container->getCCItem(i)->getWidth()); + dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFooter]\t[%s - %d] item %d -> w_used_tmp [%d] :: w_btn_tmp [%d] w_container = %d\033[0m\n", __func__, __LINE__, (int)i, w_used_tmp, w_btn_tmp, w_container); + } + } - /* set position of labels, as centered inside button container*/ - int w_chain_used = 0; - for (size_t a= 0; a< btn_container->size(); a++) - w_chain_used += btn_container->getCCItem(a)->getWidth(); - w_chain_used += (btn_container->size()-1)*cch_offset; - - int x_btn = btn_container->getWidth()/2 - w_chain_used/2; - btn_container->getCCItem(0)->setXPos(x_btn); - - for (size_t c= 1; c< btn_container->size(); c++){ - x_btn += btn_container->getCCItem(c-1)->getWidth()+ cch_offset; - btn_container->getCCItem(c)->setXPos(x_btn); + /* + * Trim position of labels, after possible changed width of button labels + */ + x_btn = 0; + btn_container->front()->setXPos(x_btn); + for (i = 1; i < c_btns; i++){ + x_btn += btn_container->getCCItem(i-1)->getWidth() + cch_offset;; + if (i < c_btns) + btn_container->getCCItem(i)->setXPos(x_btn); } } } diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index c5f68771e..cadd41358 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -650,6 +650,9 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) ddmode is always 1 ("CH1/CH2"). */ audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); + std::string desc = "N/A"; + if (!g_RemoteControl->current_PIDs.APIDs.empty()) + desc = g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].desc; if (type == AUDIO_FMT_MPEG || type == AUDIO_FMT_MP3) { @@ -661,9 +664,9 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) "single_ch" }; int max_mode = sizeof(mpegmodes) / sizeof(mpegmodes[0]); - snprintf(buf, sizeof(buf), "%s %s (%d)",type == AUDIO_FMT_MPEG ? "MPEG":"MP3", + snprintf(buf, sizeof(buf), "MPEG %s (%d) (%s)", (mode > max_mode) ? "unk" : mpegmodes[mode], - freq); + freq, desc.c_str()); } else if (type == AUDIO_FMT_DOLBY_DIGITAL || type == AUDIO_FMT_DD_PLUS) { @@ -679,10 +682,10 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) "L/C/R/SL/SR" }; int max_mode = sizeof(ddmodes) / sizeof(ddmodes[0]); - snprintf(buf, sizeof(buf), "%s %s (%d)", + snprintf(buf, sizeof(buf), "%s %s (%d) (%s)", (type == AUDIO_FMT_DOLBY_DIGITAL) ? "DD" : "DD+", (mode > max_mode) ? "unk" : ddmodes[mode], - freq); + freq, desc.c_str()); } else if (type == AUDIO_FMT_AAC || type == AUDIO_FMT_AAC_PLUS) { @@ -700,16 +703,16 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) "Dual-Mono" }; int max_mode = sizeof(aacmodes) / sizeof(aacmodes[0]); - snprintf(buf, sizeof(buf), "%s %s (%d)", + snprintf(buf, sizeof(buf), "%s %s (%d) (%s)", (type == AUDIO_FMT_AAC) ? "AAC" : "AAC+", (mode > max_mode) ? "unk" : aacmodes[mode], - freq); + freq, desc.c_str()); } else { - snprintf(buf, sizeof(buf), "%s (%d)", + snprintf(buf, sizeof(buf), "%s (%d) (%s)", g_Locale->getText(LOCALE_STREAMINFO_AUDIOTYPE_UNKNOWN), - freq); + freq, desc.c_str()); } g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width2, buf, COL_MENUCONTENT_TEXT); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index fe5147b8d..dfb199488 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -661,7 +661,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) footer->setIcon(NEUTRINO_ICON_INFO); //add button labels with conventional button label struct - footer->setButtonLabels(TestButtons, TestButtonsCount, 0, footer->getWidth()/TestButtonsCount); + footer->setButtonLabels(TestButtons, TestButtonsCount, 1000, footer->getWidth()/TestButtonsCount); //also possible: use directly button name and as 2nd parameter string or locale as text // footer->setButtonLabel(NULL, "Test", 0, 250); diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index a829164d2..cb4350049 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -657,8 +657,8 @@ struct button_label TimerListButtons[] = { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_TIMERLIST_NEW }, { NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERLIST_RELOAD }, { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_TIMERLIST_MODIFY }, - { NEUTRINO_ICON_BUTTON_INFO_SMALL, NONEXISTANT_LOCALE }, - { NEUTRINO_ICON_BUTTON_PLAY , NONEXISTANT_LOCALE } + { NEUTRINO_ICON_BUTTON_INFO_SMALL, LOCALE_TIMERLIST_INFO }, + { NEUTRINO_ICON_BUTTON_PLAY , LOCALE_TIMERLIST_SEND_TIMER } }; // int to match the type in paintButtons int TimerListButtonsCount = sizeof(TimerListButtons)/sizeof(TimerListButtons[0]); @@ -1412,9 +1412,9 @@ void CTimerList::paintFoot() footer.enableShadow(CC_SHADOW_ON, -1, true); if (timerlist.empty()) - footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, width, footer_height, 2, &(TimerListButtons[1]), width/(2+1)); + footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, width, footer_height, 2, &(TimerListButtons[1])); else - footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, width, footer_height, c, TimerListButtons, width/(c-1)); + footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, width, footer_height, c, TimerListButtons); } void CTimerList::paint() diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 127769933..1a9cec034 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -553,6 +553,7 @@ void CUpnpBrowserGui::selectDevice() { m_folderplay = false; selectItem("0"); + m_frameBuffer->Clear(); refresh=true; } else if (msg == CRCInput::RC_blue) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 5ec197d0b..fc2487df9 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1552,7 +1552,7 @@ void CMenuWidget::setFooter(const struct button_label *_fbutton_labels, const in if (!footer) footer = new CComponentsFooter(x, y + height, width + scrollbar_width, 0, 0, NULL, CC_SHADOW_ON); footer->setWidth(width + scrollbar_width); - footer->setButtonLabels(fbutton_labels, fbutton_count, 0, width/fbutton_count); + footer->setButtonLabels(fbutton_labels, fbutton_count); footer_height = footer->getHeight(); footer_width = footer->getWidth(); }else{ diff --git a/src/system/locals.h b/src/system/locals.h index 60ed0d9a4..c5b6243d2 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2348,6 +2348,7 @@ typedef enum LOCALE_TIMERLIST_CHANNEL, LOCALE_TIMERLIST_CHANNELSELECT, LOCALE_TIMERLIST_DELETE, + LOCALE_TIMERLIST_INFO, LOCALE_TIMERLIST_MENUMODIFY, LOCALE_TIMERLIST_MENUNEW, LOCALE_TIMERLIST_MESSAGE, @@ -2383,6 +2384,7 @@ typedef enum LOCALE_TIMERLIST_REPEATCOUNT_HINT_1, LOCALE_TIMERLIST_REPEATCOUNT_HINT_2, LOCALE_TIMERLIST_SAVE, + LOCALE_TIMERLIST_SEND_TIMER, LOCALE_TIMERLIST_STANDBY, LOCALE_TIMERLIST_STANDBY_OFF, LOCALE_TIMERLIST_STANDBY_ON, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index fdd72cdb9..a764dd1f5 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2348,6 +2348,7 @@ const char * locale_real_names[] = "timerlist.channel", "timerlist.channelselect", "timerlist.delete", + "timerlist.info", "timerlist.menumodify", "timerlist.menunew", "timerlist.message", @@ -2383,6 +2384,7 @@ const char * locale_real_names[] = "timerlist.repeatcount.hint_1", "timerlist.repeatcount.hint_2", "timerlist.save", + "timerlist.send.timer", "timerlist.standby", "timerlist.standby.off", "timerlist.standby.on",