port rounded corner code from tuxbox CVSuse getScreenStartX(),getScreenStartY(),h_max(),w_max() routines

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@87 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
satbaby
2009-12-17 09:58:55 +00:00
parent dfe40f9833
commit 49e009134b
11 changed files with 1109 additions and 1077 deletions

View File

@@ -1,16 +1,21 @@
/*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/screen_max.cpp,v 1.3 2004/03/17 22:56:08 rasc Exp $
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/screen_max.cpp,v 1.4 2009/12/15 09:42:59 dbt Exp $
*
* -- some odd module to calc max. screen usage of an menue
* -- this should be somewhere else (neutrino needs redesign)
*
* (C) 2004 by rasc
*
*
*/
#include <config.h>
#include "global.h"
#include "driver/screen_max.h"
// -- this is a simple odd class provided for 'static' usage
// -- to calculate max. usage of a preferred menue size (x,y)
// -- this is due to 16:9 TV zoom functions, which are cutting menues.
@@ -24,6 +29,7 @@
//
// 2004-03-17 rasc
int w_max (int w_size, int w_add)
{
int dw;
@@ -37,6 +43,7 @@ int w_max (int w_size, int w_add)
return ret;
}
int h_max (int h_size, int h_add)
{
int dh;
@@ -49,3 +56,21 @@ int h_max (int h_size, int h_add)
return ret;
}
//some helpers to get x and y screen values vor menus and windows
int getScreenStartX (int width)
{
int w = width;
return (((g_settings.screen_EndX- g_settings.screen_StartX)-w) / 2) + g_settings.screen_StartX;
}
int getScreenStartY (int height)
{
int y = height;
return (((g_settings.screen_EndY- g_settings.screen_StartY)-y) / 2) + g_settings.screen_StartY;
}

View File

@@ -1,5 +1,5 @@
/*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/screen_max.h,v 1.1 2004/03/17 21:30:51 rasc Exp $
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/screen_max.h,v 1.2 2009/12/15 09:42:59 dbt Exp $
*
*
* This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,8 @@
int w_max (int w_size, int w_add);
int h_max (int h_size, int h_add);
int getScreenStartX(int width);
int getScreenStartY(int height);
#endif

View File

@@ -68,6 +68,7 @@
#include <system/settings.h>
#include <xmltree/xmlinterface.h>
#include <driver/screen_max.h>
#include <algorithm>
#include <sys/time.h>
@@ -277,9 +278,9 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &)
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_x = (((g_settings.screen_EndX - g_settings.screen_StartX) - (m_width + ConnectLineBox_Width)) / 2)
+ g_settings.screen_StartX + ConnectLineBox_Width;
m_y = (((g_settings.screen_EndY- g_settings.screen_StartY) - m_height)/ 2) + g_settings.screen_StartY;
m_x = getScreenStartX( m_width + ConnectLineBox_Width ) + ConnectLineBox_Width;
m_y = getScreenStartY( m_height );
m_idletime=time(NULL);
m_screensaver=false;
@@ -724,17 +725,21 @@ int CAudioPlayerGui::show()
if (select >= 0)
old_select = select;
switch (select) {
case 0: scanXmlFile(RADIO_STATION_XML_FILE);
case 0:
scanXmlFile(RADIO_STATION_XML_FILE);
CVFD::getInstance()->setMode(CVFD::MODE_AUDIO);
paintLCD();
break;
case 1: openSCbrowser();
case 1:
openSCbrowser();
break;
case 2: readDir_ic();
case 2:
readDir_ic();
CVFD::getInstance()->setMode(CVFD::MODE_AUDIO);
paintLCD();
break;
default: break;
default:
break;
}
update=true;
}
@@ -1723,8 +1728,7 @@ void CAudioPlayerGui::paintFoot()
else
::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale,
m_x + 10, top + 4, ButtonWidth, 1, &(AudioPlayerButtons[7][0]));
} else
if (m_inetmode)
} else if (m_inetmode)
::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale,
m_x + 10, top + 4, ButtonWidth, 4, AudioPlayerButtons[8]);
else

View File

@@ -35,7 +35,7 @@
#include <neutrino.h>
#include <system/settings.h>
#include <driver/screen_max.h>
#include <gui/widget/messagebox.h>
#include <gui/widget/hintbox.h>
#include <gui/widget/stringinput.h>
@@ -227,13 +227,11 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
visible = false;
selected = 0;
// Max
width = 720;
if(g_settings.screen_EndX-g_settings.screen_StartX < width)
width=g_settings.screen_EndX-g_settings.screen_StartX-10;
width = w_max( 720, 10 );
buttonHeight = 25;
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
x=getScreenStartX( width );
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-( height+ info_height) ) / 2) + g_settings.screen_StartY;
listmaxshow = (height-theight-0)/(fheight*2);
liststart = 0;
@@ -251,14 +249,13 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
selected=bookmarks.size()-1;
liststart = (selected/listmaxshow)*listmaxshow;
}
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-( height+ info_height) ) / 2) + g_settings.screen_StartY;
int res = -1;
unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
uint32_t msg; uint32_t data;
uint32_t msg;
uint32_t data;
bool loop=true;
bool update=true;

View File

@@ -62,9 +62,8 @@ CDBoxInfoWidget::CDBoxInfoWidget()
width = w_max (600, 0);
height = h_max (hheight+14*mheight+ 10, 0);
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height) / 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
}

View File

@@ -144,7 +144,7 @@ void CEpgData::start()
sb = medlinecount* medlineheight;
oy = botboxheight+medlinecount*medlineheight; // recalculate //FIXME
sy = (((g_settings.screen_EndY-g_settings.screen_StartY)-(oy- topboxheight) ) / 2) + g_settings.screen_StartY;
sy = getScreenStartY(oy- topboxheight);
toph = topboxheight;
}

View File

@@ -66,8 +66,8 @@ void CImageInfo::Init(void)
width = frameBuffer->getScreenWidth() - 10;
height = frameBuffer->getScreenHeight() - 10;
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height) / 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
}
CImageInfo::~CImageInfo()

View File

@@ -56,6 +56,7 @@
#include <gui/widget/helpbox.h>
#include <gui/widget/stringinput.h>
#include <driver/screen_max.h>
#include <system/settings.h>
@@ -112,13 +113,8 @@ CPictureViewerGui::~CPictureViewerGui()
int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey)
{
selected = 0;
width = 710;
height = 570;
if((g_settings.screen_EndX- g_settings.screen_StartX) < width)
width=(g_settings.screen_EndX- g_settings.screen_StartX);
if((g_settings.screen_EndY- g_settings.screen_StartY) < height)
height=(g_settings.screen_EndY- g_settings.screen_StartY);
width = w_max (710, 0);
height = h_max (570, 0);
sheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
buttonHeight = std::min(25, sheight);
@@ -127,8 +123,8 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey)
listmaxshow = (height-theight-2*buttonHeight)/(fheight);
height = theight+2*buttonHeight+listmaxshow*fheight; // recalc height
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height)/ 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
m_viewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling);
m_viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY);

View File

@@ -54,6 +54,7 @@
#include <neutrino.h>
#include <plugins.h>
#include <driver/encoding.h>
#include <driver/screen_max.h>
#include <zapit/client/zapittools.h>
@@ -76,12 +77,8 @@ CPluginList::CPluginList(const neutrino_locale_t Name, const uint32_t listtype)
name = Name;
pluginlisttype = listtype;
selected = 0;
width = 500;
if(width>(g_settings.screen_EndX-g_settings.screen_StartX))
width=(g_settings.screen_EndX-g_settings.screen_StartX);
height = 526;
if((height+50)>(g_settings.screen_EndY-g_settings.screen_StartY))
height=(g_settings.screen_EndY-g_settings.screen_StartY) - 50; // 2*25 pixel frei
width = w_max( 500, 0 );
height = h_max( 526, 50 ); // 2*25 pixel frei
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
//
fheight1 = g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMLARGE]->getHeight();
@@ -90,8 +87,8 @@ CPluginList::CPluginList(const neutrino_locale_t Name, const uint32_t listtype)
//
listmaxshow = (height-theight-0)/fheight;
height = theight+0+listmaxshow*fheight; // recalc height
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height) / 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
liststart = 0;
}
@@ -310,16 +307,12 @@ void CPluginList::paintHead()
void CPluginList::paint()
{
hide();
width = 500;
if(width>(g_settings.screen_EndX-g_settings.screen_StartX))
width=(g_settings.screen_EndX-g_settings.screen_StartX);
height = 526;
if((height+50)>(g_settings.screen_EndY-g_settings.screen_StartY))
height=(g_settings.screen_EndY-g_settings.screen_StartY) - 50; // 2*25 pixel frei
width = w_max( 500, 0 );
height = h_max( 526, 50 ); // 2*25 pixel frei
listmaxshow = (height-theight-0)/fheight;
height = theight+0+listmaxshow*fheight; // recalc height
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height) / 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
liststart = (selected/listmaxshow)*listmaxshow;

View File

@@ -415,7 +415,7 @@ void CTimerList::updateEvents(void)
selected=timerlist.size()-1;
liststart = (selected/listmaxshow)*listmaxshow;
}
x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2;
x=getScreenStartX( width );
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height+ info_height)) / 2;
}
@@ -732,7 +732,8 @@ void CTimerList::paintItem(int pos)
line1+=" OFF";
}
break;
default:;
default:
;
}
CVFD::getInstance()->showMenuText(0, line1.c_str(), -1, true); // UTF-8
//CVFD::getInstance()->showMenuText(1, line2.c_str(), -1, true); // UTF-8
@@ -808,15 +809,24 @@ const char * CTimerList::convertTimerType2String(const CTimerd::CTimerEventTypes
{
switch (type)
{
case CTimerd::TIMER_SHUTDOWN : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_SHUTDOWN );
case CTimerd::TIMER_NEXTPROGRAM : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_NEXTPROGRAM);
case CTimerd::TIMER_ZAPTO : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_ZAPTO );
case CTimerd::TIMER_STANDBY : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_STANDBY );
case CTimerd::TIMER_RECORD : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_RECORD );
case CTimerd::TIMER_REMIND : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_REMIND );
case CTimerd::TIMER_SLEEPTIMER : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_SLEEPTIMER );
case CTimerd::TIMER_EXEC_PLUGIN : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_EXECPLUGIN );
default : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_UNKNOWN );
case CTimerd::TIMER_SHUTDOWN :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_SHUTDOWN );
case CTimerd::TIMER_NEXTPROGRAM :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_NEXTPROGRAM);
case CTimerd::TIMER_ZAPTO :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_ZAPTO );
case CTimerd::TIMER_STANDBY :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_STANDBY );
case CTimerd::TIMER_RECORD :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_RECORD );
case CTimerd::TIMER_REMIND :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_REMIND );
case CTimerd::TIMER_SLEEPTIMER :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_SLEEPTIMER );
case CTimerd::TIMER_EXEC_PLUGIN :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_EXECPLUGIN );
default :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_UNKNOWN );
}
}
@@ -824,13 +834,20 @@ std::string CTimerList::convertTimerRepeat2String(const CTimerd::CTimerEventRepe
{
switch (rep)
{
case CTimerd::TIMERREPEAT_ONCE : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_ONCE );
case CTimerd::TIMERREPEAT_DAILY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_DAILY );
case CTimerd::TIMERREPEAT_WEEKLY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_WEEKLY );
case CTimerd::TIMERREPEAT_BIWEEKLY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_BIWEEKLY );
case CTimerd::TIMERREPEAT_FOURWEEKLY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_FOURWEEKLY );
case CTimerd::TIMERREPEAT_MONTHLY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_MONTHLY );
case CTimerd::TIMERREPEAT_BYEVENTDESCRIPTION : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_BYEVENTDESCRIPTION);
case CTimerd::TIMERREPEAT_ONCE :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_ONCE );
case CTimerd::TIMERREPEAT_DAILY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_DAILY );
case CTimerd::TIMERREPEAT_WEEKLY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_WEEKLY );
case CTimerd::TIMERREPEAT_BIWEEKLY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_BIWEEKLY );
case CTimerd::TIMERREPEAT_FOURWEEKLY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_FOURWEEKLY );
case CTimerd::TIMERREPEAT_MONTHLY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_MONTHLY );
case CTimerd::TIMERREPEAT_BYEVENTDESCRIPTION :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_BYEVENTDESCRIPTION);
default:
if (rep >=CTimerd::TIMERREPEAT_WEEKDAYS)
{