Files
recycled-ni-neutrino/src/gui/audiomute.cpp
Thilo Graf 72a289a90c components: rework classes
- outsourced some classes cc_item.cpp/h, cc_draw.cpp/h
- added extra methodes for simple use of some basic components extra.cpp/h
- rework clock handling: use timer class, reworked members for
 enable/disable clock with external timer events,
 tryed to fix some display issues related with infoclock and
 time osd clock in moviebrowser, channellist, menuus
- reworked hide/kill handling, removed parameter for hide(), try to use
 cached backgrounds for other constallations, paint cache, image cache (all beta)
- reworked shadow/frame handling, add shadow modes for left/right
 arrangement, TODO: repaint for existant instances required
- reworked color gradient assignment (beta)

... Note: I had a data crash in my local git tree
and i tryed to restore my historie, but most was lost. Therefore here
the commit is large


Origin commit data
------------------
Commit: 0146511f38
Author: Thilo Graf <dbt@novatux.de>
Date: 2015-11-18 (Wed, 18 Nov 2015)

Origin message was:
------------------
components: rework classes

- outsourced some classes cc_item.cpp/h, cc_draw.cpp/h
- added extra methodes for simple use of some basic components extra.cpp/h
- rework clock handling: use timer class, reworked members for
 enable/disable clock with external timer events,
 tryed to fix some display issues related with infoclock and
 time osd clock in moviebrowser, channellist, menuus
- reworked hide/kill handling, removed parameter for hide(), try to use
 cached backgrounds for other constallations, paint cache, image cache (all beta)
- reworked shadow/frame handling, add shadow modes for left/right
 arrangement, TODO: repaint for existant instances required
- reworked color gradient assignment (beta)

... Note: I had a data crash in my local git tree
and i tryed to restore my historie, but most was lost. Therefore here
the commit is large
2015-12-27 14:42:27 +01:00

129 lines
3.6 KiB
C++

/*
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
audioMute - Neutrino-GUI
Copyright (C) 2013 M. Liebmann (micha-bbg)
CComponents implementation
Copyright (C) 2013-2015 Thilo Graf
License: GPL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <global.h>
#include <neutrino.h>
#include <driver/display.h>
#include <gui/infoclock.h>
#include <gui/volumebar.h>
#include <gui/audiomute.h>
CAudioMute::CAudioMute():CComponentsPicture(0, 0, NEUTRINO_ICON_BUTTON_MUTE)
{
y_old = -1;
paint_bg = false;
do_paint_mute_icon = true;
CVolumeHelper::getInstance()->refresh();
CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height);
}
CAudioMute* CAudioMute::getInstance()
{
static CAudioMute* Mute = NULL;
if(!Mute)
Mute = new CAudioMute();
return Mute;
}
void CAudioMute::AudioMute(int newValue, bool isEvent)
{
CNeutrinoApp* neutrino = CNeutrinoApp::getInstance();
bool doInit = newValue != (int) neutrino->isMuted();
CVFD::getInstance()->setMuted(newValue);
neutrino->setCurrentMuted(newValue);
g_Zapit->muteAudio(newValue);
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)
{
frameBuffer->fbNoCheck(true);
this->hide();
frameBuffer->fbNoCheck(false);
}
frameBuffer->setFbArea(CFrameBuffer::FB_PAINTAREA_MUTEICON1);
y_old = y;
}
/* Infoclock should be blocked in all windows and clean the clock
* display with ClearDisplay() by itself before paint,
* so we don't do this here.
*/
if (!CInfoClock::getInstance()->isBlocked()){
CInfoClock::getInstance()->ClearDisplay();
CInfoClock::getInstance()->paint();//avoids delay
}
frameBuffer->fbNoCheck(true);
if (newValue) {
if (do_paint_mute_icon)
this->paint();
frameBuffer->setFbArea(CFrameBuffer::FB_PAINTAREA_MUTEICON1, x, y, width, height);
}
else {
if (!CInfoClock::getInstance()->isBlocked()){
CInfoClock::getInstance()->ClearDisplay();
this->kill();
clearSavedScreen();
CInfoClock::getInstance()->paint();//avoids delay
}else
this->hide();
frameBuffer->setFbArea(CFrameBuffer::FB_PAINTAREA_MUTEICON1);
}
frameBuffer->fbNoCheck(false);
}
}
void CAudioMute::enableMuteIcon(bool enable)
{
CNeutrinoApp *neutrino = CNeutrinoApp::getInstance();
CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height);
frameBuffer->fbNoCheck(true);
if (enable) {
frameBuffer->doPaintMuteIcon(true);
do_paint_mute_icon = true;
if (neutrino->isMuted())
this->paint();
}
else {
if (!neutrino->isMuted())
this->kill();
frameBuffer->doPaintMuteIcon(false);
do_paint_mute_icon = false;
}
frameBuffer->fbNoCheck(false);
}