mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +02:00
- pipsetup: formatting code using astyle
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -26,17 +26,21 @@ CPipSetup::CPipSetup()
|
|||||||
{
|
{
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
|
|
||||||
if(CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio) {
|
if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio)
|
||||||
|
{
|
||||||
gx = &g_settings.pip_radio_x;
|
gx = &g_settings.pip_radio_x;
|
||||||
gy = &g_settings.pip_radio_y;
|
gy = &g_settings.pip_radio_y;
|
||||||
gw = &g_settings.pip_radio_width;
|
gw = &g_settings.pip_radio_width;
|
||||||
gh = &g_settings.pip_radio_height;
|
gh = &g_settings.pip_radio_height;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
gx = &g_settings.pip_x;
|
gx = &g_settings.pip_x;
|
||||||
gy = &g_settings.pip_y;
|
gy = &g_settings.pip_y;
|
||||||
gw = &g_settings.pip_width;
|
gw = &g_settings.pip_width;
|
||||||
gh = &g_settings.pip_height;
|
gh = &g_settings.pip_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
x_coord = *gx;
|
x_coord = *gx;
|
||||||
y_coord = *gy;
|
y_coord = *gy;
|
||||||
width = *gw;
|
width = *gw;
|
||||||
@@ -52,17 +56,25 @@ void CPipSetup::move(int x, int y, bool abs)
|
|||||||
{
|
{
|
||||||
int newx, newy;
|
int newx, newy;
|
||||||
|
|
||||||
if(abs) {
|
if (abs)
|
||||||
|
{
|
||||||
newx = x;
|
newx = x;
|
||||||
newy = y;
|
newy = y;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
newx = x_coord + x;
|
newx = x_coord + x;
|
||||||
newy = y_coord + y;
|
newy = y_coord + y;
|
||||||
if(newx < 0) newx = 0;
|
if (newx < 0)
|
||||||
else if((newx + width) >= maxw) newx = maxw - width;
|
newx = 0;
|
||||||
if(newy < 0) newy = 0;
|
else if ((newx + width) >= maxw)
|
||||||
else if((newy + height) >= maxh) newy = maxh - height;
|
newx = maxw - width;
|
||||||
|
if (newy < 0)
|
||||||
|
newy = 0;
|
||||||
|
else if ((newy + height) >= maxh)
|
||||||
|
newy = maxh - height;
|
||||||
}
|
}
|
||||||
|
|
||||||
x_coord = newx;
|
x_coord = newx;
|
||||||
y_coord = newy;
|
y_coord = newy;
|
||||||
*gx = x_coord;
|
*gx = x_coord;
|
||||||
@@ -78,19 +90,25 @@ void CPipSetup::resize(int w, int h, bool abs)
|
|||||||
{
|
{
|
||||||
int neww, newh;
|
int neww, newh;
|
||||||
|
|
||||||
if(abs) {
|
if (abs)
|
||||||
|
{
|
||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
neww = width + (maxw * w / 100);
|
neww = width + (maxw * w / 100);
|
||||||
//newh = neww * 100 / 125;
|
|
||||||
newh = height + (maxh * h / 100);
|
newh = height + (maxh * h / 100);
|
||||||
|
|
||||||
if(neww > maxw) neww = maxw;
|
if (neww > maxw)
|
||||||
else if(neww < minw) neww = minw;
|
neww = maxw;
|
||||||
|
else if (neww < minw)
|
||||||
|
neww = minw;
|
||||||
|
|
||||||
if(newh > maxh) newh = maxh;
|
if (newh > maxh)
|
||||||
else if(newh < minh) newh = minh;
|
newh = maxh;
|
||||||
|
else if (newh < minh)
|
||||||
|
newh = minh;
|
||||||
if ((x_coord + neww) > maxw)
|
if ((x_coord + neww) > maxw)
|
||||||
return;
|
return;
|
||||||
if ((y_coord + newh) > maxh)
|
if ((y_coord + newh) > maxh)
|
||||||
@@ -98,6 +116,7 @@ void CPipSetup::resize(int w, int h, bool abs)
|
|||||||
width = neww;
|
width = neww;
|
||||||
height = newh;
|
height = newh;
|
||||||
}
|
}
|
||||||
|
|
||||||
*gw = width;
|
*gw = width;
|
||||||
*gh = height;
|
*gh = height;
|
||||||
|
|
||||||
@@ -110,6 +129,7 @@ int CPipSetup::exec(CMenuTarget* parent, const std::string &)
|
|||||||
{
|
{
|
||||||
neutrino_msg_t msg;
|
neutrino_msg_t msg;
|
||||||
neutrino_msg_data_t data;
|
neutrino_msg_data_t data;
|
||||||
|
|
||||||
int oldx = x_coord;
|
int oldx = x_coord;
|
||||||
int oldy = y_coord;
|
int oldy = y_coord;
|
||||||
int oldw = width;
|
int oldw = width;
|
||||||
@@ -129,38 +149,50 @@ int CPipSetup::exec(CMenuTarget* parent, const std::string &)
|
|||||||
pipVideoDecoder[0]->ShowPig(1);
|
pipVideoDecoder[0]->ShowPig(1);
|
||||||
#endif
|
#endif
|
||||||
bool loop = true;
|
bool loop = true;
|
||||||
while (loop) {
|
while (loop)
|
||||||
|
{
|
||||||
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true);
|
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true);
|
||||||
|
|
||||||
if (msg <= CRCInput::RC_MaxRC)
|
if (msg <= CRCInput::RC_MaxRC)
|
||||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||||
|
|
||||||
if ((msg == (neutrino_msg_t) g_settings.key_pip_setup) ||
|
if ((msg == (neutrino_msg_t) g_settings.key_pip_setup) || (msg == CRCInput::RC_timeout) || (msg == CRCInput::RC_ok))
|
||||||
(msg == CRCInput::RC_timeout) || (msg == CRCInput::RC_ok)) {
|
{
|
||||||
loop = false;
|
loop = false;
|
||||||
break;
|
break;
|
||||||
} else if (CNeutrinoApp::getInstance()->backKey(msg) || (msg == CRCInput::RC_spkr)) {
|
}
|
||||||
|
else if (CNeutrinoApp::getInstance()->backKey(msg) || (msg == CRCInput::RC_spkr))
|
||||||
|
{
|
||||||
clear();
|
clear();
|
||||||
move(oldx, oldy, true);
|
move(oldx, oldy, true);
|
||||||
resize(oldw, oldh, true);
|
resize(oldw, oldh, true);
|
||||||
paint();
|
paint();
|
||||||
if (CNeutrinoApp::getInstance()->backKey(msg))
|
if (CNeutrinoApp::getInstance()->backKey(msg))
|
||||||
loop = false;
|
loop = false;
|
||||||
} else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) {
|
}
|
||||||
|
else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_down))
|
||||||
|
{
|
||||||
clear();
|
clear();
|
||||||
move(0, (msg == CRCInput::RC_up) ? -YMOVE : YMOVE);
|
move(0, (msg == CRCInput::RC_up) ? -YMOVE : YMOVE);
|
||||||
paint();
|
paint();
|
||||||
} else if ((msg == CRCInput::RC_left) || (msg == CRCInput::RC_right)) {
|
}
|
||||||
|
else if ((msg == CRCInput::RC_left) || (msg == CRCInput::RC_right))
|
||||||
|
{
|
||||||
clear();
|
clear();
|
||||||
move((msg == CRCInput::RC_left) ? -XMOVE : XMOVE, 0);
|
move((msg == CRCInput::RC_left) ? -XMOVE : XMOVE, 0);
|
||||||
paint();
|
paint();
|
||||||
} else if ((msg == CRCInput::RC_plus) || (msg == CRCInput::RC_minus)) {
|
}
|
||||||
|
else if ((msg == CRCInput::RC_plus) || (msg == CRCInput::RC_minus))
|
||||||
|
{
|
||||||
clear();
|
clear();
|
||||||
int percent = (msg == CRCInput::RC_plus) ? PERCENT : -PERCENT;
|
int percent = (msg == CRCInput::RC_plus) ? PERCENT : -PERCENT;
|
||||||
resize(percent, percent);
|
resize(percent, percent);
|
||||||
paint();
|
paint();
|
||||||
} else if (msg > CRCInput::RC_MaxRC) {
|
}
|
||||||
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
|
else if (msg > CRCInput::RC_MaxRC)
|
||||||
|
{
|
||||||
|
if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all)
|
||||||
|
{
|
||||||
loop = false;
|
loop = false;
|
||||||
res = menu_return::RETURN_EXIT_ALL;
|
res = menu_return::RETURN_EXIT_ALL;
|
||||||
}
|
}
|
||||||
@@ -205,8 +237,10 @@ void CPipSetup::paint()
|
|||||||
int y = (frameBuffer->getScreenHeight() - mheight * 4) / 2;
|
int y = (frameBuffer->getScreenHeight() - mheight * 4) / 2;
|
||||||
|
|
||||||
if (pipVideoDecoder[0] != NULL)
|
if (pipVideoDecoder[0] != NULL)
|
||||||
|
{
|
||||||
if (pipVideoDecoder[0]->getBlank())
|
if (pipVideoDecoder[0]->getBlank())
|
||||||
frameBuffer->paintBoxRel(x_coord, y_coord, width, height, COL_MENUCONTENT_PLUS_0);
|
frameBuffer->paintBoxRel(x_coord, y_coord, width, height, COL_MENUCONTENT_PLUS_0);
|
||||||
|
}
|
||||||
|
|
||||||
frameBuffer->paintBoxRel(x, y, mwidth, mheight * 4, COL_MENUCONTENT_PLUS_0);
|
frameBuffer->paintBoxRel(x, y, mwidth, mheight * 4, COL_MENUCONTENT_PLUS_0);
|
||||||
|
|
||||||
|
@@ -28,4 +28,5 @@ class CPipSetup : public CMenuTarget
|
|||||||
void resize(int w, int h, bool abs = false);
|
void resize(int w, int h, bool abs = false);
|
||||||
int exec(CMenuTarget *parent, const std::string &actionKey);
|
int exec(CMenuTarget *parent, const std::string &actionKey);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user