From 47b247472c5fdf75b41e987945c19c91a8bdc8c2 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 9 Oct 2017 17:23:11 +0200 Subject: [PATCH 01/23] src/gui/upnpbrowser.cpp clear framebuffer --- src/gui/upnpbrowser.cpp | 1 + 1 file changed, 1 insertion(+) 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) From 8bdcfb263d316ffe46065555c95e6994daffb8a5 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 02/23] - libdvbsub: port usefull code from Neutrino-MP to make dvbsub nice again Signed-off-by: J. Krieg Signed-off-by: Thilo Graf --- lib/libdvbsub/dvbsub.cpp | 16 +++++++++--- lib/libdvbsub/dvbsubtitle.cpp | 47 ++++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/lib/libdvbsub/dvbsub.cpp b/lib/libdvbsub/dvbsub.cpp index 828f09849..08e9722d6 100644 --- a/lib/libdvbsub/dvbsub.cpp +++ b/lib/libdvbsub/dvbsub.cpp @@ -103,8 +103,8 @@ int dvbsub_start(int pid) pid_change_req = 1; } } -printf("[dvb-sub] ***************************************** start, stopped %d pid %x\n", dvbsub_stopped, dvbsub_pid); #if 0 +printf("[dvb-sub] ***************************************** start, stopped %d pid %x\n", dvbsub_stopped, dvbsub_pid); while(!dvbsub_stopped) usleep(10); #endif @@ -244,11 +244,15 @@ static void* reader_thread(void * /*arg*/) int len; uint16_t packlen; uint8_t* buf; + bool bad_startcode = false; 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__); @@ -283,9 +287,13 @@ static void* reader_thread(void * /*arg*/) continue; if(memcmp(tmp, "\x00\x00\x01\xbd", 4)) { - sub_debug.print(Debug::VERBOSE, "[subtitles] bad start code: %02x%02x%02x%02x\n", tmp[0], tmp[1], tmp[2], tmp[3]); + if (!bad_startcode) { + sub_debug.print(Debug::VERBOSE, "[subtitles] bad start code: %02x%02x%02x%02x\n", tmp[0], tmp[1], tmp[2], tmp[3]); + bad_startcode = true; + } continue; } + bad_startcode = false; count = 6; packlen = getbits(tmp, 4*8, 16) + 6; @@ -372,7 +380,7 @@ static void* dvbsub_thread(void* /*arg*/) if(packet_queue.size() == 0) { continue; } - sub_debug.print(Debug::VERBOSE, "PES: Wakeup, queue size %d\n\n", packet_queue.size()); + sub_debug.print(Debug::VERBOSE, "PES: Wakeup, queue size %d\n", packet_queue.size()); if(dvbsub_stopped /*dvbsub_paused*/) { clear_queue(); continue; diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index 0dd848881..991152dbc 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -87,12 +87,16 @@ 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) @@ -111,19 +115,29 @@ 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 +#if 0 dbgconverter("cDvbSubtitleBitmaps::Draw: %d bitmaps, x= %d, width= %d yend=%d stride %d\n", Count(), xstart, wd, yend, stride); +#endif + 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) @@ -135,6 +149,7 @@ 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); @@ -147,14 +162,26 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) if(yoff < ystart) yoff = ystart; } +#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); + #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); #else 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; @@ -162,6 +189,7 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) *(sublfb + xoff + x2 + y) = *ptr++; } free(newdata); +#endif if(min_x > xoff) min_x = xoff; @@ -172,11 +200,13 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) if(max_y < (yoff + nh)) 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"); } +static int screen_w, screen_h, screen_x, screen_y; // --- cDvbSubtitleConverter ------------------------------------------------- cDvbSubtitleConverter::cDvbSubtitleConverter(void) @@ -207,10 +237,10 @@ cDvbSubtitleConverter::cDvbSubtitleConverter(void) //if(DebugConverter) // av_log_set_level(AV_LOG_INFO); - min_x = CFrameBuffer::getInstance()->getScreenWidth(); - min_y = CFrameBuffer::getInstance()->getScreenHeight(); - max_x = CFrameBuffer::getInstance()->getScreenX(); - max_y = CFrameBuffer::getInstance()->getScreenY(); + screen_w = min_x = CFrameBuffer::getInstance()->getScreenWidth(); + screen_h = min_y = CFrameBuffer::getInstance()->getScreenHeight(); + screen_x = max_x = CFrameBuffer::getInstance()->getScreenX(); + screen_y = max_y = CFrameBuffer::getInstance()->getScreenY(); Timeout.Set(0xFFFF*1000); } @@ -256,6 +286,11 @@ 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)) { 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(); } } @@ -342,6 +377,7 @@ int cDvbSubtitleConverter::Action(void) 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); if (running) { Clear(); @@ -356,7 +392,10 @@ int cDvbSubtitleConverter::Action(void) WaitMs = int((Delta > SHOW_DELTA) ? Delta - SHOW_DELTA : Delta); } else + { + dbgconverter("deleted because delta (%lld) > MAXDELTA (%d)\n", Delta, MAXDELTA); bitmaps->Del(sb, true); + } } else { if (Timeout.TimedOut()) { dbgconverter("cDvbSubtitleConverter::Action: timeout, elapsed %lld\n", Timeout.Elapsed()); From 5ba719402a6ebeffb2c082473f66efe72f3fc2a5 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 03/23] - libdvbsub: allow FullHD resolution dimensions Signed-off-by: J. Krieg Signed-off-by: Thilo Graf --- lib/libdvbsub/dvbsubtitle.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index 991152dbc..ca60b15f4 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -163,7 +163,12 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) yoff = ystart; } #endif - int h2 = (width == 1280) ? 720 : 576; + int h2 = 576; + switch (width) + { + case 1280: h2 = 720; break; + case 1920: h2 = 1080; break; + } xoff = sub.rects[i]->x * sw / width; yoff = sub.rects[i]->y * sh / h2; int nw = width * sw / width; From 18699eaf411400c91d1ad1a73ed7b1bfd15e46b1 Mon Sep 17 00:00:00 2001 From: Striper Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 04/23] - cleanup dvbsubtitle code Signed-off-by: J. Krieg Signed-off-by: Thilo Graf --- lib/libdvbsub/dvbsub.cpp | 27 ++----------------- lib/libdvbsub/dvbsubtitle.cpp | 50 +---------------------------------- 2 files changed, 3 insertions(+), 74 deletions(-) diff --git a/lib/libdvbsub/dvbsub.cpp b/lib/libdvbsub/dvbsub.cpp index 08e9722d6..7081e5ca0 100644 --- a/lib/libdvbsub/dvbsub.cpp +++ b/lib/libdvbsub/dvbsub.cpp @@ -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 ca60b15f4..bd0d091a2 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -36,8 +36,6 @@ static bool DebugConverter = true; #define dbgconverter(a...) if (DebugConverter) sub_debug.print(Debug::VERBOSE, a) -// --- cDvbSubtitleBitmaps --------------------------------------------------- - class cDvbSubtitleBitmaps : public cListObject { private: @@ -87,16 +85,12 @@ 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,29 +109,10 @@ 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 - -#if 0 - dbgconverter("cDvbSubtitleBitmaps::Draw: %d bitmaps, x= %d, width= %d yend=%d stride %d\n", Count(), xstart, wd, yend, stride); -#endif - 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) @@ -149,26 +124,13 @@ 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; - } -#endif int h2 = 576; switch (width) { case 1280: h2 = 720; break; case 1920: h2 = 1080; break; } + xoff = sub.rects[i]->x * sw / width; yoff = sub.rects[i]->y * sh / h2; int nw = width * sw / width; @@ -183,10 +145,6 @@ 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; @@ -194,7 +152,6 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) *(sublfb + xoff + x2 + y) = *ptr++; } free(newdata); -#endif if(min_x > xoff) min_x = xoff; @@ -212,7 +169,6 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) } static int screen_w, screen_h, screen_x, screen_y; -// --- cDvbSubtitleConverter ------------------------------------------------- cDvbSubtitleConverter::cDvbSubtitleConverter(void) { @@ -279,9 +235,7 @@ void cDvbSubtitleConverter::Pause(bool pause) Clear(); running = false; Unlock(); - //Reset(); } else { - //Reset(); running = true; } } @@ -296,7 +250,6 @@ void cDvbSubtitleConverter::Clear(void) min_y = screen_h; max_x = screen_x; max_y = screen_h; - //CFrameBuffer::getInstance()->paintBackground(); } } @@ -330,7 +283,6 @@ int cDvbSubtitleConverter::Convert(const uchar *Data, int Length, int64_t pts) 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 ! 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); From 3edc365eab89133b386c796e9b9adae82cc764b7 Mon Sep 17 00:00:00 2001 From: Striper Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 05/23] - dvbsubtitle: fix copy/paste error and only show debug if there is something to clear Signed-off-by: J. Krieg Signed-off-by: Thilo Graf --- lib/libdvbsub/dvbsubtitle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index bd0d091a2..43020b0dd 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -242,14 +242,14 @@ void cDvbSubtitleConverter::Pause(bool pause) 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; + max_y = screen_y; } } From fa0400f8b21565157b019d87ee24e426b19873ed Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 06/23] - libdvbsub: use framebuffer functions getBackBufferPointer() and blit2FB() Signed-off-by: J. Krieg Signed-off-by: Thilo Graf --- lib/libdvbsub/dvbsubtitle.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index 43020b0dd..897f9fc49 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -85,12 +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; - cr = (fb_pixel_t *) malloc(dx*dy*sizeof(fb_pixel_t)); - - if(cr == NULL) { - printf("Error: malloc\n"); - return NULL; - } + cr = CFrameBuffer::getInstance()->getBackBufferPointer(); l = cr; for(j = 0; j < dy; j++, l += dx) @@ -109,8 +104,6 @@ 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; - int stride = CFrameBuffer::getInstance()->getScreenWidth(true); - uint32_t *sublfb = CFrameBuffer::getInstance()->getFrameBufferPointer(); int sw = CFrameBuffer::getInstance()->getScreenWidth(true); int sh = CFrameBuffer::getInstance()->getScreenHeight(true); @@ -145,13 +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 - 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); + CFrameBuffer::getInstance()->blit2FB(newdata, nw, nh, xoff, yoff, 0, 0); if(min_x > xoff) min_x = xoff; @@ -217,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) From 89f9ae85f07ffc900a0698be718e4e635db282f4 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 07/23] - libdvbsub: add missing free() call Signed-off-by: J. Krieg Signed-off-by: Thilo Graf --- lib/libdvbsub/dvbsubtitle.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index 897f9fc49..5ec75dded 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -139,6 +139,7 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) #endif CFrameBuffer::getInstance()->blit2FB(newdata, nw, nh, xoff, yoff, 0, 0); + free(newdata); if(min_x > xoff) min_x = xoff; From c1d4da731b1aa748bc237860fd361823faf7500c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 08/23] CTimerList: localize info and send timer buttons --- data/locale/deutsch.locale | 2 ++ data/locale/english.locale | 2 ++ src/gui/timerlist.cpp | 4 ++-- src/system/locals.h | 2 ++ src/system/locals_intern.h | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 3888f0dee..b3cb599a6 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 17159bacd..2d267ff64 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/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 1249c2e1c..aca24ed3f 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 } }; size_t TimerListButtonsCount = sizeof(TimerListButtons)/sizeof(TimerListButtons[0]); 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", From 35f048a735910010362f0ecdbd5282a531e219b7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 09/23] CMenuWidget: don't use parameter for label width calculation Footer object does this itself. --- src/gui/widget/menue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 3b71a6490..12f2bd6e1 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1553,7 +1553,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{ From 88e488d3a0e78b7d20c1a037c8cb82776089ee95 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 10/23] Revert "CTimerList: adjust label width in footer dependent by count of buttons" This reverts commit 3987c3a30633111ed1e5d78f580e3b837b2f87e8. --- src/gui/timerlist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index aca24ed3f..89b5d735b 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1411,9 +1411,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() From c7a2dd70fc0b504ebd930997933a882e9be557f3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 11/23] CComponentsFooter: rework uniformed arrangement Some parts were incomplete treated with defined parameter 'label_width' and/or 'chain_width'. --- src/gui/components/cc_frm_footer.cpp | 213 ++++++++++++++++----------- src/gui/test_menu.cpp | 2 +- 2 files changed, 128 insertions(+), 87 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index e7e9da36e..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 [%d], 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/test_menu.cpp b/src/gui/test_menu.cpp index 790e18a8b..d777e095c 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -656,7 +656,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); From 97a124ab44dbabef24aee3b443bbd24fe34b241b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 12/23] bedit: remove multiple forward declaration of CFrameBuffer I don't see any sense why this should be done here. --- src/gui/bedit/bouqueteditor_globals.cpp | 1 - src/gui/bedit/bouqueteditor_globals.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp index 62f51c1d9..3e8a9c14c 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -30,7 +30,6 @@ #include "bouqueteditor_globals.h" -class CFrameBuffer; CBEGlobals::CBEGlobals() { diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h index ea02ea8d1..3e5b665e8 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -25,7 +25,6 @@ #include #include -class CFrameBuffer; class CBEGlobals { From 3045baea1300a17cca594ddd1ba157cc652a3c74 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 13/23] bedit: use inherited version of paintDetails() and dline/ibox objects This moves full identicaly code into base class. TODO: There are more similar parts. --- src/gui/bedit/bouqueteditor_bouquets.h | 1 + src/gui/bedit/bouqueteditor_channels.cpp | 53 +--------------------- src/gui/bedit/bouqueteditor_channels.h | 5 +- src/gui/bedit/bouqueteditor_chanselect.cpp | 52 --------------------- src/gui/bedit/bouqueteditor_chanselect.h | 5 +- src/gui/bedit/bouqueteditor_globals.cpp | 51 +++++++++++++++++++++ src/gui/bedit/bouqueteditor_globals.h | 9 +++- 7 files changed, 63 insertions(+), 113 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.h b/src/gui/bedit/bouqueteditor_bouquets.h index 9aa27dc2c..439ae1d7b 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.h +++ b/src/gui/bedit/bouqueteditor_bouquets.h @@ -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*/){}; public: CBEBouquetWidget(); diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index ac5a260cd..3bbb3c706 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; @@ -76,8 +75,6 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou CBEChannelWidget::~CBEChannelWidget() { - delete dline; - delete ibox; } void CBEChannelWidget::paintItem(int pos) @@ -178,54 +175,6 @@ void CBEChannelWidget::paintFoot() 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); diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index e8a9b521c..73f5512aa 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, @@ -64,7 +61,7 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelp void paintItem(int pos); void paintItems(); void paintFoot(); - void paintDetails(int pos, int current); + void hide(); void updateSelection(unsigned int newpos); diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 09766df53..008997664 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) @@ -184,54 +180,6 @@ void CBEChannelSelectWidget::paintFoot() 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); diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index bf7b9e6f6..c54436fae 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, @@ -64,7 +61,7 @@ class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CLi void paintItem(int pos); void paintItems(); void paintFoot(); - void paintDetails(int pos, int current); + void hide(); void updateSelection(unsigned int newpos); diff --git a/src/gui/bedit/bouqueteditor_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp index 3e8a9c14c..4d624724c 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -54,8 +54,59 @@ CBEGlobals::CBEGlobals() y = getScreenStartY(height); timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU]; + + dline = NULL; + ibox = NULL; } CBEGlobals::~CBEGlobals() { + delete dline; + delete ibox; } + +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(); + } + } +} + + diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h index 3e5b665e8..af04c4e16 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -28,9 +28,16 @@ class CBEGlobals { + protected: + CComponentsDetailsLine *dline; + CComponentsInfoBox *ibox; + + virtual std::string getInfoText(int index) = 0; + void paintDetails(int pos, int current); + public: CBEGlobals(); - ~CBEGlobals(); + virtual ~CBEGlobals(); CFrameBuffer *frameBuffer; From d64f06b19626476aea81157d6a58065a3074ae1f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 14/23] bedit: use inherited version of hide() This overwrites inherited hide() from CMenuTarget rework hide --- src/gui/bedit/bouqueteditor_bouquets.cpp | 5 ----- src/gui/bedit/bouqueteditor_bouquets.h | 3 ++- src/gui/bedit/bouqueteditor_channels.cpp | 12 +----------- src/gui/bedit/bouqueteditor_channels.h | 3 ++- src/gui/bedit/bouqueteditor_chanselect.cpp | 10 ---------- src/gui/bedit/bouqueteditor_chanselect.h | 3 ++- src/gui/bedit/bouqueteditor_globals.cpp | 13 +++++++++++++ src/gui/bedit/bouqueteditor_globals.h | 3 +++ 8 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 69ee284ab..430c467ee 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -169,11 +169,6 @@ void CBEBouquetWidget::paintFoot() 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); -} - void CBEBouquetWidget::updateSelection(unsigned int newpos) { if (newpos == selected || newpos == (unsigned int)-1) diff --git a/src/gui/bedit/bouqueteditor_bouquets.h b/src/gui/bedit/bouqueteditor_bouquets.h index 439ae1d7b..0e1e6325a 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.h +++ b/src/gui/bedit/bouqueteditor_bouquets.h @@ -68,7 +68,7 @@ class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelp void paintItem(int pos); void paintItems(); void paintFoot(); - void hide(); + void updateSelection(unsigned int newpos); void deleteBouquet(); @@ -93,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 3bbb3c706..5417194f3 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -175,16 +175,6 @@ void CBEChannelWidget::paintFoot() footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEChannelWidgetButtons); } -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 = ""; @@ -434,7 +424,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 73f5512aa..d6f64c055 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -62,7 +62,7 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelp void paintItems(); void paintFoot(); - void hide(); + void updateSelection(unsigned int newpos); void deleteChannel(); @@ -85,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 008997664..c4be1fb8a 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -180,16 +180,6 @@ void CBEChannelSelectWidget::paintFoot() footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEChannelSelectButtons); } -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 = ""; diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index c54436fae..5766837b0 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.h +++ b/src/gui/bedit/bouqueteditor_chanselect.h @@ -62,7 +62,7 @@ class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CLi void paintItems(); void paintFoot(); - void hide(); + void updateSelection(unsigned int newpos); void sortChannels(); @@ -77,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 4d624724c..df21cc1a0 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -109,4 +109,17 @@ void CBEGlobals::paintDetails(int pos, int current) } } +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(); +} diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h index af04c4e16..49e7724a4 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -34,6 +34,7 @@ class CBEGlobals virtual std::string getInfoText(int index) = 0; void paintDetails(int pos, int current); + void killDetails(); public: CBEGlobals(); @@ -64,6 +65,8 @@ class CBEGlobals int status_icon_width; int timeout; + + void hide(); }; #endif From 53293ba49d83379ba0287e7175c289f206fc95cf Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 15/23] bedit: declare internal vars as protected Access to internal member vars should be done via methods and funtions. --- src/gui/bedit/bouqueteditor_globals.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h index 49e7724a4..af2300155 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -31,14 +31,8 @@ class CBEGlobals protected: CComponentsDetailsLine *dline; CComponentsInfoBox *ibox; - - virtual std::string getInfoText(int index) = 0; - void paintDetails(int pos, int current); - void killDetails(); - - public: - CBEGlobals(); - virtual ~CBEGlobals(); + CComponentsHeader header; + CComponentsFooter footer; CFrameBuffer *frameBuffer; @@ -53,19 +47,23 @@ 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; + unsigned int items_count; int timeout; + virtual std::string getInfoText(int index) = 0; + void paintDetails(int pos, int current); + void killDetails(); + + public: + CBEGlobals(); + virtual ~CBEGlobals(); + void hide(); }; From 61a29f061ade553234c9f7c3e750bc5d85e0bf57 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 16/23] bedit: move paintBody() into base class Avoids multiple code parts --- src/gui/bedit/bouqueteditor_bouquets.cpp | 5 ----- src/gui/bedit/bouqueteditor_bouquets.h | 2 +- src/gui/bedit/bouqueteditor_channels.cpp | 5 ----- src/gui/bedit/bouqueteditor_channels.h | 2 +- src/gui/bedit/bouqueteditor_chanselect.cpp | 5 ----- src/gui/bedit/bouqueteditor_chanselect.h | 2 +- src/gui/bedit/bouqueteditor_globals.cpp | 5 +++++ src/gui/bedit/bouqueteditor_globals.h | 2 ++ 8 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 430c467ee..0953d03b6 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -135,11 +135,6 @@ 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); diff --git a/src/gui/bedit/bouqueteditor_bouquets.h b/src/gui/bedit/bouqueteditor_bouquets.h index 0e1e6325a..edb3a440f 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.h +++ b/src/gui/bedit/bouqueteditor_bouquets.h @@ -64,7 +64,7 @@ class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelp bool bouquetsChanged; void paintHead(); - void paintBody(); + void paintItem(int pos); void paintItems(); void paintFoot(); diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 5417194f3..b398c5fb3 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -140,11 +140,6 @@ 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")); diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index d6f64c055..8a1b16881 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -57,7 +57,7 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelp unsigned int bouquet; void paintHead(); - void paintBody(); + void paintItem(int pos); void paintItems(); void paintFoot(); diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index c4be1fb8a..66a11dc3e 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -124,11 +124,6 @@ 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")); diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index 5766837b0..0bd20f880 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.h +++ b/src/gui/bedit/bouqueteditor_chanselect.h @@ -57,7 +57,7 @@ class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CLi std::string caption; void paintHead(); - void paintBody(); + void paintItem(int pos); void paintItems(); void paintFoot(); diff --git a/src/gui/bedit/bouqueteditor_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp index df21cc1a0..a09a8259f 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -109,6 +109,11 @@ void CBEGlobals::paintDetails(int pos, int current) } } +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); diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h index af2300155..bd071ba45 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -56,6 +56,8 @@ class CBEGlobals unsigned int items_count; int timeout; + void paintBody(); + virtual std::string getInfoText(int index) = 0; void paintDetails(int pos, int current); void killDetails(); From b7124973de2cb68a4ac4cda448f9d0f58b79b2cb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 17/23] bedit: ensure apply of possible changed timeout settings on runtime --- src/gui/bedit/bouqueteditor_bouquets.cpp | 6 +++--- src/gui/bedit/bouqueteditor_channels.cpp | 6 +++--- src/gui/bedit/bouqueteditor_chanselect.cpp | 4 ++-- src/gui/bedit/bouqueteditor_globals.cpp | 2 +- src/gui/bedit/bouqueteditor_globals.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 0953d03b6..2ecabefbc 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -211,7 +211,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) @@ -219,7 +219,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)) { @@ -354,7 +354,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) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index b398c5fb3..76a9b2022 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -251,7 +251,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) @@ -259,7 +259,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)) { @@ -296,7 +296,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) { diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 66a11dc3e..8b98500cc 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -251,7 +251,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; @@ -260,7 +260,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_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp index a09a8259f..445742c7c 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -53,7 +53,7 @@ CBEGlobals::CBEGlobals() x = getScreenStartX(width); y = getScreenStartY(height); - timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU]; + timeout_ptr = &g_settings.timing[SNeutrinoSettings::TIMING_MENU]; dline = NULL; ibox = NULL; diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h index bd071ba45..299e42ed1 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -54,7 +54,7 @@ class CBEGlobals int status_icon_width; unsigned int items_count; - int timeout; + int* timeout_ptr; void paintBody(); From 4dc047557f6d43f2299229a9cb89e4135607e7c2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 18/23] bedit: remove multiple code from paintFoot() method --- src/gui/bedit/bouqueteditor_bouquets.cpp | 4 +--- src/gui/bedit/bouqueteditor_channels.cpp | 3 +-- src/gui/bedit/bouqueteditor_chanselect.cpp | 3 +-- src/gui/bedit/bouqueteditor_globals.cpp | 7 +++++++ src/gui/bedit/bouqueteditor_globals.h | 1 + 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 2ecabefbc..eb1dad793 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -159,9 +159,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); + CBEGlobals::paintFoot(numbuttons, CBEBouquetWidgetButtons); } void CBEBouquetWidget::updateSelection(unsigned int newpos) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 76a9b2022..1ef0c1c7d 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -166,8 +166,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); + CBEGlobals::paintFoot(numbuttons, CBEChannelWidgetButtons); } std::string CBEChannelWidget::getInfoText(int index) diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 8b98500cc..9f58703e8 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -171,8 +171,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); + CBEGlobals::paintFoot(numbuttons, CBEChannelSelectButtons); } std::string CBEChannelSelectWidget::getInfoText(int index) diff --git a/src/gui/bedit/bouqueteditor_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp index 445742c7c..69dca3165 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -128,3 +128,10 @@ void CBEGlobals::killDetails() if (ibox) ibox->kill(); } + +void CBEGlobals::paintFoot(const size_t& label_count, const struct button_label * const content) +{ + 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); +} diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h index 299e42ed1..98aa263e4 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -57,6 +57,7 @@ class CBEGlobals int* timeout_ptr; 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); From c651f6aa40d7b123fee1f21b183e77ae4747117e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 19/23] bedit: remove multiple code from paintHead() method --- src/gui/bedit/bouqueteditor_bouquets.cpp | 7 +------ src/gui/bedit/bouqueteditor_channels.cpp | 9 ++------- src/gui/bedit/bouqueteditor_chanselect.cpp | 9 ++------- src/gui/bedit/bouqueteditor_globals.cpp | 10 ++++++++++ src/gui/bedit/bouqueteditor_globals.h | 1 + 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index eb1dad793..d52259a0a 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -137,12 +137,7 @@ void CBEBouquetWidget::paintItems() 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[] = diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 1ef0c1c7d..f30904477 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -142,13 +142,8 @@ void CBEChannelWidget::paintItems() 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); + CBEGlobals::paintHead(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio"), + mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO); } const struct button_label CBEChannelWidgetButtons[] = diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 9f58703e8..4ad6606f8 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -126,13 +126,8 @@ void CBEChannelSelectWidget::paintItems() 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[] = diff --git a/src/gui/bedit/bouqueteditor_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp index 69dca3165..3df2c9dd7 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -135,3 +135,13 @@ void CBEGlobals::paintFoot(const size_t& label_count, const struct button_label 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) +{ + 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 98aa263e4..6a3182873 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -56,6 +56,7 @@ class CBEGlobals unsigned int items_count; int* timeout_ptr; + void paintHead(const std::string& Caption, const char* Icon); void paintBody(); void paintFoot(const size_t& label_count, const struct button_label * const content); From f53b8fb1100bfc12155f0b89b565d6a09d674eff Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 12 Oct 2017 12:26:02 +0200 Subject: [PATCH 20/23] bedit: add methods ResetModules() and init() Help to handle instances of modules to get current screen and font settings after changed settings by user. Dimensions were not applied after changed settings. eg: All Items had wrong position and dimensions after changed font size. --- src/gui/bedit/bouqueteditor_bouquets.cpp | 2 + src/gui/bedit/bouqueteditor_channels.cpp | 3 +- src/gui/bedit/bouqueteditor_globals.cpp | 67 +++++++++++++++++------- src/gui/bedit/bouqueteditor_globals.h | 7 ++- 4 files changed, 58 insertions(+), 21 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index d52259a0a..0eac1f10f 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -196,6 +196,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* parent->hide(); Bouquets = &g_bouquetManager->Bouquets; + init(); paintHead(); paintBody(); @@ -379,6 +380,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* } } hide(); + ResetModules(); return res; } diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index f30904477..c2d670f5a 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -70,7 +70,6 @@ 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() @@ -142,6 +141,8 @@ void CBEChannelWidget::paintItems() void CBEChannelWidget::paintHead() { + 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); } diff --git a/src/gui/bedit/bouqueteditor_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp index 3df2c9dd7..8e0235edc 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -34,16 +34,33 @@ 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; @@ -52,17 +69,27 @@ CBEGlobals::CBEGlobals() x = getScreenStartX(width); y = getScreenStartY(height); - - timeout_ptr = &g_settings.timing[SNeutrinoSettings::TIMING_MENU]; - - dline = NULL; - ibox = NULL; } CBEGlobals::~CBEGlobals() { - delete dline; - delete ibox; + 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) @@ -131,17 +158,21 @@ void CBEGlobals::killDetails() void CBEGlobals::paintFoot(const size_t& label_count, const struct button_label * const content) { - 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); + 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) { - 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); + 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 6a3182873..5b8d4f9d7 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -31,8 +31,8 @@ class CBEGlobals protected: CComponentsDetailsLine *dline; CComponentsInfoBox *ibox; - CComponentsHeader header; - CComponentsFooter footer; + CComponentsHeader *header; + CComponentsFooter *footer; CFrameBuffer *frameBuffer; @@ -56,6 +56,8 @@ class CBEGlobals 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); @@ -69,6 +71,7 @@ class CBEGlobals virtual ~CBEGlobals(); void hide(); + void ResetModules(); }; #endif From 9365e09ab9f35b4f688a2ad90bb09b4b6070bb2b Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sat, 14 Oct 2017 09:59:01 +0200 Subject: [PATCH 21/23] CBEBouquetWidget::getInfoText(): Fix compile error --- src/gui/bedit/bouqueteditor_bouquets.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.h b/src/gui/bedit/bouqueteditor_bouquets.h index edb3a440f..5d951c582 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.h +++ b/src/gui/bedit/bouqueteditor_bouquets.h @@ -85,7 +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*/){}; + std::string getInfoText(int /*index*/) { return ""; }; public: CBEBouquetWidget(); From ff61f5aef16538dd9fdfbbdc61062d6f00bc3578 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 14 Oct 2017 13:26:55 +0200 Subject: [PATCH 22/23] streaminfo2: add desc to audiotype --- src/gui/streaminfo2.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index f4ddae10b..31a7ef272 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -655,6 +655,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) { @@ -666,9 +669,9 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) "single_ch" }; int max_mode = sizeof(mpegmodes) / sizeof(mpegmodes[0]); - snprintf(buf, sizeof(buf), "MPEG %s (%d)", + 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) { @@ -684,10 +687,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) { @@ -705,16 +708,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); From 0f8e614ee4f2f73b8e285f157ec3bfde087d6d6f Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 16 Oct 2017 10:44:19 +0200 Subject: [PATCH 23/23] Revert "- libdvbsub: add missing free() call" This reverts commit 89f9ae85f07ffc900a0698be718e4e635db282f4. --- lib/libdvbsub/dvbsubtitle.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index 5ec75dded..897f9fc49 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -139,7 +139,6 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) #endif CFrameBuffer::getInstance()->blit2FB(newdata, nw, nh, xoff, yoff, 0, 0); - free(newdata); if(min_x > xoff) min_x = xoff;