diff --git a/acinclude.m4 b/acinclude.m4 index 2c9257a51..646ba5a0c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -22,6 +22,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_ARG_ENABLE(tmsdk, AS_HELP_STRING(--enable-tmsdk, compile inside sdk), ,[enable_tmsdk=no]) @@ -565,6 +573,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/zee²/link]) + AC_DEFINE(ENABLE_CHANGE_OSD_RESOLUTION,1,[enable change the osd resolution]) elif test "$BOXMODEL" = "dm500"; then AC_DEFINE(BOXMODEL_DM500, 1, [dreambox 500]) elif test "$BOXMODEL" = "ip200"; then diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 9aad4011a..0673e4db8 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -351,12 +351,11 @@ 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.osd_resolution OSD-Auflösung colormenu.progressbar_active Farbe des aktiven Teil colormenu.progressbar_passive Hintergrundfarbe -colormenu.sd_preset CRT colormenu.textcolor Textfarbe colormenu.themeselect Theme auswählen colormenu.timing Timeouts @@ -1399,6 +1398,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 diff --git a/data/locale/english.locale b/data/locale/english.locale index f7dabc42b..a25447ea3 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -351,12 +351,11 @@ 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.osd_resolution OSD resolution colormenu.progressbar_active Aktive part color colormenu.progressbar_passive Background -colormenu.sd_preset CRT colormenu.textcolor Text color colormenu.themeselect Select theme colormenu.timing Timeouts @@ -1399,6 +1398,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 diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index 9c79991c6..82f8d1f2f 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -108,6 +108,7 @@ class CFbAccelCSHD1 void setBlendLevel(int); void add_gxa_sync_marker(void); void setupGXA(void); + void setOsdResolutions(); }; class CFbAccelCSHD2 @@ -127,6 +128,9 @@ class CFbAccelCSHD2 void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); void setBlendMode(uint8_t); void setBlendLevel(int); + int scaleFont(int size); + bool fullHdAvailable(); + void setOsdResolutions(); }; class CFbAccelGLFB diff --git a/src/driver/fb_accel_cs_hd1.cpp b/src/driver/fb_accel_cs_hd1.cpp index 9f5f62527..142d9d1a2 100644 --- a/src/driver/fb_accel_cs_hd1.cpp +++ b/src/driver/fb_accel_cs_hd1.cpp @@ -325,9 +325,25 @@ 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; + 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) { diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index 0cf8a31a6..8d49c3a0d 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -185,21 +185,77 @@ 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; + osd_resolutions.push_back(res); + if (fullHdAvailable()) { + res.xRes = 1920; + res.yRes = 1080; + res.bpp = 32; + 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(); + + if (fullHdAvailable()) { + screeninfo.xres_virtual=screeninfo.xres=nxRes; + screeninfo.yres_virtual=screeninfo.yres=nyRes; + 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; 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 +*/ + int needmem = stride * yRes * 2; if (available >= needmem) { @@ -228,3 +284,18 @@ void CFbAccelCSHD2::setBlendLevel(int level) if (level == 100) // TODO: sucks. usleep(20000); } + +int CFbAccelCSHD2::scaleFont(int size) +{ + if (screeninfo.xres == 1920) + size += size/2; + + return size; +} + +bool CFbAccelCSHD2::fullHdAvailable() +{ + if (available >= 16588800) /* new fb driver with maxres 1920x1080(*8) */ + return true; + return false; +} diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index c1b8b55a1..f1fff37c5 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -355,8 +355,21 @@ 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; + osd_resolutions.push_back(res); +} + #if 0 //never used void CFrameBuffer::setTransparency( int /*tr*/ ) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index b5f26da70..8272fcd18 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -39,6 +39,13 @@ typedef struct fb_var_screeninfo t_fb_var_screeninfo; +typedef struct osd_resolution_t +{ + uint32_t yRes; + uint32_t xRes; + uint32_t bpp; +} osd_resolution_struct_t; + typedef struct gradientData_t { fb_pixel_t* gradientBuf; @@ -270,6 +277,10 @@ class CFrameBuffer : public sigc::trackable 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); + virtual int scaleFont(int size) { return size; }; + virtual bool fullHdAvailable() { return false; }; + virtual void setOsdResolutions(); + std::vector osd_resolutions; //NI void clearIconCache(); diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp index 80b40377e..6bbe1e912 100644 --- a/src/driver/neutrinofonts.cpp +++ b/src/driver/neutrinofonts.cpp @@ -176,12 +176,23 @@ 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); +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + fontSize = CFrameBuffer::getInstance()->scaleFont(CNeutrinoApp::getInstance()->getConfigFile()->getInt32(locale_real_names[neutrino_font[i].name], neutrino_font[i].defaultsize)) + neutrino_font[i].size_offset * fontDescr.size_offset; +#else + fontSize = CNeutrinoApp::getInstance()->getConfigFile()->getInt32(locale_real_names[neutrino_font[i].name], neutrino_font[i].defaultsize) + neutrino_font[i].size_offset * fontDescr.size_offset; +#endif + 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); +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + fontSize = CFrameBuffer::getInstance()->scaleFont(signal_font.defaultsize) + signal_font.size_offset * fontDescr.size_offset; +#else + fontSize = signal_font.defaultsize + signal_font.size_offset * fontDescr.size_offset; +#endif + g_SignalFont = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[signal_font.style].c_str(), fontSize); } void CNeutrinoFonts::refreshDynFonts() @@ -242,7 +253,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/gui/infoclock.cpp b/src/gui/infoclock.cpp index 54b485b09..a5c75b7fc 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -76,6 +76,9 @@ void CInfoClock::initCCLockItems() //set height, NOTE: height is strictly bound to settings height = g_settings.infoClockFontSize; +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + height = CFrameBuffer::getInstance()->scaleFont(height); +#endif initClockFont(0, height); // set corner radius depending on clock height diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 5fb7f3c55..9a2d675e0 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -398,12 +398,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 @@ -662,6 +661,30 @@ 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; + } + CMenuOptionChooser * osd_res = new CMenuOptionChooser(LOCALE_COLORMENU_OSD_RESOLUTION, &g_settings.osd_resolution, kext, resCount, (resCount>1), 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); @@ -679,6 +702,8 @@ int COsdSetup::showOsdSetup() osd_menu->addItem(mc); #endif + 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); @@ -1460,16 +1485,48 @@ 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->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(); + } + } + 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 cc8dce29c..6322aa770 100644 --- a/src/gui/osd_setup.h +++ b/src/gui/osd_setup.h @@ -101,6 +101,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/volumebar.cpp b/src/gui/volumebar.cpp index 92d8a7354..445584765 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -54,6 +54,9 @@ void CVolumeBar::initVarVolumeBar() corner_rad = CORNER_RADIUS_MID; vb_item_offset = OFFSET_INNER_SMALL; height = g_settings.volume_size; //default height +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + height = CFrameBuffer::getInstance()->scaleFont(height); +#endif //assume volume value as pointer to global setting vb_vol = &g_settings.current_volume; @@ -92,6 +95,9 @@ void CVolumeBar::initVolumeBarSize() //scale vb_pbw = 200; +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + vb_pbw = CFrameBuffer::getInstance()->scaleFont(vb_pbw); +#endif vb_pbh = height-4*vb_item_offset; //result for width @@ -367,6 +373,9 @@ void CVolumeHelper::initVolBarSize() icon_width += 8; g_settings.volume_size = max(g_settings.volume_size, icon_height); vol_height = g_settings.volume_size; +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + vol_height = CFrameBuffer::getInstance()->scaleFont(vol_height); +#endif if (g_settings.volume_digits) { CNeutrinoFonts *cnf = CNeutrinoFonts::getInstance(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index abb8a86d8..711be389b 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -236,6 +236,7 @@ CNeutrinoApp::CNeutrinoApp() : configfile('\t') { standby_pressed_at.tv_sec = 0; + osd_resolution_tmp = -1; frameBuffer = CFrameBuffer::getInstance(); frameBuffer->setIconBasePath(ICONSDIR); @@ -317,15 +318,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 45 //5 //NI -#define DEFAULT_Y_START_HD 30 //5 //NI -#define DEFAULT_X_END_HD 1235 //1275 -#define DEFAULT_Y_END_HD 690 //715 std::string ttx_font_file = ""; @@ -779,29 +771,31 @@ 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; + 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" , 1199); + g_settings.screen_EndY_crt_0 = configfile.getInt32("screen_EndY_crt_0" , 674); + 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", 22); + g_settings.screen_EndX_lcd_0 = configfile.getInt32("screen_EndX_lcd_0" , 1193); + g_settings.screen_EndY_lcd_0 = configfile.getInt32("screen_EndY_lcd_0" , 697); + 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" , 1839); + g_settings.screen_EndY_crt_1 = configfile.getInt32("screen_EndY_crt_1" , 1034); + 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", 22); + g_settings.screen_EndX_lcd_1 = configfile.getInt32("screen_EndX_lcd_1" , 1879); + g_settings.screen_EndY_lcd_1 = configfile.getInt32("screen_EndY_lcd_1" , 1057); + 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", 1); //NI g_settings.window_size = configfile.getInt32("window_size", 100); @@ -1005,6 +999,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); @@ -1419,15 +1463,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" , g_settings.osd_resolution); + 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 ); @@ -1924,7 +1977,37 @@ void CNeutrinoApp::CmdParser(int argc, char **argv) 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); + +#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); } @@ -5082,11 +5165,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; @@ -5097,6 +5176,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 } }; @@ -5119,7 +5206,7 @@ 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 */ @@ -5129,4 +5216,3 @@ void CNeutrinoApp::migrateConfig(const char *fname) if (my_system(NEUTRINO_NI_MIGRATION_SCRIPT) != 0) perror(NEUTRINO_NI_MIGRATION_SCRIPT " failed"); } - diff --git a/src/neutrino.h b/src/neutrino.h index 1160503bb..7f9aa9915 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -108,6 +108,7 @@ private: bool channelList_allowed; bool channelList_painted; int first_mode_found; + int osd_resolution_tmp; bool blank_screen; //NI void SDT_ReloadChannels(); @@ -164,6 +165,7 @@ public: void ExitRun(const bool write_si = true, int retcode = 0); //NI cross-team settings 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/system/locals.h b/src/system/locals.h index 05c523765..860698b1e 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -378,12 +378,11 @@ 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_OSD_RESOLUTION, LOCALE_COLORMENU_PROGRESSBAR_ACTIVE, LOCALE_COLORMENU_PROGRESSBAR_PASSIVE, - LOCALE_COLORMENU_SD_PRESET, LOCALE_COLORMENU_TEXTCOLOR, LOCALE_COLORMENU_THEMESELECT, LOCALE_COLORMENU_TIMING, @@ -1426,6 +1425,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, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index a899aead7..af4125eef 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -378,12 +378,11 @@ const char * locale_real_names[] = "colormenu.fade", "colormenu.font", "colormenu.font_ttx", - "colormenu.hd_preset", "colormenu.menucolors", "colormenu.osd_preset", + "colormenu.osd_resolution", "colormenu.progressbar_active", "colormenu.progressbar_passive", - "colormenu.sd_preset", "colormenu.textcolor", "colormenu.themeselect", "colormenu.timing", @@ -1426,6 +1425,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", diff --git a/src/system/settings.h b/src/system/settings.h index 8f6babd87..50e0b86b2 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -625,14 +625,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;