fix clock osd

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1038 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Commit: 970b0ac6a3
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2011-01-22 (Sat, 22 Jan 2011)

Origin message was:
------------------
-fix clock osd

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1038 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
Jacek Jendrzej
2011-01-22 09:06:38 +00:00
parent 8d9d8676fa
commit 5a65f7bb9f
3 changed files with 18 additions and 23 deletions

View File

@@ -36,16 +36,13 @@ CInfoClock::~CInfoClock()
void CInfoClock::paintTime( bool show_dot) void CInfoClock::paintTime( bool show_dot)
{ {
char timestr[10]; char timestr[20];
time_t tm; time_t tm = time(0);
strftime((char*) &timestr, sizeof(timestr), "%H:%M:%S", localtime(&tm));
timestr[2] = show_dot ? ':':'.';
tm = time(0); frameBuffer->paintBoxRel(x - time_width - 10, y, time_width, time_height, COL_MENUCONTENT_PLUS_0, RADIUS_SMALL);
if(show_dot) g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(x - time_width- 5, y+ time_height, time_width, timestr, COL_MENUCONTENT);
strftime((char*) &timestr, 20, "%H:%M:%S", localtime(&tm));
else
strftime((char*) &timestr, 20, "%H.%M:%S", localtime(&tm));
frameBuffer->paintBoxRel(x - time_width - 15, y, time_width, time_height, COL_MENUCONTENT_PLUS_0, RADIUS_SMALL);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(x - time_width- 10, y+ time_height, time_width, timestr, COL_MENUCONTENT);
} }
void* CInfoClock::TimerProc(void *arg) void* CInfoClock::TimerProc(void *arg)
@@ -79,6 +76,6 @@ void CInfoClock::StopClock()
if(thrTimer) { if(thrTimer) {
pthread_cancel(thrTimer); pthread_cancel(thrTimer);
thrTimer = 0; thrTimer = 0;
frameBuffer->paintBackgroundBoxRel(x - time_width - 15, y, time_width, time_height); frameBuffer->paintBackgroundBoxRel(x - time_width - 10, y, time_width, time_height);
} }
} }

View File

@@ -34,7 +34,6 @@
static CProgressBar *timescale; static CProgressBar *timescale;
#define TIMEOSD_FONT SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME #define TIMEOSD_FONT SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME
#define TIMEBARH 38
#define BARLEN 200 #define BARLEN 200
CTimeOSD::CTimeOSD() CTimeOSD::CTimeOSD()
{ {
@@ -43,7 +42,7 @@ CTimeOSD::CTimeOSD()
m_mode=MODE_ASC; m_mode=MODE_ASC;
GetDimensions(); GetDimensions();
if (! timescale) if (! timescale)
timescale = new CProgressBar(true, 200, 32, 40, 100, 70, true); timescale = new CProgressBar(true, BARLEN, 32, 40, 100, 70, true);
} }
CTimeOSD::~CTimeOSD() CTimeOSD::~CTimeOSD()
@@ -61,7 +60,7 @@ void CTimeOSD::show(time_t time_show)
visible = true; visible = true;
m_time_dis = time(NULL); m_time_dis = time(NULL);
m_time_show = time_show; m_time_show = time_show;
frameBuffer->paintBoxRel(m_xstart-2, m_y, 2+BARLEN+2, TIMEBARH, COL_INFOBAR_SHADOW_PLUS_0); //border frameBuffer->paintBoxRel(m_xend - m_width - t1, m_y, m_width, m_height, COL_INFOBAR_SHADOW_PLUS_0,RADIUS_SMALL);//border
timescale->reset(); timescale->reset();
update(); update();
} }
@@ -73,11 +72,10 @@ void CTimeOSD::GetDimensions()
m_height = g_Font[TIMEOSD_FONT]->getHeight(); m_height = g_Font[TIMEOSD_FONT]->getHeight();
m_y = frameBuffer->getScreenY(); m_y = frameBuffer->getScreenY();
m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00"); m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00");
t1 = g_Font[TIMEOSD_FONT]->getRenderWidth(widest_number);
m_width += t1;
if(g_settings.mode_clock) { if(g_settings.mode_clock) {
int x1 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(widest_number); m_xend = m_xend - m_width - (m_width/4);
int x2 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(":");
twidth = x1*6 + x2*2;
m_xend = m_xend - twidth - 45;
} }
} }
@@ -114,8 +112,8 @@ void CTimeOSD::update(time_t time_show)
if(tDisplayTime != oldDisplayTime) { if(tDisplayTime != oldDisplayTime) {
oldDisplayTime = tDisplayTime; oldDisplayTime = tDisplayTime;
strftime(cDisplayTime, 9, "%T", gmtime(&tDisplayTime)); strftime(cDisplayTime, 9, "%T", gmtime(&tDisplayTime));
frameBuffer->paintBoxRel(m_xend - m_width - 10, m_y, m_width + 10, m_height, color1); frameBuffer->paintBoxRel(m_xend - m_width - t1, m_y, m_width, m_height, color1,RADIUS_SMALL);
g_Font[TIMEOSD_FONT]->RenderString(m_xend - m_width - 5, m_y + m_height, m_width +5, cDisplayTime, color2); g_Font[TIMEOSD_FONT]->RenderString(m_xend - m_width - (t1/2), m_y + m_height, m_width, cDisplayTime, color2);
} }
} }
@@ -127,11 +125,11 @@ void CTimeOSD::updatePos(short runningPercent)
void CTimeOSD::hide() void CTimeOSD::hide()
{ {
GetDimensions(); GetDimensions();
printf("CTimeOSD::hide: x %d y %d xend %d yend %d\n", m_xstart, m_y , m_xend - (g_settings.mode_clock ? m_width-5 : 0), m_height + 15);
if(!visible) if(!visible)
return; return;
//frameBuffer->paintBackgroundBoxRel(m_xstart-10, m_y - 10 , m_xend - (g_settings.mode_clock ? 35 : 0), m_height + 15); frameBuffer->paintBackgroundBoxRel(m_xend - m_width - t1, m_y, m_width, m_height);
frameBuffer->paintBackgroundBoxRel(m_xstart-2, m_y , m_xend - (g_settings.mode_clock ? m_width-5 : 0), m_height + 15);
visible=false; visible=false;
timescale->reset(); timescale->reset();
frameBuffer->paintBackgroundBoxRel(m_xstart, m_y, BARLEN, m_height);
} }

View File

@@ -42,7 +42,7 @@ class CTimeOSD
time_t m_time_dis; time_t m_time_dis;
time_t m_time_show; time_t m_time_show;
bool visible; bool visible;
int m_xstart,m_xend,m_y,m_height, m_width, twidth; int m_xstart,m_xend,m_y,m_height, m_width, t1;
mode m_mode; mode m_mode;
void GetDimensions(); void GetDimensions();