mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
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:
@@ -62,6 +62,9 @@ void CAudioMute::AudioMute(int newValue, bool isEvent)
|
||||
|
||||
if( isEvent && ( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_pic))
|
||||
{
|
||||
if (doInit)
|
||||
CVolumeHelper::getInstance()->refresh();
|
||||
|
||||
CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height);
|
||||
if ((y_old != y)) {
|
||||
if (do_paint_mute_icon)
|
||||
@@ -88,15 +91,13 @@ void CAudioMute::AudioMute(int newValue, bool isEvent)
|
||||
frameBuffer->setFbArea(CFrameBuffer::FB_PAINTAREA_MUTEICON1);
|
||||
}
|
||||
frameBuffer->fbNoCheck(false);
|
||||
|
||||
if (doInit)
|
||||
CVolumeHelper::getInstance()->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioMute::enableMuteIcon(bool enable)
|
||||
{
|
||||
CNeutrinoApp *neutrino = CNeutrinoApp::getInstance();
|
||||
CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height);
|
||||
frameBuffer->fbNoCheck(true);
|
||||
if (enable) {
|
||||
frameBuffer->doPaintMuteIcon(true);
|
||||
|
@@ -57,8 +57,18 @@ void CInfoClock::initVarInfoClock()
|
||||
|
||||
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()->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();
|
||||
}
|
||||
|
||||
@@ -82,18 +92,6 @@ bool CInfoClock::StopClock()
|
||||
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 ret = false;
|
||||
|
@@ -47,7 +47,6 @@ class CInfoClock : public CComponentsFrmClock
|
||||
bool StopClock();
|
||||
bool enableInfoClock(bool enable);
|
||||
void ClearDisplay();
|
||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -79,6 +79,7 @@ void CVolumeBar::initVarVolumeBar()
|
||||
void CVolumeBar::initVolumeBarSize()
|
||||
{
|
||||
CVolumeHelper *cvh = CVolumeHelper::getInstance();
|
||||
cvh->refresh();
|
||||
cvh->getSpacer(&h_spacer, &v_spacer);
|
||||
cvh->getDimensions(&x, &y, &sw, &sh, &vb_icon_w, &vb_digit_w);
|
||||
cvh->getVolBarDimensions(&y, &height);
|
||||
@@ -125,7 +126,7 @@ void CVolumeBar::initVolumeBarPosition()
|
||||
if ((neutrino->isMuted()) && (!g_settings.mode_clock))
|
||||
x_corr = mute_dx + h_spacer;
|
||||
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;
|
||||
break;
|
||||
@@ -260,6 +261,8 @@ CVolumeHelper::CVolumeHelper()
|
||||
{
|
||||
h_spacer = 11;
|
||||
v_spacer = 6;
|
||||
vb_font = NULL;
|
||||
clock_font = NULL;
|
||||
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
|
||||
@@ -273,7 +276,6 @@ void CVolumeHelper::Init()
|
||||
y = frameBuffer->getScreenY() + v_spacer;
|
||||
sw = g_settings.screen_EndX - h_spacer;
|
||||
sh = frameBuffer->getScreenHeight();
|
||||
vb_font = NULL;
|
||||
|
||||
initVolBarSize();
|
||||
initMuteIcon();
|
||||
@@ -282,12 +284,12 @@ void CVolumeHelper::Init()
|
||||
|
||||
void CVolumeHelper::initInfoClock()
|
||||
{
|
||||
digit_offset = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitOffset();
|
||||
digit_h = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitHeight();
|
||||
int t1 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(widest_number);
|
||||
int t2 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(":");
|
||||
clock_dy = digit_h + (int)((float)digit_offset * 1.5);
|
||||
clock_dx = t1*6 + t2*2;
|
||||
digit_offset = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getDigitOffset();
|
||||
digit_h = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getDigitHeight();
|
||||
int t1 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(widest_number);
|
||||
int t2 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(":");
|
||||
clock_dy = digit_h + (int)((float)digit_offset * 1.3);
|
||||
clock_dx = t1*7 + t2*2;
|
||||
clock_ax = sw - clock_dx;
|
||||
clock_ay = y;
|
||||
vol_ay = y;
|
||||
|
@@ -105,6 +105,7 @@ class CVolumeHelper
|
||||
int icon_width, icon_height, digit_width;
|
||||
int h_spacer, v_spacer;
|
||||
int vol_ay, vol_height;
|
||||
Font** clock_font;
|
||||
CFrameBuffer *frameBuffer;
|
||||
|
||||
void Init();
|
||||
|
@@ -52,6 +52,7 @@
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <gui/widget/stringinput.h>
|
||||
#include <gui/audiomute.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <driver/volume.h>
|
||||
#include <system/helpers.h>
|
||||
@@ -321,6 +322,10 @@ bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *)
|
||||
hintBox.hide();
|
||||
/* recalculate infoclock/muteicon/volumebar */
|
||||
CVolumeHelper::getInstance()->refresh();
|
||||
if (CNeutrinoApp::getInstance()->isMuted()) {
|
||||
CAudioMute::getInstance()->enableMuteIcon(false);
|
||||
CAudioMute::getInstance()->enableMuteIcon(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user