remove unused files in src/gui dir

Origin commit data
------------------
Commit: 5eb799532a
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-06-13 (Wed, 13 Jun 2012)
This commit is contained in:
[CST] Focus
2012-06-13 17:59:02 +04:00
parent 0108613906
commit a0751da034
8 changed files with 0 additions and 969 deletions

View File

@@ -1,272 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gui/alphasetup.h>
#include <driver/fontrenderer.h>
#include <driver/rcinput.h>
#include <gui/color.h>
#include <gui/widget/messagebox.h>
#include <driver/screen_max.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <stdlib.h>
#include <global.h>
#include <neutrino.h>
#define ALPHA_SETUP_ICON_DESELECTED NEUTRINO_ICON_VOLUMESLIDER2
#define ALPHA_SETUP_ICON_ALPHA1_SELECTED NEUTRINO_ICON_VOLUMESLIDER2RED
#define ALPHA_SETUP_ICON_ALPHA2_SELECTED NEUTRINO_ICON_VOLUMESLIDER2GREEN
CAlphaSetup::CAlphaSetup(const neutrino_locale_t Name, unsigned char* Alpha1, unsigned char* Alpha2, CChangeObserver* Observer)
{
frameBuffer = CFrameBuffer::getInstance();
observer = Observer;
name = Name;
alpha1 = Alpha1;
alpha2 = Alpha2;
//frameBuffer->setBlendLevel(*alpha1, *alpha2); //FIXME until blend works
}
int CAlphaSetup::exec(CMenuTarget* parent, const std::string &)
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
width = w_max(360, 0);
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+ mheight*3;
x = frameBuffer->getScreenX() + ((frameBuffer->getScreenWidth()-width) >> 1);
y = frameBuffer->getScreenY() + ((frameBuffer->getScreenHeight()-height) >> 1);
int res = menu_return::RETURN_REPAINT;
if (parent)
{
parent->hide();
}
unsigned char alpha1_alt= *alpha1;
unsigned char alpha2_alt= *alpha2;
frameBuffer->setBlendLevel(*alpha1, *alpha2);
paint();
int selected = 0;
// int max = 1;
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
::TIMING_MENU]);
bool loop=true;
while (loop)
{
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd, true );
if ( msg <= CRCInput::RC_MaxRC )
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
::TIMING_MENU]);
switch ( msg )
{
#if 0
case CRCInput::RC_down:
{
if(selected<max)
{
paintSlider(x + 10, y + hheight , alpha1, LOCALE_GTXALPHA_ALPHA1, ALPHA_SETUP_ICON_DESELECTED , false);
paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, ALPHA_SETUP_ICON_DESELECTED , false);
selected++;
switch (selected)
{
case 0:
paintSlider(x + 10, y + hheight , alpha1, LOCALE_GTXALPHA_ALPHA1, ALPHA_SETUP_ICON_ALPHA1_SELECTED, true );
break;
case 1:
paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, ALPHA_SETUP_ICON_ALPHA2_SELECTED, true );
break;
}
}
break;
}
case CRCInput::RC_up:
{
if (selected > 0)
{
paintSlider(x + 10, y + hheight , alpha1, LOCALE_GTXALPHA_ALPHA1, ALPHA_SETUP_ICON_DESELECTED , false);
paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, ALPHA_SETUP_ICON_DESELECTED , false);
selected--;
switch (selected)
{
case 0:
paintSlider(x + 10, y + hheight , alpha1, LOCALE_GTXALPHA_ALPHA1, ALPHA_SETUP_ICON_ALPHA1_SELECTED, true );
break;
case 1:
paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, ALPHA_SETUP_ICON_ALPHA2_SELECTED, true );
break;
}
}
break;
}
#endif
case CRCInput::RC_right:
{
switch (selected)
{
case 0:
if (*alpha1 < 255) {
*alpha1+= 0x10;
paintSlider(x + 10, y + hheight , alpha1, LOCALE_GTXALPHA_ALPHA1, ALPHA_SETUP_ICON_ALPHA1_SELECTED, true );
frameBuffer->setBlendLevel(*alpha1, *alpha2);
}
break;
case 1:
if (*alpha2 < 255) {
*alpha2 += 0x10;
paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, ALPHA_SETUP_ICON_ALPHA2_SELECTED, true );
frameBuffer->setBlendLevel(*alpha1, *alpha2);
}
break;
}
break;
}
case CRCInput::RC_left:
{
switch (selected)
{
case 0:
if (*alpha1 >= 0x10) {
*alpha1 -= 0x10;
paintSlider(x + 10, y + hheight , alpha1, LOCALE_GTXALPHA_ALPHA1, ALPHA_SETUP_ICON_ALPHA1_SELECTED, true );
frameBuffer->setBlendLevel(*alpha1, *alpha2);
}
break;
case 1:
if (*alpha2 >= 0x10) {
*alpha2 -= 0x10;
paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, ALPHA_SETUP_ICON_ALPHA2_SELECTED, true );
frameBuffer->setBlendLevel(*alpha1, *alpha2);
}
break;
}
break;
}
case CRCInput::RC_favorites:
case CRCInput::RC_sat:
break;
case CRCInput::RC_home:
if ((*alpha1 != alpha1_alt) || (*alpha2 != alpha2_alt))
{
if (ShowLocalizedMessage(name, LOCALE_MESSAGEBOX_DISCARD, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel) == CMessageBox::mbrCancel)
{
break;
}
}
// sonst abbruch...
*alpha1 = alpha1_alt;
*alpha2 = alpha2_alt;
case CRCInput::RC_timeout:
case CRCInput::RC_ok:
loop = false;
break;
default:
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
{
loop = false;
res = menu_return::RETURN_EXIT_ALL;
}
}
}
hide();
if(observer)
observer->changeNotify(name, NULL);
return res;
}
void CAlphaSetup::hide()
{
frameBuffer->paintBackgroundBoxRel(x,y, width,height);
}
void CAlphaSetup::paint()
{
frameBuffer->paintBoxRel(x,y, width,hheight, COL_MENUHEAD_PLUS_0);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+10,y+hheight, width, g_Locale->getText(name), COL_MENUHEAD, 0, true); // UTF-8
frameBuffer->paintBoxRel(x,y+hheight, width,height-hheight, COL_MENUCONTENT_PLUS_0);
paintSlider(x + 10, y + hheight , alpha1, LOCALE_GTXALPHA_ALPHA1, ALPHA_SETUP_ICON_ALPHA1_SELECTED, true );
//paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, ALPHA_SETUP_ICON_DESELECTED , false);
}
void CAlphaSetup::paintSlider(const int px, const int py, const unsigned char * const spos, const neutrino_locale_t text, const char * const iconname, const bool /*selected*/) // UTF-8
{
if (!spos)
return;
int sspos = (*spos)*100/255;
frameBuffer->paintBoxRel(x+70,y,120,mheight, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintIcon(NEUTRINO_ICON_VOLUMEBODY, px + 70 , py + 2 + mheight / 4);
frameBuffer->paintIcon(iconname , px + 73 + sspos, py + mheight / 4);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(px,py+mheight, width, g_Locale->getText(text), COL_MENUCONTENT, 0, true); // UTF-8
}

View File

@@ -1,78 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __alphasetup__
#define __alphasetup__
#include "widget/menue.h"
#include <driver/framebuffer.h>
#include <system/localize.h>
#include <string>
class CAlphaSetup : public CMenuTarget
{
private:
CFrameBuffer *frameBuffer;
int x;
int y;
int width;
int height;
int hheight,mheight; // head/menu font height
unsigned char *alpha1;
unsigned char *alpha2;
neutrino_locale_t name;
CChangeObserver* observer;
void paint();
void setAlpha();
void paintSlider(const int x, const int y, const unsigned char * const spos, const neutrino_locale_t text, const char * const iconname, const bool selected);
public:
CAlphaSetup(const neutrino_locale_t Name, unsigned char* Alpha1, unsigned char* Alpha2, CChangeObserver* Observer = NULL);
void hide();
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

View File

@@ -1,256 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <unistd.h>
#include <config.h>
#include <global.h>
#include <neutrino.h>
#include <driver/fontrenderer.h>
#include <driver/rcinput.h>
#include <gui/color.h>
#include <gui/eventlist.h>
#include <gui/channellist.h>
#include "ch_mosaic.h"
#warning "experimental..."
/*
-- Channel/Service Mosaic
-- Display multiple channel images on screen
-- capture used from outdoor (tmbinc)
-- 2002-11 rasc
*/
//
// -- init Channel Mosaic Handler Class
// -- to be used for calls from Menue
//
int CChMosaicHandler::exec(CMenuTarget* parent, const std::string &actionkey)
{
int res = menu_return::RETURN_EXIT_ALL;
CChMosaic * mosaic;
if (parent) {
parent->hide();
}
mosaic = new CChMosaic;
mosaic->doMosaic ();
delete mosaic;
return res;
}
#define SCREEN_X 720
#define SCREEN_Y 572
#define RATIO(y) (((y)*100)/126) // w/h PAL ratio
//
// -- Channel Mosaic Class
// -- do Mosaic
//
CChMosaic::CChMosaic()
{
pig = new CPIG (0);
capture = new CCAPTURE (0);
current_pig_pos = 0;
channellist = CNeutrinoApp::getInstance()->channelList;
frameBuffer = CFrameBuffer::getInstance();
}
CChMosaic::~CChMosaic()
{
delete pig;
}
void CChMosaic::doMosaic()
{
#define W (150)
#define H (120)
struct PIG_COORD coord[] = {
{ 40, 10, W,H },
{200, 10, W,H },
{360, 10, W,H },
{520, 10, W,H },
{ 40,150, W,H },
{200,150, W,H },
{360,150, W,H },
{520,150, W,H },
{ 40,290, W,H },
{200,290, W,H },
{360,290, W,H },
{520,290, W,H },
{ 40,430, W,H },
{200,430, W,H },
{360,430, W,H },
{520,430, W,H }
};
int channel;
int i;
channellist = CNeutrinoApp::getInstance()->channelList;
channel = channellist->getActiveChannelNumber();
frameBuffer = CFrameBuffer::getInstance();
// $$$ mute
// -- paint background and - windows
paintBackground();
for (i=0; i < (int)(sizeof(coord)/sizeof(coord[0])); i++) {
paintMiniTVBackground(coord[i].x,coord[i].y, coord[i].w, coord[i].h);
}
// experimental
for (i=0; i < (int)(sizeof(coord)/sizeof(coord[0])); i++) {
u_char frame_buf[SCREEN_X*SCREEN_Y*2];
int j;
// -- adjust pig and zap to channel, set capture size
printf ("pig: %d \n",i);
pig->show (coord[i].x,coord[i].y, coord[i].w, coord[i].h);
channellist->zapTo(channel);
capture->set_coord (coord[i].x, coord[i].y, coord[i].w, coord[i].h);
// capture->set_output_size (coord[i].w, coord[i].h);
sleep (2);
// -- inner loop
// -- try 4 times (4 * 0,5 sec) to get a captured frame
for (j=0; j < 4; j++) {
neutrino_msg_t msg;
neutrino_msg_data_t data;
unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(500);
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd );
printf ("pig inner loop: %d - %d \n",i,j);
// $$$ TEST
capture->readframe (frame_buf);
//if (frame_buf[10] == 0x00) continue;
int a;
for (a=0; a<0x10; a++) {
printf("%02x ",frame_buf[a]);
}
printf ("\n");
if (msg == CRCInput::RC_timeout) {
printf ("pig inner loop timeout: \n");
i = i;
}
// -- push other events
if ( msg > CRCInput::RC_MaxRC ) {
CNeutrinoApp::getInstance()->handleMsg( msg, data );
}
// zap, sleep 0.5 sec
// capture frame
// loop 4 times frame "empty"?
// --> wait 0,5 sec, re-capture
}
// display frame
// display add info (sendername, epg info)
//
channel ++;
}
// -- clear
clearTV();
// $$$ unmute
}
//
// -- some paint abstraction functions in this class
//
void CChMosaic::clearTV()
{
frameBuffer->paintBackgroundBoxRel(0,0,SCREEN_X-1,SCREEN_Y-1);
}
void CChMosaic::paintBackground()
{
fb_pixel_t col = 254;
frameBuffer->paintBoxRel(0, 0, SCREEN_X-1, SCREEN_Y-1, col);
//frameBuffer->paintBoxRel(0, 0, SCREEN_X-1, SCREEN_Y-1, frameBuffer->realcolor[0xFe]);
}
void CChMosaic::paintMiniTVBackground(int x, int y, int w, int h)
{
fb_pixel_t col = 240;
frameBuffer->paintBoxRel(x,y,w,h, col);
//frameBuffer->paintBoxRel(x,y,w,h, frameBuffer->realcolor[0xF0]);
}

View File

@@ -1,70 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ch_mosaic__
#define __ch_mosaic__
#include <driver/framebuffer.h>
#include "widget/menue.h"
#include <driver/pig.h>
#include <driver/capture.h>
using namespace std;
class CChMosaicHandler : public CMenuTarget
{
public:
int exec( CMenuTarget* parent, const std::string &actionkey);
};
class CChMosaic
{
public:
CChMosaic ();
~CChMosaic ();
void doMosaic ();
private:
void clearTV ();
void paintBackground ();
void paintMiniTVBackground(int x, int y, int w, int h);
CPIG *pig;
CCAPTURE *capture;
int current_pig_pos;
struct PIG_COORD {
int x,y,w,h;
};
CChannelList *channellist;
CFrameBuffer *frameBuffer;
};
#endif

View File

@@ -1,80 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <global.h>
#include <neutrino.h>
#include <gui/widget/icons.h>
#include <gui/epg_menu.h>
#include <gui/eventlist.h>
#include <gui/infoviewer.h>
#include <gui/epgplus.h>
#include <gui/streaminfo2.h>
//
// -- EPG Menue Handler Class
// -- to be used for calls from Menue
// -- (2004-03-06 rasc)
//
int CEPGMenuHandler::exec(CMenuTarget* parent, const std::string &/*actionkey*/)
{
int res = menu_return::RETURN_EXIT_ALL;
if (parent) {
parent->hide();
}
doMenu ();
return res;
}
int CEPGMenuHandler::doMenu ()
{
CMenuWidget EPGSelector(LOCALE_EPGMENU_HEAD, NEUTRINO_ICON_FEATURES);
// EPGSelector.addItem(GenericMenuSeparator);
EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST , true, NULL, new CEventListHandler(), NULL, CRCInput::RC_red , NEUTRINO_ICON_BUTTON_RED ), false);
EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS , true, NULL, new CEPGplusHandler() , NULL, CRCInput::RC_green , NEUTRINO_ICON_BUTTON_GREEN ), false);
EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO , true, NULL, new CEPGDataHandler() , NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW), false);
EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_STREAMINFO, true, NULL, new CStreamInfo2() , NULL, CRCInput::RC_blue , NEUTRINO_ICON_BUTTON_BLUE ), false);
EPGSelector.addItem(GenericMenuSeparator);
return EPGSelector.exec(NULL, "");
}

View File

@@ -1,43 +0,0 @@
/*
Neutrino-GUI - DBoxII-Project
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __epg_menu__
#define __epg_menu__
#include "widget/menue.h"
using namespace std;
class CEPGMenuHandler : public CMenuTarget
{
public:
int exec( CMenuTarget* parent, const std::string &actionkey);
int doMenu();
};
#endif

View File

@@ -1,140 +0,0 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <global.h>
#include <neutrino.h>
#include <gui/customcolor.h>
#include <gui/scale.h>
#include <string>
#include <time.h>
#include <sys/timeb.h>
#include <sys/param.h>
#define RED_BAR 40
#define YELLOW_BAR 70
#define GREEN_BAR 100
#define BAR_BORDER 1
#define BARW 2
#define BARWW 2
#define ITEMW 4
#define POINT 2
#define RED 0xFF0000
#define GREEN 0x00FF00
#define YELLOW 0xFFFF00
inline unsigned int make16color(__u32 rgb)
{
return 0xFF000000 | rgb;
}
CScale::CScale (int w, int h, int r, int g, int b, bool inv)
{
width = w;
height = h;
inverse = inv;
#ifndef NO_BLINKENLIGHTS
double div;
//printf("new SCALE, w %d h %d size %d\n", w, h, sizeof(CScale)); fflush(stdout);
frameBuffer = CFrameBuffer::getInstance ();
div = (double) 100 / (double) width;
red = (double) r / (double) div / (double) ITEMW;
green = (double) g / (double) div / (double) ITEMW;
yellow = (double) b / (double) div / (double) ITEMW;
#endif
percent = 255;
}
#ifndef NO_BLINKENLIGHTS
void CScale::paint (int x, int y, int pcr)
{
int i, j, siglen;
int posx, posy;
int xpos, ypos;
int hcnt = height / ITEMW;
double div;
uint32_t rgb;
fb_pixel_t color;
int b = 0;
i = 0;
xpos = x;
ypos = y;
//printf("CScale::paint: old %d new %d x %d y %d\n", percent, pcr, x, y); fflush(stdout);
if (pcr != percent) {
if(percent == 255) percent = 0;
div = (double) 100 / (double) width;
siglen = (double) pcr / (double) div;
posx = xpos;
posy = ypos;
int maxi = siglen / ITEMW;
int total = width / ITEMW;
int step = 255/total;
if (pcr > percent) {
for (i = 0; (i < red) && (i < maxi); i++) {
step = 255/red;
if(inverse) rgb = GREEN + ((unsigned char)(step*i) << 16); // adding red
else rgb = RED + ((unsigned char)(step*i) << 8); // adding green
color = make16color(rgb);
for(j = 0; j <= hcnt; j++ ) {
frameBuffer->paintBoxRel (posx + i*ITEMW, posy + j*ITEMW, POINT, POINT, color);
}
}
//printf("hcnt %d yellow %d i %d\n", hcnt, yellow, i); fflush(stdout);
for (; (i < yellow) && (i < maxi); i++) {
step = 255/yellow/2;
if(inverse) rgb = YELLOW - (((unsigned char)step*(b++)) << 8); // removing green
else rgb = YELLOW - ((unsigned char)(step*(b++)) << 16); // removing red
color = make16color(rgb);
//printf("YELLOW: or %08X diff %08X result %08X\n", YELLOW, ((unsigned char)(step*(b-1)) << 16), color);
for(j = 0; j <= hcnt; j++ ) {
frameBuffer->paintBoxRel (posx + i*ITEMW, posy + j*ITEMW, POINT, POINT, color);
}
}
for (; (i < green) && (i < maxi); i++) {
step = 255/green;
if(inverse) rgb = YELLOW - ((unsigned char) (step*(b++)) << 8); // removing green
else rgb = YELLOW - ((unsigned char) (step*(b++)) << 16); // removing red
color = make16color(rgb);
for(j = 0; j <= hcnt; j++ ) {
frameBuffer->paintBoxRel (posx + i*ITEMW, posy + j*ITEMW, POINT, POINT, color);
}
}
}
for(i = maxi; i < total; i++) {
for(j = 0; j <= hcnt; j++ ) {
frameBuffer->paintBoxRel (posx + i*ITEMW, posy + j*ITEMW, POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive
}
}
percent = pcr;
}
}
#else
void CScale::paint (int x, int y, int pcr)
{
if (pcr == percent)
return;
percent = pcr;
pb.paintProgressBar(x, y, width, height, pcr * width / 100, width, COL_INFOBAR_PLUS_3, COL_INFOBAR_PLUS_0, COL_INFOBAR_PLUS_3);
}
#endif
void CScale::reset ()
{
percent = 255;
}
void CScale::hide ()
{
}

View File

@@ -1,30 +0,0 @@
#ifndef __scale_
#define __scale_
#include <driver/framebuffer.h>
/* config.h is included by driver/framebuffer.h already */
#ifdef NO_BLINKENLIGHTS
#include <gui/widget/progressbar.h>
#endif
#error scale.h/CScale is obsolete, use CProgressBar instead.
class CScale
{
private:
#ifdef NO_BLINKENLIGHTS
CProgressBar pb;
#else
CFrameBuffer * frameBuffer;
short red, green, yellow;
#endif
short width;
short height;
char percent;
bool inverse;
public:
CScale(int w, int h, int r, int g, int b, bool inv = false);
void paint(int x, int y, int pcr);
void hide();
void reset();
int getPercent() { return percent; };
};
#endif