* Problems with display volume control (patch by snafed)

- Fixes display problems when setting 'mute icon volume at 0'
- Fixes problems with neutrino getMode() switching

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2160 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
micha-bbg
2012-03-24 08:31:17 +00:00
parent 1136e87ce5
commit 01a520ab17
2 changed files with 60 additions and 20 deletions

View File

@@ -60,6 +60,7 @@ CVolume::CVolume()
MuteIconFrame = false; // For future On/Off switch IconFrame MuteIconFrame = false; // For future On/Off switch IconFrame
ShadowOffset = 4; ShadowOffset = 4;
mute_ay = 0; mute_ay = 0;
m_mode = CNeutrinoApp::getInstance()->getMode();
Init(); Init();
} }
@@ -115,6 +116,8 @@ void CVolume::Init()
mute_dy += mute_icon_dx / 4; mute_dy += mute_icon_dx / 4;
mute_ax = sw - mute_dx; mute_ax = sw - mute_dx;
mute_ay = y; mute_ay = y;
CNeutrinoApp* neutrino = CNeutrinoApp::getInstance();
if ((g_settings.mode_clock) && (g_settings.volume_pos == 0)) { if ((g_settings.mode_clock) && (g_settings.volume_pos == 0)) {
// Clock and MuteIcon in a line. // Clock and MuteIcon in a line.
@@ -129,17 +132,20 @@ void CVolume::Init()
else else
mute_ay += (vbar_h - mute_dy) / 2; mute_ay += (vbar_h - mute_dy) / 2;
} }
if ((g_settings.mode_clock) && (!CNeutrinoApp::getInstance()->isMuted()))
if ((g_settings.mode_clock) && (!neutrino->isMuted()))
frameBuffer->paintBackgroundBoxRel(sw - clock_width, y, clock_width, clock_height); frameBuffer->paintBackgroundBoxRel(sw - clock_width, y, clock_width, clock_height);
//printf("\n##### [volume.cpp Zeile %d] mute_ax %d, mute_dx %d\n \n", __LINE__, mute_ax, mute_dx); //printf("\n##### [volume.cpp Zeile %d] mute_ax %d, mute_dx %d\n \n", __LINE__, mute_ax, mute_dx);
switch (g_settings.volume_pos) switch (g_settings.volume_pos)
{ {
case 0:// upper right case 0:// upper right
if (CNeutrinoApp::getInstance()->isMuted()) if (( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_audio) && ( neutrino->getMode() != CNeutrinoApp::mode_pic)) {
x_corr = mute_dx + spacer; if ((neutrino->isMuted()) && (!g_settings.mode_clock))
x_corr = mute_dx + spacer;
if (g_settings.mode_clock)
y += clock_height + spacer / 2;
}
x = sw - vbar_w - x_corr; x = sw - vbar_w - x_corr;
if (g_settings.mode_clock)
y += clock_height + spacer / 2;
break; break;
case 1:// upper left case 1:// upper left
break; break;
@@ -181,8 +187,6 @@ CVolume* CVolume::getInstance()
void CVolume::AudioMute(int newValue, bool isEvent) void CVolume::AudioMute(int newValue, bool isEvent)
{ {
if((g_settings.current_volume == 0) && (g_settings.show_mute_icon == 1))
return;
CNeutrinoApp* neutrino = CNeutrinoApp::getInstance(); CNeutrinoApp* neutrino = CNeutrinoApp::getInstance();
bool doInit = newValue != (int) neutrino->isMuted(); bool doInit = newValue != (int) neutrino->isMuted();
@@ -212,6 +216,17 @@ void CVolume::setvol(int vol)
void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowait) void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowait)
{ {
neutrino_msg_t msg = key; neutrino_msg_t msg = key;
int mode = CNeutrinoApp::getInstance()->getMode();
if (msg <= CRCInput::RC_MaxRC) {
if(m_mode != mode) {
m_mode = mode;
Init();
setVolume(msg);
return;
}
}
int vol = g_settings.current_volume; int vol = g_settings.current_volume;
fb_pixel_t * pixbuf = NULL; fb_pixel_t * pixbuf = NULL;
@@ -245,11 +260,6 @@ void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowa
sub_chan_keybind = 1; sub_chan_keybind = 1;
if ((msg == CRCInput::RC_plus) || (sub_chan_keybind == 1 && (msg == CRCInput::RC_right))) { if ((msg == CRCInput::RC_plus) || (sub_chan_keybind == 1 && (msg == CRCInput::RC_right))) {
if (g_settings.current_volume < 100 - g_settings.current_volume_step)
g_settings.current_volume += g_settings.current_volume_step;
else
g_settings.current_volume = 100;
if(CNeutrinoApp::getInstance()->isMuted()) { if(CNeutrinoApp::getInstance()->isMuted()) {
if ((bDoPaint) && (pixbuf!= NULL)) { if ((bDoPaint) && (pixbuf!= NULL)) {
frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf); frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf);
@@ -260,18 +270,47 @@ void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowa
setVolume(msg); setVolume(msg);
return; return;
} }
if(!CNeutrinoApp::getInstance()->isMuted()) {
if (g_settings.current_volume < 100 - g_settings.current_volume_step)
g_settings.current_volume += g_settings.current_volume_step;
else
g_settings.current_volume = 100;
}
} }
else if ((msg == CRCInput::RC_minus) || (sub_chan_keybind == 1 && (msg == CRCInput::RC_left))) { else if ((msg == CRCInput::RC_minus) || (sub_chan_keybind == 1 && (msg == CRCInput::RC_left))) {
if (g_settings.current_volume > g_settings.current_volume_step) if(CNeutrinoApp::getInstance()->isMuted() && g_settings.current_volume > 0) {
g_settings.current_volume -= g_settings.current_volume_step; if ((bDoPaint) && (pixbuf!= NULL)) {
else if ((g_settings.show_mute_icon == 1) && (g_settings.current_volume = 1)) { frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf);
(g_settings.current_volume = 1); delete [] pixbuf;
AudioMute( true, true); }
g_settings.current_volume = 0; AudioMute(false, true);
Init();
setVolume(msg);
return;
} }
else if (g_settings.show_mute_icon == 0)
g_settings.current_volume = 0; if(!CNeutrinoApp::getInstance()->isMuted()) {
if (g_settings.current_volume > g_settings.current_volume_step)
g_settings.current_volume -= g_settings.current_volume_step;
else if (g_settings.show_mute_icon == 1) {
if ((bDoPaint) && (pixbuf!= NULL)) {
frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf);
delete [] pixbuf;
}
g_settings.current_volume = 0;
AudioMute( true, true);
Init();
setVolume(msg);
return;
}
else if (g_settings.show_mute_icon == 0)
g_settings.current_volume = 0;
}
} }
else if (msg == CRCInput::RC_home) else if (msg == CRCInput::RC_home)
break; break;
else { else {

View File

@@ -45,6 +45,7 @@ class CVolume
int VolumeFont, colShadow, colBar, colFrame, colContent; int VolumeFont, colShadow, colBar, colFrame, colContent;
int ShadowOffset; int ShadowOffset;
int rounded; int rounded;
int m_mode;
bool paintShadow, paintDigits, MuteIconFrame; bool paintShadow, paintDigits, MuteIconFrame;
public: public: