CInfoClock: Rework calculate size & position

- Fix display info clock
- Preparation for alternative use of neutrino fonts / DynFonts


Origin commit data
------------------
Branch: ni/coolstream
Commit: 0c18d4a6db
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2013-11-26 (Tue, 26 Nov 2013)



------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2013-11-26 14:08:48 +01:00
parent 8ada33708f
commit 206b940e95
6 changed files with 30 additions and 24 deletions

View File

@@ -62,6 +62,9 @@ void CAudioMute::AudioMute(int newValue, bool isEvent)
if( isEvent && ( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_pic)) if( isEvent && ( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_pic))
{ {
if (doInit)
CVolumeHelper::getInstance()->refresh();
CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height); CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height);
if ((y_old != y)) { if ((y_old != y)) {
if (do_paint_mute_icon) if (do_paint_mute_icon)
@@ -88,15 +91,13 @@ void CAudioMute::AudioMute(int newValue, bool isEvent)
frameBuffer->setFbArea(CFrameBuffer::FB_PAINTAREA_MUTEICON1); frameBuffer->setFbArea(CFrameBuffer::FB_PAINTAREA_MUTEICON1);
} }
frameBuffer->fbNoCheck(false); frameBuffer->fbNoCheck(false);
if (doInit)
CVolumeHelper::getInstance()->refresh();
} }
} }
void CAudioMute::enableMuteIcon(bool enable) void CAudioMute::enableMuteIcon(bool enable)
{ {
CNeutrinoApp *neutrino = CNeutrinoApp::getInstance(); CNeutrinoApp *neutrino = CNeutrinoApp::getInstance();
CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height);
frameBuffer->fbNoCheck(true); frameBuffer->fbNoCheck(true);
if (enable) { if (enable) {
frameBuffer->doPaintMuteIcon(true); frameBuffer->doPaintMuteIcon(true);

View File

@@ -57,8 +57,18 @@ void CInfoClock::initVarInfoClock()
void CInfoClock::Init() void CInfoClock::Init()
{ {
int x_old = x, y_old = y, width_old = width, height_old = height;
cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
CVolumeHelper::getInstance()->refresh(); CVolumeHelper::getInstance()->refresh();
CVolumeHelper::getInstance()->getInfoClockDimensions(&x, &y, &width, &height); CVolumeHelper::getInstance()->getInfoClockDimensions(&x, &y, &width, &height);
if ((x_old != x) || (y_old != y) || (width_old != width) || (height_old != height)) {
cleanCCForm();
clearCCItems();
}
// set corner radius depending on clock height
corner_rad = (g_settings.rounded_corners) ? std::max(height/10, CORNER_RADIUS_SMALL) : 0;
initCCLockItems(); initCCLockItems();
} }
@@ -82,18 +92,6 @@ bool CInfoClock::StopClock()
return ret; return ret;
} }
void CInfoClock::paint(bool do_save_bg)
{
// calculate current x-position of clock (mute icon on/off)
x = CVolumeHelper::getInstance()->getInfoClockX();
//prepare items before paint
initCCLockItems();
//paint the clock
paintForm(do_save_bg);
}
bool CInfoClock::enableInfoClock(bool enable) bool CInfoClock::enableInfoClock(bool enable)
{ {
bool ret = false; bool ret = false;

View File

@@ -47,7 +47,6 @@ class CInfoClock : public CComponentsFrmClock
bool StopClock(); bool StopClock();
bool enableInfoClock(bool enable); bool enableInfoClock(bool enable);
void ClearDisplay(); void ClearDisplay();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
}; };
#endif #endif

View File

@@ -79,6 +79,7 @@ void CVolumeBar::initVarVolumeBar()
void CVolumeBar::initVolumeBarSize() void CVolumeBar::initVolumeBarSize()
{ {
CVolumeHelper *cvh = CVolumeHelper::getInstance(); CVolumeHelper *cvh = CVolumeHelper::getInstance();
cvh->refresh();
cvh->getSpacer(&h_spacer, &v_spacer); cvh->getSpacer(&h_spacer, &v_spacer);
cvh->getDimensions(&x, &y, &sw, &sh, &vb_icon_w, &vb_digit_w); cvh->getDimensions(&x, &y, &sw, &sh, &vb_icon_w, &vb_digit_w);
cvh->getVolBarDimensions(&y, &height); cvh->getVolBarDimensions(&y, &height);
@@ -125,7 +126,7 @@ void CVolumeBar::initVolumeBarPosition()
if ((neutrino->isMuted()) && (!g_settings.mode_clock)) if ((neutrino->isMuted()) && (!g_settings.mode_clock))
x_corr = mute_dx + h_spacer; x_corr = mute_dx + h_spacer;
if (g_settings.mode_clock) if (g_settings.mode_clock)
y += max(clock_y + clock_height, mute_ay + mute_dy); y = clock_y + clock_height + v_spacer;
} }
x = sw - width - x_corr; x = sw - width - x_corr;
break; break;
@@ -260,6 +261,8 @@ CVolumeHelper::CVolumeHelper()
{ {
h_spacer = 11; h_spacer = 11;
v_spacer = 6; v_spacer = 6;
vb_font = NULL;
clock_font = NULL;
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
@@ -273,7 +276,6 @@ void CVolumeHelper::Init()
y = frameBuffer->getScreenY() + v_spacer; y = frameBuffer->getScreenY() + v_spacer;
sw = g_settings.screen_EndX - h_spacer; sw = g_settings.screen_EndX - h_spacer;
sh = frameBuffer->getScreenHeight(); sh = frameBuffer->getScreenHeight();
vb_font = NULL;
initVolBarSize(); initVolBarSize();
initMuteIcon(); initMuteIcon();
@@ -282,12 +284,12 @@ void CVolumeHelper::Init()
void CVolumeHelper::initInfoClock() void CVolumeHelper::initInfoClock()
{ {
digit_offset = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitOffset(); digit_offset = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getDigitOffset();
digit_h = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitHeight(); digit_h = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getDigitHeight();
int t1 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(widest_number); int t1 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(widest_number);
int t2 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(":"); int t2 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(":");
clock_dy = digit_h + (int)((float)digit_offset * 1.5); clock_dy = digit_h + (int)((float)digit_offset * 1.3);
clock_dx = t1*6 + t2*2; clock_dx = t1*7 + t2*2;
clock_ax = sw - clock_dx; clock_ax = sw - clock_dx;
clock_ay = y; clock_ay = y;
vol_ay = y; vol_ay = y;

View File

@@ -105,6 +105,7 @@ class CVolumeHelper
int icon_width, icon_height, digit_width; int icon_width, icon_height, digit_width;
int h_spacer, v_spacer; int h_spacer, v_spacer;
int vol_ay, vol_height; int vol_ay, vol_height;
Font** clock_font;
CFrameBuffer *frameBuffer; CFrameBuffer *frameBuffer;
void Init(); void Init();

View File

@@ -52,6 +52,7 @@
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include <gui/widget/stringinput.h> #include <gui/widget/stringinput.h>
#include <gui/audiomute.h>
#include <gui/infoclock.h> #include <gui/infoclock.h>
#include <driver/volume.h> #include <driver/volume.h>
#include <system/helpers.h> #include <system/helpers.h>
@@ -321,6 +322,10 @@ bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *)
hintBox.hide(); hintBox.hide();
/* recalculate infoclock/muteicon/volumebar */ /* recalculate infoclock/muteicon/volumebar */
CVolumeHelper::getInstance()->refresh(); CVolumeHelper::getInstance()->refresh();
if (CNeutrinoApp::getInstance()->isMuted()) {
CAudioMute::getInstance()->enableMuteIcon(false);
CAudioMute::getInstance()->enableMuteIcon(true);
}
return true; return true;
} }