port getScreenStartX() & getScreenStartY() code from tuxbox CVS; use getScreenStartX(),getScreenStartY(),h_max(),w_max() routines

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@90 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
satbaby
2009-12-17 11:19:16 +00:00
parent 2cea351f94
commit 2e9d4bc46a
2 changed files with 86 additions and 86 deletions

View File

@@ -130,7 +130,7 @@ void CEpgData::start()
{ {
ox = w_max (MAX_W * (bigFonts ? BIG_FONT_FAKTOR : 1), 0); ox = w_max (MAX_W * (bigFonts ? BIG_FONT_FAKTOR : 1), 0);
oy = h_max (MAX_H * (bigFonts ? BIG_FONT_FAKTOR : 1), 0); oy = h_max (MAX_H * (bigFonts ? BIG_FONT_FAKTOR : 1), 0);
sx = (((g_settings.screen_EndX-g_settings.screen_StartX) -ox) / 2) + g_settings.screen_StartX; sx = getScreenStartX( ox );
topheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getHeight(); topheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getHeight();
topboxheight = topheight + 6; topboxheight = topheight + 6;

View File

@@ -49,6 +49,7 @@
#include <driver/audioplay.h> #include <driver/audioplay.h>
#include <driver/audiofile.h> #include <driver/audiofile.h>
#include <driver/audiometadata.h> #include <driver/audiometadata.h>
#include <driver/screen_max.h>
#include <daemonc/remotecontrol.h> #include <daemonc/remotecontrol.h>
@@ -102,7 +103,7 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/
CAudioPlayer::getInstance()->init(); CAudioPlayer::getInstance()->init();
if(parent) if (parent)
{ {
parent->hide(); parent->hide();
} }
@@ -139,9 +140,8 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/
m_listmaxshow = (m_height - m_info_height - m_title_height - m_theight - 2*m_buttonHeight) / (m_fheight); m_listmaxshow = (m_height - m_info_height - m_title_height - m_theight - 2*m_buttonHeight) / (m_fheight);
m_height = m_theight + m_info_height + m_title_height + 2*m_buttonHeight + m_listmaxshow * m_fheight; // recalc height m_height = m_theight + m_info_height + m_title_height + 2*m_buttonHeight + m_listmaxshow * m_fheight; // recalc height
m_x = (((g_settings.screen_EndX - g_settings.screen_StartX) - (m_width + ConnectLineBox_Width)) / 2) m_x=getScreenStartX( m_width + ConnectLineBox_Width ) + ConnectLineBox_Width;
+ g_settings.screen_StartX + ConnectLineBox_Width; m_y=getScreenStartY( m_height );
m_y = (((g_settings.screen_EndY- g_settings.screen_StartY) - m_height)/ 2) + g_settings.screen_StartY;
// Stop sectionsd // Stop sectionsd
g_Sectionsd->setPauseScanning(true); g_Sectionsd->setPauseScanning(true);
@@ -151,7 +151,7 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/
selectDevice(); selectDevice();
if(CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
CAudioPlayer::getInstance()->stop(); CAudioPlayer::getInstance()->stop();
//g_Zapit->setStandby(false); //g_Zapit->setStandby(false);
@@ -213,7 +213,7 @@ std::vector<UPnPEntry> *CUpnpBrowserGui::decodeResult(std::string result)
parser = new XMLTreeParser("UTF-8"); parser = new XMLTreeParser("UTF-8");
parser->Parse(result.c_str(), result.size(), 1); parser->Parse(result.c_str(), result.size(), 1);
root=parser->RootNode(); root=parser->RootNode();
if (!root){ if (!root) {
delete parser; delete parser;
return NULL; return NULL;
} }
@@ -407,12 +407,12 @@ void CUpnpBrowserGui::selectDevice()
g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display
neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat; neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat;
if( msg == CRCInput::RC_timeout) if ( msg == CRCInput::RC_timeout)
{ {
// nothing // nothing
} }
else if( msg == CRCInput::RC_home) else if ( msg == CRCInput::RC_home)
{ {
loop=false; loop=false;
} }
@@ -433,14 +433,14 @@ void CUpnpBrowserGui::selectDevice()
changed=true; changed=true;
} }
else if( msg == CRCInput::RC_right || msg == CRCInput::RC_ok) else if ( msg == CRCInput::RC_right || msg == CRCInput::RC_ok)
{ {
m_folderplay = false; m_folderplay = false;
selectItem("0"); selectItem("0");
changed=true; changed=true;
} }
else if( msg == CRCInput::RC_blue) else if ( msg == CRCInput::RC_blue)
{ {
scanBox->paint(); scanBox->paint();
#if 0 #if 0
@@ -465,7 +465,7 @@ void CUpnpBrowserGui::selectDevice()
changed=true; changed=true;
} }
else if(msg == NeutrinoMessages::RECORD_START || else if (msg == NeutrinoMessages::RECORD_START ||
msg == NeutrinoMessages::ZAPTO || msg == NeutrinoMessages::ZAPTO ||
msg == NeutrinoMessages::STANDBY_ON || msg == NeutrinoMessages::STANDBY_ON ||
msg == NeutrinoMessages::SHUTDOWN || msg == NeutrinoMessages::SHUTDOWN ||
@@ -475,14 +475,14 @@ void CUpnpBrowserGui::selectDevice()
g_RCInput->postMsg(msg, data); g_RCInput->postMsg(msg, data);
} }
else if(msg == NeutrinoMessages::EVT_TIMER) else if (msg == NeutrinoMessages::EVT_TIMER)
{ {
CNeutrinoApp::getInstance()->handleMsg( msg, data ); CNeutrinoApp::getInstance()->handleMsg( msg, data );
} }
else else
{ {
if( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
loop = false; loop = false;
changed=true; changed=true;
} }
@@ -578,7 +578,7 @@ void CUpnpBrowserGui::playnext(void)
neutrino_msg_data_t data; neutrino_msg_data_t data;
g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display
if( msg == CRCInput::RC_home) if ( msg == CRCInput::RC_home)
{ {
m_folderplay = false; m_folderplay = false;
break; break;
@@ -697,16 +697,16 @@ bool CUpnpBrowserGui::selectItem(std::string id)
g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display
neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat; neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat;
if( msg == CRCInput::RC_timeout) if ( msg == CRCInput::RC_timeout)
{ {
// nothing // nothing
} }
else if(msg == CRCInput::RC_home) else if (msg == CRCInput::RC_home)
{ {
loop=false; loop=false;
endall=true; endall=true;
} }
else if(msg == CRCInput::RC_left) else if (msg == CRCInput::RC_left)
{ {
loop=false; loop=false;
} }
@@ -722,7 +722,7 @@ bool CUpnpBrowserGui::selectItem(std::string id)
changed=true; changed=true;
} }
else if(msg == CRCInput::RC_green && selected > 0) else if (msg == CRCInput::RC_green && selected > 0)
{ {
if (index > 0) if (index > 0)
{ {
@@ -746,7 +746,7 @@ bool CUpnpBrowserGui::selectItem(std::string id)
changed=true; changed=true;
} }
else if(msg == CRCInput::RC_red && selected + 1 < dirnum) else if (msg == CRCInput::RC_red && selected + 1 < dirnum)
{ {
if (index < ((dirnum - 1) / m_listmaxshow) * m_listmaxshow) if (index < ((dirnum - 1) / m_listmaxshow) * m_listmaxshow)
{ {
@@ -761,7 +761,7 @@ bool CUpnpBrowserGui::selectItem(std::string id)
changed=true; changed=true;
} }
else if(msg == CRCInput::RC_right) else if (msg == CRCInput::RC_right)
{ {
if ((*entries)[selected - index].isdir) if ((*entries)[selected - index].isdir)
{ {
@@ -771,7 +771,7 @@ bool CUpnpBrowserGui::selectItem(std::string id)
} }
changed=true; changed=true;
} }
else if(msg == CRCInput::RC_ok) else if (msg == CRCInput::RC_ok)
{ {
if (!(*entries)[selected - index].isdir) if (!(*entries)[selected - index].isdir)
{ {
@@ -802,9 +802,9 @@ bool CUpnpBrowserGui::selectItem(std::string id)
viewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling); viewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling);
viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY); viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY);
if(g_settings.video_Format==1) if (g_settings.video_Format==1)
viewer->SetAspectRatio(16.0/9); viewer->SetAspectRatio(16.0/9);
else if(g_settings.video_Format==0) else if (g_settings.video_Format==0)
{ {
CControldClient cdc; CControldClient cdc;
cdc.setVideoFormat(CControldClient::VIDEOFORMAT_4_3); cdc.setVideoFormat(CControldClient::VIDEOFORMAT_4_3);
@@ -820,7 +820,7 @@ bool CUpnpBrowserGui::selectItem(std::string id)
{ {
g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display
if( msg == CRCInput::RC_home) if ( msg == CRCInput::RC_home)
loop=false; loop=false;
} }
m_frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); m_frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t));
@@ -840,14 +840,14 @@ bool CUpnpBrowserGui::selectItem(std::string id)
} }
changed=true; changed=true;
} }
else if( msg == CRCInput::RC_yellow) else if ( msg == CRCInput::RC_yellow)
{ {
if(CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
CAudioPlayer::getInstance()->stop(); CAudioPlayer::getInstance()->stop();
m_folderplay = false; m_folderplay = false;
} }
else if(msg == NeutrinoMessages::RECORD_START || else if (msg == NeutrinoMessages::RECORD_START ||
msg == NeutrinoMessages::ZAPTO || msg == NeutrinoMessages::ZAPTO ||
msg == NeutrinoMessages::STANDBY_ON || msg == NeutrinoMessages::STANDBY_ON ||
msg == NeutrinoMessages::SHUTDOWN || msg == NeutrinoMessages::SHUTDOWN ||
@@ -857,14 +857,14 @@ bool CUpnpBrowserGui::selectItem(std::string id)
g_RCInput->postMsg(msg, data); g_RCInput->postMsg(msg, data);
} }
else if(msg == NeutrinoMessages::EVT_TIMER) else if (msg == NeutrinoMessages::EVT_TIMER)
{ {
CNeutrinoApp::getInstance()->handleMsg( msg, data ); CNeutrinoApp::getInstance()->handleMsg( msg, data );
} }
else else
{ {
if( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
loop = false; loop = false;
changed=true; changed=true;
} }
@@ -996,7 +996,7 @@ void CUpnpBrowserGui::paintDevice()
m_devices[m_selecteddevice].manufacturerurl; m_devices[m_selecteddevice].manufacturerurl;
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8
xstart = (m_width - w) / 2; xstart = (m_width - w) / 2;
if(xstart < 10) if (xstart < 10)
xstart = 10; xstart = 10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_mheight, m_width - 20, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_mheight, m_width - 20,
tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8 tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8
@@ -1007,7 +1007,7 @@ void CUpnpBrowserGui::paintDevice()
m_devices[m_selecteddevice].modeldescription; m_devices[m_selecteddevice].modeldescription;
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8
xstart = (m_width - w) / 2; xstart = (m_width - w) / 2;
if(xstart < 10) if (xstart < 10)
xstart = 10; xstart = 10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 2*m_mheight, m_width - 20, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 2*m_mheight, m_width - 20,
tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8 tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8
@@ -1015,7 +1015,7 @@ void CUpnpBrowserGui::paintDevice()
tmp = m_devices[m_selecteddevice].modelurl; tmp = m_devices[m_selecteddevice].modelurl;
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8
xstart = (m_width - w) / 2; xstart = (m_width - w) / 2;
if(xstart < 10) if (xstart < 10)
xstart = 10; xstart = 10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20,
tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8 tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8
@@ -1027,22 +1027,22 @@ void CUpnpBrowserGui::paintDevice()
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(m_x + 35, m_y + m_theight + m_title_height + 0, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(m_x + 35, m_y + m_theight + m_title_height + 0,
m_width - 45, tmp, COL_MENUHEAD, 0, true); // UTF-8 m_width - 45, tmp, COL_MENUHEAD, 0, true); // UTF-8
ypos = m_y + m_title_height; ypos = m_y + m_title_height;
if(m_theight > 26) if (m_theight > 26)
ypos = (m_theight - 26) / 2 + m_y + m_title_height; ypos = (m_theight - 26) / 2 + m_y + m_title_height;
m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, m_x + m_width - 30, ypos); m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, m_x + m_width - 30, ypos);
#if 0 #if 0
if( CNeutrinoApp::getInstance()->isMuted() ) if ( CNeutrinoApp::getInstance()->isMuted() )
{ {
xpos = m_x + m_width - 75; xpos = m_x + m_width - 75;
ypos = m_y + m_title_height; ypos = m_y + m_title_height;
if(m_theight > 32) if (m_theight > 32)
ypos = (m_theight - 32) / 2 + m_y + m_title_height; ypos = (m_theight - 32) / 2 + m_y + m_title_height;
m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MUTE, xpos, ypos); m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MUTE, xpos, ypos);
} }
#endif #endif
// Items // Items
for (unsigned int count=0;count<m_listmaxshow;count++) for (unsigned int count=0; count<m_listmaxshow; count++)
paintDevicePos(count); paintDevicePos(count);
ypos = m_y + m_title_height + m_theight; ypos = m_y + m_title_height + m_theight;
@@ -1095,7 +1095,7 @@ void CUpnpBrowserGui::paintItem(std::vector<UPnPEntry> *entry, unsigned int sele
if (w > m_width - 20) if (w > m_width - 20)
w = m_width - 20; w = m_width - 20;
xstart = (m_width - w) / 2; xstart = (m_width - w) / 2;
if(xstart < 10) if (xstart < 10)
xstart = 10; xstart = 10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_mheight, m_width - 20, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_mheight, m_width - 20,
tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8 tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8
@@ -1118,7 +1118,7 @@ void CUpnpBrowserGui::paintItem(std::vector<UPnPEntry> *entry, unsigned int sele
if (w > m_width - 20) if (w > m_width - 20)
w = m_width - 20; w = m_width - 20;
xstart = (m_width - w) / 2; xstart = (m_width - w) / 2;
if(xstart < 10) if (xstart < 10)
xstart = 10; xstart = 10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 2*m_mheight, m_width - 20, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 2*m_mheight, m_width - 20,
tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8 tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8
@@ -1137,7 +1137,7 @@ void CUpnpBrowserGui::paintItem(std::vector<UPnPEntry> *entry, unsigned int sele
if (w > m_width - 20) if (w > m_width - 20)
w = m_width - 20; w = m_width - 20;
xstart = (m_width - w) / 2; xstart = (m_width - w) / 2;
if(xstart < 10) if (xstart < 10)
xstart = 10; xstart = 10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20,
tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8 tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8
@@ -1150,22 +1150,22 @@ void CUpnpBrowserGui::paintItem(std::vector<UPnPEntry> *entry, unsigned int sele
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(m_x + 35, m_y + m_theight + m_title_height + 0, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(m_x + 35, m_y + m_theight + m_title_height + 0,
m_width - 45, tmp, COL_MENUHEAD, 0, true); // UTF-8 m_width - 45, tmp, COL_MENUHEAD, 0, true); // UTF-8
ypos = m_y + m_title_height; ypos = m_y + m_title_height;
if(m_theight > 26) if (m_theight > 26)
ypos = (m_theight - 26) / 2 + m_y + m_title_height; ypos = (m_theight - 26) / 2 + m_y + m_title_height;
m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, m_x + m_width - 30, ypos); m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, m_x + m_width - 30, ypos);
#if 0 #if 0
if( CNeutrinoApp::getInstance()->isMuted() ) if ( CNeutrinoApp::getInstance()->isMuted() )
{ {
xpos = m_x + m_width - 75; xpos = m_x + m_width - 75;
ypos = m_y + m_title_height; ypos = m_y + m_title_height;
if(m_theight > 32) if (m_theight > 32)
ypos = (m_theight - 32) / 2 + m_y + m_title_height; ypos = (m_theight - 32) / 2 + m_y + m_title_height;
m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MUTE, xpos, ypos); m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MUTE, xpos, ypos);
} }
#endif #endif
// Items // Items
for (unsigned int count=0;count<m_listmaxshow;count++) for (unsigned int count=0; count<m_listmaxshow; count++)
paintItemPos(entry, count, selected); paintItemPos(entry, count, selected);
ypos = m_y + m_title_height + m_theight; ypos = m_y + m_title_height + m_theight;
@@ -1355,7 +1355,7 @@ void CUpnpBrowserGui::paintItem2DetailsLine (int pos, unsigned int /*ch_index*/)
void CUpnpBrowserGui::updateTimes(const bool force) void CUpnpBrowserGui::updateTimes(const bool force)
{ {
int top; int top;
if(CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
{ {
bool updatePlayed = force; bool updatePlayed = force;