Merge branch 'pip' into next

Conflicts:
	src/gui/channellist.cpp
This commit is contained in:
[CST] Focus
2013-02-28 16:45:41 +04:00
22 changed files with 494 additions and 17 deletions

View File

@@ -108,6 +108,7 @@ libneutrino_gui_a_SOURCES = \
user_menue_setup.cpp \
vfd_setup.cpp \
videosettings.cpp \
pipsetup.cpp \
zapit_setup.cpp
libneutrino_gui2_a_SOURCES = \

View File

@@ -778,6 +778,21 @@ int CChannelList::show()
loop=false;
}
}
#ifdef BOXMODEL_APOLLO
else if ( msg == CRCInput::RC_play) {
if(SameTP() && CRecordManager::getInstance()->GetRecordMode(chanlist[selected]->channel_id) == CRecordManager::RECMODE_OFF) {
if (CZapit::getInstance()->GetPipChannelID() == chanlist[selected]->getChannelID()) {
CZapit::getInstance()->StopPip();
paint();
} else {
if (CZapit::getInstance()->StartPip(chanlist[selected]->getChannelID()))
paint();
else
DisplayErrorMessage(g_Locale->getText(LOCALE_VIDEOMENU_PIP_ERROR));
}
}
}
#endif
else if (( msg == CRCInput::RC_spkr ) && new_zap_mode ) {
if(CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) {
switch (new_zap_mode) {
@@ -1856,11 +1871,19 @@ void CChannelList::paintItem(int pos)
rec_mode = CRecordManager::getInstance()->GetRecordMode(chanlist[curr]->channel_id);
//set recording icon
const char * rec_icon = "";
std::string rec_icon;
if (rec_mode & CRecordManager::RECMODE_REC)
rec_icon = NEUTRINO_ICON_REC;
else if (rec_mode & CRecordManager::RECMODE_TSHIFT)
rec_icon = NEUTRINO_ICON_AUTO_SHIFT;
#ifdef BOXMODEL_APOLLO
else if (chanlist[curr]->channel_id == CZapit::getInstance()->GetPipChannelID()) {
int h;
frameBuffer->getIconSize(NEUTRINO_ICON_PIP, &ChannelList_Rec, &h);
rec_icon = NEUTRINO_ICON_PIP;
ChannelList_Rec += 8;
}
#endif
//calculating icons
int icon_x = (x+width-15-2) - RADIUS_LARGE/2;
@@ -1875,7 +1898,8 @@ void CChannelList::paintItem(int pos)
r_icon_x = r_icon_x - s_icon_w;
//paint recording icon
if (rec_mode != CRecordManager::RECMODE_OFF)
//if (rec_mode != CRecordManager::RECMODE_OFF)
if (!rec_icon.empty())
frameBuffer->paintIcon(rec_icon, r_icon_x - r_icon_w, ypos, fheight);//ypos + (fheight - 16)/2);
//paint buttons

View File

@@ -184,7 +184,8 @@ const key_settings_struct_t key_settings[CKeybindSetup::KEYBINDS_COUNT] =
{LOCALE_MPKEY_PLUGIN, &g_settings.mpkey_plugin, LOCALE_MENU_HINT_KEY_MPPLUGIN },
/*{LOCALE_EXTRA_KEY_PLUGIN, &g_settings.key_plugin, },*/
{LOCALE_EXTRA_KEY_UNLOCK, &g_settings.key_unlock, LOCALE_MENU_HINT_KEY_UNLOCK},
{LOCALE_EXTRA_KEY_SCREENSHOT, &g_settings.key_screenshot, LOCALE_MENU_HINT_KEY_SCREENSHOT }
{LOCALE_EXTRA_KEY_SCREENSHOT, &g_settings.key_screenshot, LOCALE_MENU_HINT_KEY_SCREENSHOT },
{LOCALE_EXTRA_KEY_PIP, &g_settings.key_pip, LOCALE_MENU_HINT_KEY_PIP }
};
@@ -311,6 +312,12 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings)
mf = new CMenuDForwarder(key_settings[KEY_SCREENSHOT].keydescription, true, keychooser[KEY_SCREENSHOT]->getKeyName(), keychooser[KEY_SCREENSHOT]);
mf->setHint("", key_settings[KEY_SCREENSHOT].hint);
bindSettings->addItem(mf);
#ifdef BOXMODEL_APOLLO
// pip
mf = new CMenuDForwarder(key_settings[KEY_PIP].keydescription, true, keychooser[KEY_PIP]->getKeyName(), keychooser[KEY_PIP]);
mf->setHint("", key_settings[KEY_PIP].hint);
bindSettings->addItem(mf);
#endif
//bindSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_ZAP_CYCLE, &g_settings.zap_cycle, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
// left-exit, FIXME is this option really change anything ??

View File

@@ -76,6 +76,7 @@ class CKeybindSetup : public CMenuTarget, public CChangeObserver
/*KEY_PLUGIN,*/
KEY_UNLOCK,
KEY_SCREENSHOT,
KEY_PIP,
KEYBINDS_COUNT
};

219
src/gui/pipsetup.cpp Normal file
View File

@@ -0,0 +1,219 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gui/color.h>
#include <gui/widget/messagebox.h>
#include <driver/fontrenderer.h>
#include <driver/rcinput.h>
#include <system/settings.h>
#include <global.h>
#include <neutrino.h>
#include <gui/pipsetup.h>
#define PERCENT 5
#define XMOVE 10
#define YMOVE 10
#ifdef BOXMODEL_APOLLO
extern cVideo *pipDecoder;
CPipSetup::CPipSetup()
{
frameBuffer = CFrameBuffer::getInstance();
x_coord = g_settings.pip_x;
y_coord = g_settings.pip_y;
width = g_settings.pip_width;
height = g_settings.pip_height;
maxw = frameBuffer->getScreenWidth(true);
maxh = frameBuffer->getScreenHeight(true);
minw = maxw/8;
minh = minw*1000/1825;
}
void CPipSetup::move(int x, int y, bool abs)
{
int newx, newy;
if(abs) {
newx = x;
newy = y;
} else {
newx = x_coord + x;
newy = y_coord + y;
if(newx < 0) newx = 0;
else if((newx + width) >= maxw) newx = maxw - width;
if(newy < 0) newy = 0;
else if((newy + height) >= maxh) newy = maxh - height;
}
x_coord = newx;
y_coord = newy;
g_settings.pip_x = x_coord;
g_settings.pip_y = y_coord;
printf("CPipSetup::move: x %d y %d\n", x_coord, y_coord);
pipDecoder->Pig(x_coord, y_coord, width, height, maxw, maxh);
}
// w and h is percent, if not absolute
void CPipSetup::resize(int w, int h, bool abs)
{
int neww, newh;
if(abs) {
width = w;
height = h;
} else {
neww = width + (maxw*w/100);
//newh = neww * 100 / 125;
newh = height + (maxh*h/100);
if(neww > maxw) neww = maxw;
else if(neww < minw) neww = minw;
if(newh > maxh) newh = maxh;
else if(newh < minh) newh = minh;
if( (x_coord + neww) > maxw)
return;
if( (y_coord + newh) > maxh)
return;
width = neww;
height = newh;
}
g_settings.pip_width = width;
g_settings.pip_height = height;
printf("CPipSetup::resize: w %d h %d \n", width, height);
pipDecoder->Pig(x_coord, y_coord, width, height, maxw, maxh);
}
int CPipSetup::exec(CMenuTarget* parent, const std::string &)
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
int oldx = x_coord;
int oldy = y_coord;
int oldw = width;
int oldh = height;
printf("CPipSetup::exec\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
parent->hide();
paint();
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
bool loop=true;
while (loop) {
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true);
if ( msg <= CRCInput::RC_MaxRC )
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
switch (msg) {
case CRCInput::RC_timeout:
case CRCInput::RC_ok:
loop = false;
break;
case CRCInput::RC_setup:
res = menu_return::RETURN_EXIT_ALL;
loop = false;
break;
case CRCInput::RC_home:
loop = false;
case CRCInput::RC_spkr:
clear();
move(oldx, oldy, true);
resize(oldw, oldh, true);
paint();
break;
case CRCInput::RC_up:
clear();
move(0, -YMOVE);
paint();
break;
case CRCInput::RC_down:
clear();
move(0, YMOVE);
paint();
break;
case CRCInput::RC_left:
clear();
move(-XMOVE, 0);
paint();
break;
case CRCInput::RC_right:
clear();
move(XMOVE, 0);
paint();
break;
case CRCInput::RC_plus:
clear();
resize(PERCENT, PERCENT);
paint();
break;
case CRCInput::RC_minus:
clear();
resize(-PERCENT, -PERCENT);
paint();
break;
default:
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
loop = false;
res = menu_return::RETURN_EXIT_ALL;
}
}
}
hide();
return res;
}
void CPipSetup::hide()
{
frameBuffer->Clear();
}
void CPipSetup::clear()
{
frameBuffer->paintBackgroundBoxRel(x_coord, y_coord, width, height);
}
void CPipSetup::paint()
{
if (!frameBuffer->getActive())
return;
char xpos[30];
char ypos[30];
char wpos[30];
char hpos[30];
sprintf(xpos, "X: %d", x_coord );
sprintf(ypos, "Y: %d", y_coord );
sprintf(wpos, "W: %d", width );
sprintf(hpos, "H: %d", height );
int mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
int mwidth = 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("W: 9999");
int x = (frameBuffer->getScreenWidth() - mwidth)/2;
int y = (frameBuffer->getScreenHeight() - mheight*4)/2;
if (pipDecoder->getBlank())
frameBuffer->paintBoxRel(x_coord, y_coord, width, height, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x, y, mwidth, mheight*4, COL_MENUCONTENT_PLUS_0);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+5, y+mheight, mwidth, xpos, COL_MENUCONTENT);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+5, y+mheight*2, mwidth, ypos, COL_MENUCONTENT);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+5, y+mheight*3, mwidth, wpos, COL_MENUCONTENT);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+5, y+mheight*4, mwidth, hpos, COL_MENUCONTENT);
}
#endif //BOXMODEL_APOLLO

29
src/gui/pipsetup.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef __PIP_SETUP_H_
#define __PIP_SETUP_H_
#include <gui/widget/menue.h>
#include <driver/framebuffer.h>
#include <string>
class CPipSetup : public CMenuTarget
{
private:
CFrameBuffer * frameBuffer;
int x_coord;
int y_coord;
int width;
int height;
int maxw;
int maxh;
int minw;
int minh;
void paint();
void hide();
void clear();
public:
CPipSetup();
void move(int x, int y, bool abs = false);
void resize(int w, int h, bool abs = false);
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

View File

@@ -200,6 +200,9 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey)
CRecordManager::getInstance()->StopAutoRecord();
g_Zapit->stopPlayBack();
#ifdef BOXMODEL_APOLLO
CZapit::getInstance()->StopPip();
#endif
frameBuffer->paintBackground();
videoDecoder->ShowPicture(DATADIR "/neutrino/icons/scan.jpg");
@@ -342,6 +345,8 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey)
videoDecoder->StopPicture();
frameBuffer->Clear();
g_Sectionsd->setPauseScanning(false);
CNeutrinoApp::getInstance()->channelList->setSelected(0xfffffff);
CNeutrinoApp::getInstance()->channelList->zapTo_ChannelID(CZapit::getInstance()->GetCurrentChannelID());
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
return menu_return::RETURN_REPAINT;

View File

@@ -54,6 +54,10 @@
#include <video.h>
extern cVideo *videoDecoder;
#ifdef BOXMODEL_APOLLO
extern cVideo *pipDecoder;
#include <gui/pipsetup.h>
#endif
extern int prev_video_mode;
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
@@ -297,11 +301,19 @@ int CVideoSettings::showVideoSetup()
#ifdef BOXMODEL_APOLLO
/* values are from -128 to 127, but brightness really no sense after +/- 40. changeNotify multiply contrast and saturation to 3 */
CMenuOptionNumberChooser * bcont = new CMenuOptionNumberChooser(LOCALE_VIDEOMENU_BRIGHTNESS, &g_settings.brightness, true, -42, 42, this);
bcont->setHint("", LOCALE_MENU_HINT_VIDEO_BRIGHTNESS);
CMenuOptionNumberChooser * ccont = new CMenuOptionNumberChooser(LOCALE_VIDEOMENU_CONTRAST, &g_settings.contrast, true, -42, 42, this);
ccont->setHint("", LOCALE_MENU_HINT_VIDEO_CONTRAST);
CMenuOptionNumberChooser * scont = new CMenuOptionNumberChooser(LOCALE_VIDEOMENU_SATURATION, &g_settings.saturation, true, -42, 42, this);
scont->setHint("", LOCALE_MENU_HINT_VIDEO_SATURATION);
videosetup->addItem(bcont);
videosetup->addItem(ccont);
videosetup->addItem(scont);
CPipSetup pip;
CMenuForwarder * pipsetup = new CMenuForwarder(LOCALE_VIDEOMENU_PIP, true, NULL, &pip);
pipsetup->setHint("", LOCALE_MENU_HINT_VIDEO_PIP);
videosetup->addItem(pipsetup);
#endif
int res = videosetup->exec(NULL, "");
selected = videosetup->getSelected();
@@ -332,6 +344,9 @@ void CVideoSettings::setVideoSettings()
videoDecoder->setAspectRatio(g_settings.video_Format, -1);
#endif
videoDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode);
#ifdef BOXMODEL_APOLLO
pipDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode);
#endif
videoDecoder->SetDBDR(g_settings.video_dbdr);
CAutoModeNotifier anotify;
@@ -340,6 +355,7 @@ void CVideoSettings::setVideoSettings()
changeNotify(LOCALE_VIDEOMENU_BRIGHTNESS, NULL);
changeNotify(LOCALE_VIDEOMENU_CONTRAST, NULL);
changeNotify(LOCALE_VIDEOMENU_SATURATION, NULL);
pipDecoder->Pig(g_settings.pip_x, g_settings.pip_y, g_settings.pip_width, g_settings.pip_height, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true));
#endif
}
@@ -397,6 +413,9 @@ bool CVideoSettings::changeNotify(const neutrino_locale_t OptionName, void * /*
if (g_settings.video_Format != 1 && g_settings.video_Format != 3 && g_settings.video_Format != 2)
g_settings.video_Format = 3;
videoDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode);
#ifdef BOXMODEL_APOLLO
pipDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode);
#endif
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEOMODE))
{
@@ -449,6 +468,9 @@ void CVideoSettings::next43Mode(void)
text = VIDEOMENU_43MODE_OPTIONS[curmode].value;
g_settings.video_43mode = VIDEOMENU_43MODE_OPTIONS[curmode].key;
videoDecoder->setAspectRatio(-1, g_settings.video_43mode);
#ifdef BOXMODEL_APOLLO
pipDecoder->setAspectRatio(-1, g_settings.video_43mode);
#endif
ShowHintUTF(LOCALE_VIDEOMENU_43MODE, g_Locale->getText(text), 450, 2);
}
@@ -472,6 +494,9 @@ void CVideoSettings::SwitchFormat()
g_settings.video_Format = VIDEOMENU_VIDEOFORMAT_OPTIONS[curmode].key;
videoDecoder->setAspectRatio(g_settings.video_Format, -1);
#ifdef BOXMODEL_APOLLO
pipDecoder->setAspectRatio(g_settings.video_Format, -1);
#endif
ShowHintUTF(LOCALE_VIDEOMENU_VIDEOFORMAT, g_Locale->getText(text), 450, 2);
}

View File

@@ -163,6 +163,7 @@
#define NEUTRINO_ICON_PERSONALIZE "personalize"
#define NEUTRINO_ICON_RECORDING_EVENT_MARKER "rec_event_marker"
#define NEUTRINO_ICON_ZAP "zap"
#define NEUTRINO_ICON_PIP "pip"
#define DUMMY_ICON "dummy"