mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-13 00:13:43 +02:00
CVolumeBar: rework volumebar handling
Use CComponenets and separates the gui part from driver part - add new class CVolumeBar as CComponentsForm - Various changes for reworked volume bar handling in some classes - Move AudioMute() from CVolume to new class CAudioMute - Use CComponentsPicture to paint muteicon
This commit is contained in:
@@ -53,6 +53,7 @@ noinst_LIBRARIES = libtimerlist.a libneutrino_gui.a libneutrino_gui2.a
|
||||
libneutrino_gui_a_SOURCES = \
|
||||
audio_select.cpp \
|
||||
audio_setup.cpp \
|
||||
audiomute.cpp \
|
||||
audioplayer.cpp \
|
||||
audioplayer_setup.cpp\
|
||||
bookmarkmanager.cpp \
|
||||
@@ -110,6 +111,7 @@ libneutrino_gui_a_SOURCES = \
|
||||
user_menue_setup.cpp \
|
||||
vfd_setup.cpp \
|
||||
videosettings.cpp \
|
||||
volumebar.cpp \
|
||||
pipsetup.cpp \
|
||||
zapit_setup.cpp
|
||||
|
||||
|
87
src/gui/audiomute.cpp
Normal file
87
src/gui/audiomute.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
Based up Neutrino-GUI - Tuxbox-Project
|
||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||
|
||||
audioMute - Neutrino-GUI
|
||||
Copyright (C) 2013 M. Liebmann (micha-bbg)
|
||||
|
||||
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 <gui/infoclock.h>
|
||||
#include <gui/volumebar.h>
|
||||
#include <gui/audiomute.h>
|
||||
|
||||
CAudioMute::CAudioMute()
|
||||
{
|
||||
mute_ax = 0;
|
||||
mute_ay = 0;
|
||||
mute_dx = 0;
|
||||
mute_dy = 0;
|
||||
mute_ay_old = -1;
|
||||
CVolumeHelper::getInstance()->getMuteIconDimensions(&mute_ax, &mute_ay, &mute_dx, &mute_dy);
|
||||
mIcon = new CComponentsPicture(mute_ax, mute_ay, mute_dx, mute_dy, NEUTRINO_ICON_BUTTON_MUTE);
|
||||
}
|
||||
|
||||
CAudioMute::~CAudioMute()
|
||||
{
|
||||
delete mIcon;
|
||||
}
|
||||
|
||||
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_audio) && ( neutrino->getMode() != CNeutrinoApp::mode_pic))
|
||||
{
|
||||
CVolumeHelper::getInstance()->getMuteIconDimensions(&mute_ax, &mute_ay, &mute_dx, &mute_dy);
|
||||
if ((mIcon) && (mute_ay_old != mute_ay)) {
|
||||
mIcon->hide();
|
||||
mIcon->setYPos(mute_ay);
|
||||
mute_ay_old = mute_ay;
|
||||
}
|
||||
if ((g_settings.mode_clock) && (doInit))
|
||||
CInfoClock::getInstance(true)->ClearDisplay();
|
||||
|
||||
if (newValue)
|
||||
mIcon->paint();
|
||||
else
|
||||
mIcon->hide();
|
||||
|
||||
if (doInit)
|
||||
CInfoClock::getInstance(true)->Init(true);
|
||||
}
|
||||
}
|
48
src/gui/audiomute.h
Normal file
48
src/gui/audiomute.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Based up Neutrino-GUI - Tuxbox-Project
|
||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||
|
||||
audioMute - Neutrino-GUI
|
||||
Copyright (C) 2013 M. Liebmann (micha-bbg)
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __CAUDIOMUTE__
|
||||
#define __CAUDIOMUTE__
|
||||
|
||||
#include <gui/components/cc.h>
|
||||
|
||||
class CAudioMute
|
||||
{
|
||||
private:
|
||||
int mute_ay_old;
|
||||
int mute_ax, mute_ay, mute_dx, mute_dy;
|
||||
CComponentsPicture *mIcon;
|
||||
|
||||
public:
|
||||
|
||||
CAudioMute();
|
||||
~CAudioMute();
|
||||
static CAudioMute* getInstance();
|
||||
|
||||
void AudioMute(int newValue, bool isEvent= false);
|
||||
};
|
||||
|
||||
#endif // __CAUDIOMUTE__
|
@@ -12,6 +12,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <driver/volume.h>
|
||||
#include <gui/volumebar.h>
|
||||
#include <gui/infoclock.h>
|
||||
|
||||
#define YOFF 0
|
||||
@@ -33,14 +34,18 @@ CInfoClock::~CInfoClock()
|
||||
|
||||
void CInfoClock::Init(bool noVolume)
|
||||
{
|
||||
static int mute_dx = 0;
|
||||
static int spacer = 0;
|
||||
static int mute_dx = 0, mute_dy = 0, y_org = 0, spacer = 0;
|
||||
int mute_corrY = 0;
|
||||
if (!noVolume) {
|
||||
x = CVolume::getInstance()->getEndPosRight();
|
||||
y = CVolume::getInstance()->getStartPosTop();
|
||||
mute_dx = CVolume::getInstance()->mute_dx;
|
||||
spacer = CVolume::getInstance()->spacer;
|
||||
CVolumeHelper *vh = CVolumeHelper::getInstance();
|
||||
int dummy;
|
||||
vh->getDimensions(&dummy, &y, &x, &dummy);
|
||||
vh->getMuteIconDimensions(&dummy, &dummy, &mute_dx, &mute_dy);
|
||||
vh->getSpacer(&spacer, &dummy);
|
||||
y_org = y;
|
||||
}
|
||||
else
|
||||
y = y_org;
|
||||
|
||||
digit_offset = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitOffset();
|
||||
digit_h = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitHeight();
|
||||
@@ -49,8 +54,14 @@ void CInfoClock::Init(bool noVolume)
|
||||
time_height = digit_h + (int)((float)digit_offset * 1.5);
|
||||
time_width = t1*6 + t2*2;
|
||||
clock_x = x - time_width;
|
||||
if (CNeutrinoApp::getInstance()->isMuted())
|
||||
if (CNeutrinoApp::getInstance()->isMuted()) {
|
||||
clock_x -= (mute_dx + spacer);
|
||||
if (mute_dy > time_height)
|
||||
y += (mute_dy - time_height) / 2;
|
||||
else
|
||||
mute_corrY = (time_height - mute_dy) / 2;
|
||||
CVolumeHelper::getInstance()->setMuteIconCorrY(mute_corrY);
|
||||
}
|
||||
}
|
||||
|
||||
CInfoClock* CInfoClock::getInstance(bool noVolume)
|
||||
@@ -98,7 +109,6 @@ void CInfoClock::ClearDisplay()
|
||||
void CInfoClock::StartClock()
|
||||
{
|
||||
Init();
|
||||
CVolume::getInstance()->Init();
|
||||
|
||||
if(!thrTimer) {
|
||||
pthread_create (&thrTimer, NULL, TimerProc, (void*) this) ;
|
||||
@@ -108,7 +118,6 @@ void CInfoClock::StartClock()
|
||||
|
||||
void CInfoClock::StopClock()
|
||||
{
|
||||
CVolume::getInstance()->Init();
|
||||
if(thrTimer) {
|
||||
pthread_cancel(thrTimer);
|
||||
thrTimer = 0;
|
||||
|
@@ -891,15 +891,9 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
|
||||
g_InfoViewer->changePB();
|
||||
return true;
|
||||
}
|
||||
else if ((ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_VOLUME_POS)) ||
|
||||
(ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_VOLUME_DIGITS))){
|
||||
CVolume::getInstance()->Init();
|
||||
return false;
|
||||
}
|
||||
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_ROUNDED_CORNERS)) {
|
||||
osd_menu->hide();
|
||||
g_settings.rounded_corners = * (int*) data;
|
||||
CVolume::getInstance()->Init();
|
||||
return true;
|
||||
}
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_RADIOTEXT)) {
|
||||
|
@@ -450,7 +450,7 @@ int CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
case CRCInput::RC_minus:
|
||||
case CRCInput::RC_left:
|
||||
case CRCInput::RC_right:
|
||||
CVolume::getInstance()->setVolume(msg, true, true);
|
||||
CVolume::getInstance()->setVolume(msg, true /*nowait = true*/);
|
||||
break;
|
||||
default:
|
||||
if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000))
|
||||
|
317
src/gui/volumebar.cpp
Normal file
317
src/gui/volumebar.cpp
Normal file
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
Based up Neutrino-GUI - Tuxbox-Project
|
||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||
|
||||
Volumebar class for gui.
|
||||
Copyright (C) 2013, Thilo Graf 'dbt'
|
||||
Copyright (C) 2013, M. Liebmann (micha-bbg)
|
||||
|
||||
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 "gui/volumebar.h"
|
||||
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <gui/infoclock.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CVolumeBar::CVolumeBar()
|
||||
{
|
||||
initVarVolumeBar();
|
||||
}
|
||||
|
||||
void CVolumeBar::initVarVolumeBar()
|
||||
{
|
||||
//init inherited variables
|
||||
initVarForm();
|
||||
col_body = COL_MENUCONTENT_PLUS_0;
|
||||
height = 36; //default height
|
||||
|
||||
//init variables this
|
||||
|
||||
//assume volume value as pointer to global setting
|
||||
vb_vol = &g_settings.current_volume;
|
||||
|
||||
//items
|
||||
//icon object
|
||||
vb_icon = NULL;
|
||||
// icon whith / height
|
||||
int tmp_h = 0;
|
||||
frameBuffer->getIconSize(NEUTRINO_ICON_VOLUME, &icon_w, &tmp_h);
|
||||
icon_w += 12;
|
||||
tmp_h += 4;
|
||||
height = max(height, tmp_h);
|
||||
|
||||
//progressbar object
|
||||
vb_pb = NULL;
|
||||
vb_pbx = 0;
|
||||
vb_pbw = 0;
|
||||
vb_pbh = 0;
|
||||
vb_pby = 0;
|
||||
// progressbar whith
|
||||
pb_w = 200;
|
||||
|
||||
//digit
|
||||
vb_digit = NULL;
|
||||
vb_digit_mode = CTextBox::CENTER;
|
||||
VolumeFont = SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO;
|
||||
vb_font = g_Font[VolumeFont];
|
||||
|
||||
initVolumeBarSize();
|
||||
initVolumeBarPosition();
|
||||
initVolumeBarItems();
|
||||
}
|
||||
|
||||
//calculates size referred for possible activated clock or/and mute icon
|
||||
void CVolumeBar::initVolumeBarSize()
|
||||
{
|
||||
int tmp_h = height;
|
||||
|
||||
// digit whith / height
|
||||
if (g_settings.volume_digits) {
|
||||
tmp_h = g_Font[VolumeFont]->getDigitHeight() + (g_Font[VolumeFont]->getDigitOffset() * 18) / 10;
|
||||
height = max(height, tmp_h);
|
||||
digit_w = g_Font[VolumeFont]->getRenderWidth("100 ");
|
||||
}
|
||||
else
|
||||
digit_w = 0;
|
||||
|
||||
//adapt x-pos
|
||||
icon_x = corner_rad + 2;
|
||||
pb_x = icon_x + icon_w + 4;
|
||||
digit_x = pb_x + pb_w + 5;
|
||||
|
||||
//width
|
||||
if (g_settings.volume_digits)
|
||||
width = digit_x + digit_w + corner_rad;
|
||||
else
|
||||
width = pb_x + pb_w + corner_rad + 12;
|
||||
|
||||
CVolumeHelper *cvh = CVolumeHelper::getInstance();
|
||||
cvh->getSpacer(&h_spacer, &v_spacer);
|
||||
cvh->getDimensions(&x, &y, &sw, &sh);
|
||||
|
||||
// mute icon
|
||||
cvh->getMuteIconDimensions(&mute_ax, &mute_ay, &mute_dx, &mute_dy);
|
||||
|
||||
clock_height = 0;
|
||||
int clock_width = 0;
|
||||
int mute_corrY = 0;
|
||||
if ((g_settings.mode_clock) && (g_settings.volume_pos == 0)) {
|
||||
// Clock and MuteIcon in a line.
|
||||
clock_height = CInfoClock::getInstance(true)->time_height;
|
||||
clock_width = CInfoClock::getInstance(true)->time_width;
|
||||
mute_corrY = (clock_height - mute_dy) / 2;
|
||||
}
|
||||
else {
|
||||
// Volume level and MuteIcon in a line.
|
||||
if (mute_dy > height)
|
||||
y += (mute_dy - height) / 2;
|
||||
else
|
||||
mute_corrY = (height - mute_dy) / 2;
|
||||
}
|
||||
cvh->setMuteIconCorrY(mute_corrY);
|
||||
|
||||
if ((g_settings.mode_clock) && (!CNeutrinoApp::getInstance()->isMuted()))
|
||||
frameBuffer->paintBackgroundBoxRel(sw - clock_width, y, clock_width, clock_height);
|
||||
|
||||
vb_pbh = height-8;
|
||||
vb_pby = height/2-vb_pbh/2;
|
||||
}
|
||||
|
||||
//init current position of form
|
||||
void CVolumeBar::initVolumeBarPosition()
|
||||
{
|
||||
CNeutrinoApp* neutrino = CNeutrinoApp::getInstance();
|
||||
|
||||
switch (g_settings.volume_pos)
|
||||
{
|
||||
case 0:{// upper right
|
||||
int x_corr = 0;
|
||||
if (( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_audio) && ( neutrino->getMode() != CNeutrinoApp::mode_pic)) {
|
||||
if ((neutrino->isMuted()) && (!g_settings.mode_clock))
|
||||
x_corr = mute_dx + h_spacer;
|
||||
if (g_settings.mode_clock)
|
||||
y += clock_height + v_spacer / 2;
|
||||
}
|
||||
x = sw - width - x_corr;
|
||||
break;
|
||||
}
|
||||
case 1:// upper left
|
||||
break;
|
||||
case 2:// bottom left
|
||||
y = (sh + frameBuffer->getScreenY()) - height - v_spacer;
|
||||
break;
|
||||
case 3:// bottom right
|
||||
x = sw - width;
|
||||
y = (sh + frameBuffer->getScreenY()) - height - v_spacer;
|
||||
break;
|
||||
case 4:// upper center
|
||||
x = ((sw - width) / 2) + x;
|
||||
break;
|
||||
case 5:// bottom center
|
||||
x = ((sw - width) / 2) + x;
|
||||
y = (sh + frameBuffer->getScreenY()) - height - v_spacer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CVolumeBar::initVolumeBarItems()
|
||||
{
|
||||
//icon
|
||||
initVolumeBarIcon();
|
||||
|
||||
//scale
|
||||
initVolumeBarScale();
|
||||
|
||||
//digits
|
||||
if (g_settings.volume_digits)
|
||||
initVolumeBarDigit();
|
||||
}
|
||||
|
||||
//init current icon object
|
||||
void CVolumeBar::initVolumeBarIcon()
|
||||
{
|
||||
vb_icon = new CComponentsPicture(icon_x, 0, icon_w, height, NEUTRINO_ICON_VOLUME);
|
||||
|
||||
vb_icon->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
|
||||
vb_icon->setColorBody(col_body);
|
||||
vb_icon->setCornerRadius(corner_rad);
|
||||
vb_icon->setCornerType(CORNER_LEFT);
|
||||
|
||||
//add icon to container
|
||||
addCCItem(vb_icon);
|
||||
}
|
||||
|
||||
//create new scale
|
||||
void CVolumeBar::initVolumeBarScale()
|
||||
{
|
||||
vb_pb = new CProgressBar();
|
||||
|
||||
vb_pbx = pb_x;
|
||||
vb_pbw = pb_w;
|
||||
|
||||
vb_pb->setInvert();
|
||||
vb_pb->setBlink();
|
||||
vb_pb->setRgb(85, 75, 100);
|
||||
vb_pb->setFrameThickness(2);
|
||||
vb_pb->setProgress(vb_pbx, vb_pby, vb_pbw, vb_pbh, *vb_vol, 100);
|
||||
|
||||
//add progressbar to container
|
||||
addCCItem(vb_pb);
|
||||
}
|
||||
|
||||
//set digit text with current volume value
|
||||
void CVolumeBar::initVolumeBarDigitValue()
|
||||
{
|
||||
vb_digit->setText(*vb_vol ,vb_digit_mode, vb_font);
|
||||
}
|
||||
|
||||
//create digit
|
||||
void CVolumeBar::initVolumeBarDigit()
|
||||
{
|
||||
vb_digit = new CComponentsLabel();
|
||||
|
||||
vb_digit->setDimensionsAll(digit_x, 0, digit_w, height);
|
||||
vb_digit->setTextColor(COL_MENUCONTENT);
|
||||
initVolumeBarDigitValue();
|
||||
|
||||
//add digit label to container
|
||||
addCCItem(vb_digit);
|
||||
}
|
||||
|
||||
//refresh and paint digit
|
||||
void CVolumeBar::paintVolumeBarDigit()
|
||||
{
|
||||
// digits
|
||||
CTextBox* ctb = vb_digit->getCTextBoxObject();
|
||||
if (ctb)
|
||||
ctb->setFontUseDigitHeight();
|
||||
int dx = vb_digit->getRealXPos();
|
||||
int dy = vb_digit->getRealYPos();
|
||||
vb_digit->setDimensionsAll(dx, dy, digit_w, height);
|
||||
vb_digit->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
|
||||
//refresh progressbar and digit
|
||||
void CVolumeBar::repaintVolScale()
|
||||
{
|
||||
paintVolScale();
|
||||
|
||||
if (g_settings.volume_digits) {
|
||||
initVolumeBarDigitValue();
|
||||
paintVolumeBarDigit();
|
||||
}
|
||||
}
|
||||
|
||||
//set current volume value and paint form
|
||||
void CVolumeBar::paintVolScale()
|
||||
{
|
||||
vb_pb->setValue(*vb_vol);
|
||||
vb_pb->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
|
||||
//final paint
|
||||
void CVolumeBar::paint(bool do_save_bg)
|
||||
{
|
||||
//paint form
|
||||
paintForm(do_save_bg);
|
||||
}
|
||||
|
||||
|
||||
// CVolumeHelper ####################################################################################################
|
||||
|
||||
CVolumeHelper::CVolumeHelper()
|
||||
{
|
||||
h_spacer = 11;
|
||||
v_spacer = 6;
|
||||
|
||||
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
|
||||
x = frameBuffer->getScreenX() + h_spacer;
|
||||
y = frameBuffer->getScreenY() + v_spacer;
|
||||
sw = g_settings.screen_EndX - h_spacer;
|
||||
sh = frameBuffer->getScreenHeight();
|
||||
|
||||
int mute_icon_dx = 0;
|
||||
int mute_icon_dy = 0;
|
||||
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MUTE, &mute_icon_dx, &mute_icon_dy);
|
||||
mute_dx = mute_icon_dx;
|
||||
mute_dy = mute_icon_dy;
|
||||
mute_dx += mute_icon_dx / 4;
|
||||
mute_dy += mute_icon_dx / 4;
|
||||
mute_ax = sw - mute_dx;
|
||||
mute_ay = y;
|
||||
mute_corrY = 0;
|
||||
}
|
||||
|
||||
CVolumeHelper* CVolumeHelper::getInstance()
|
||||
{
|
||||
static CVolumeHelper* Helper = NULL;
|
||||
if(!Helper)
|
||||
Helper = new CVolumeHelper();
|
||||
return Helper;
|
||||
}
|
98
src/gui/volumebar.h
Normal file
98
src/gui/volumebar.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
Based up Neutrino-GUI - Tuxbox-Project
|
||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||
|
||||
Volumebar class for gui.
|
||||
Copyright (C) 2013, Thilo Graf 'dbt'
|
||||
Copyright (C) 2013, M. Liebmann (micha-bbg)
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __VOLUMEBAR_H__
|
||||
#define __VOLUMEBAR_H__
|
||||
|
||||
#include <gui/components/cc_frm.h> //CComponentsForm
|
||||
#include <gui/components/cc_item_progressbar.h> //CProgressBar
|
||||
|
||||
class CVolumeBar : public CComponentsForm
|
||||
{
|
||||
private:
|
||||
CProgressBar *vb_pb;
|
||||
CComponentsPicture *vb_icon;
|
||||
CComponentsLabel *vb_digit;
|
||||
int vb_digit_mode;
|
||||
Font* vb_font;
|
||||
int VolumeFont;
|
||||
int sy, sw, sh;
|
||||
int mute_ax, mute_ay, mute_dx, mute_dy, mute_ay_old;
|
||||
int h_spacer, v_spacer;
|
||||
|
||||
//clock
|
||||
int clock_height;
|
||||
|
||||
//volume value
|
||||
char *vb_vol;
|
||||
|
||||
//scale dimensions
|
||||
int vb_pbx, vb_pby, vb_pbw, vb_pbh;
|
||||
int icon_x, pb_x, digit_x;
|
||||
int icon_w, pb_w, digit_w;
|
||||
|
||||
void initVarVolumeBar();
|
||||
void initVolumeBarPosition();
|
||||
void initVolumeBarSize();
|
||||
|
||||
void initVolumeBarIcon();
|
||||
void initVolumeBarScale();
|
||||
void initVolumeBarDigitValue();
|
||||
void initVolumeBarDigit();
|
||||
void initVolumeBarItems();
|
||||
|
||||
void paintVolScale();
|
||||
void paintVolumeBarDigit();
|
||||
|
||||
public:
|
||||
|
||||
CVolumeBar(/*int current_volume*/);
|
||||
// ~CVolumeBar(); inherited from CComponentsForm
|
||||
|
||||
void repaintVolScale();
|
||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
};
|
||||
|
||||
|
||||
class CVolumeHelper
|
||||
{
|
||||
private:
|
||||
int x, y, sw, sh;
|
||||
int mute_ax, mute_ay, mute_dx, mute_dy, mute_corrY;
|
||||
int h_spacer, v_spacer;
|
||||
|
||||
public:
|
||||
|
||||
CVolumeHelper();
|
||||
static CVolumeHelper* getInstance();
|
||||
|
||||
void getSpacer(int *h, int *v) { *h = h_spacer; *v = v_spacer; }
|
||||
void getDimensions(int *_x, int *_y, int *_sw, int *_sh) { *_x = x; *_y = y; *_sw = sw; *_sh = sh; }
|
||||
void getMuteIconDimensions(int *_x, int *_y, int *w, int *h) { *_x = mute_ax; *_y = mute_ay+mute_corrY; *w = mute_dx; *h = mute_dy; }
|
||||
void setMuteIconCorrY(int corr) { mute_corrY = corr; }
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user