mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 00:41:09 +02:00
gui/osd_setup.cpp: add support to change window width and height,
use buttons up/down to change height, left/right to change width, page up/down to change both
Origin commit data
------------------
Branch: ni/coolstream
Commit: aaf9d3edf6
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-11-07 (Thu, 07 Nov 2013)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -268,27 +268,11 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
else if(actionKey=="window_size") {
|
else if(actionKey=="window_size") {
|
||||||
if (win_demo == NULL) {
|
int old_window_width = g_settings.window_width;
|
||||||
win_demo = new CComponentsShapeSquare(0, 0, 0, 0);
|
int old_window_height = g_settings.window_height;
|
||||||
win_demo->setFrameThickness(8);
|
|
||||||
win_demo->setShadowOnOff(CC_SHADOW_OFF);
|
|
||||||
win_demo->setColorBody(COL_BACKGROUND);
|
|
||||||
win_demo->setColorFrame(COL_RED);
|
|
||||||
win_demo->doPaintBg(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (win_demo->isPainted())
|
|
||||||
win_demo->kill();
|
|
||||||
}
|
|
||||||
|
|
||||||
win_demo->setWidth(frameBuffer->getScreenWidthRel());
|
paintWindowSize(old_window_width, old_window_height);
|
||||||
win_demo->setHeight(frameBuffer->getScreenHeightRel());
|
|
||||||
win_demo->setXPos(getScreenStartX(win_demo->getWidth()));
|
|
||||||
win_demo->setYPos(getScreenStartY(win_demo->getHeight()));
|
|
||||||
|
|
||||||
win_demo->paint(CC_SAVE_SCREEN_NO);
|
|
||||||
|
|
||||||
int old_window_size = g_settings.window_size;
|
|
||||||
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||||
|
|
||||||
bool loop=true;
|
bool loop=true;
|
||||||
@@ -301,30 +285,34 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
if ( msg == CRCInput::RC_ok ) {
|
if ( msg == CRCInput::RC_ok ) {
|
||||||
loop = false;
|
loop = false;
|
||||||
memset(window_size_value, 0, sizeof(window_size_value));
|
memset(window_size_value, 0, sizeof(window_size_value));
|
||||||
snprintf(window_size_value, sizeof(window_size_value)-1, "%d", g_settings.window_size);
|
snprintf(window_size_value, sizeof(window_size_value)-1, "%d / %d", g_settings.window_width, g_settings.window_height);
|
||||||
mfWindowSize->setOption(window_size_value);
|
mfWindowSize->setOption(window_size_value);
|
||||||
break;
|
break;
|
||||||
} else if ((msg == CRCInput::RC_home) || (msg == CRCInput::RC_timeout)) {
|
} else if ((msg == CRCInput::RC_home) || (msg == CRCInput::RC_timeout)) {
|
||||||
g_settings.window_size = old_window_size;
|
g_settings.window_width = old_window_width;
|
||||||
|
g_settings.window_height = old_window_height;
|
||||||
loop = false;
|
loop = false;
|
||||||
} else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) {
|
} else if ((msg == CRCInput::RC_page_up) || (msg == CRCInput::RC_page_down) ||
|
||||||
if ((msg == CRCInput::RC_up) && (g_settings.window_size < WINDOW_SIZE_MAX)) {
|
(msg == CRCInput::RC_left) || (msg == CRCInput::RC_right) ||
|
||||||
g_settings.window_size += 1;
|
(msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) {
|
||||||
}
|
|
||||||
if ((msg == CRCInput::RC_down) && (g_settings.window_size > WINDOW_SIZE_MIN)) {
|
|
||||||
g_settings.window_size -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (win_demo->isPainted())
|
int dir = 1;
|
||||||
win_demo->kill();
|
if ((msg == CRCInput::RC_page_down) || (msg == CRCInput::RC_left) || (msg == CRCInput::RC_down))
|
||||||
|
dir = -1;
|
||||||
|
|
||||||
win_demo->setWidth(frameBuffer->getScreenWidthRel());
|
int mask = 3;
|
||||||
win_demo->setHeight(frameBuffer->getScreenHeightRel());
|
if ((msg == CRCInput::RC_left) || (msg == CRCInput::RC_right))
|
||||||
win_demo->setXPos(getScreenStartX(win_demo->getWidth()));
|
mask = 1;
|
||||||
win_demo->setYPos(getScreenStartY(win_demo->getHeight()));
|
else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_down))
|
||||||
|
mask = 2;
|
||||||
|
if (mask & 1)
|
||||||
|
g_settings.window_width += dir;
|
||||||
|
if (mask & 2)
|
||||||
|
g_settings.window_height += dir;
|
||||||
|
|
||||||
win_demo->paint(CC_SAVE_SCREEN_NO);
|
paintWindowSize(g_settings.window_width, g_settings.window_height);
|
||||||
|
|
||||||
|
} else if ((msg == CRCInput::RC_left) || (msg == CRCInput::RC_right)) {
|
||||||
} else if (msg > CRCInput::RC_MaxRC) {
|
} else if (msg > CRCInput::RC_MaxRC) {
|
||||||
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
|
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
|
||||||
loop = false;
|
loop = false;
|
||||||
@@ -584,7 +572,7 @@ int COsdSetup::showOsdSetup()
|
|||||||
|
|
||||||
// window size
|
// window size
|
||||||
memset(window_size_value, 0, sizeof(window_size_value));
|
memset(window_size_value, 0, sizeof(window_size_value));
|
||||||
snprintf(window_size_value, sizeof(window_size_value)-1, "%d", g_settings.window_size);
|
snprintf(window_size_value, sizeof(window_size_value)-1, "%d / %d", g_settings.window_width, g_settings.window_height);
|
||||||
mfWindowSize = new CMenuForwarder(LOCALE_WINDOW_SIZE, true, window_size_value, this, "window_size", CRCInput::convertDigitToKey(shortcut++));
|
mfWindowSize = new CMenuForwarder(LOCALE_WINDOW_SIZE, true, window_size_value, this, "window_size", CRCInput::convertDigitToKey(shortcut++));
|
||||||
mfWindowSize->setHint("", LOCALE_MENU_HINT_WINDOW_SIZE);
|
mfWindowSize->setHint("", LOCALE_MENU_HINT_WINDOW_SIZE);
|
||||||
osd_menu->addItem(mfWindowSize);
|
osd_menu->addItem(mfWindowSize);
|
||||||
@@ -1162,3 +1150,37 @@ void COsdSetup::showOsdScreenShotSetup(CMenuWidget *menu_screenshot)
|
|||||||
mc->setHint("", LOCALE_MENU_HINT_SCREENSHOT_COVER);
|
mc->setHint("", LOCALE_MENU_HINT_SCREENSHOT_COVER);
|
||||||
menu_screenshot->addItem(mc);
|
menu_screenshot->addItem(mc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void COsdSetup::paintWindowSize(int w, int h)
|
||||||
|
{
|
||||||
|
if (win_demo == NULL) {
|
||||||
|
win_demo = new CComponentsShapeSquare(0, 0, 0, 0);
|
||||||
|
win_demo->setFrameThickness(8);
|
||||||
|
win_demo->setShadowOnOff(CC_SHADOW_OFF);
|
||||||
|
win_demo->setColorBody(COL_BACKGROUND);
|
||||||
|
win_demo->setColorFrame(COL_RED);
|
||||||
|
win_demo->doPaintBg(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (win_demo->isPainted())
|
||||||
|
win_demo->kill();
|
||||||
|
}
|
||||||
|
|
||||||
|
g_settings.window_width = w;
|
||||||
|
g_settings.window_height = h;
|
||||||
|
if (g_settings.window_width > WINDOW_SIZE_MAX)
|
||||||
|
g_settings.window_width = WINDOW_SIZE_MAX;
|
||||||
|
if (g_settings.window_width < WINDOW_SIZE_MIN)
|
||||||
|
g_settings.window_width = WINDOW_SIZE_MIN;
|
||||||
|
if (g_settings.window_height > WINDOW_SIZE_MAX)
|
||||||
|
g_settings.window_height = WINDOW_SIZE_MAX;
|
||||||
|
if (g_settings.window_height < WINDOW_SIZE_MIN)
|
||||||
|
g_settings.window_height = WINDOW_SIZE_MIN;
|
||||||
|
|
||||||
|
win_demo->setWidth(frameBuffer->getScreenWidthRel());
|
||||||
|
win_demo->setHeight(frameBuffer->getScreenHeightRel());
|
||||||
|
win_demo->setXPos(getScreenStartX(win_demo->getWidth()));
|
||||||
|
win_demo->setYPos(getScreenStartY(win_demo->getHeight()));
|
||||||
|
|
||||||
|
win_demo->paint(CC_SAVE_SCREEN_NO);
|
||||||
|
}
|
||||||
|
@@ -50,7 +50,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
|
|||||||
CMenuWidget *osd_menu;
|
CMenuWidget *osd_menu;
|
||||||
CMenuWidget *submenu_menus;
|
CMenuWidget *submenu_menus;
|
||||||
CMenuForwarder *mfFontFile, *mfTtxFontFile, *mfWindowSize;
|
CMenuForwarder *mfFontFile, *mfTtxFontFile, *mfWindowSize;
|
||||||
char window_size_value[6];
|
char window_size_value[10];
|
||||||
std::string osdFontFile, osdTtxFontFile;
|
std::string osdFontFile, osdTtxFontFile;
|
||||||
CComponentsShapeSquare *win_demo;
|
CComponentsShapeSquare *win_demo;
|
||||||
|
|
||||||
@@ -69,6 +69,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
|
|||||||
void showOsdEventlistSetup(CMenuWidget *menu_eventlist);
|
void showOsdEventlistSetup(CMenuWidget *menu_eventlist);
|
||||||
void showOsdVolumeSetup(CMenuWidget *menu_volume);
|
void showOsdVolumeSetup(CMenuWidget *menu_volume);
|
||||||
void showOsdScreenShotSetup(CMenuWidget *menu_screenshot);
|
void showOsdScreenShotSetup(CMenuWidget *menu_screenshot);
|
||||||
|
void paintWindowSize(int w, int h);
|
||||||
|
|
||||||
void AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSettings::FONT_TYPES number_of_fontsize_entry);
|
void AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSettings::FONT_TYPES number_of_fontsize_entry);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user