diff --git a/acinclude.m4 b/acinclude.m4
index 6212c1f25..be7f8f602 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -21,6 +21,14 @@ if test "$DEBUG" = "yes"; then
AC_DEFINE(DEBUG,1,[Enable debug messages])
fi
+AC_ARG_ENABLE(reschange,
+ AS_HELP_STRING(--enable-reschange,enable change the osd resolution (default for hd2)))
+
+AM_CONDITIONAL(ENABLE_RESCHANGE,test "$enable_reschange" = "yes")
+if test "$enable_reschange" = "yes"; then
+ AC_DEFINE(ENABLE_CHANGE_OSD_RESOLUTION,1,[enable change the osd resolution])
+fi
+
AC_MSG_CHECKING(target)
if test "$TARGET" = "native"; then
@@ -354,6 +362,7 @@ if test "$BOXMODEL" = "hd1"; then
AC_DEFINE(BOXMODEL_CS_HD1, 1, [coolstream hd1/neo/neo2/zee])
elif test "$BOXMODEL" = "hd2"; then
AC_DEFINE(BOXMODEL_CS_HD2, 1, [coolstream tank/trinity/trinity v2/trinity duo/zee2/link])
+ AC_DEFINE(ENABLE_CHANGE_OSD_RESOLUTION,1,[enable change the osd resolution])
elif test "$BOXMODEL" = "raspi"; then
AC_DEFINE(BOXMODEL_RASPI, 1, [Raspberry pi])
fi
diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale
index d1bb700f7..94852a2b8 100644
--- a/data/locale/deutsch.locale
+++ b/data/locale/deutsch.locale
@@ -322,10 +322,9 @@ colormenu.clock_textcolor Ziffernfarbe
colormenu.fade Ein-/Ausblenden
colormenu.font Verwendete Schriftart
colormenu.font_ttx Teletext Schriftart
-colormenu.hd_preset LCD
colormenu.menucolors Farben
colormenu.osd_preset Monitor Auswahl
-colormenu.sd_preset CRT
+colormenu.osd_resolution OSD-Auflösung
colormenu.textcolor Textfarbe
colormenu.themeselect Theme auswählen
colormenu.timing Timeouts
@@ -1254,6 +1253,7 @@ menu.hint_opkg_upgrade Aktualisiert alle installierten Pakete auf die neueste ve
menu.hint_osd Farben, Schriftarten, Anzeigegröße, Ansichtsoptionen der Menüs usw.
menu.hint_osd_language Wählen Sie ihre Menü-Sprache
menu.hint_osd_preset Wählen Sie zwischen Röhren-TV (CRT) oder Flachbildschirm (LCD)
+menu.hint_osd_resolution Wählen Sie eine OSD-Auflösung
menu.hint_osd_timing Einblendzeit, die das OSD auf dem TV angezeigt wird
menu.hint_other_fonts Ändern Sie andere Schriftgrößen
menu.hint_parentallock_changepin Geben Sie den 4-stelligen PIN-Code ein, der dann ggf. abgefragt wird
@@ -2320,9 +2320,11 @@ streaminfo.framerate Bildrate
streaminfo.framerate_unknown unbekannt
streaminfo.head Tech. Information
streaminfo.not_available nicht verfügbar
+streaminfo.osd_resolution OSD-Auflösung
streaminfo.resolution Auflösung
streaminfo.signal Empfangssignal
-streaming.busy Ein oder mehrere Aufnahmeprozesse sind aktiv.\nSollte die Aufnahme eigentlich beendet sein,\nschafft ein Neustart der GUI Abhilfe.
+streaminfo.videosystem Videosystem
+streaming.busy Einer oder mehrere Aufnahmeprozesse sind aktiv.\nSollte die Aufnahme eigentlich beendet sein,\nschafft ein Neustart der GUI Abhilfe.
streaming.dir_not_writable Das Aufnahmeverzeichnis ist nicht beschreibbar.\nAufnahmen sind daher nicht möglich.
streaming.overflow Aufnahme-Puffer Überlauf! Bitte ggf. einige Aufnahmen beenden.
streaming.slow System oder Datenträger zu langsam! Bitte ggf. einige Aufnahmen beenden.
diff --git a/data/locale/english.locale b/data/locale/english.locale
index f2934a7df..43ffeb429 100644
--- a/data/locale/english.locale
+++ b/data/locale/english.locale
@@ -322,10 +322,9 @@ colormenu.clock_textcolor Digit color
colormenu.fade Fade GUI
colormenu.font Select GUI font
colormenu.font_ttx Select Teletext font
-colormenu.hd_preset LCD
colormenu.menucolors Colors
colormenu.osd_preset TV preset
-colormenu.sd_preset CRT
+colormenu.osd_resolution OSD resolution
colormenu.textcolor Text color
colormenu.themeselect Select theme
colormenu.timing Timeouts
@@ -1172,7 +1171,7 @@ menu.hint_key_volumedown Assign button to decrease volume
menu.hint_key_volumeup Assign button to increase volume
menu.hint_keys Remote control repeat rate\nEdit key bindings
menu.hint_lang_pref Configure preferred audio, EPG\nand subtitle languages
-menu.hint_language OSD language, timezone\nPreffered audio and subtitles languages
+menu.hint_language OSD language, timezone\nPrefered audio and subtitles languages
menu.hint_last_radio Start box on selected channel\nif last mode is Radio
menu.hint_last_tv Start box on selected channel\nif last mode is TV
menu.hint_last_use Start box on last used channel
@@ -1254,6 +1253,7 @@ menu.hint_opkg_upgrade Updates all installed packages to the most recent version
menu.hint_osd Colors, fonts, screen size\nGUI look and feel options
menu.hint_osd_language Select OSD language
menu.hint_osd_preset Pre-configured screen margins for CRT and LCD TV
+menu.hint_osd_resolution Change OSD resolution
menu.hint_osd_timing After this time the OSD will be faded out
menu.hint_other_fonts Change other font sizes
menu.hint_parentallock_changepin Change PIN code
@@ -2320,8 +2320,10 @@ streaminfo.framerate Framerate
streaminfo.framerate_unknown unknown
streaminfo.head Stream-Information
streaminfo.not_available not available
+streaminfo.osd_resolution OSD resolution
streaminfo.resolution Resolution
streaminfo.signal Receipt signal
+streaminfo.videosystem Videosystem
streaming.busy One or several recording processes are active.\nIf you encounter this message and no recording is active, please restart GUI.
streaming.dir_not_writable The recording directory is not writable.\nRecording will not work.
streaming.overflow Record buffer overflow, consider to stop some records
diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp
index 4fec1c501..714494681 100644
--- a/lib/libtuxtxt/tuxtxt.cpp
+++ b/lib/libtuxtxt/tuxtxt.cpp
@@ -5234,7 +5234,7 @@ void RenderPage()
{
page_atrb[32].fg = yellow;
page_atrb[32].bg = menu1;
- int showpage = tuxtxt_cache.page_receiving;
+ int showpage = tuxtxt_cache.page_receiving < 0 ? 0 : tuxtxt_cache.page_receiving;
int showsubpage = tuxtxt_cache.subpagetable[showpage];
if (showsubpage!=0xff)
{
@@ -5524,7 +5524,7 @@ void CopyBB2FB()
{
fb_pixel_t *src, *dst, *topsrc;
int fillcolor, i, screenwidth, swtmp;
-#if defined(HAVE_SPARK_HARDWARE) || defined(BOXMODEL_CS_HD2)
+#if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_COOL_HARDWARE)
CFrameBuffer *f = CFrameBuffer::getInstance();
#endif
@@ -5537,10 +5537,20 @@ void CopyBB2FB()
{
#ifdef HAVE_SPARK_HARDWARE
f->blit2FB(lbb, var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, 0, true);
-#elif defined BOXMODEL_CS_HD2
+#elif defined(HAVE_COOL_HARDWARE)
f->fbCopyArea(var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, var_screeninfo.yres);
#else
- memcpy(lfb, lbb, fix_screeninfo.line_length*var_screeninfo.yres);
+ if ((uint32_t)stride > var_screeninfo.xres) {
+ fb_pixel_t *lfb_ = lfb;
+ fb_pixel_t *lbb_ = lbb;
+ for (uint32_t i1 = 0; i1 < var_screeninfo.yres; i1++) {
+ memcpy(lfb_, lbb_, var_screeninfo.xres * sizeof(fb_pixel_t));
+ lfb_ += stride;
+ lbb_ += stride;
+ }
+ }
+ else
+ memcpy(lfb, lbb, fix_screeninfo.line_length*var_screeninfo.yres);
#endif
/* adapt background of backbuffer if changed */
@@ -5576,7 +5586,7 @@ void CopyBB2FB()
if (screenmode == 1)
{
screenwidth = ( TV43STARTX );
-#if defined(HAVE_SPARK_HARDWARE) || defined(BOXMODEL_CS_HD2)
+#if defined(HAVE_SPARK_HARDWARE)
int cx = var_screeninfo.xres - TV43STARTX; /* x start */
int cw = TV43STARTX; /* width */
int cy = StartY;
@@ -5584,8 +5594,6 @@ void CopyBB2FB()
#endif
#ifdef HAVE_SPARK_HARDWARE
f->blit2FB(lbb, cw, ch, cx, cy, cx, cy, true);
-#elif defined BOXMODEL_CS_HD2
- f->fbCopyArea(cw, ch, cx, cy, cx, cy+var_screeninfo.yres);
#else
fb_pixel_t *topdst = dst;
size_t width = (ex - screenwidth) * sizeof(fb_pixel_t);
diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am
index e7d4eaf43..37040c4b0 100644
--- a/src/driver/Makefile.am
+++ b/src/driver/Makefile.am
@@ -47,6 +47,8 @@ libneutrino_driver_a_SOURCES = \
volume.cpp
if BOXTYPE_COOL
+libneutrino_driver_a_SOURCES += \
+ fb_accel_cs_hdx.cpp
if BOXMODEL_CS_HD2
libneutrino_driver_a_SOURCES += \
fb_accel_cs_hd2.cpp \
diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h
index 72bca8aa5..6343056f9 100644
--- a/src/driver/fb_accel.h
+++ b/src/driver/fb_accel.h
@@ -78,17 +78,41 @@ class CFbAccelSTi
void setBlendLevel(int);
};
-class CFbAccelCSHD1
+class CFbAccelCSHDx
: public CFbAccel
{
private:
+
+ protected:
+ OpenThreads::Mutex mutex;
+
+ int fbCopy(uint32_t *mem_p, int width, int height, int dst_x, int dst_y, int src_x, int src_y, int mode);
+ int fbFill(int sx, int sy, int width, int height, fb_pixel_t color, int mode=0);
+
+ public:
+ CFbAccelCSHDx();
+// ~CFbAccelCSHDx();
+
+#if 0
+ /* TODO: Run this functions with hardware acceleration */
+ void SaveScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp);
+ void RestoreScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp);
+ void Clear();
+#endif
+};
+
+class CFbAccelCSHD1
+ : public CFbAccelCSHDx
+{
+ private:
fb_pixel_t lastcol;
+ fb_pixel_t *backbuffer;
int devmem_fd; /* to access the GXA register we use /dev/mem */
unsigned int smem_start; /* as aquired from the fbdev, the framebuffers physical start address */
volatile uint8_t *gxa_base; /* base address for the GXA's register access */
+
void setColor(fb_pixel_t col);
- void run(void);
- fb_pixel_t *backbuffer;
+
public:
CFbAccelCSHD1();
~CFbAccelCSHD1();
@@ -109,13 +133,16 @@ class CFbAccelCSHD1
void setBlendLevel(int);
void add_gxa_sync_marker(void);
void setupGXA(void);
+ void setOsdResolutions();
};
class CFbAccelCSHD2
- : public CFbAccel
+ : public CFbAccelCSHDx
{
private:
fb_pixel_t *backbuffer;
+ int sysRev;
+ bool IsApollo;
public:
CFbAccelCSHD2();
@@ -130,6 +157,9 @@ class CFbAccelCSHD2
fb_pixel_t * getBackBufferPointer() const;
void setBlendMode(uint8_t);
void setBlendLevel(int);
+ int scale2Res(int size);
+ bool fullHdAvailable();
+ void setOsdResolutions();
uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true);
bool needAlign4Blit() { return true; };
};
diff --git a/src/driver/fb_accel_cs_hd1.cpp b/src/driver/fb_accel_cs_hd1.cpp
index 2672dfd58..2b6b0e0dd 100644
--- a/src/driver/fb_accel_cs_hd1.cpp
+++ b/src/driver/fb_accel_cs_hd1.cpp
@@ -264,13 +264,21 @@ void CFbAccelCSHD1::paintBoxRel(const int x, const int y, const int dx, const in
void CFbAccelCSHD1::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y)
{
+ if ((width == 0) || (height == 0))
+ return;
+
uint32_t w_, h_;
w_ = (width > xRes) ? xRes : width;
h_ = (height > yRes) ? yRes : height;
- //printf("\033[33m>>>>\033[0m [CFbAccelCSHD1::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y);
- printf("\033[31m>>>>\033[0m [CFbAccelCSHD1::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y);
- CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y);
+ int mode = CS_FBCOPY_FB2FB;
+ uint32_t src_y_ = src_y;
+ if (src_y >= yRes) {
+ mode = CS_FBCOPY_BB2FB;
+ src_y_ -= yRes;
+ }
+ fbCopy(NULL, w_, h_, dst_x, dst_y, src_x, src_y_, mode);
+// printf("\033[31m>>>>\033[0m%s hw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func_ext__, w_, h_, dst_x, dst_y, src_x, src_y);
}
void CFbAccelCSHD1::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp)
@@ -336,9 +344,26 @@ void CFbAccelCSHD1::setupGXA()
add_gxa_sync_marker();
}
-/* wrong name... */
+void CFbAccelCSHD1::setOsdResolutions()
+{
+ /* FIXME: Infos available in driver? */
+ osd_resolution_t res;
+ osd_resolutions.clear();
+ res.xRes = 1280;
+ res.yRes = 720;
+ res.bpp = 32;
+ res.mode = OSDMODE_720;
+ osd_resolutions.push_back(res);
+}
+
int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int)
{
+ if (!available&&!active)
+ return -1;
+
+ if (osd_resolutions.empty())
+ setOsdResolutions();
+
fb_fix_screeninfo _fix;
if (ioctl(fd, FBIOGET_FSCREENINFO, &_fix) < 0) {
@@ -353,6 +378,10 @@ int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int)
yRes = screeninfo.yres;
bpp = screeninfo.bits_per_pixel;
printf(LOGTAG "%dx%dx%d line length %d. using %s graphics accelerator.\n", xRes, yRes, bpp, stride, _fix.id);
+
+ if (videoDecoder != NULL)
+ videoDecoder->updateOsdScreenInfo();
+
int needmem = stride * yRes * 2;
if (available >= needmem)
{
diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp
index ce20ce051..cfafaf4bf 100644
--- a/src/driver/fb_accel_cs_hd2.cpp
+++ b/src/driver/fb_accel_cs_hd2.cpp
@@ -28,7 +28,9 @@
CFbAccelCSHD2::CFbAccelCSHD2()
{
- fb_name = "Coolstream HD2 framebuffer";
+ fb_name = "Coolstream HD2 framebuffer";
+ IsApollo = false;
+ sysRev = -1;
}
/*
@@ -143,11 +145,22 @@ void CFbAccelCSHD2::paintBoxRel(const int x, const int y, const int dx, const in
void CFbAccelCSHD2::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y)
{
+ if ((width == 0) || (height == 0))
+ return;
+
uint32_t w_, h_;
w_ = (width > xRes) ? xRes : width;
h_ = (height > yRes) ? yRes : height;
- if(!(w_%4)) {
+ if (sysRev < 0) {
+ sysRev = cs_get_revision();
+ IsApollo = (sysRev == 9);
+ }
+
+ if(!(w_ % 4) && !IsApollo) {
+ /* workaround for bad fb driver */
+ w_ -= 1;
+ h_ -= 1;
fb_copyarea area;
area.dx = dst_x;
area.dy = dst_y;
@@ -156,11 +169,18 @@ void CFbAccelCSHD2::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x,
area.sx = src_x;
area.sy = src_y;
ioctl(fd, FBIO_COPY_AREA, &area);
- //printf("\033[33m>>>>\033[0m [CFbAccelCSHD2::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y);
- return;
+// printf("\033[33m>>>>\033[0m%s fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func_ext__, w_, h_, dst_x, dst_y, src_x, src_y);
+ }
+ else {
+ int mode = CS_FBCOPY_FB2FB;
+ uint32_t src_y_ = src_y;
+ if (src_y >= yRes) {
+ mode = CS_FBCOPY_BB2FB;
+ src_y_ -= yRes;
+ }
+ fbCopy(NULL, w_, h_, dst_x, dst_y, src_x, src_y_, mode);
+// printf("\033[31m>>>>\033[0m%s fbCopy w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func_ext__, w_, h_, dst_x, dst_y, src_x, src_y);
}
- //printf("\033[31m>>>>\033[0m [CFbAccelCSHD2::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y);
- CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y);
}
void CFbAccelCSHD2::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp)
@@ -207,22 +227,91 @@ void CFbAccelCSHD2::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_
CFrameBuffer::blitBox2FB(boxBuf, width, height, xoff, yoff);
}
-int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int)
+void CFbAccelCSHD2::setOsdResolutions()
{
+ /* FIXME: Infos available in driver? */
+ osd_resolution_t res;
+ osd_resolutions.clear();
+ res.xRes = 1280;
+ res.yRes = 720;
+ res.bpp = 32;
+ res.mode = OSDMODE_720;
+ osd_resolutions.push_back(res);
+ if (fullHdAvailable()) {
+ res.xRes = 1920;
+ res.yRes = 1080;
+ res.bpp = 32;
+ res.mode = OSDMODE_1080;
+ osd_resolutions.push_back(res);
+ }
+}
+
+int CFbAccelCSHD2::setMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp)
+{
+ if (!available&&!active)
+ return -1;
+
+ if (osd_resolutions.empty())
+ setOsdResolutions();
+
+ unsigned int nxRes_ = nxRes;
+ unsigned int nyRes_ = nyRes;
+ unsigned int nbpp_ = nbpp;
+ if (!fullHdAvailable()) {
+ nxRes_ = 1280;
+ nyRes_ = 720;
+ nbpp_ = 32;
+ }
+ screeninfo.xres=nxRes_;
+ screeninfo.yres=nyRes_;
+ screeninfo.xres_virtual=nxRes_;
+ screeninfo.yres_virtual=nyRes_*2;
+ screeninfo.height=0;
+ screeninfo.width=0;
+ screeninfo.xoffset=screeninfo.yoffset=0;
+ screeninfo.bits_per_pixel=nbpp_;
+
+ if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0)
+ perror(LOGTAG "FBIOPUT_VSCREENINFO");
+
+ printf(LOGTAG "SetMode: %dbits, red %d:%d green %d:%d blue %d:%d transp %d:%d\n",
+ screeninfo.bits_per_pixel, screeninfo.red.length, screeninfo.red.offset, screeninfo.green.length, screeninfo.green.offset, screeninfo.blue.length, screeninfo.blue.offset, screeninfo.transp.length, screeninfo.transp.offset);
+ if ((screeninfo.xres != nxRes_) ||
+ (screeninfo.yres != nyRes_) ||
+ (screeninfo.bits_per_pixel != nbpp_)) {
+ printf(LOGTAG "SetMode failed: wanted: %dx%dx%d, got %dx%dx%d\n",
+ nxRes_, nyRes_, nbpp_,
+ screeninfo.xres, screeninfo.yres, screeninfo.bits_per_pixel);
+ return -1;
+ }
+
fb_fix_screeninfo _fix;
if (ioctl(fd, FBIOGET_FSCREENINFO, &_fix) < 0) {
- perror("FBIOGET_FSCREENINFO");
+ perror(LOGTAG "FBIOGET_FSCREENINFO");
return -1;
}
stride = _fix.line_length;
swidth = stride / sizeof(fb_pixel_t);
if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0)
- printf("screen unblanking failed\n");
+ printf(LOGTAG "screen unblanking failed\n");
xRes = screeninfo.xres;
yRes = screeninfo.yres;
bpp = screeninfo.bits_per_pixel;
- printf(LOGTAG "%dx%dx%d line length %d. using hd2 graphics accelerator.\n", xRes, yRes, bpp, stride);
+ printf(LOGTAG "%dx%dx%d line length %d. using %s graphics accelerator.\n", xRes, yRes, bpp, stride, _fix.id);
+
+/*
+max res 1280x720
+ available 14745600
+ stride 5120
+max res 1920x1080
+ available 16588800
+ stride 7680
+*/
+
+ if (videoDecoder != NULL)
+ videoDecoder->updateOsdScreenInfo();
+
int needmem = stride * yRes * 2;
if (available >= needmem)
{
@@ -260,6 +349,30 @@ void CFbAccelCSHD2::setBlendLevel(int level)
usleep(20000);
}
+int CFbAccelCSHD2::scale2Res(int size)
+{
+ /*
+ The historic resolution 1280x720 is default for some values/sizes.
+ So let's scale these values to other resolutions.
+ */
+
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+ if (screeninfo.xres == 1920)
+ size += size/2;
+#endif
+
+ return size;
+}
+
+bool CFbAccelCSHD2::fullHdAvailable()
+{
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+ if (available >= 16588800) /* new fb driver with maxres 1920x1080(*8) */
+ return true;
+#endif
+ return false;
+}
+
/* align for hw blit */
uint32_t CFbAccelCSHD2::getWidth4FB_HW_ACC(const uint32_t _x, const uint32_t _w, const bool max)
{
diff --git a/src/driver/fb_accel_cs_hdx.cpp b/src/driver/fb_accel_cs_hdx.cpp
new file mode 100644
index 000000000..3ab238f35
--- /dev/null
+++ b/src/driver/fb_accel_cs_hdx.cpp
@@ -0,0 +1,122 @@
+/*
+ Framebuffer acceleration hardware abstraction functions.
+ The common functions for coolstream hd1/hd2 graphic chips
+ are represented in this class.
+
+ (C) 2017 M. Liebmann
+
+ License: GPL
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#include "fb_accel_cs_hdx_inc.h"
+
+#define LOGTAG "[fb_accel_cs_hdx] "
+
+CFbAccelCSHDx::CFbAccelCSHDx()
+{
+ fb_name = "CST HDx framebuffer";
+}
+
+/*
+CFbAccelCSHDx::~CFbAccelCSHDx()
+{
+}
+*/
+
+int CFbAccelCSHDx::fbCopy(uint32_t *mem_p, int width, int height,
+ int dst_x, int dst_y, int src_x, int src_y, int mode)
+{
+ if (videoDecoder == NULL) {
+ if (dst_y < (int)yRes) {
+ uint32_t src_y_ = src_y;
+ if (mode == CS_FBCOPY_BB2FB)
+ src_y_ += yRes;
+ CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y_);
+ return 0;
+ }
+ return -1;
+ }
+
+ mutex.lock();
+ setActive(false);
+ int ret = videoDecoder->fbCopy(mem_p, width, height, dst_x, dst_y, src_x, src_y, mode);
+ add_gxa_sync_marker();
+ setActive(true);
+ mutex.unlock();
+ return ret;
+}
+
+int CFbAccelCSHDx::fbFill(int sx, int sy, int width, int height, fb_pixel_t color, int mode/*=0*/)
+{
+ if (videoDecoder == NULL) {
+ CFbAccel::paintRect(sx, sy, width, height, color);
+ return 0;
+ }
+
+ mutex.lock();
+ setActive(false);
+ int ret = videoDecoder->fbFill(sx, sy, width, height, color, mode);
+ add_gxa_sync_marker();
+ setActive(true);
+ mutex.unlock();
+ return ret;
+}
+
+#if 0
+/* TODO: Run this functions with hardware acceleration */
+void CFbAccelCSHDx::SaveScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp)
+{
+ if (!getActive())
+ return;
+
+ checkFbArea(x, y, dx, dy, true);
+ fb_pixel_t * pos = getFrameBufferPointer() + x + swidth * y;
+ fb_pixel_t * bkpos = memp;
+ for (int count = 0; count < dy; count++) {
+ fb_pixel_t * dest = (fb_pixel_t *)pos;
+ for (int i = 0; i < dx; i++)
+ *(bkpos++) = *(dest++);
+ pos += swidth;
+ }
+ checkFbArea(x, y, dx, dy, false);
+printf("%s\n", __func_ext__);
+}
+
+void CFbAccelCSHDx::RestoreScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp)
+{
+ if (!getActive())
+ return;
+
+ checkFbArea(x, y, dx, dy, true);
+ fb_pixel_t * fbpos = getFrameBufferPointer() + x + swidth * y;
+ fb_pixel_t * bkpos = memp;
+ for (int count = 0; count < dy; count++)
+ {
+ memmove(fbpos, bkpos, dx * sizeof(fb_pixel_t));
+ fbpos += swidth;
+ bkpos += dx;
+ }
+ mark(x, y, x + dx, y + dy);
+ checkFbArea(x, y, dx, dy, false);
+printf("%s\n", __func_ext__);
+}
+
+void CFbAccelCSHDx::Clear()
+{
+ paintBackground();
+printf("%s\n", __func_ext__);
+}
+#endif
diff --git a/src/driver/fb_accel_cs_hdx_inc.h b/src/driver/fb_accel_cs_hdx_inc.h
index cd38baa72..5f98cd34b 100644
--- a/src/driver/fb_accel_cs_hdx_inc.h
+++ b/src/driver/fb_accel_cs_hdx_inc.h
@@ -1,6 +1,6 @@
/*
Framebuffer acceleration hardware abstraction functions.
- The hardware dependent acceleration functions for coolstream hdx graphic chips
+ The common functions for coolstream hd1/hd2 graphic chips
are represented in this class.
(C) 2017 M. Liebmann
@@ -23,6 +23,8 @@
along with this program. If not, see .
*/
+#ifndef FB_ACCEL_CS_HDX_INC_H
+#define FB_ACCEL_CS_HDX_INC_H
#include
#include
@@ -31,8 +33,16 @@
#include
#include
#include
-#include
-#include
+#include
+#include
+#include
+#include
#include
+#include
+#include
#include
+
+extern cVideo * videoDecoder;
+
+#endif // FB_ACCEL_CS_HDX_INC_H
diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp
index 6d470ade6..af678dc7c 100644
--- a/src/driver/fb_generic.cpp
+++ b/src/driver/fb_generic.cpp
@@ -46,6 +46,7 @@
#include
#include
+#include
#include
#include
#include
@@ -350,8 +351,34 @@ int CFrameBuffer::setMode(unsigned int /*nxRes*/, unsigned int /*nyRes*/, unsign
if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) {
printf("screen unblanking failed\n");
}
+
return 0;
}
+
+void CFrameBuffer::setOsdResolutions()
+{
+ /* FIXME: Infos available in driver? */
+ osd_resolution_t res;
+ osd_resolutions.clear();
+ res.xRes = 1280;
+ res.yRes = 720;
+ res.bpp = 32;
+ res.mode = OSDMODE_720;
+ osd_resolutions.push_back(res);
+}
+
+size_t CFrameBuffer::getIndexOsdResolution(uint32_t mode)
+{
+ if (osd_resolutions.size() == 1)
+ return 0;
+
+ for (size_t i = 0; i < osd_resolutions.size(); i++) {
+ if (osd_resolutions[i].mode == mode)
+ return i;
+ }
+ return 0;
+}
+
#if 0
//never used
void CFrameBuffer::setTransparency( int /*tr*/ )
diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h
index 26752987c..b355377ce 100644
--- a/src/driver/fb_generic.h
+++ b/src/driver/fb_generic.h
@@ -39,6 +39,14 @@
typedef struct fb_var_screeninfo t_fb_var_screeninfo;
+typedef struct osd_resolution_t
+{
+ uint32_t yRes;
+ uint32_t xRes;
+ uint32_t bpp;
+ uint32_t mode;
+} osd_resolution_struct_t;
+
typedef struct gradientData_t
{
fb_pixel_t* gradientBuf;
@@ -270,6 +278,13 @@ class CFrameBuffer : public sigc::trackable
virtual void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);
virtual void mark(int x, int y, int dx, int dy);
+/* Remove this when pu/fb-setmode branch is merged to master */
+#define SCALE2RES_DEFINED
+ virtual int scale2Res(int size) { return size; };
+ virtual bool fullHdAvailable() { return false; };
+ virtual void setOsdResolutions();
+ std::vector osd_resolutions;
+ size_t getIndexOsdResolution(uint32_t mode);
enum
{
diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp
index 8c200a301..16fa1de89 100644
--- a/src/driver/neutrinofonts.cpp
+++ b/src/driver/neutrinofonts.cpp
@@ -176,12 +176,15 @@ void CNeutrinoFonts::SetupNeutrinoFonts(bool initRenderClass/*=true*/)
fontStyle[2] = "Italic";
}
+ int fontSize;
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_COUNT; i++) {
if (g_Font[i]) delete g_Font[i];
- g_Font[i] = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[neutrino_font[i].style].c_str(), CNeutrinoApp::getInstance()->getConfigFile()->getInt32(locale_real_names[neutrino_font[i].name], neutrino_font[i].defaultsize) + neutrino_font[i].size_offset * fontDescr.size_offset);
+ fontSize = CFrameBuffer::getInstance()->scale2Res(CNeutrinoApp::getInstance()->getConfigFile()->getInt32(locale_real_names[neutrino_font[i].name], neutrino_font[i].defaultsize)) + neutrino_font[i].size_offset * fontDescr.size_offset;
+ g_Font[i] = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[neutrino_font[i].style].c_str(), fontSize);
}
if (g_SignalFont) delete g_SignalFont;
- g_SignalFont = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[signal_font.style].c_str(), signal_font.defaultsize + signal_font.size_offset * fontDescr.size_offset);
+ fontSize = CFrameBuffer::getInstance()->scale2Res(signal_font.defaultsize) + signal_font.size_offset * fontDescr.size_offset;
+ g_SignalFont = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[signal_font.style].c_str(), fontSize);
}
void CNeutrinoFonts::refreshDynFonts()
@@ -242,7 +245,7 @@ int CNeutrinoFonts::getFontHeight(Font* fnt)
int CNeutrinoFonts::getDynFontSize(int dx, int dy, std::string text, int style)
{
int dynSize = dy/1.6;
- if (dx == 0) dx = 1280;
+ if (dx == 0) dx = CFrameBuffer::getInstance()->getScreenWidth(true);
if (!vDynSize.empty()) {
for (size_t i = 0; i < vDynSize.size(); i++) {
diff --git a/src/driver/screenshot.cpp b/src/driver/screenshot.cpp
index c965f3117..1ad99fe01 100644
--- a/src/driver/screenshot.cpp
+++ b/src/driver/screenshot.cpp
@@ -63,6 +63,7 @@ CScreenShot::CScreenShot(const std::string fname, screenshot_format_t fmt)
fd = NULL;
xres = 0;
yres = 0;
+ extra_osd = false;
scs_thread = 0;
pthread_mutex_init(&thread_mutex, NULL);
pthread_mutex_init(&getData_mutex, NULL);
@@ -78,9 +79,66 @@ CScreenShot::~CScreenShot()
// printf("[CScreenShot::%s:%d] thread: %p\n", __func__, __LINE__, this);
}
+#ifdef BOXMODEL_CS_HD2
+
+bool CScreenShot::mergeOsdScreen(uint32_t dx, uint32_t dy, fb_pixel_t* osdData)
+{
+ uint8_t* d = (uint8_t *)pixel_data;
+ fb_pixel_t* d2;
+
+ for (uint32_t count = 0; count < dy; count++ ) {
+ fb_pixel_t *pixpos = (fb_pixel_t*)&osdData[count*dx];
+ d2 = (fb_pixel_t*)d;
+ for (uint32_t count2 = 0; count2 < dx; count2++ ) {
+ //don't paint backgroundcolor (*pixpos = 0x00000000)
+ if (*pixpos) {
+ fb_pixel_t pix = *pixpos;
+ if ((pix & 0xff000000) == 0xff000000)
+ *d2 = (pix & 0x00ffffff);
+ else {
+ uint8_t *in = (uint8_t *)(pixpos);
+ uint8_t *out = (uint8_t *)d2;
+ int a = in[3];
+ *out = (*out + ((*in - *out) * a) / 256);
+ in++; out++;
+ *out = (*out + ((*in - *out) * a) / 256);
+ in++; out++;
+ *out = (*out + ((*in - *out) * a) / 256);
+ }
+ }
+ d2++;
+ pixpos++;
+ }
+ d += dx*sizeof(fb_pixel_t);
+ }
+ return true;
+}
+#endif
+
/* try to get video frame data in ARGB format, restore GXA state */
bool CScreenShot::GetData()
{
+#ifdef BOXMODEL_CS_HD2
+ /* Workaround for broken osd screenshot with new fb driver and 1280x720 resolution */
+ CFrameBuffer* frameBuffer = CFrameBuffer::getInstance();
+ fb_pixel_t* screenBuf = NULL;
+ uint32_t _xres = 0, _yres = 0;
+ if (frameBuffer->fullHdAvailable() && (frameBuffer->getScreenWidth(true) == 1280)) {
+ _xres = xres = 1280;
+ _yres = yres = 720;
+ get_osd = false;
+ extra_osd = true;
+ screenBuf = new fb_pixel_t[_xres*_yres*sizeof(fb_pixel_t)];
+ if (screenBuf == NULL) {
+ printf("[CScreenShot::%s:%d] memory error\n", __func__, __LINE__);
+ return false;
+ }
+ printf("\n[CScreenShot::%s:%d] Read osd screen...", __func__, __LINE__);
+ frameBuffer->SaveScreen(0, 0, _xres, _yres, screenBuf);
+ printf(" done.\n");
+ }
+#endif
+
bool res = false;
pthread_mutex_lock(&getData_mutex);
@@ -90,6 +148,20 @@ bool CScreenShot::GetData()
if (videoDecoder->getBlank())
get_video = false;
+#ifdef BOXMODEL_CS_HD2
+ if (extra_osd && !get_video) {
+ uint32_t memSize = xres * yres * sizeof(fb_pixel_t) * 2;
+ pixel_data = (uint8_t*)cs_malloc_uncached(memSize);
+ if (pixel_data == NULL) {
+ printf("[CScreenShot::%s:%d] memory error\n", __func__, __LINE__);
+ pthread_mutex_unlock(&getData_mutex);
+ return false;
+ }
+ memset(pixel_data, 0, memSize);
+ res = true;
+ }
+ else
+#endif
#if 1 // to enable after libcs/drivers update
res = videoDecoder->GetScreenImage(pixel_data, xres, yres, get_video, get_osd, scale_to_video);
#endif
@@ -107,6 +179,14 @@ bool CScreenShot::GetData()
return false;
}
+#ifdef BOXMODEL_CS_HD2
+ if (extra_osd && screenBuf) {
+ printf("[CScreenShot::%s:%d] Merge osd screen to screenshot...", __func__, __LINE__);
+ mergeOsdScreen(_xres, _yres, screenBuf);
+ delete[] screenBuf;
+ printf(" done.\n \n");
+ }
+#endif
printf("[CScreenShot::%s:%d] data: %p %d x %d\n", __func__, __LINE__, pixel_data, xres, yres);
return true;
}
@@ -313,7 +393,7 @@ bool CScreenShot::SaveJpg()
int xres2 = xres1+2;
for (int x = 0; x < xres; x++) {
int x2 = x*3;
- memmove(pixel_data + x2 + xres1, pixel_data + x*4 + y*xres*4, 3);
+ memcpy(pixel_data + x2 + xres1, pixel_data + x*4 + y*xres*4, 3);
SWAP(pixel_data[x2 + xres1], pixel_data[x2 + xres2]);
}
}
diff --git a/src/driver/screenshot.h b/src/driver/screenshot.h
index fefaf7c78..bf17e72bf 100644
--- a/src/driver/screenshot.h
+++ b/src/driver/screenshot.h
@@ -40,6 +40,7 @@ class CScreenShot
unsigned char * pixel_data;
int xres;
int yres;
+ bool extra_osd;
bool get_osd;
bool get_video;
bool scale_to_video;
@@ -61,6 +62,10 @@ class CScreenShot
void runThread();
static void cleanupThread(void *arg);
+#ifdef BOXMODEL_CS_HD2
+ bool mergeOsdScreen(uint32_t dx, uint32_t dy, fb_pixel_t* osdData);
+#endif
+
public:
CScreenShot(const std::string fname = "", screenshot_format_t fmt = CScreenShot::FORMAT_JPG);
~CScreenShot();
diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am
index 1314dad9c..906cda947 100644
--- a/src/gui/Makefile.am
+++ b/src/gui/Makefile.am
@@ -73,6 +73,7 @@ libneutrino_gui_a_SOURCES = \
network_setup.cpp \
nfs.cpp \
opkg_manager.cpp \
+ osd_helpers.cpp \
osd_progressbar_setup.cpp \
osd_setup.cpp \
osdlang_setup.cpp \
diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp
index b35300b78..2ffc959c4 100644
--- a/src/gui/buildinfo.cpp
+++ b/src/gui/buildinfo.cpp
@@ -35,7 +35,7 @@
using namespace std;
-CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, 700, 500, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO)
+CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, CCW_PERCENT 90, CCW_PERCENT 90, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO)
{
initVarBuildInfo();
if (show)
diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp
index 81da16c5e..82dd27cca 100644
--- a/src/gui/components/cc_detailsline.cpp
+++ b/src/gui/components/cc_detailsline.cpp
@@ -61,7 +61,7 @@ void CComponentsDetailsLine::initVarDline( const int& x_pos, const int& y_pos_to
shadow_w = 1;
//CComponentsDetailsLine
- thickness = 4; /* MUST be an even value! */
+ dl_w = CFrameBuffer::getInstance()->scale2Res(3);
cc_body_gradient_enable = false;
}
@@ -101,6 +101,7 @@ void CComponentsDetailsLine::paint(bool do_save_bg)
int y_mark_top = y-h_mark_top/2;
int y_mark_down = y_down-h_mark_down/2;
+ int dx_c = dl_w%2; //correction for odd values
cc_fbdata_t fbdata[] =
{
@@ -108,26 +109,26 @@ void CComponentsDetailsLine::paint(bool do_save_bg)
{true, CC_FBDATA_TYPE_BGSCREEN, x, y_mark_top, width, y_mark_down-y_mark_top+h_mark_down+sw, 0, 0, 0, 0, NULL, NULL, NULL, false},
/* vertical item mark | */
- {true, CC_FBDATA_TYPE_BOX, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x+width-dl_w-sw, y_mark_top, dl_w, h_mark_top, col_body, 0, 0, 0, NULL, NULL, NULL, false},
{true, CC_FBDATA_TYPE_BOX, x+width-sw, y_mark_top+sw, sw, h_mark_top-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
- {true, CC_FBDATA_TYPE_BOX, x+width-thickness, y_mark_top+h_mark_top, thickness, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x+width-dl_w, y_mark_top+h_mark_top, dl_w, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
/* horizontal item line - */
- {true, CC_FBDATA_TYPE_BOX, x, y-thickness/2, width-thickness-sw, thickness, col_body, 0, 0, 0, NULL, NULL, NULL, false},
- {true, CC_FBDATA_TYPE_BOX, x+thickness, y+thickness/2, width-2*thickness-sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x, y-dl_w/2, width-dl_w-sw, dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x+dl_w, y+dl_w/2+dx_c, width-2*dl_w-sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
/* vertical connect line [ */
- {true, CC_FBDATA_TYPE_BOX, x, y+thickness/2, thickness, y_down-y-thickness, col_body, 0, 0, 0, NULL, NULL, NULL, false},
- {true, CC_FBDATA_TYPE_BOX, x+thickness, y+thickness/2+sw, sw, y_down-y-thickness-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x, y+dl_w/2+dx_c, dl_w, y_down-y-dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x+dl_w, y+dl_w/2+dx_c, sw, y_down-y-dl_w, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
/* horizontal info line - */
- {true, CC_FBDATA_TYPE_BOX, x, y_down-thickness/2, width-thickness-sw, thickness, col_body, 0, 0, 0, NULL, NULL, NULL, false},
- {true, CC_FBDATA_TYPE_BOX, x+sw, y_down+thickness/2, width-thickness-2*sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x, y_down-dl_w/2, width-dl_w-sw, dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x+sw, y_down+dl_w/2+dx_c, width-dl_w-2*sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
/* vertical info mark | */
- {true, CC_FBDATA_TYPE_BOX, x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_body, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x+width-dl_w-sw, y_mark_down, dl_w, h_mark_down, col_body, 0, 0, 0, NULL, NULL, NULL, false},
{true, CC_FBDATA_TYPE_BOX, x+width-sw, y_mark_down+sw, sw, h_mark_down-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
- {true, CC_FBDATA_TYPE_BOX, x+width-thickness, y_mark_down+h_mark_down,thickness, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
+ {true, CC_FBDATA_TYPE_BOX, x+width-dl_w, y_mark_down+h_mark_down,dl_w, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
};
for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++)
diff --git a/src/gui/components/cc_detailsline.h b/src/gui/components/cc_detailsline.h
index be07ef57f..66197f51f 100644
--- a/src/gui/components/cc_detailsline.h
+++ b/src/gui/components/cc_detailsline.h
@@ -40,8 +40,8 @@ Not usable as CCItem!
class CComponentsDetailsLine : public CComponents
{
private:
- ///property: line thickness
- int thickness;
+ ///property: line width
+ int dl_w;
///property: lowest y position
int y_down;
///property: height of top marker
@@ -73,6 +73,8 @@ class CComponentsDetailsLine : public CComponents
///set all positions and dimensions of details line at once
void setDimensionsAll(const int& x_pos,const int& y_pos, const int& y_pos_down, const int& h_mark_top_ , const int& h_mark_down_)
{setXPos(x_pos); setYPos(y_pos); setYPosDown(y_pos_down); setHMarkTop(h_mark_top_); setHMarkDown(h_mark_down_);}
+ ///property: set line thickness
+ void setLineWidth(const int& w){dl_w = w;}
///paint all to screen
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp
index 864336d91..0587d90db 100644
--- a/src/gui/components/cc_frm_ext_text.cpp
+++ b/src/gui/components/cc_frm_ext_text.cpp
@@ -31,7 +31,8 @@
#include
-#define DEF_HEIGHT 27
+#define DEF_HEIGHT CFrameBuffer::getInstance()->scale2Res(27)
+#define DEF_WIDTH CFrameBuffer::getInstance()->scale2Res(300)
#define DEF_LABEL_WIDTH_PERCENT 30
using namespace std;
@@ -39,7 +40,7 @@ using namespace std;
CComponentsExtTextForm::CComponentsExtTextForm(CComponentsForm* parent)
{
Font* t_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO];
- initVarExtTextForm(0, 0, 300, t_font->getHeight(), "", "", t_font, parent, CC_SHADOW_OFF, COL_MENUCONTENTINACTIVE_TEXT, COL_MENUCONTENT_TEXT, COL_FRAME_PLUS_0, COL_MENUCONTENT_PLUS_0, COL_SHADOW_PLUS_0);
+ initVarExtTextForm(0, 0, DEF_WIDTH, t_font->getHeight(), "", "", t_font, parent, CC_SHADOW_OFF, COL_MENUCONTENTINACTIVE_TEXT, COL_MENUCONTENT_TEXT, COL_FRAME_PLUS_0, COL_MENUCONTENT_PLUS_0, COL_SHADOW_PLUS_0);
initCCTextItems();
}
@@ -86,8 +87,7 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p
width = w;
//init ccx_label_width and ccx_text_width
//default ccx_label_width = 30% of form width
- ccx_percent_label_w = DEF_LABEL_WIDTH_PERCENT;
- ccx_label_width = ccx_percent_label_w * width/100;
+ ccx_label_width = DEF_LABEL_WIDTH_PERCENT * width/100;
ccx_text_width = width-ccx_label_width;
height = h;
@@ -223,7 +223,8 @@ void CComponentsExtTextForm::initCCTextItems()
void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val)
{
- ccx_percent_label_w = (int)percent_val;
+ ccx_label_width = (int)percent_val * width/100;
+ ccx_text_width = width-ccx_label_width;
initCCTextItems();
}
diff --git a/src/gui/components/cc_frm_ext_text.h b/src/gui/components/cc_frm_ext_text.h
index 837eb8c18..4e37efd0f 100644
--- a/src/gui/components/cc_frm_ext_text.h
+++ b/src/gui/components/cc_frm_ext_text.h
@@ -49,8 +49,6 @@ class CComponentsExtTextForm : public CComponentsForm, public CCTextScreen
int ccx_text_width;
///property: font type of both items (label and text), see also setLabelAndText()
Font* ccx_font;
- ///property: percentage val of label width related to full width, causes fit of text automatically into the available remaining size of item, see also setLabelWidthPercent()
- uint8_t ccx_percent_label_w;
///centered y position of label and text
int y_text;
diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp
index 4d43e08be..39aaffbf8 100644
--- a/src/gui/components/cc_frm_window.cpp
+++ b/src/gui/components/cc_frm_window.cpp
@@ -169,9 +169,13 @@ void CComponentsWindow::initWindowSize()
if (cc_parent)
return;
+ if (width < 0 && width >= -100) //percentage conversion TODO: behavior inside parent
+ width = frameBuffer->getScreenWidth()*abs(width)/100;
if (width == 0 || (unsigned)width > frameBuffer->getScreenWidth())
width = frameBuffer->getScreenWidth();
+ if (height < 0 && height >= -100) //percentage conversion TODO: behavior inside parent
+ height = frameBuffer->getScreenHeight()*abs(height)/100;
if (height == 0 || (unsigned)height > frameBuffer->getScreenHeight())
height = frameBuffer->getScreenHeight();
}
diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h
index f6eb80f20..6dfe67df8 100644
--- a/src/gui/components/cc_frm_window.h
+++ b/src/gui/components/cc_frm_window.h
@@ -29,6 +29,8 @@
#include "cc_frm_header.h"
#include "cc_frm_footer.h"
+#define CCW_PERCENT - //placeholder for negative sign '-', used for discret dimensions parameters
+
//! Sub class of CComponentsForm. Shows a window with prepared items.
/*!
CComponentsWindow provides prepared items like header, footer and a container for
@@ -128,10 +130,56 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes
{
CC_WINDOW_ITEM_HEADER = 0
};
- ///simple constructor for CComponentsWindow, this shows a window over full screen
+
+ enum
+ {
+ CC_WINDOW_LEFT_SIDEBAR = 1,
+ CC_WINDOW_RIGHT_SIDEBAR = 2
+ };
+
+
+ /**simple constructor for CComponentsWindow, this shows a window over full screen
+ * @param[in] parent
+ * @li optional: expects type CComponentsForm * as possible parent object, default = NULL
+ */
CComponentsWindow(CComponentsForm *parent = NULL);
- ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window
+ /**
+ * advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window
+ * @param[in] x_pos
+ * @li expects type const &int, defines x position on screen
+ * @param[in] y_pos
+ * @li expects type const &int, defines y position on screen
+ * @param[in] w
+ * @li expects type const &int, width of window, Note: value = 0 uses full screen
+ * @param[in] h
+ * @li expects type const &int, height of window, Note: value = 0 uses full screen
+ * @param[in] caption
+ * @li optional: expects type const std::string&, defines title of window header
+ * @param[in] iconname
+ * @li optional: expects type const std::string&, defines icon name of window header
+ * @param[in] parent
+ * @li optional: expects type CComponentsForm * as possible parent object, default = NULL
+ * @param[in] shadow_mode
+ * @li optional: expects type int as mode, default = CC_SHADOW_OFF \n
+ * possible values are \n
+ * CC_SHADOW_ON = (CC_SHADOW_RIGHT | CC_SHADOW_BOTTOM | CC_SHADOW_CORNER_BOTTOM_LEFT | CC_SHADOW_CORNER_BOTTOM_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT) \n
+ * Take a look into cc_types.h
+ * @param[in] color_frame
+ * @li optional: expects type fb_pixel_t, defines frame color, default = COL_FRAME_PLUS_0
+ * @param[in] color_body
+ * @li optional: expects type fb_pixel_t, defines color color, default = COL_MENUCONTENT_PLUS_0
+ * @param[in] color_shadow
+ * @li optional: expects type fb_pixel_t, defines shadow color, default = COL_SHADOW_PLUS_0
+ *
+ * @note Discret dimensions parameters: values < 0 to -100 will be interpreted as percent values related to screen.
+ * For better readability please use placeholder 'CCW_PERCENT' as negative sign '-' \n
+ * Example: \n
+ * this inits a window with position x100 y100 on screen with dimensions 700px x 800px \n
+ * CComponentsWindow win(100, 100, 700, 800, "Test window");\n
+ * this inits a window with position x100 y100 on screen with 50% of screen size assigned with discret percental screen dimensions \n
+ * CComponentsWindow win(100, 100, CCW_PERCENT 50, CCW_PERCENT 50, "Test window");
+ */
CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption = "",
const std::string& iconname = "",
@@ -141,7 +189,12 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
- ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales, x_pos or y_pos = 0 will center window
+ /**
+ * advanced constructor for CComponentsWindow, provides parameters for the most required properties
+ * @param[in] locale_text
+ * @li optional: expects type neutrino_locale_t, defines title of window header
+ * @see for other parameters take a look to CComponentsWindow base class above
+ */
CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
neutrino_locale_t locale_text = NONEXISTANT_LOCALE,
const std::string& iconname = "",
@@ -151,92 +204,249 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
- ///add item to body object, also usable is addCCItem() to add items to the windo object
+ /**
+ * Add an item to body object, also usable is addCCItem() to add items to the window object
+ * @param[in] cc_Item
+ * @li expects type CComponentsItem* , defines a cc item
+ * @return Returns item ID
+ * @see Take a look to cc_types.h for possible types.
+ */
int addWindowItem(CComponentsItem* cc_Item);
- ///allow/disallow paint a footer, default true, see also ccw_show_footer, showHeader()
- void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();};
- ///allow/disallow paint a header, default true, see also ccw_show_header, showFooter()
- void showHeader(bool show = true){ccw_show_header = show; initCCWItems();};
+ /**
+ * enable/disable paint of footer, default true
+ * @param[in] show
+ * @li expects type bool, default = true
+ * @see ccw_show_footer, showHeader()
+ */
+ void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();}
- enum
- {
- CC_WINDOW_LEFT_SIDEBAR = 1,
- CC_WINDOW_RIGHT_SIDEBAR = 2
- };
- ///allow/disallow paint a sidebar, default are enabled
+ /**
+ * enable/disable paint of header, default true
+ * @param[in] show
+ * @li expects type bool, default = true
+ * @see ccw_show_header, showFooter()
+ */
+ void showHeader(bool show = true){ccw_show_header = show; initCCWItems();}
+
+ /**
+ * enable/disable paint of sidebar,
+ * @param[in] show
+ * @li optional: expects type const int&, default = enabled
+ */
void enableSidebar(const int& sidbar_type = CC_WINDOW_LEFT_SIDEBAR | CC_WINDOW_RIGHT_SIDEBAR);
- ///set caption in header with string, see also getHeaderObject()
+ /**
+ * sets title text in header
+ * @param[in] text
+ * @li expects type const std::string&, defines title of window header
+ * @param[in] align_mode
+ * @li optional: expects type const cc_title_alignment_t&, defines allignment of title text
+ * @see CTextBox for alignment modes
+ */
void setWindowCaption(const std::string& text, const cc_title_alignment_t& align_mode = DEFAULT_TITLE_ALIGN){ccw_caption = text; ccw_align_mode = align_mode;}
- ///set header text color
+ /**
+ * sets title text in header
+ * @param[in] text
+ * @li expects type neutrino_locale_t
+ * @param[in] align_mode
+ * @li optional: expects type const cc_title_alignment_t&, defines allignment of title text
+ * @see CTextBox for alignment modes
+ */
+ void setWindowCaption(neutrino_locale_t locale_text, const cc_title_alignment_t& align_mode = DEFAULT_TITLE_ALIGN);
+
+ /**
+ * Sets header text color
+ * @param[in] const fb_pixel_t&
+ * @li expects type const fb_pixel_t&
+ */
void setWindowHeaderTextColor(const fb_pixel_t& color){ccw_col_head_text = color;}
- ///set background to header
+
+ /**
+ * Sets header background color
+ * @param[in] const fb_pixel_t&
+ * @li expects type const fb_pixel_t&
+ */
void setWindowHeaderColor(const fb_pixel_t& color){ccw_col_head = color;}
- ///set caption in header from locales, see also getHeaderObject()
- void setWindowCaption(neutrino_locale_t locale_text, const cc_title_alignment_t& align_mode = DEFAULT_TITLE_ALIGN);
- ///set caption alignment, see CTextBox for possible modes
+ /**
+ * sets title text alignment
+ * @param[in] align_mode
+ * @li expects type const cc_title_alignment_t&
+ * @see CTextBox for alignment modes
+ */
void setWindowCaptionAlignment(const cc_title_alignment_t& align_mode){ccw_align_mode = align_mode;};
- ///set icon name in header, see also getHeaderObject()
+ /**
+ * Sets icon name of window header.
+ * @param[in] iconname
+ * @li expects type const std::string&
+ */
void setWindowIcon(const std::string& iconname){ccw_icon_name = iconname; initHeader();};
///set default header icon buttons, see also getHeaderObject()
- void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;};
+ /**
+ * Sets context buttons in window header.
+ * @param[in] buttons
+ * @li expects type const int&
+ * @note possible types are:
+ * CC_BTN_HELP,
+ CC_BTN_INFO,
+ CC_BTN_MENU,
+ CC_BTN_EXIT,
+ CC_BTN_MUTE_ZAP_ACTIVE,
+ CC_BTN_MUTE_ZAP_INACTIVE,
+ CC_BTN_OKAY,
+ CC_BTN_MUTE,
+ CC_BTN_UP,
+ CC_BTN_DOWN,
+ CC_BTN_LEFT,
+ CC_BTN_RIGHT,
+ CC_BTN_FORWARD,
+ CC_BTN_BACKWARD,
+ CC_BTN_PAUSE,
+ CC_BTN_PLAY,
+ CC_BTN_RECORD_ACTIVE,
+ CC_BTN_RECORD_INACTIVE,
+ CC_BTN_RECORD_STOP,
+ * @see cc_frm_header.h for current types
+ */
+ void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;}
- ///returns a pointer to the internal header object, use this to get access to header properities
- CComponentsHeader* getHeaderObject(){return ccw_head;};
+ /**
+ * Gets a pointer to the internal header object, use this to get direct access to header properities
+ * @return CComponentsHeader*
+ */
+ CComponentsHeader* getHeaderObject(){return ccw_head;}
- ///returns a pointer to the internal body object, use this to get access to body properities
- CComponentsForm* getBodyObject(){return ccw_body;};
- ///returns a pointer to the internal footer object, use this to get access to footer properities
- CComponentsFooter* getFooterObject(){return ccw_footer;};
+ /**
+ * Gets a pointer to the internal body object, use this to get access to body properities
+ * @return CComponentsForm*
+ */
+ CComponentsForm* getBodyObject(){return ccw_body;}
- ///set background to footer
+ /**
+ * Gets a pointer to the internal footer object, use this to get access to footer properities
+ * @return CComponentsFooter*
+ */
+ CComponentsFooter* getFooterObject(){return ccw_footer;}
+
+ /**
+ * Sets footer background color
+ * @param[in] color
+ * @li expects type const fb_pixel_t&
+ */
void setWindowFooterColor(const fb_pixel_t& color){ccw_col_footer = color;}
- ///set font for footer buttons
+
+ /**
+ * Sets font for footer buttons
+ * @param[in] font_type
+ * @li expects type Font*
+ */
void setWindowFooterFont(Font* font_type){ccw_button_font = font_type;}
- ///returns a pointer to the internal left side bar object, use this to get access to left sidebar properities
- CComponentsFrmChain* getLeftSidebarObject(){return ccw_left_sidebar;};
- ///returns a pointer to the internal right side bar object, use this to get access to right sidebar properities
- CComponentsFrmChain* getRightSidebarObject(){return ccw_right_sidebar;};
- ///sets width of sidebars
- void setWidthSidebar(const int& sidebar_width){ccw_w_sidebar = sidebar_width; initCCWItems();};
+ /**
+ * Gets a pointer to the internal left side bar object, use this to get access to left sidebar properities
+ * @return CComponentsFrmChain*
+ */
+ CComponentsFrmChain* getLeftSidebarObject(){return ccw_left_sidebar;}
- ///sets current page, NOTE: this is simliar with setCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object
+ /**
+ * Gets a pointer to the internal right side bar object, use this to get access to right sidebar properities
+ * @return CComponentsFrmChain*
+ */
+ CComponentsFrmChain* getRightSidebarObject(){return ccw_right_sidebar;}
+
+ /**
+ * Sets width of sidebars
+ * @param[in] sidebar_width
+ * @li expects type const int&
+ */
+ void setWidthSidebar(const int& sidebar_width){ccw_w_sidebar = sidebar_width; initCCWItems();}
+
+ /**
+ * Sets current page number
+ * @param[in] sidebar_width
+ * @li expects type const int&
+ * @note This is simliar to setCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object.
+ */
void setCurrentPage(const u_int8_t& current_page);
- ///get current page, NOTE: this is simliar with getCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object
+
+ /**
+ * Gets current page number
+ * @return CComponentsFrmChain*
+ * @note This simliar to getCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object
+ */
u_int8_t getCurrentPage();
- ///paint window body items, this paints only the current page, body = page, current page is definied in body object, see setCurrentPage()
+ /**
+ * Paints window body items, this paints only the current page, body = page, current page is definied in body object, see setCurrentPage()
+ * @param[in] do_save_bg
+ * @li optional: expects type bool, default = CC_SAVE_SCREEN_NO (false), sets background save mode
+ */
void paintCurPage(bool do_save_bg = CC_SAVE_SCREEN_NO);
- ///paint defined page of body, parameter number 0...n
+
+ /**
+ * Paints defined page of body, parameter number 0...n
+ * @param[in] page_number
+ * @li expects type const u_int8_t& as page number
+ * @param[in] do_save_bg
+ * @li optional: expects type bool, default = CC_SAVE_SCREEN_NO (false), sets background save mode
+ */
void paintPage(const u_int8_t& page_number, bool do_save_bg = CC_SAVE_SCREEN_NO);
- ///enable/disable page scroll, parameter1 default enabled for up/down keys, only for body!
+
+ /**
+ * enable/disable page scroll
+ * @param[in] mode
+ * @li optional: expects type const int&, default enabled for up/down keys, only for body!
+ */
void enablePageScroll(const int& mode = PG_SCROLL_M_UP_DOWN_KEY);
- ///set width of body scrollbar
+ /**
+ * Sets width of body scrollbar
+ * @param[in] crollbar_width
+ * @li expects type const int&
+ */
void setScrollBarWidth(const int& scrollbar_width);
- ///refresh position and dimension and reinitialize elemenatary properties
+ /**
+ * Reinit position and dimensions and reinitialize mostly elemenatary properties
+ */
void Refresh(){initCCWItems();};
- ///paint all window items, this overwriting paint() from CComponentsForm
+ /**
+ * Paint window
+ * @param[in] do_save_bg
+ * @li optional: expects type bool, sets background save mode
+ */
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
- ///adds additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup
+ /**
+ * Adds an additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup
+ * @param[in] key
+ * @li expects type const neutrino_msg_t&
+ * @see river/rcinput.h for possible keys
+ */
virtual void addExitKey(const neutrino_msg_t& key){getBodyObject()->addExitKey(key);}
- ///remove all current exec keys from current collection, NOTE: use addExitKey() if new exec key is required
+
+ /**
+ * Removes all current exec keys from current collection.
+ * @note use addExitKey() if new exec key is required
+ */
virtual void removeExitKeys(){getBodyObject()->removeExitKeys();}
};
class CComponentsWindowMax : public CComponentsWindow
{
public:
- ///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings
+ /**
+ * Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings
+ * @see for other parameters take a look to CComponentsWindow base class above
+ * @param[in] caption
+ * @li expects type const std::string&, defines title of window header
+ * @see for other parameters take a look to CComponentsWindow base class above
+ */
CComponentsWindowMax( const std::string& caption, const std::string& iconname = "",
CComponentsForm *parent = NULL,
int shadow_mode = CC_SHADOW_OFF,
@@ -244,7 +454,13 @@ class CComponentsWindowMax : public CComponentsWindow
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
- ///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings
+ /**
+ * Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings
+ * @see for other parameters take a look to CComponentsWindow base class above
+ * @param[in] locale_text
+ * @li expects type neutrino_locale_t, defines title of window header
+ * @see for other parameters take a look to CComponentsWindow base class above
+ */
CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "",
CComponentsForm *parent = NULL,
int shadow_mode = CC_SHADOW_OFF,
diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h
index b158bd49e..610402687 100644
--- a/src/gui/components/cc_item_progressbar.h
+++ b/src/gui/components/cc_item_progressbar.h
@@ -157,9 +157,6 @@ class CProgressBar : public CComponentsItem
//set gradient (overides g_settings.theme.progressbar_gradient)
void setGradient(int &gradient) { pb_gradient = &gradient; }
-
- void setXPos(const int& xpos){CCDraw::setXPos(xpos);}
- void setYPos(const int& ypos){CCDraw::setYPos(ypos);}
};
#endif /* __CC_PROGRESSBAR_H__ */
diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h
index 532aba066..1db5ed7aa 100644
--- a/src/gui/components/cc_types.h
+++ b/src/gui/components/cc_types.h
@@ -197,8 +197,8 @@ typedef struct button_label_cc
directKeys(1, CRCInput::RC_nokey){}
} button_label_cc_struct;
-#define CC_WIDTH_MIN 16
-#define CC_HEIGHT_MIN 16
+#define CC_WIDTH_MIN CFrameBuffer::getInstance()->scale2Res(16)
+#define CC_HEIGHT_MIN CC_WIDTH_MIN
#define CC_SHADOW_OFF 0x0
#define CC_SHADOW_RIGHT 0x2
diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp
index 8dd342ed8..d62fa7487 100644
--- a/src/gui/imageinfo.cpp
+++ b/src/gui/imageinfo.cpp
@@ -69,7 +69,7 @@ void CImageInfo::Init(void)
cc_sub_caption = NULL;
b_info = NULL;
btn_red = NULL;
- item_offset = 10;
+ item_offset = OFFSET_INNER_MID;
item_font = NULL;
item_height = 0;
y_tmp = 0;
@@ -355,7 +355,7 @@ void CImageInfo::InitInfos()
y_tmp = 0;
for (size_t i=0; igetWidth(), 0, g_Locale->getText(v_info[i].caption), v_info[i].info_text);
- item->setLabelWidthPercent(20);
+ item->setLabelWidthPercent(15);
if (!item_font){
item_font = item->getFont();
diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp
index 54b485b09..5e770faac 100644
--- a/src/gui/infoclock.cpp
+++ b/src/gui/infoclock.cpp
@@ -75,7 +75,7 @@ void CInfoClock::initCCLockItems()
setClockFormat("%H:%M", "%H %M");
//set height, NOTE: height is strictly bound to settings
- height = g_settings.infoClockFontSize;
+ height = CFrameBuffer::getInstance()->scale2Res(g_settings.infoClockFontSize);
initClockFont(0, height);
// set corner radius depending on clock height
diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp
index 367bca476..693f543c4 100644
--- a/src/gui/infoviewer.cpp
+++ b/src/gui/infoviewer.cpp
@@ -696,15 +696,15 @@ void CInfoViewer::check_channellogo_ca_SettingsChange()
}
}
-void CInfoViewer::showTitle(t_channel_id chid, const bool calledFromNumZap, int epgpos)
+void CInfoViewer::showTitle(t_channel_id chid, const bool calledFromNumZap, int epgpos, bool forcePaintButtonBar/*=false*/)
{
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(chid);
if(channel)
- showTitle(channel, calledFromNumZap, epgpos);
+ showTitle(channel, calledFromNumZap, epgpos, forcePaintButtonBar);
}
-void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap, int epgpos)
+void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap, int epgpos, bool forcePaintButtonBar/*=false*/)
{
if(!calledFromNumZap && !(zap_mode & IV_MODE_DEFAULT))
resetSwitchMode();
@@ -728,7 +728,8 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap
check_channellogo_ca_SettingsChange();
aspectRatio = 0;
last_curr_id = last_next_id = 0;
- showButtonBar = !calledFromNumZap;
+ showButtonBar = (!calledFromNumZap || forcePaintButtonBar);
+ bool noTimer = (calledFromNumZap && forcePaintButtonBar);
fileplay = (ChanNum == 0);
newfreq = true;
@@ -780,7 +781,7 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap
show_dot = !show_dot;
if (showButtonBar) {
- infoViewerBB->paintshowButtonBar();
+ infoViewerBB->paintshowButtonBar(noTimer);
}
int ChanNumWidth = 0;
diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h
index 69d1ce595..d5f605e7a 100644
--- a/src/gui/infoviewer.h
+++ b/src/gui/infoviewer.h
@@ -173,8 +173,8 @@ class CInfoViewer
void start();
void showEpgInfo();
- void showTitle(CZapitChannel * channel, const bool calledFromNumZap = false, int epgpos = 0);
- void showTitle(t_channel_id channel_id, const bool calledFromNumZap = false, int epgpos = 0);
+ void showTitle(CZapitChannel * channel, const bool calledFromNumZap = false, int epgpos = 0, bool forcePaintButtonBar = false);
+ void showTitle(t_channel_id channel_id, const bool calledFromNumZap = false, int epgpos = 0, bool forcePaintButtonBar = false);
void lookAheadEPG(const int ChanNum, const std::string & Channel, const t_channel_id new_channel_id = 0, const bool calledFromNumZap = false); //alpha: fix for nvod subchannel update
void killTitle();
CSectionsdClient::CurrentNextInfo getEPG(const t_channel_id for_channel_id, CSectionsdClient::CurrentNextInfo &info);
diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp
index 6cdd0d85b..cea2656eb 100644
--- a/src/gui/infoviewer_bb.cpp
+++ b/src/gui/infoviewer_bb.cpp
@@ -458,7 +458,7 @@ void CInfoViewerBB::showBBIcons(const int modus, const std::string & icon)
}
}
-void CInfoViewerBB::paintshowButtonBar()
+void CInfoViewerBB::paintshowButtonBar(bool noTimer/*=false*/)
{
if (!is_visible)
return;
@@ -466,7 +466,9 @@ void CInfoViewerBB::paintshowButtonBar()
for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) {
tmp_bbButtonInfoText[i] = "";
}
- g_InfoViewer->sec_timer_id = g_RCInput->addTimer(1*1000*1000, false);
+
+ if (!noTimer)
+ g_InfoViewer->sec_timer_id = g_RCInput->addTimer(1*1000*1000, false);
if (g_settings.infobar_casystem_display < 2)
paint_ca_bar();
diff --git a/src/gui/infoviewer_bb.h b/src/gui/infoviewer_bb.h
index 753e32a2e..765ddc20a 100644
--- a/src/gui/infoviewer_bb.h
+++ b/src/gui/infoviewer_bb.h
@@ -141,7 +141,7 @@ class CInfoViewerBB
void showIcon_Tuner(void);
void showIcon_DD(void);
void showBBButtons(bool paintFooter = false);
- void paintshowButtonBar();
+ void paintshowButtonBar(bool noTimer = false);
void getBBButtonInfo(void);
void reset_allScala(void);
void initBBOffset(void);
diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp
index 9fdc4f188..7a881f479 100644
--- a/src/gui/moviebrowser/mb.cpp
+++ b/src/gui/moviebrowser/mb.cpp
@@ -2755,7 +2755,7 @@ void CMovieBrowser::updateDir(void)
void CMovieBrowser::loadAllTsFileNamesFromStorage(void)
{
//TRACE("[mb]->loadAllTsFileNamesFromStorage \n");
- int i,size;
+ size_t i,size;
m_movieSelectionHandler = NULL;
m_dirNames.clear();
@@ -2766,8 +2766,10 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void)
size = m_dir.size();
for (i=0; i < size;i++)
{
- if (*m_dir[i].used == true)
+ if (*m_dir[i].used == true){
+ OnGlobalProgress(i, size, m_dir[i].name);
loadTsFileNamesFromDir(m_dir[i].name);
+ }
}
TRACE("[mb] Dir%d, Files:%d\n", (int)m_dirNames.size(), (int)m_vMovieInfo.size());
@@ -2875,7 +2877,8 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname)
CFileList flist;
if (readDir(dirname, &flist) == true)
{
- for (size_t i = 0; i < flist.size(); i++)
+ size_t count = flist.size();
+ for (size_t i = 0; i < count; i++)
{
if (S_ISDIR(flist[i].Mode)) {
if (m_settings.ts_only || !CFileBrowser::checkBD(flist[i])) {
@@ -2886,7 +2889,8 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname)
} else {
result |= addFile(flist[i], dirItNr);
}
- OnLoadFile(i, flist.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES));
+ if (result)
+ OnLocalProgress(i, count, dirname );
}
//result = true;
}
@@ -3125,7 +3129,10 @@ void CMovieBrowser::loadMovies(bool doRefresh)
{
TRACE("[mb] loadMovies: \n");
- CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, 500, 150, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile);
+ struct timeval t1, t2;
+ gettimeofday(&t1, NULL);
+
+ CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, CCW_PERCENT 50, CCW_PERCENT 10, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnProgress : &OnLocalProgress, &OnGlobalProgress);
loadBox.enableShadow();
loadBox.paint();
@@ -3140,6 +3147,11 @@ void CMovieBrowser::loadMovies(bool doRefresh)
}
m_file_info_stale = false;
+ gettimeofday(&t2, NULL);
+ uint64_t duration = ((t2.tv_sec * 1000000ULL + t2.tv_usec) - (t1.tv_sec * 1000000ULL + t1.tv_usec)) / 1000ULL;
+ if (duration)
+ fprintf(stderr, "\033[33m[CMovieBrowser] %s: %" PRIu64 " ms to scan movies \033[0m\n",__func__, duration);
+
loadBox.hide();
if (doRefresh)
diff --git a/src/gui/moviebrowser/mb.h b/src/gui/moviebrowser/mb.h
index 607528821..bbaecf735 100644
--- a/src/gui/moviebrowser/mb.h
+++ b/src/gui/moviebrowser/mb.h
@@ -57,6 +57,7 @@
#include
#include
#include
+#include
#define MAX_NUMBER_OF_BOOKMARK_ITEMS MI_MOVIE_BOOK_USER_MAX // we just use the same size as used in Movie info (MAX_NUMBER_OF_BOOKMARK_ITEMS is used for the number of menu items)
#define MOVIEBROWSER_SETTINGS_FILE CONFIGDIR "/moviebrowser.conf"
@@ -133,7 +134,7 @@ class CYTCacheSelectorTarget : public CMenuTarget
};
// Priorities for Developmemt: P1: critical feature, P2: important feature, P3: for next release, P4: looks nice, lets see
-class CMovieBrowser : public CMenuTarget
+class CMovieBrowser : public CMenuTarget, public CProgressSignals
{
friend class CYTCacheSelectorTarget;
@@ -362,7 +363,6 @@ class CMovieBrowser : public CMenuTarget
void clearSelection();
bool supportedExtension(CFile &file);
bool addFile(CFile &file, int dirItNr);
- sigc::signal OnLoadFile;
};
// I tried a lot to use the menu.cpp as ListBox selection, and I got three solution which are all garbage.
diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp
index 267b6f629..d108e5473 100644
--- a/src/gui/movieplayer.cpp
+++ b/src/gui/movieplayer.cpp
@@ -40,6 +40,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -150,6 +151,8 @@ void CMoviePlayerGui::Init(void)
{
playing = false;
stopped = true;
+ currentVideoSystem = -1;
+ currentOsdResolution = 0;
frameBuffer = CFrameBuffer::getInstance();
@@ -226,6 +229,12 @@ void CMoviePlayerGui::cutNeutrino()
if (playing)
return;
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+ COsdHelpers *coh = COsdHelpers::getInstance();
+ currentVideoSystem = coh->getVideoSystem();
+ currentOsdResolution = coh->getOsdResolution();
+#endif
+
playing = true;
/* set g_InfoViewer update timer to 1 sec, should be reset to default from restoreNeutrino->set neutrino mode */
if (!isWebTV)
@@ -250,6 +259,19 @@ void CMoviePlayerGui::restoreNeutrino()
if (!playing)
return;
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+ if ((currentVideoSystem > -1) &&
+ (g_settings.video_Mode == VIDEO_STD_AUTO) &&
+ (g_settings.enabled_auto_modes[currentVideoSystem] == 1)) {
+ COsdHelpers *coh = COsdHelpers::getInstance();
+ if (currentVideoSystem != coh->getVideoSystem()) {
+ coh->setVideoSystem(currentVideoSystem, false);
+ coh->changeOsdResolution(currentOsdResolution, false, true);
+ }
+ currentVideoSystem = -1;
+ }
+#endif
+
playing = false;
if (isUPNP)
diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h
index 1e15997d7..0b6cd507d 100644
--- a/src/gui/movieplayer.h
+++ b/src/gui/movieplayer.h
@@ -118,6 +118,8 @@ class CMoviePlayerGui : public CMenuTarget
int startposition;
int position;
int duration;
+ int currentVideoSystem;
+ uint32_t currentOsdResolution;
unsigned short numpida;
unsigned short vpid;
diff --git a/src/gui/osd_helpers.cpp b/src/gui/osd_helpers.cpp
new file mode 100644
index 000000000..2675cffef
--- /dev/null
+++ b/src/gui/osd_helpers.cpp
@@ -0,0 +1,224 @@
+
+#ifdef HAVE_CONFIG_H
+#include
+#endif
+
+#include
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+extern CInfoClock *InfoClock;
+extern CTimeOSD *FileTimeOSD;
+extern cVideo *videoDecoder;
+
+COsdHelpers::COsdHelpers()
+{
+ g_settings_osd_resolution_save = 0;
+}
+
+COsdHelpers::~COsdHelpers()
+{
+}
+
+COsdHelpers* COsdHelpers::getInstance()
+{
+ static COsdHelpers* osdh = NULL;
+ if(!osdh)
+ osdh = new COsdHelpers();
+
+ return osdh;
+}
+
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+void COsdHelpers::changeOsdResolution(uint32_t mode, bool automode/*=false*/, bool forceOsdReset/*=false*/)
+{
+ size_t idx = 0;
+ bool resetOsd = false;
+ uint32_t modeNew;
+
+ CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
+
+ if (automode) {
+ if (g_settings.video_Mode == VIDEO_STD_AUTO)
+ modeNew = OSDMODE_1080;
+ else
+ modeNew = g_settings_osd_resolution_save;
+ }
+ else {
+ modeNew = mode;
+ }
+
+ int videoSystem = getVideoSystem();
+
+ if ((g_settings.video_Mode == VIDEO_STD_AUTO) &&
+ (g_settings.enabled_auto_modes[videoSystem] == 1) &&
+ (!isVideoSystem1080(videoSystem)))
+ modeNew = OSDMODE_720;
+
+// if (!isVideoSystem1080(videoSystem))
+// modeNew = OSDMODE_720;
+
+ idx = frameBuffer->getIndexOsdResolution(modeNew);
+ resetOsd = (modeNew != getOsdResolution()) ? true : false;
+#if 1
+ printf(">>>>>[%s:%d] osd mode: %s => %s, automode: %s, forceOsdReset: %s\n", __func__, __LINE__,
+ (g_settings.osd_resolution == OSDMODE_720)?"OSDMODE_720":"OSDMODE_1080",
+ (modeNew == OSDMODE_720)?"OSDMODE_720":"OSDMODE_1080",
+ (automode)?"true":"false",
+ (forceOsdReset)?"true":"false");
+#endif
+ if (forceOsdReset)
+ resetOsd = true;
+
+ if (frameBuffer->fullHdAvailable()) {
+ if (frameBuffer->osd_resolutions.empty())
+ return;
+
+ bool ivVisible = false;
+ if (g_InfoViewer && g_InfoViewer->is_visible) {
+ g_InfoViewer->killTitle();
+ ivVisible = true;
+ }
+
+ int switchFB = frameBuffer->setMode(frameBuffer->osd_resolutions[idx].xRes,
+ frameBuffer->osd_resolutions[idx].yRes,
+ frameBuffer->osd_resolutions[idx].bpp);
+
+ if (switchFB == 0) {
+//printf("\n>>>>>[%s:%d] New res: %dx%dx%d\n \n", __func__, __LINE__, resW, resH, bpp);
+ g_settings.osd_resolution = modeNew;
+ if (InfoClock)
+ InfoClock->enableInfoClock(false);
+ frameBuffer->Clear();
+ if (resetOsd) {
+ CNeutrinoApp::getInstance()->setScreenSettings();
+ CNeutrinoApp::getInstance()->SetupFonts(CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT);
+ CVolumeHelper::getInstance()->refresh();
+ if (InfoClock)
+ CInfoClock::getInstance()->ClearDisplay();
+ if (FileTimeOSD)
+ FileTimeOSD->Init();
+ if (CNeutrinoApp::getInstance()->channelList)
+ CNeutrinoApp::getInstance()->channelList->ResetModules();
+ }
+ if (InfoClock)
+ InfoClock->enableInfoClock(true);
+ }
+ if (g_InfoViewer) {
+ g_InfoViewer->ResetModules();
+ g_InfoViewer->start();
+ }
+ if (ivVisible) {
+ CNeutrinoApp::getInstance()->StopSubtitles();
+ g_InfoViewer->showTitle(CNeutrinoApp::getInstance()->channelList->getActiveChannel(), true, 0, true);
+ CNeutrinoApp::getInstance()->StartSubtitles();
+ }
+ }
+}
+#else
+void COsdHelpers::changeOsdResolution(uint32_t, bool, bool)
+{
+}
+#endif
+
+int COsdHelpers::isVideoSystem1080(int res)
+{
+ if ((res == VIDEO_STD_1080I60) ||
+ (res == VIDEO_STD_1080I50) ||
+ (res == VIDEO_STD_1080P30) ||
+ (res == VIDEO_STD_1080P24) ||
+ (res == VIDEO_STD_1080P25))
+ return true;
+
+#ifdef BOXMODEL_CS_HD2
+ if ((res == VIDEO_STD_1080P50) ||
+ (res == VIDEO_STD_1080P60) ||
+ (res == VIDEO_STD_1080P2397) ||
+ (res == VIDEO_STD_1080P2997))
+ return true;
+#endif
+
+#if 0
+ /* for testing only */
+ if (res == VIDEO_STD_720P50)
+ return true;
+#endif
+
+ return false;
+}
+
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+int COsdHelpers::getVideoSystem()
+{
+ return videoDecoder->GetVideoSystem();
+}
+#else
+int COsdHelpers::getVideoSystem()
+{
+ return g_settings.video_Mode;
+}
+#endif
+
+uint32_t COsdHelpers::getOsdResolution()
+{
+ CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
+ if (frameBuffer->osd_resolutions.size() == 1)
+ return 0;
+
+ uint32_t yRes = frameBuffer->getScreenHeight(true);
+ for (size_t i = 0; i < frameBuffer->osd_resolutions.size(); i++) {
+ if (frameBuffer->osd_resolutions[i].yRes == yRes)
+ return frameBuffer->osd_resolutions[i].mode;
+ }
+ return 0;
+}
+
+#define DEBUGINFO_SETVIDEOSYSTEM
+
+int COsdHelpers::setVideoSystem(int newSystem, bool remember/* = true*/)
+{
+ if ((newSystem < 0) || (newSystem > VIDEO_STD_MAX))
+ return -1;
+
+ if (newSystem == getVideoSystem())
+ return 0;
+
+#ifdef DEBUGINFO_SETVIDEOSYSTEM
+ int fd = CFrameBuffer::getInstance()->getFileHandle();
+ fb_var_screeninfo var;
+ fb_fix_screeninfo fix;
+
+ ioctl(fd, FBIOGET_VSCREENINFO, &var);
+ ioctl(fd, FBIOGET_FSCREENINFO, &fix);
+ printf(">>>>>[%s - %s:%d] before SetVideoSystem:\n"
+ " var.xres : %4d, var.yres : %4d, var.yres_virtual: %4d\n"
+ " fix.line_length : %4d, fix.smem_len: %d Byte\n",
+ __path_file__, __func__, __LINE__,
+ var.xres, var.yres, var.yres_virtual,
+ fix.line_length, fix.smem_len);
+#endif
+
+ int ret = videoDecoder->SetVideoSystem(newSystem, remember);
+
+#ifdef DEBUGINFO_SETVIDEOSYSTEM
+ ioctl(fd, FBIOGET_VSCREENINFO, &var);
+ ioctl(fd, FBIOGET_FSCREENINFO, &fix);
+ printf(">>>>>[%s - %s:%d] after SetVideoSystem:\n"
+ " var.xres : %4d, var.yres : %4d, var.yres_virtual: %4d\n"
+ " fix.line_length : %4d, fix.smem_len: %d Byte\n",
+ __path_file__, __func__, __LINE__,
+ var.xres, var.yres, var.yres_virtual,
+ fix.line_length, fix.smem_len);
+#endif
+
+ return ret;
+}
diff --git a/src/gui/osd_helpers.h b/src/gui/osd_helpers.h
new file mode 100644
index 000000000..9c78886f0
--- /dev/null
+++ b/src/gui/osd_helpers.h
@@ -0,0 +1,29 @@
+
+#ifndef __osd_helpers__
+#define __osd_helpers__
+
+enum {
+ OSDMODE_720 = 0,
+ OSDMODE_1080 = 1
+};
+
+class COsdHelpers
+{
+ private:
+
+ public:
+ COsdHelpers();
+ ~COsdHelpers();
+ static COsdHelpers* getInstance();
+
+ int g_settings_osd_resolution_save;
+
+ void changeOsdResolution(uint32_t mode, bool automode=false, bool forceOsdReset=false);
+ int isVideoSystem1080(int res);
+ int getVideoSystem();
+ uint32_t getOsdResolution();
+ int setVideoSystem(int newSystem, bool remember = true);
+};
+
+
+#endif //__osd_helpers__
diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp
index 99eae1590..06122d93a 100644
--- a/src/gui/osd_setup.cpp
+++ b/src/gui/osd_setup.cpp
@@ -39,6 +39,7 @@
#include
#include "osd_setup.h"
+#include "osd_helpers.h"
#include "themes.h"
#include "screensetup.h"
#include "osdlang_setup.h"
@@ -392,12 +393,11 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
return res;
}
-
#define OSD_PRESET_OPTIONS_COUNT 2
-const CMenuOptionChooser::keyval OSD_PRESET_OPTIONS[OSD_PRESET_OPTIONS_COUNT] =
+const CMenuOptionChooser::keyval_ext OSD_PRESET_OPTIONS[] =
{
- { 0, LOCALE_COLORMENU_SD_PRESET },
- { 1, LOCALE_COLORMENU_HD_PRESET }
+ { COsdSetup::PRESET_CRT, NONEXISTANT_LOCALE, "CRT" },
+ { COsdSetup::PRESET_LCD, NONEXISTANT_LOCALE, "LCD" }
};
#define INFOBAR_CASYSTEM_MODE_OPTION_COUNT 4
@@ -644,11 +644,41 @@ int COsdSetup::showOsdSetup()
osd_menu->addItem(GenericMenuSeparatorLine);
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+ // osd resolution
+ size_t resCount = frameBuffer->osd_resolutions.size();
+ struct CMenuOptionChooser::keyval_ext kext[resCount];
+ char valname[resCount][255];
+ if (resCount > 0) {
+ for (size_t i = 0; i < resCount; i++) {
+ kext[i].key = i;
+ kext[i].value = NONEXISTANT_LOCALE;
+ snprintf(valname[i], sizeof(valname[resCount]), "%dx%d", frameBuffer->osd_resolutions[i].xRes, frameBuffer->osd_resolutions[i].yRes);
+ kext[i].valname = valname[i];
+ }
+ }
+ else {
+ kext[0].key = 0;
+ kext[0].value = NONEXISTANT_LOCALE;
+ kext[0].valname = "-";
+ resCount = 1;
+ }
+ int videoSystem = COsdHelpers::getInstance()->getVideoSystem();
+ bool enable = ((resCount > 1) &&
+ COsdHelpers::getInstance()->isVideoSystem1080(videoSystem) &&
+ (g_settings.video_Mode != VIDEO_STD_AUTO));
+ CMenuOptionChooser * osd_res = new CMenuOptionChooser(LOCALE_COLORMENU_OSD_RESOLUTION, &g_settings.osd_resolution, kext, resCount, enable, this);
+ osd_res->setHint("", LOCALE_MENU_HINT_OSD_RESOLUTION);
+ osd_menu->addItem(osd_res);
+#endif
+
//monitor
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_COLORMENU_OSD_PRESET, &g_settings.screen_preset, OSD_PRESET_OPTIONS, OSD_PRESET_OPTIONS_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_OSD_PRESET);
osd_menu->addItem(mc);
+ osd_menu->addItem(GenericMenuSeparatorLine);
+
// round corners
mc = new CMenuOptionChooser(LOCALE_EXTRA_ROUNDED_CORNERS, &g_settings.rounded_corners, MENU_CORNERSETTINGS_TYPE_OPTIONS, MENU_CORNERSETTINGS_TYPE_OPTION_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_ROUNDED_CORNERS);
@@ -1357,16 +1387,56 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
int preset = * (int *) data;
printf("preset %d (setting %d)\n", preset, g_settings.screen_preset);
- g_settings.screen_StartX = g_settings.screen_preset ? g_settings.screen_StartX_lcd : g_settings.screen_StartX_crt;
- g_settings.screen_StartY = g_settings.screen_preset ? g_settings.screen_StartY_lcd : g_settings.screen_StartY_crt;
- g_settings.screen_EndX = g_settings.screen_preset ? g_settings.screen_EndX_lcd : g_settings.screen_EndX_crt;
- g_settings.screen_EndY = g_settings.screen_preset ? g_settings.screen_EndY_lcd : g_settings.screen_EndY_crt;
+ CNeutrinoApp::getInstance()->setScreenSettings();
osd_menu->hide();
if (g_InfoViewer == NULL)
g_InfoViewer = new CInfoViewer;
g_InfoViewer->changePB();
return true;
}
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+ else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_OSD_RESOLUTION))
+ {
+ if (frameBuffer->osd_resolutions.empty())
+ return true;
+ osd_menu->hide();
+ uint32_t osd_mode = (uint32_t)*(int*)data;
+ COsdHelpers::getInstance()->g_settings_osd_resolution_save = osd_mode;
+ COsdHelpers::getInstance()->changeOsdResolution(osd_mode);
+#if 0
+ if (frameBuffer->fullHdAvailable()) {
+ if (frameBuffer->osd_resolutions.empty())
+ return true;
+
+ size_t index = (size_t)*(int*)data;
+ size_t resCount = frameBuffer->osd_resolutions.size();
+ if (index >= resCount)
+ index = 0;
+
+ uint32_t resW = frameBuffer->osd_resolutions[index].xRes;
+ uint32_t resH = frameBuffer->osd_resolutions[index].yRes;
+ uint32_t bpp = frameBuffer->osd_resolutions[index].bpp;
+ int switchFB = frameBuffer->setMode(resW, resH, bpp);
+
+ if (switchFB == 0) {
+//printf("\n>>>>>[%s:%d] New res: %dx%dx%d\n \n", __func__, __LINE__, resW, resH, bpp);
+ osd_menu->hide();
+ frameBuffer->Clear();
+ CNeutrinoApp::getInstance()->setScreenSettings();
+ CNeutrinoApp::getInstance()->SetupFonts(CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT);
+ CVolumeHelper::getInstance()->refresh();
+ CInfoClock::getInstance()->ClearDisplay();
+ FileTimeOSD->Init();
+ if (CNeutrinoApp::getInstance()->channelList)
+ CNeutrinoApp::getInstance()->channelList->ResetModules();
+ if (g_InfoViewer)
+ g_InfoViewer->ResetModules();
+ }
+ }
+#endif
+ return true;
+ }
+#endif
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_ROUNDED_CORNERS)) {
osd_menu->hide();
g_settings.rounded_corners = * (int*) data;
diff --git a/src/gui/osd_setup.h b/src/gui/osd_setup.h
index 18adc6311..cdea56535 100644
--- a/src/gui/osd_setup.h
+++ b/src/gui/osd_setup.h
@@ -96,6 +96,12 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
INFOBAR_LOGO_FRAMED,
INFOBAR_LOGO_SHADED
};
+
+ enum
+ {
+ PRESET_CRT,
+ PRESET_LCD
+ };
COsdSetup(int wizard_mode = SNeutrinoSettings::WIZARD_OFF);
~COsdSetup();
diff --git a/src/gui/screensetup.cpp b/src/gui/screensetup.cpp
index b1327fed2..207020eab 100644
--- a/src/gui/screensetup.cpp
+++ b/src/gui/screensetup.cpp
@@ -37,6 +37,7 @@
#include
#include
+#include
#include
#include
@@ -109,27 +110,61 @@ int CScreenSetup::exec(CMenuTarget* parent, const std::string &)
switch ( msg )
{
- case CRCInput::RC_ok:
+ case CRCInput::RC_ok: {
// abspeichern
g_settings.screen_StartX = x_coord[0];
g_settings.screen_EndX = x_coord[1];
g_settings.screen_StartY = y_coord[0];
g_settings.screen_EndY = y_coord[1];
- if(g_settings.screen_preset) {
- g_settings.screen_StartX_lcd = g_settings.screen_StartX;
- g_settings.screen_StartY_lcd = g_settings.screen_StartY;
- g_settings.screen_EndX_lcd = g_settings.screen_EndX;
- g_settings.screen_EndY_lcd = g_settings.screen_EndY;
- } else {
- g_settings.screen_StartX_crt = g_settings.screen_StartX;
- g_settings.screen_StartY_crt = g_settings.screen_StartY;
- g_settings.screen_EndX_crt = g_settings.screen_EndX;
- g_settings.screen_EndY_crt = g_settings.screen_EndY;
+ switch (g_settings.osd_resolution) {
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+ case 1:
+ {
+ switch (g_settings.screen_preset) {
+ case COsdSetup::PRESET_CRT:
+ g_settings.screen_StartX_crt_1 = g_settings.screen_StartX;
+ g_settings.screen_StartY_crt_1 = g_settings.screen_StartY;
+ g_settings.screen_EndX_crt_1 = g_settings.screen_EndX;
+ g_settings.screen_EndY_crt_1 = g_settings.screen_EndY;
+ break;
+ case COsdSetup::PRESET_LCD:
+ default:
+ g_settings.screen_StartX_lcd_1 = g_settings.screen_StartX;
+ g_settings.screen_StartY_lcd_1 = g_settings.screen_StartY;
+ g_settings.screen_EndX_lcd_1 = g_settings.screen_EndX;
+ g_settings.screen_EndY_lcd_1 = g_settings.screen_EndY;
+ break;
+ }
+ }
+ break;
+#endif
+ case 0:
+ default:
+ {
+ switch (g_settings.screen_preset) {
+ case COsdSetup::PRESET_CRT:
+ g_settings.screen_StartX_crt_0 = g_settings.screen_StartX;
+ g_settings.screen_StartY_crt_0 = g_settings.screen_StartY;
+ g_settings.screen_EndX_crt_0 = g_settings.screen_EndX;
+ g_settings.screen_EndY_crt_0 = g_settings.screen_EndY;
+ break;
+ case COsdSetup::PRESET_LCD:
+ default:
+ g_settings.screen_StartX_lcd_0 = g_settings.screen_StartX;
+ g_settings.screen_StartY_lcd_0 = g_settings.screen_StartY;
+ g_settings.screen_EndX_lcd_0 = g_settings.screen_EndX;
+ g_settings.screen_EndY_lcd_0 = g_settings.screen_EndY;
+ break;
+ }
+ }
+ break;
}
+
if (g_InfoViewer) /* recalc infobar position */
g_InfoViewer->start();
loop = false;
break;
+ }
case CRCInput::RC_home:
if ( ( ( g_settings.screen_StartX != x_coord[0] ) ||
diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp
index d99ab6818..b799c4c3f 100644
--- a/src/gui/streaminfo2.cpp
+++ b/src/gui/streaminfo2.cpp
@@ -527,18 +527,20 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
if(!channel)
return;
- int array[6]={g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_RESOLUTION)),
+ int array[]= {g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_RESOLUTION)),
+ g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_VIDEOSYSTEM)),
+ g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_OSD_RESOLUTION)),
g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_ARATIO)),
g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_BITRATE)),
g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE)),
g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE)),
g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_SCANTS_FREQDATA))};
- for(i=0 ; i<6; i++) {
+ for(i=0 ; i<(int)(sizeof(array)/sizeof(array[0])); i++) {
if(spaceoffset < array[i])
spaceoffset = array[i];
}
- spaceoffset += g_Font[font_info]->getRenderWidth(" ");
+ spaceoffset += g_Font[font_info]->getRenderWidth(" ");
average_bitrate_offset = spaceoffset;
int box_width2 = box_width-(spaceoffset+xpos);
@@ -557,7 +559,30 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
snprintf(buf, sizeof(buf), "%dx%d", xres, yres);
g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width2, buf, COL_MENUCONTENT_TEXT);
- //audio rate
+#if HAVE_COOL_HARDWARE
+ //Video SYSTEM
+ ypos += iheight;
+ snprintf(buf, sizeof(buf), "%s:", g_Locale->getText (LOCALE_STREAMINFO_VIDEOSYSTEM));
+ g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT);
+ cs_vs_format_t vsfn;
+ videoDecoder->GetVideoSystemFormatName(&vsfn);
+#ifdef BOXMODEL_CS_HD1
+ snprintf(buf, sizeof(buf), "HDMI: %s%s", vsfn.format,
+#else
+ snprintf(buf, sizeof(buf), "HDMI: %s, Scart/Cinch: %s%s", vsfn.formatHD, vsfn.formatSD,
+#endif
+ (g_settings.video_Mode == VIDEO_STD_AUTO)?" (AUTO)":"");
+ g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width2, buf, COL_MENUCONTENT_TEXT);
+#endif
+
+ //OSD RESOLUTION
+ ypos += iheight;
+ snprintf(buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_STREAMINFO_OSD_RESOLUTION));
+ g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT);
+ snprintf(buf, sizeof(buf), "%dx%d", frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true));
+ g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width2, buf, COL_MENUCONTENT_TEXT);
+
+ //Aspect Ratio
ypos += iheight;
snprintf(buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_STREAMINFO_ARATIO));
g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT);
diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp
index 9d1865966..9f6637d6b 100644
--- a/src/gui/test_menu.cpp
+++ b/src/gui/test_menu.cpp
@@ -50,6 +50,7 @@
#include
#include
+#include
#include
#include
#include
@@ -836,6 +837,55 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
}
return res;
}
+ else if (actionKey == "progress_window"){
+ //classical
+ CProgressWindow pw0("Progress Single Test");
+ pw0.paint();
+ size_t max = 3;
+ for(size_t i = 0; i< max; i++){
+ pw0.showStatus(i, max, to_string(i));
+ sleep(1);
+ }
+ pw0.hide();
+
+ CProgressWindow pw1("Progress Local/Global Test");
+ pw1.paint();
+ for(size_t i = 0; i< max; i++){
+ pw1.showGlobalStatus(i, max, to_string(i));
+ for(size_t j = 0; j< max; j++){
+ pw1.showLocalStatus(j, max, to_string(j));
+ sleep(1);
+ }
+ }
+ pw1.hide();
+
+ //with signals
+ sigc::signal OnProgress0, OnProgress1;
+ CProgressWindow pw2("Progress Single Test -> single Signal", CCW_PERCENT 50, CCW_PERCENT 30, &OnProgress0);
+ pw2.paint();
+
+ for(size_t i = 0; i< max; i++){
+ OnProgress0(i, max, to_string(i));
+ sleep(1);
+ }
+ pw2.hide();
+
+ OnProgress0.clear();
+ OnProgress1.clear();
+ CProgressWindow pw3("Progress Single Test -> dub Signal", CCW_PERCENT 50, CCW_PERCENT 20, NULL, &OnProgress0, &OnProgress1);
+ pw3.paint();
+
+ for(size_t i = 0; i< max; i++){
+ OnProgress1(i, max, to_string(i));
+ for(size_t j = 0; j< max; j++){
+ OnProgress0(j, max, to_string(j));
+ sleep(1);
+ }
+ }
+ pw3.hide();
+
+ return menu_return::RETURN_REPAINT;
+ }
else if (actionKey == "hintbox_test")
{
ShowHint("Testmenu: Hintbox popup test", "Test for HintBox,\nPlease press any key or wait some seconds! ...", 700, 10, NULL, NEUTRINO_ICON_HINT_IMAGEINFO, CComponentsHeader::CC_BTN_EXIT);
@@ -1080,6 +1130,7 @@ int CTestMenu::showTestMenu()
void CTestMenu::showCCTests(CMenuWidget *widget)
{
widget->addIntroItems();
+ widget->addItem(new CMenuForwarder("Progress Window", true, NULL, this, "progress_window"));
widget->addItem(new CMenuForwarder("Running Clock", true, NULL, this, "running_clock"));
widget->addItem(new CMenuForwarder("Clock", true, NULL, this, "clock"));
widget->addItem(new CMenuForwarder("Button", true, NULL, this, "button"));
diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp
index 9a013a6af..6848628ae 100644
--- a/src/gui/videosettings.cpp
+++ b/src/gui/videosettings.cpp
@@ -44,6 +44,7 @@
#include
#include
#include
+#include
#include
#include
@@ -412,7 +413,8 @@ void CVideoSettings::setVideoSettings()
void CVideoSettings::setupVideoSystem(bool do_ask)
{
printf("[neutrino VideoSettings] %s setup videosystem...\n", __FUNCTION__);
- videoDecoder->SetVideoSystem(g_settings.video_Mode); //FIXME
+ COsdHelpers::getInstance()->setVideoSystem(g_settings.video_Mode); //FIXME
+ COsdHelpers::getInstance()->changeOsdResolution(0, true, false);
if (do_ask)
{
@@ -422,7 +424,8 @@ void CVideoSettings::setupVideoSystem(bool do_ask)
if (ShowMsg(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_VIDEO_MODE_OK), CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_INFO) != CMsgBox::mbrYes)
{
g_settings.video_Mode = prev_video_mode;
- videoDecoder->SetVideoSystem(g_settings.video_Mode);
+ COsdHelpers::getInstance()->setVideoSystem(g_settings.video_Mode);
+ COsdHelpers::getInstance()->changeOsdResolution(0, true, false);
}
else
prev_video_mode = g_settings.video_Mode;
@@ -606,7 +609,8 @@ void CVideoSettings::nextMode(void)
else if(res == messages_return::cancel_info) {
g_settings.video_Mode = VIDEOMENU_VIDEOMODE_OPTIONS[curmode].key;
//CVFD::getInstance()->ShowText(text);
- videoDecoder->SetVideoSystem(g_settings.video_Mode);
+ COsdHelpers::getInstance()->setVideoSystem(g_settings.video_Mode);
+ COsdHelpers::getInstance()->changeOsdResolution(0, true, false);
//return;
disp_cur = 1;
}
diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp
index 9f9921ad6..1c79b22fa 100644
--- a/src/gui/volumebar.cpp
+++ b/src/gui/volumebar.cpp
@@ -53,7 +53,7 @@ void CVolumeBar::initVarVolumeBar()
col_body = COL_MENUCONTENT_PLUS_0;
corner_rad = CORNER_RADIUS_MID;
vb_item_offset = OFFSET_INNER_SMALL;
- height = g_settings.volume_size; //default height
+ height = CFrameBuffer::getInstance()->scale2Res(g_settings.volume_size);
//assume volume value as pointer to global setting
vb_vol = &g_settings.current_volume;
@@ -91,7 +91,7 @@ void CVolumeBar::initVolumeBarSize()
//vb_digit_w += corner_rad/2;
//scale
- vb_pbw = 200;
+ vb_pbw = CFrameBuffer::getInstance()->scale2Res(200);
vb_pbh = height-4*vb_item_offset;
//result for width
@@ -362,7 +362,7 @@ void CVolumeHelper::initVolBarSize()
icon_height += 2;
icon_width += 8;
g_settings.volume_size = max(g_settings.volume_size, icon_height);
- vol_height = g_settings.volume_size;
+ vol_height = CFrameBuffer::getInstance()->scale2Res(g_settings.volume_size);
if (g_settings.volume_digits) {
CNeutrinoFonts *cnf = CNeutrinoFonts::getInstance();
diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp
index e0eec64f8..e0b6bfd4c 100644
--- a/src/gui/widget/hintbox.cpp
+++ b/src/gui/widget/hintbox.cpp
@@ -67,7 +67,7 @@ CHintBox::CHintBox( const neutrino_locale_t Caption,
const char * const Picon,
const int& header_buttons,
const int& text_mode,
- const int& indent): CComponentsWindow( 0, 0, width,
+ const int& indent): CComponentsWindow( 0, 0, Width,
HINTBOX_MIN_HEIGHT,
Caption,
string(Icon == NULL ? "" : Icon),
@@ -84,7 +84,7 @@ CHintBox::CHintBox( const char * const Caption,
const char * const Picon,
const int& header_buttons,
const int& text_mode,
- const int& indent):CComponentsWindow( 0, 0, width,
+ const int& indent):CComponentsWindow( 0, 0, Width,
HINTBOX_MIN_HEIGHT,
Caption,
string(Icon == NULL ? "" : Icon),
@@ -101,7 +101,7 @@ CHintBox::CHintBox( const neutrino_locale_t Caption,
const char * const Picon,
const int& header_buttons,
const int& text_mode,
- const int& indent):CComponentsWindow( 0, 0, width,
+ const int& indent):CComponentsWindow( 0, 0, Width,
HINTBOX_MIN_HEIGHT,
Caption,
string(Icon == NULL ? "" : Icon),
@@ -118,7 +118,7 @@ CHintBox::CHintBox( const char * const Caption,
const char * const Picon,
const int& header_buttons,
const int& text_mode,
- const int& indent):CComponentsWindow( 0, 0, width,
+ const int& indent):CComponentsWindow( 0, 0, Width,
HINTBOX_MIN_HEIGHT,
Caption,
string(Icon == NULL ? "" : Icon),
diff --git a/src/gui/widget/hintbox.h b/src/gui/widget/hintbox.h
index 187752286..9019228a6 100644
--- a/src/gui/widget/hintbox.h
+++ b/src/gui/widget/hintbox.h
@@ -32,14 +32,15 @@
#include
-#define HINTBOX_MIN_WIDTH 320
-#define HINTBOX_MIN_HEIGHT 125
-#define HINTBOX_MAX_HEIGHT 520
+#define HINTBOX_MIN_WIDTH CFrameBuffer::getInstance()->scale2Res(320)
+#define HINTBOX_MIN_HEIGHT CFrameBuffer::getInstance()->scale2Res(125)
+#define HINTBOX_MAX_HEIGHT CFrameBuffer::getInstance()->scale2Res(520)
+
#define HINTBOX_DEFAULT_TIMEOUT g_settings.timing[SNeutrinoSettings::TIMING_POPUP_MESSAGES]
#define NO_TIMEOUT 0
#define DEFAULT_TIMEOUT -1
//frame around hint container as indent
-#define W_FRAME std::max(HINTBOX_MIN_WIDTH, HINTBOX_MIN_HEIGHT) * 2/100
+#define W_FRAME OFFSET_INNER_MID
//frame color around hint/message box
#define HINTBOX_DEFAULT_FRAME_COLOR COL_FRAME
#define TIMEOUT_BAR_HEIGHT OFFSET_SHADOW/2
diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp
index 927f1c559..807c26442 100644
--- a/src/gui/widget/menue.cpp
+++ b/src/gui/widget/menue.cpp
@@ -600,6 +600,7 @@ void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, c
selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]);
//dimension
+ mwidth_save = mwidth;
min_width = 0;
width = 0; /* is set in paint() */
if (mwidth > 100){
@@ -1096,6 +1097,13 @@ void CMenuWidget::checkHints()
void CMenuWidget::calcSize()
{
+ // recalc min_width
+ min_width = 0;
+ int mwidth = std::min(mwidth_save, 100);
+ min_width = frameBuffer->getScreenWidth(true) * mwidth / 100;
+ if (min_width > (int)frameBuffer->getScreenWidth())
+ min_width = frameBuffer->getScreenWidth();
+
width = min_width;
int wi, hi;
@@ -1104,35 +1112,35 @@ void CMenuWidget::calcSize()
if (items[i]->iconName_Info_right) {
frameBuffer->getIconSize(items[i]->iconName_Info_right, &wi, &hi);
if ((wi > 0) && (hi > 0))
- wi += 10;
+ wi += OFFSET_INNER_MID;
else
wi = 0;
}
- int tmpw = items[i]->getWidth() + 10 + 10 + wi; /* 10 pixels to the left and right of the text */
+ int tmpw = items[i]->getWidth() + 2*OFFSET_INNER_MID + wi; /* 10 pixels to the left and right of the text */
if (tmpw > width)
width = tmpw;
}
hint_height = 0;
if(g_settings.show_menu_hints && has_hints) {
- hint_height = 60; //TODO: rework calculation of hint_height
+ hint_height = frameBuffer->scale2Res(60); //TODO: rework calculation of hint_height
int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight();
- int h_tmp = 16 + 2*fheight;
+ int h_tmp = OFFSET_INNER_LARGE + 2*fheight;
/* assuming all hint icons has the same size ! */
int iw, ih;
frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih);
- h_tmp = std::max(h_tmp, ih+10);
+ h_tmp = std::max(h_tmp, ih+OFFSET_INNER_MID);
hint_height = std::max(h_tmp, hint_height);
}
/* set the max height to 9/10 of usable screen height
debatable, if the callers need a possibility to set this */
height = (frameBuffer->getScreenHeight() - fbutton_height - hint_height) / 20 * 18; /* make sure its a multiple of 2 */
- if(height > ((int)frameBuffer->getScreenHeight() - 10))
- height = frameBuffer->getScreenHeight() - 10;
+ if(height > ((int)frameBuffer->getScreenHeight() - OFFSET_INNER_MID))
+ height = frameBuffer->getScreenHeight() - OFFSET_INNER_MID;
int neededWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(getName());
- if (neededWidth > width-48) {
- width= neededWidth+ 49;
+ if (neededWidth > width - frameBuffer->scale2Res(48)) {
+ width = neededWidth + frameBuffer->scale2Res(48)+1;
}
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
@@ -1166,7 +1174,7 @@ void CMenuWidget::calcSize()
iconOffset = w;
}
- iconOffset += 10;
+ iconOffset += OFFSET_INNER_MID;
width += iconOffset;
if (fbutton_count)
diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h
index de1d58744..ff4f3e008 100644
--- a/src/gui/widget/menue.h
+++ b/src/gui/widget/menue.h
@@ -513,6 +513,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals
std::string iconfile;
int min_width;
+ int mwidth_save;
int width;
int height;
int hheight; // header
diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp
index 84c74e15d..68b416439 100644
--- a/src/gui/widget/progresswindow.cpp
+++ b/src/gui/widget/progresswindow.cpp
@@ -57,8 +57,19 @@ CProgressWindow::CProgressWindow(const neutrino_locale_t title,
Init(statusSignal, localSignal, globalSignal);
}
+CProgressWindow::CProgressWindow(const std::string &title,
+ const int &dx,
+ const int &dy,
+ signal *statusSignal,
+ signal *localSignal,
+ signal *globalSignal)
+ : CComponentsWindow(0, 0, dx, dy, title, NEUTRINO_ICON_INFO, NULL, CC_SHADOW_ON)
+{
+ Init(statusSignal, localSignal, globalSignal);
+}
+
void CProgressWindow::Init( signal *statusSignal,
- signal *localSignal,
+ signal *localSignal,
signal *globalSignal)
{
if (statusSignal)
@@ -68,112 +79,82 @@ void CProgressWindow::Init( signal *statusSignal,
if (globalSignal)
*globalSignal->connect(mem_fun(*this, &CProgressWindow::showGlobalStatus));
- global_progress = local_progress = 100;
+ global_progress = local_progress = percent_progress = 0;
showFooter(false);
- shadow = true;
-
- int x_item = 10;
- int y_item = 10;
-
- int w_item = width-2*x_item;
- int h_item = 14;
- int h_pbar = 20;
- w_bar_frame = 0;
//create status text object
status_txt = new CComponentsLabel();
- int h_txt = max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(), h_item);
- status_txt->setDimensionsAll(x_item, y_item, w_item, h_txt);
+ status_txt->setDimensionsAll(OFFSET_INNER_MID, OFFSET_INNER_MID, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight());
status_txt->setColorBody(col_body);
status_txt->doPaintTextBoxBg(true);
status_txt->doPaintBg(false);
addWindowItem(status_txt);
- y_item += h_txt + 10;
+
+ cur_statusText = string();
//create local_bar object
- local_bar = new CProgressBar();
- local_bar->allowPaint(false);
- local_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar);
- local_bar->setColorBody(col_body);
- local_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0);
- local_bar->setFrameThickness(w_bar_frame);
- local_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0);
- addWindowItem(local_bar);
- y_item += 2*h_pbar;
+ local_bar = getProgressItem();
//create global_bar object
- global_bar = new CProgressBar();
- global_bar->allowPaint(false);
- global_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar);
- global_bar->setColorBody(col_body);
- global_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0);
- global_bar->setFrameThickness(w_bar_frame);
- global_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0);
- addWindowItem(global_bar);
- y_item += 2*h_pbar;
+ global_bar = getProgressItem();
+ //set window height
h_height = ccw_head->getHeight();
- height = max(height, y_item + h_height);
+ ccw_body->setHeight(ccw_body->back()->getYPos()+ ccw_body->back()->getHeight()+ OFFSET_INNER_MID);
+ height = max(height, ccw_body->getHeight() + h_height);
+ //set position on screen
setCenterPos();
}
-void CProgressWindow::setTitle(const neutrino_locale_t title)
+CProgressBar* CProgressWindow::getProgressItem()
{
- setWindowCaption(title);
+ CProgressBar *pBar = new CProgressBar();
+ pBar->allowPaint(false);
+ int y_tmp = 0;
+ for(size_t i = ccw_body->size()-1; i< ccw_body->size(); i++){
+ y_tmp += ccw_body->getCCItem(i)->getYPos() + ccw_body->getCCItem(i)->getHeight();
+ y_tmp += OFFSET_INNER_MID;
+ }
+ pBar->setDimensionsAll(OFFSET_INNER_MID, y_tmp, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight());
+ pBar->setColorBody(col_body);
+ pBar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0);
+ pBar->setFrameThickness(1);
+ pBar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0);
+ addWindowItem(pBar);
-#ifdef VFD_UPDATE
- CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD
-#endif // VFD_UPDATE
+ return pBar;
}
-void CProgressWindow::setTitle(const string & title)
+void CProgressWindow::initStatus(const unsigned int prog, const unsigned int max, const string &statusText, CProgressBar *pBar)
{
- setWindowCaption(title);
-
-#ifdef VFD_UPDATE
- CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD
-#endif // VFD_UPDATE
-}
-
-//if header is disabled we need new position for body items
-void CProgressWindow::fitItems()
-{
- if (ccw_show_header)
- return;
-
- for(size_t i=0; isize() ;i++){
- int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - 10;
- ccw_body->getCCItem(i)->setYPos(y_item);
+ pBar->allowPaint(true);
+ unsigned int cur_perc = prog*100/(max+1);
+ if (percent_progress != cur_perc || prog == 0){
+ pBar->setValues(prog, (int)max);
+ if (!statusText.empty() && (cur_statusText != statusText)){
+ showStatusMessageUTF(statusText);
+ cur_statusText = statusText;
+ }
+ pBar->paint(false);
+ percent_progress = cur_perc;
}
}
void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const string &statusText)
{
- if (global_progress == prog)
- return;
-
- if (!global_bar->isPainted()){
- int g_height = global_bar->getHeight();
- global_bar->setYPos(local_bar->getYPos() + g_height/2);
- global_bar->setHeight(g_height + g_height/2);
- }
-
- showGlobalStatus(prog, max, statusText);
+ showLocalStatus(prog, max, statusText);
}
void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max, const string &statusText)
{
- if (global_progress == prog)
+ if (!local_bar->isPainted())
+ showLocalStatus(0, 0, statusText); // ensure first paint of local bar on painted global bar at same time
+ if (global_progress == prog && global_bar->isPainted())
return;
-
- global_bar->allowPaint(true);
global_progress = prog;
- global_bar->setValues(prog, (int)max);
- if (!statusText.empty())
- showStatusMessageUTF(statusText);
- global_bar->paint(false);
+ initStatus(prog, max, statusText, global_bar);
#ifdef VFD_UPDATE
CVFD::getInstance()->showProgressBar2(-1,NULL,global_progress);
@@ -182,15 +163,10 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned i
void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max, const string &statusText)
{
- if (local_progress == prog)
+ if (local_progress == prog && local_bar->isPainted())
return;
-
- local_bar->allowPaint(true);
local_progress = prog;
- local_bar->setValues(prog, (int)max);
- if (!statusText.empty())
- showStatusMessageUTF(statusText);
- local_bar->paint(false);
+ initStatus(prog, max, statusText, local_bar);
#ifdef VFD_UPDATE
CVFD::getInstance()->showProgressBar2(local_progress);
@@ -240,3 +216,33 @@ void CProgressWindow::paint(bool do_save_bg)
fitItems();
CComponentsWindow::paint(do_save_bg);
}
+
+void CProgressWindow::setTitle(const neutrino_locale_t title)
+{
+ setWindowCaption(title);
+
+#ifdef VFD_UPDATE
+ CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD
+#endif // VFD_UPDATE
+}
+
+void CProgressWindow::setTitle(const string & title)
+{
+ setWindowCaption(title);
+
+#ifdef VFD_UPDATE
+ CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD
+#endif // VFD_UPDATE
+}
+
+//if header is disabled we need new position for body items
+void CProgressWindow::fitItems()
+{
+ if (ccw_show_header)
+ return;
+
+ for(size_t i=0; isize() ;i++){
+ int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - OFFSET_INNER_MID;
+ ccw_body->getCCItem(i)->setYPos(y_item);
+ }
+}
\ No newline at end of file
diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h
index 811b5714a..1be4255a9 100644
--- a/src/gui/widget/progresswindow.h
+++ b/src/gui/widget/progresswindow.h
@@ -28,6 +28,9 @@
#include
#include "menue.h"
+#define PW_MIN_WIDTH CCW_PERCENT 50
+#define PW_MIN_HEIGHT CCW_PERCENT 20
+
class CProgressWindow : public CComponentsWindow, public CMenuTarget
{
private:
@@ -36,11 +39,15 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
unsigned int global_progress;
unsigned int local_progress;
- int w_bar_frame;
+ unsigned int percent_progress;
+ std::string cur_statusText;
int h_height;
void Init( sigc::signal *statusSignal,
sigc::signal *localSignal,
sigc::signal *globalSignal);
+
+ CProgressBar* getProgressItem();
+ void initStatus(const unsigned int prog, const unsigned int max, const std::string &statusText, CProgressBar *pBar);
void fitItems();
public:
@@ -84,10 +91,10 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
* status.hide();
* }
*
- * //That's it. Until now these steps are a classical way inside neutrino, but you can use proress window with signals too.
- * //Working with signals have the advantage that the implementation could be more compactly, because
- * //complex constructions within the classes are usually unnecessary,
- * //beacuse of the signals can be installed where they directly take the required values. See next example:
+ * //That's it. Until now these steps are a classical way inside neutrino, but you can use proress window with signals too.
+ * //Working with signals have the advantage that the implementation could be more compactly, because
+ * //complex constructions within the classes are usually unnecessary,
+ * //beacuse of the signals can be installed where they directly catching the required values. See next example:
*
* class CFooClass
* {
@@ -96,6 +103,7 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
* private:
* //other members...
* sigc::signal OnProgress;
+ * void DoCount();
* //other members...
* public:
* //other members...
@@ -127,12 +135,57 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
* //finally remove window from screen
* progress.hide();
* }
+ *
+ * //Another and a recommended way to implement signals is to inherit prepared signals with
+ * //class CProgressSignals. This class contains prepared signals for implemantation and disconnetion of slots
+ * //is performed automatically.
+ * //See next example:
+ * class CFooClass : public CProgressSignals
+ * {
+ * private:
+ * //other members...
+ * void DoCount();
+ * //other members...
+ * public:
+ * //other members...
+ * void DoAnything();
+ * //other members...
+ * };
+ *
+ * //add the OnGlobalProgress and OnLocalProgress signals into a counter methode
+ * void CFooClass::DoCount();{
+ * size_t max = 10;
+ * for (size_t i = 0; i < max; i++){
+ * OnGlobalProgress(i, max, "Test"); //visualize global progress
+ * for (size_t j = 0; j < max; j++){
+ * OnLocalProgress(ij, max, "Test"); // visualize local progress
+ * }
+ * }
+ * }
+ *
+ * void CFooClass::DoAnything{
+ * //inside of methode which calls the progress define a CProgressWindow object and the counter method:
+ * //...any code
+ * CProgressWindow progress(NULL, 500, 150, NULL, &OnLocalProgress, &OnGlobalProgress);
+ * progress.paint(); // paint window
+ *
+ * //...
+ *
+ * void DoCount();
+ *
+ * //...
+ *
+ * //finally remove window from screen
+ * progress.hide();
+ * }
+ *
* @note
- * Don't use status_Signal at same time with localSignal and globalSignal. In This case please set status_Signal = NULL
+ * Don't use status_Signal at same time with localSignal and globalSignal. \n
+ * In This case please set prameter 'status_Signal' = NULL
*/
CProgressWindow(CComponentsForm *parent = NULL,
- const int &dx = 700,
- const int &dy = 200,
+ const int &dx = PW_MIN_WIDTH,
+ const int &dy = PW_MIN_HEIGHT,
sigc::signal *status_Signal = NULL,
sigc::signal *localSignal = NULL,
sigc::signal *globalSignal = NULL);
@@ -144,8 +197,21 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
* @see For other arguments and examples, see related constructor(s)
*/
CProgressWindow(const neutrino_locale_t title,
- const int &dx = 700,
- const int &dy = 200,
+ const int &dx = PW_MIN_WIDTH,
+ const int &dy = PW_MIN_HEIGHT,
+ sigc::signal *status_Signal = NULL,
+ sigc::signal *localSignal = NULL,
+ sigc::signal *globalSignal = NULL);
+
+ /**CProgressWindow Constructor
+ * @param[in] title
+ * @li expects type std::string as window title
+ *
+ * @see For other arguments and examples, see related constructor(s)
+ */
+ CProgressWindow(const std::string &title,
+ const int &dx = PW_MIN_WIDTH,
+ const int &dy = PW_MIN_HEIGHT,
sigc::signal *status_Signal = NULL,
sigc::signal *localSignal = NULL,
sigc::signal *globalSignal = NULL);
@@ -223,5 +289,25 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
void paint(bool do_save_bg = true);
};
+class CProgressSignals : public sigc::trackable
+{
+ public:
+ /**CProgressSignals Constructor:
+ * Additional class for inherited signal implemantations into classes with used CProgressWindow instances.
+ */
+ CProgressSignals()
+ {
+ //obligatory init of signals. Not really required but just to be safe.
+ OnProgress.clear();
+ OnLocalProgress.clear();
+ OnGlobalProgress.clear();
+ };
+
+ /**
+ * For general usage for implementations of signals for classes which are using CProgressBar() window instances based on inheritance.
+ * @see Take a look into examples to find in progressbar.h
+ */
+ sigc::signal OnProgress, OnLocalProgress, OnGlobalProgress;
+};
#endif
diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp
index 34b0a941e..23ed96132 100644
--- a/src/gui/widget/textbox.cpp
+++ b/src/gui/widget/textbox.cpp
@@ -68,14 +68,14 @@
#endif
#include
-#define SCROLL_FRAME_WIDTH 10
-#define SCROLL_MARKER_BORDER 2
+#define SCROLL_FRAME_WIDTH SCROLLBAR_WIDTH
+#define SCROLL_MARKER_BORDER OFFSET_INNER_MIN
-#define MAX_WINDOW_WIDTH (g_settings.screen_EndX - g_settings.screen_StartX - 40)
-#define MAX_WINDOW_HEIGHT (g_settings.screen_EndY - g_settings.screen_StartY - 40)
+#define MAX_WINDOW_WIDTH (g_settings.screen_EndX - g_settings.screen_StartX - CFrameBuffer::getInstance()->scale2Res(40))
+#define MAX_WINDOW_HEIGHT (g_settings.screen_EndY - g_settings.screen_StartY - CFrameBuffer::getInstance()->scale2Res(40))
#define MIN_WINDOW_WIDTH ((g_settings.screen_EndX - g_settings.screen_StartX)>>1)
-#define MIN_WINDOW_HEIGHT 40
+#define MIN_WINDOW_HEIGHT CFrameBuffer::getInstance()->scale2Res(40)
CTextBox::CTextBox(const char * text, Font* font_text, const int pmode,
const CBox* position, CFBWindow::color_t textBackgroundColor)
diff --git a/src/neutrino.cpp b/src/neutrino.cpp
index e629a685f..1a2d9fb7b 100644
--- a/src/neutrino.cpp
+++ b/src/neutrino.cpp
@@ -82,6 +82,7 @@
#include "gui/infoviewer.h"
#include "gui/mediaplayer.h"
#include "gui/movieplayer.h"
+#include "gui/osd_helpers.h"
#include "gui/osd_setup.h"
#include "gui/osdlang_setup.h"
#include "gui/pictureviewer.h"
@@ -228,6 +229,8 @@ CNeutrinoApp::CNeutrinoApp()
: configfile('\t')
{
standby_pressed_at.tv_sec = 0;
+ osd_resolution_tmp = -1;
+ frameBufferInitialized = false;
frameBuffer = CFrameBuffer::getInstance();
frameBuffer->setIconBasePath(ICONSDIR);
@@ -308,15 +311,6 @@ static SNeutrinoSettings::usermenu_t usermenu_default[] = {
/**************************************************************************************
* CNeutrinoApp - loadSetup, load the application-settings *
**************************************************************************************/
-#define DEFAULT_X_START_SD 60
-#define DEFAULT_Y_START_SD 20
-#define DEFAULT_X_END_SD 1220
-#define DEFAULT_Y_END_SD 560
-
-#define DEFAULT_X_START_HD 40 //5
-#define DEFAULT_Y_START_HD 25 //5
-#define DEFAULT_X_END_HD 1235 //1275
-#define DEFAULT_Y_END_HD 690 //715
std::string ttx_font_file = "";
@@ -326,22 +320,27 @@ int CNeutrinoApp::loadSetup(const char * fname)
int erg = 0;
configfile.clear();
- //settings laden - und dabei Defaults setzen!
- if(!configfile.loadConfig(fname)) {
- //file existiert nicht
+ // load settings; setup defaults
+ if (!configfile.loadConfig(fname))
+ {
+ // file doesn't exist
erg = 1;
- } else {
+ }
+ else
+ {
+#if 0
/* try to detect bad / broken config file */
- if (!configfile.getInt32("screen_EndX_crt", 0) ||
- !configfile.getInt32("screen_EndY_crt", 0) ||
- !configfile.getInt32("screen_EndX_lcd", 0) ||
- !configfile.getInt32("screen_EndY_lcd", 0)) {
+ if (!configfile.getInt32("screen_EndX_crt_0", 0) ||
+ !configfile.getInt32("screen_EndY_crt_0", 0) ||
+ !configfile.getInt32("screen_EndX_lcd_0", 0) ||
+ !configfile.getInt32("screen_EndY_lcd_0", 0)) {
printf("[neutrino] config file %s is broken, using defaults\n", fname);
configfile.clear();
- } else {
+ } else
+#endif
migrateConfig(fname);
- }
}
+
parentallocked = !access(NEUTRINO_PARENTALLOCKED_FILE, R_OK);
//theme/color options
@@ -736,29 +735,32 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.channellist_show_numbers = configfile.getInt32("channellist_show_numbers", 1);
//screen configuration
- g_settings.screen_StartX_crt = configfile.getInt32( "screen_StartX_crt", DEFAULT_X_START_SD);
- g_settings.screen_StartY_crt = configfile.getInt32( "screen_StartY_crt", DEFAULT_Y_START_SD );
- g_settings.screen_EndX_crt = configfile.getInt32( "screen_EndX_crt", DEFAULT_X_END_SD);
- g_settings.screen_EndY_crt = configfile.getInt32( "screen_EndY_crt", DEFAULT_Y_END_SD);
- g_settings.screen_StartX_lcd = configfile.getInt32( "screen_StartX_lcd", DEFAULT_X_START_HD);
- g_settings.screen_StartY_lcd = configfile.getInt32( "screen_StartY_lcd", DEFAULT_Y_START_HD );
- g_settings.screen_EndX_lcd = configfile.getInt32( "screen_EndX_lcd", DEFAULT_X_END_HD);
- g_settings.screen_EndY_lcd = configfile.getInt32( "screen_EndY_lcd", DEFAULT_Y_END_HD);
- g_settings.screen_preset = configfile.getInt32( "screen_preset", 1);
-
- g_settings.screen_StartX = g_settings.screen_preset ? g_settings.screen_StartX_lcd : g_settings.screen_StartX_crt;
- g_settings.screen_StartY = g_settings.screen_preset ? g_settings.screen_StartY_lcd : g_settings.screen_StartY_crt;
- g_settings.screen_EndX = g_settings.screen_preset ? g_settings.screen_EndX_lcd : g_settings.screen_EndX_crt;
- g_settings.screen_EndY = g_settings.screen_preset ? g_settings.screen_EndY_lcd : g_settings.screen_EndY_crt;
-
- g_settings.screen_width = frameBuffer->getScreenWidth(true);
- g_settings.screen_height = frameBuffer->getScreenHeight(true);
+ g_settings.osd_resolution = (osd_resolution_tmp == -1) ? configfile.getInt32("osd_resolution", 0) : osd_resolution_tmp;
+ COsdHelpers::getInstance()->g_settings_osd_resolution_save = g_settings.osd_resolution;
+ g_settings.screen_StartX_crt_0 = configfile.getInt32("screen_StartX_crt_0", 80);
+ g_settings.screen_StartY_crt_0 = configfile.getInt32("screen_StartY_crt_0", 45);
+ g_settings.screen_EndX_crt_0 = configfile.getInt32("screen_EndX_crt_0" , 1280 - g_settings.screen_StartX_crt_0 - 1);
+ g_settings.screen_EndY_crt_0 = configfile.getInt32("screen_EndY_crt_0" , 580 - g_settings.screen_StartY_crt_0 - 1);
+ g_settings.screen_StartX_lcd_0 = configfile.getInt32("screen_StartX_lcd_0", 40);
+ g_settings.screen_StartY_lcd_0 = configfile.getInt32("screen_StartY_lcd_0", 25);
+ g_settings.screen_EndX_lcd_0 = configfile.getInt32("screen_EndX_lcd_0" , 1280 - g_settings.screen_StartX_lcd_0 - 1);
+ g_settings.screen_EndY_lcd_0 = configfile.getInt32("screen_EndY_lcd_0" , 720 - g_settings.screen_StartY_lcd_0 - 1);
+ g_settings.screen_StartX_crt_1 = configfile.getInt32("screen_StartX_crt_1", 80);
+ g_settings.screen_StartY_crt_1 = configfile.getInt32("screen_StartY_crt_1", 45);
+ g_settings.screen_EndX_crt_1 = configfile.getInt32("screen_EndX_crt_1" , 1920 - g_settings.screen_StartX_crt_1 - 1);
+ g_settings.screen_EndY_crt_1 = configfile.getInt32("screen_EndY_crt_1" , 870 - g_settings.screen_StartY_crt_1 - 1);
+ g_settings.screen_StartX_lcd_1 = configfile.getInt32("screen_StartX_lcd_1", 40);
+ g_settings.screen_StartY_lcd_1 = configfile.getInt32("screen_StartY_lcd_1", 25);
+ g_settings.screen_EndX_lcd_1 = configfile.getInt32("screen_EndX_lcd_1" , 1920 - g_settings.screen_StartX_lcd_1 - 1);
+ g_settings.screen_EndY_lcd_1 = configfile.getInt32("screen_EndY_lcd_1" , 1080 - g_settings.screen_StartY_lcd_1 - 1);
+ g_settings.screen_preset = configfile.getInt32("screen_preset", COsdSetup::PRESET_LCD);
+ setScreenSettings();
// avoid configuration mismatch
- if (g_settings.screen_EndX > g_settings.screen_width)
- g_settings.screen_EndX = g_settings.screen_width;
- if (g_settings.screen_EndY > g_settings.screen_height)
- g_settings.screen_EndY = g_settings.screen_height;
+ if (g_settings.screen_EndX >= g_settings.screen_width)
+ g_settings.screen_EndX = g_settings.screen_width - 1;
+ if (g_settings.screen_EndY >= g_settings.screen_height)
+ g_settings.screen_EndY = g_settings.screen_height - 1;
g_settings.bigFonts = configfile.getInt32("bigFonts", 0);
g_settings.window_size = configfile.getInt32("window_size", 100);
@@ -965,6 +967,56 @@ int CNeutrinoApp::loadSetup(const char * fname)
return erg;
}
+void CNeutrinoApp::setScreenSettings()
+{
+ g_settings.screen_width = frameBuffer->getScreenWidth(true);
+ g_settings.screen_height = frameBuffer->getScreenHeight(true);
+
+ switch (g_settings.osd_resolution) {
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+ case 1:
+ {
+ switch (g_settings.screen_preset) {
+ case COsdSetup::PRESET_CRT:
+ g_settings.screen_StartX = g_settings.screen_StartX_crt_1;
+ g_settings.screen_StartY = g_settings.screen_StartY_crt_1;
+ g_settings.screen_EndX = g_settings.screen_EndX_crt_1;
+ g_settings.screen_EndY = g_settings.screen_EndY_crt_1;
+ break;
+ case COsdSetup::PRESET_LCD:
+ default:
+ g_settings.screen_StartX = g_settings.screen_StartX_lcd_1;
+ g_settings.screen_StartY = g_settings.screen_StartY_lcd_1;
+ g_settings.screen_EndX = g_settings.screen_EndX_lcd_1;
+ g_settings.screen_EndY = g_settings.screen_EndY_lcd_1;
+ break;
+ }
+ }
+ break;
+#endif
+ case 0:
+ default:
+ {
+ switch (g_settings.screen_preset) {
+ case COsdSetup::PRESET_CRT:
+ g_settings.screen_StartX = g_settings.screen_StartX_crt_0;
+ g_settings.screen_StartY = g_settings.screen_StartY_crt_0;
+ g_settings.screen_EndX = g_settings.screen_EndX_crt_0;
+ g_settings.screen_EndY = g_settings.screen_EndY_crt_0;
+ break;
+ case COsdSetup::PRESET_LCD:
+ default:
+ g_settings.screen_StartX = g_settings.screen_StartX_lcd_0;
+ g_settings.screen_StartY = g_settings.screen_StartY_lcd_0;
+ g_settings.screen_EndX = g_settings.screen_EndX_lcd_0;
+ g_settings.screen_EndY = g_settings.screen_EndY_lcd_0;
+ break;
+ }
+ }
+ break;
+ }
+}
+
void CNeutrinoApp::upgradeSetup(const char * fname)
{
dprintf(DEBUG_NORMAL, "upgrade/cleanup %s\n", fname);
@@ -1328,15 +1380,24 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setInt32("channellist_show_numbers", g_settings.channellist_show_numbers);
//screen configuration
- configfile.setInt32( "screen_StartX_lcd", g_settings.screen_StartX_lcd );
- configfile.setInt32( "screen_StartY_lcd", g_settings.screen_StartY_lcd );
- configfile.setInt32( "screen_EndX_lcd", g_settings.screen_EndX_lcd );
- configfile.setInt32( "screen_EndY_lcd", g_settings.screen_EndY_lcd );
- configfile.setInt32( "screen_StartX_crt", g_settings.screen_StartX_crt );
- configfile.setInt32( "screen_StartY_crt", g_settings.screen_StartY_crt );
- configfile.setInt32( "screen_EndX_crt", g_settings.screen_EndX_crt );
- configfile.setInt32( "screen_EndY_crt", g_settings.screen_EndY_crt );
- configfile.setInt32( "screen_preset", g_settings.screen_preset );
+ configfile.setInt32("osd_resolution" , COsdHelpers::getInstance()->g_settings_osd_resolution_save);
+ configfile.setInt32("screen_StartX_lcd_0", g_settings.screen_StartX_lcd_0);
+ configfile.setInt32("screen_StartY_lcd_0", g_settings.screen_StartY_lcd_0);
+ configfile.setInt32("screen_EndX_lcd_0" , g_settings.screen_EndX_lcd_0);
+ configfile.setInt32("screen_EndY_lcd_0" , g_settings.screen_EndY_lcd_0);
+ configfile.setInt32("screen_StartX_crt_0", g_settings.screen_StartX_crt_0);
+ configfile.setInt32("screen_StartY_crt_0", g_settings.screen_StartY_crt_0);
+ configfile.setInt32("screen_EndX_crt_0" , g_settings.screen_EndX_crt_0);
+ configfile.setInt32("screen_EndY_crt_0" , g_settings.screen_EndY_crt_0);
+ configfile.setInt32("screen_StartX_lcd_1", g_settings.screen_StartX_lcd_1);
+ configfile.setInt32("screen_StartY_lcd_1", g_settings.screen_StartY_lcd_1);
+ configfile.setInt32("screen_EndX_lcd_1" , g_settings.screen_EndX_lcd_1);
+ configfile.setInt32("screen_EndY_lcd_1" , g_settings.screen_EndY_lcd_1);
+ configfile.setInt32("screen_StartX_crt_1", g_settings.screen_StartX_crt_1);
+ configfile.setInt32("screen_StartY_crt_1", g_settings.screen_StartY_crt_1);
+ configfile.setInt32("screen_EndX_crt_1" , g_settings.screen_EndX_crt_1);
+ configfile.setInt32("screen_EndY_crt_1" , g_settings.screen_EndY_crt_1);
+ configfile.setInt32("screen_preset" , g_settings.screen_preset);
//Software-update
configfile.setInt32 ("softupdate_mode" , g_settings.softupdate_mode );
@@ -1830,14 +1891,50 @@ void CNeutrinoApp::CmdParser(int argc, char **argv)
/**************************************************************************************
* CNeutrinoApp - setup the framebuffer *
**************************************************************************************/
+
void CNeutrinoApp::SetupFrameBuffer()
{
frameBuffer->init();
- if(frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t))) {
+ int setFbMode = 0;
+ osd_resolution_tmp = -1;
+#ifdef ENABLE_CHANGE_OSD_RESOLUTION
+ frameBuffer->setOsdResolutions();
+ if (frameBuffer->osd_resolutions.empty()) {
+ dprintf(DEBUG_NORMAL, "Error while setting framebuffer mode\n");
+ exit(-1);
+ }
+
+ uint32_t ort;
+ configfile.loadConfig(NEUTRINO_SETTINGS_FILE);
+ ort = configfile.getInt32("osd_resolution", 0);
+
+ size_t resCount = frameBuffer->osd_resolutions.size();
+
+ if (ort > (resCount - 1))
+ osd_resolution_tmp = ort = 0;
+
+ if (resCount == 1)
+ ort = 0;
+
+ setFbMode = frameBuffer->setMode(frameBuffer->osd_resolutions[ort].xRes,
+ frameBuffer->osd_resolutions[ort].yRes,
+ frameBuffer->osd_resolutions[ort].bpp);
+
+/*
+ setFbMode = 0;
+ COsdHelpers::getInstance()->changeOsdResolution(0, true);
+*/
+#else
+ /* all other hardware ignores setMode parameters */
+ setFbMode = frameBuffer->setMode(0, 0, 0);
+#endif
+
+ if (setFbMode == -1) {
dprintf(DEBUG_NORMAL, "Error while setting framebuffer mode\n");
exit(-1);
}
frameBuffer->Clear();
+ frameBufferInitialized = true;
}
/**************************************************************************************
@@ -2051,6 +2148,9 @@ int CNeutrinoApp::run(int argc, char **argv)
TIMER_START();
cs_api_init();
cs_register_messenger(CSSendMessage);
+#if defined(HAVE_COOL_HARDWARE) && defined(ENABLE_CHANGE_OSD_RESOLUTION)
+ cs_new_auto_videosystem();
+#endif
g_Locale = new CLocaleManager;
@@ -2109,6 +2209,8 @@ TIMER_START();
ZapStart_arg.volume = g_settings.current_volume;
ZapStart_arg.webtv_xml = &g_settings.webtv_xml;
+ ZapStart_arg.osd_resolution = g_settings.osd_resolution;
+
CCamManager::getInstance()->SetCITuner(g_settings.ci_tuner);
/* create decoders, read channels */
bool zapit_init = CZapit::getInstance()->Start(&ZapStart_arg);
@@ -2899,6 +3001,18 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
CMoviePlayerGui::getInstance(true).showSubtitle(data);
return messages_return::handled;
}
+ if (msg == NeutrinoMessages::EVT_AUTO_SET_VIDEOSYSTEM) {
+ printf(">>>>>[CNeutrinoApp::%s:%d] Receive EVT_AUTO_SET_VIDEOSYSTEM message\n", __func__, __LINE__);
+ COsdHelpers *coh = COsdHelpers::getInstance();
+ int videoSystem = (int)data;
+ if ((videoSystem != -1) /* -1 => not enabled for automode */ &&
+ (coh->getVideoSystem() != videoSystem)) {
+ coh->setVideoSystem(videoSystem, false);
+ if (frameBufferInitialized)
+ coh->changeOsdResolution(0, true, false);
+ }
+ return messages_return::handled;
+ }
if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) {
CZapit::getInstance()->GetAudioMode(g_settings.audio_AnalogMode);
if(g_settings.audio_AnalogMode < 0 || g_settings.audio_AnalogMode > 2)
@@ -4840,11 +4954,7 @@ bool CNeutrinoApp::adjustToChannelID(const t_channel_id channel_id)
}
/*
- * commit 523b273a changed the names of config file entries:
- * casystem_display => infobar_casystem_display
- * casystem_dotmatrix => infobar_casystem_dotmatrix
- * casystem_frame => infobar_casystem_frame
- * convert these, so that users do not need to set up their system again
+ * convert config keys, so that users do not need to set up their system again
*/
struct __key_rename {
const char *from;
@@ -4855,6 +4965,14 @@ static struct __key_rename key_rename[] = {
{ "casystem_display", "infobar_casystem_display" },
{ "casystem_dotmatrix", "infobar_casystem_dotmatrix"},
{ "casystem_frame", "infobar_casystem_frame" },
+ { "screen_StartX_crt", "screen_StartX_crt_0" },
+ { "screen_StartY_crt", "screen_StartY_crt_0" },
+ { "screen_EndX_crt", "screen_EndX_crt_0" },
+ { "screen_EndY_crt", "screen_EndY_crt_0" },
+ { "screen_StartX_lcd", "screen_StartX_lcd_0" },
+ { "screen_StartY_lcd", "screen_StartY_lcd_0" },
+ { "screen_EndX_lcd", "screen_EndX_lcd_0" },
+ { "screen_EndY_lcd", "screen_EndY_lcd_0" },
{ NULL, NULL }
};
@@ -4877,9 +4995,8 @@ void CNeutrinoApp::migrateConfig(const char *fname)
/* only set new key to old value if the new key does not yet exist */
if (configfile.getInt32(to, magic) == magic)
configfile.setInt32(to, tmp);
- /* always remove old key*/
+ /* always remove old key */
configfile.deleteKey(from);
}
/* more complex migration, including converting values etc. could be done here */
}
-
diff --git a/src/neutrino.h b/src/neutrino.h
index 406a934b7..b70f5586f 100644
--- a/src/neutrino.h
+++ b/src/neutrino.h
@@ -108,6 +108,8 @@ private:
bool channelList_allowed;
bool channelList_painted;
int first_mode_found;
+ int osd_resolution_tmp;
+ bool frameBufferInitialized;
void SDT_ReloadChannels();
void setupNetwork( bool force= false );
@@ -162,6 +164,7 @@ public:
void saveSetup(const char * fname);
int loadSetup(const char * fname);
+ void setScreenSettings();
void upgradeSetup(const char * fname);
void loadKeys(const char * fname = NULL);
void saveKeys(const char * fname = NULL);
diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h
index fe89d019a..81f77fa6c 100644
--- a/src/neutrinoMessages.h
+++ b/src/neutrinoMessages.h
@@ -123,6 +123,7 @@ struct NeutrinoMessages {
/* NEVER CHANGE THIS */
EVT_CA_MESSAGE = CRCInput::RC_Events + 60, /* data = CA_MESSAGE pointer */
EVT_SUBT_MESSAGE = CRCInput::RC_Events + 61, /* data = subtitles pointer */
+ EVT_AUTO_SET_VIDEOSYSTEM = CRCInput::RC_Events + 62, /* data = new video system */
/* END */
EVT_CURRENTEPG = CRCInput::RC_WithData + 1,
diff --git a/src/system/locals.h b/src/system/locals.h
index 965508c82..a7147a146 100644
--- a/src/system/locals.h
+++ b/src/system/locals.h
@@ -349,10 +349,9 @@ typedef enum
LOCALE_COLORMENU_FADE,
LOCALE_COLORMENU_FONT,
LOCALE_COLORMENU_FONT_TTX,
- LOCALE_COLORMENU_HD_PRESET,
LOCALE_COLORMENU_MENUCOLORS,
LOCALE_COLORMENU_OSD_PRESET,
- LOCALE_COLORMENU_SD_PRESET,
+ LOCALE_COLORMENU_OSD_RESOLUTION,
LOCALE_COLORMENU_TEXTCOLOR,
LOCALE_COLORMENU_THEMESELECT,
LOCALE_COLORMENU_TIMING,
@@ -1281,6 +1280,7 @@ typedef enum
LOCALE_MENU_HINT_OSD,
LOCALE_MENU_HINT_OSD_LANGUAGE,
LOCALE_MENU_HINT_OSD_PRESET,
+ LOCALE_MENU_HINT_OSD_RESOLUTION,
LOCALE_MENU_HINT_OSD_TIMING,
LOCALE_MENU_HINT_OTHER_FONTS,
LOCALE_MENU_HINT_PARENTALLOCK_CHANGEPIN,
@@ -2347,8 +2347,10 @@ typedef enum
LOCALE_STREAMINFO_FRAMERATE_UNKNOWN,
LOCALE_STREAMINFO_HEAD,
LOCALE_STREAMINFO_NOT_AVAILABLE,
+ LOCALE_STREAMINFO_OSD_RESOLUTION,
LOCALE_STREAMINFO_RESOLUTION,
LOCALE_STREAMINFO_SIGNAL,
+ LOCALE_STREAMINFO_VIDEOSYSTEM,
LOCALE_STREAMING_BUSY,
LOCALE_STREAMING_DIR_NOT_WRITABLE,
LOCALE_STREAMING_OVERFLOW,
diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h
index 0a256f41c..adb7a51b0 100644
--- a/src/system/locals_intern.h
+++ b/src/system/locals_intern.h
@@ -349,10 +349,9 @@ const char * locale_real_names[] =
"colormenu.fade",
"colormenu.font",
"colormenu.font_ttx",
- "colormenu.hd_preset",
"colormenu.menucolors",
"colormenu.osd_preset",
- "colormenu.sd_preset",
+ "colormenu.osd_resolution",
"colormenu.textcolor",
"colormenu.themeselect",
"colormenu.timing",
@@ -1281,6 +1280,7 @@ const char * locale_real_names[] =
"menu.hint_osd",
"menu.hint_osd_language",
"menu.hint_osd_preset",
+ "menu.hint_osd_resolution",
"menu.hint_osd_timing",
"menu.hint_other_fonts",
"menu.hint_parentallock_changepin",
@@ -2347,8 +2347,10 @@ const char * locale_real_names[] =
"streaminfo.framerate_unknown",
"streaminfo.head",
"streaminfo.not_available",
+ "streaminfo.osd_resolution",
"streaminfo.resolution",
"streaminfo.signal",
+ "streaminfo.videosystem",
"streaming.busy",
"streaming.dir_not_writable",
"streaming.overflow",
diff --git a/src/system/settings.h b/src/system/settings.h
index 08b9dc3d1..352e45d33 100644
--- a/src/system/settings.h
+++ b/src/system/settings.h
@@ -616,14 +616,23 @@ struct SNeutrinoSettings
int screen_StartY;
int screen_EndX;
int screen_EndY;
- int screen_StartX_crt;
- int screen_StartY_crt;
- int screen_EndX_crt;
- int screen_EndY_crt;
- int screen_StartX_lcd;
- int screen_StartY_lcd;
- int screen_EndX_lcd;
- int screen_EndY_lcd;
+ int screen_StartX_crt_0;
+ int screen_StartY_crt_0;
+ int screen_EndX_crt_0;
+ int screen_EndY_crt_0;
+ int screen_StartX_lcd_0;
+ int screen_StartY_lcd_0;
+ int screen_EndX_lcd_0;
+ int screen_EndY_lcd_0;
+ int screen_StartX_crt_1;
+ int screen_StartY_crt_1;
+ int screen_EndX_crt_1;
+ int screen_EndY_crt_1;
+ int screen_StartX_lcd_1;
+ int screen_StartY_lcd_1;
+ int screen_EndX_lcd_1;
+ int screen_EndY_lcd_1;
+ int osd_resolution;
int screen_preset;
int screen_width;
int screen_height;
@@ -906,10 +915,10 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO
#define DEFAULT_LCD_AUTODIMM 0x00
#define DEFAULT_LCD_SHOW_VOLUME 0x01
-#define CORNER_RADIUS_LARGE 11
-#define CORNER_RADIUS_MID 7
-#define CORNER_RADIUS_SMALL 5
-#define CORNER_RADIUS_MIN 3
+#define CORNER_RADIUS_LARGE CFrameBuffer::getInstance()->scale2Res(11)
+#define CORNER_RADIUS_MID CFrameBuffer::getInstance()->scale2Res(7)
+#define CORNER_RADIUS_SMALL CFrameBuffer::getInstance()->scale2Res(5)
+#define CORNER_RADIUS_MIN CFrameBuffer::getInstance()->scale2Res(3)
#define CORNER_RADIUS_NONE 0
#define RADIUS_LARGE (g_settings.rounded_corners ? CORNER_RADIUS_LARGE : 0)
@@ -919,17 +928,17 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO
#define RADIUS_NONE 0
// offsets
-#define OFFSET_SHADOW 6
-#define OFFSET_INTER 6
-#define OFFSET_INNER_LARGE 20
-#define OFFSET_INNER_MID 10
-#define OFFSET_INNER_SMALL 5
-#define OFFSET_INNER_MIN 2
+#define OFFSET_SHADOW CFrameBuffer::getInstance()->scale2Res(6)
+#define OFFSET_INTER CFrameBuffer::getInstance()->scale2Res(6)
+#define OFFSET_INNER_LARGE CFrameBuffer::getInstance()->scale2Res(20)
+#define OFFSET_INNER_MID CFrameBuffer::getInstance()->scale2Res(10)
+#define OFFSET_INNER_SMALL CFrameBuffer::getInstance()->scale2Res(5)
+#define OFFSET_INNER_MIN CFrameBuffer::getInstance()->scale2Res(2)
#define OFFSET_INNER_NONE 0
#define SCROLLBAR_WIDTH (OFFSET_INNER_MID + 2*OFFSET_INNER_MIN)
-#define DETAILSLINE_WIDTH 16 // TODO: scale2Res() ?
+#define DETAILSLINE_WIDTH CFrameBuffer::getInstance()->scale2Res(16)
#define BIGFONT_FACTOR 1.5
diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp
index 3c558ee1b..407d452a4 100644
--- a/src/system/ytparser.cpp
+++ b/src/system/ytparser.cpp
@@ -323,7 +323,7 @@ bool cYTFeedParser::parseFeedJSON(std::string &answer)
Json::Value elements = root["items"];
for(unsigned int i=0; igetText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES));
+ OnProgress(i, elements.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES));
#ifdef DEBUG_PARSER
printf("=========================================================\n");
printf("Element %d in elements\n", i);
diff --git a/src/system/ytparser.h b/src/system/ytparser.h
index c54c2239b..dcc8f1322 100644
--- a/src/system/ytparser.h
+++ b/src/system/ytparser.h
@@ -30,6 +30,7 @@
#include
#include
#include
+#include
class cYTVideoUrl
{
@@ -68,7 +69,7 @@ class cYTVideoInfo
typedef std::vector yt_video_list_t;
-class cYTFeedParser
+class cYTFeedParser : public CProgressSignals
{
private:
std::string error;
@@ -155,8 +156,6 @@ class cYTFeedParser
void SetMaxResults(int count) { max_results = count; }
void SetConcurrentDownloads(int count) { concurrent_downloads = count; }
void SetThumbnailDir(std::string &_thumbnail_dir);
-
- sigc::signal OnLoadVideoInfo;
};
#endif
diff --git a/src/zapit/include/zapit/zapit.h b/src/zapit/include/zapit/zapit.h
index a60c79fb5..989f3cc7c 100644
--- a/src/zapit/include/zapit/zapit.h
+++ b/src/zapit/include/zapit/zapit.h
@@ -42,6 +42,7 @@ typedef struct ZAPIT_start_arg
t_channel_id startchannelradio_id;
int uselastchannel;
int video_mode;
+ uint32_t osd_resolution;
int volume;
int ci_clock;
std::list *webtv_xml;
diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp
index 92d7929d7..c88eabe0b 100644
--- a/src/zapit/src/zapit.cpp
+++ b/src/zapit/src/zapit.cpp
@@ -77,6 +77,7 @@
#include
#include
+#include
/* globals */
int sig_delay = 2; // seconds between signal check
@@ -1664,7 +1665,8 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd)
case CZapitMessages::CMD_SET_VIDEO_SYSTEM: {
CZapitMessages::commandInt msg;
CBasicServer::receive_data(connfd, &msg, sizeof(msg));
- videoDecoder->SetVideoSystem(msg.val);
+ COsdHelpers::getInstance()->setVideoSystem(msg.val);
+ COsdHelpers::getInstance()->changeOsdResolution(0, true);
CNeutrinoApp::getInstance()->g_settings_video_Mode(msg.val);
break;
}
@@ -2368,7 +2370,9 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg)
audioDecoder = cAudio::GetDecoder(0);
videoDecoder->SetDemux(videoDemux);
- videoDecoder->SetVideoSystem(video_mode);
+ COsdHelpers::getInstance()->setVideoSystem(video_mode);
+ uint32_t osd_resolution = ZapStart_arg->osd_resolution;
+ COsdHelpers::getInstance()->changeOsdResolution(osd_resolution);
videoDecoder->Standby(false);
audioDecoder->SetDemux(audioDemux);