mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 01:11:06 +02:00
Colors: init global color gradient implementation
Origin commit data
------------------
Branch: ni/coolstream
Commit: 523b273af8
Author: Thilo Graf <dbt@novatux.de>
Date: 2015-11-19 (Thu, 19 Nov 2015)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -89,7 +89,7 @@ CInfoViewerBB::CInfoViewerBB()
|
||||
bbIconInfo[0].h = 0;
|
||||
BBarY = 0;
|
||||
BBarFontY = 0;
|
||||
|
||||
foot = cabar = NULL;
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ void CInfoViewerBB::Init()
|
||||
}
|
||||
|
||||
InfoHeightY_Info = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight() + 5;
|
||||
setBBOffset();
|
||||
initBBOffset();
|
||||
|
||||
changePB();
|
||||
}
|
||||
@@ -120,10 +120,7 @@ CInfoViewerBB::~CInfoViewerBB()
|
||||
pthread_cancel(scrambledT);
|
||||
scrambledT = 0;
|
||||
}
|
||||
if (hddscale)
|
||||
delete hddscale;
|
||||
if (sysscale)
|
||||
delete sysscale;
|
||||
ResetModules();
|
||||
}
|
||||
|
||||
CInfoViewerBB* CInfoViewerBB::getInstance()
|
||||
@@ -181,7 +178,7 @@ void CInfoViewerBB::getBBIconInfo()
|
||||
iconView = checkBBIcon(NEUTRINO_ICON_RESOLUTION_1280, &w, &h);
|
||||
break;
|
||||
case CInfoViewerBB::ICON_CA:
|
||||
if (g_settings.casystem_display == 2)
|
||||
if (g_settings.infobar_casystem_display == 2)
|
||||
iconView = checkBBIcon(NEUTRINO_ICON_SCRAMBLED2, &w, &h);
|
||||
break;
|
||||
case CInfoViewerBB::ICON_TUNER:
|
||||
@@ -409,7 +406,21 @@ void CInfoViewerBB::showBBButtons(const int modus)
|
||||
}
|
||||
|
||||
if (paint) {
|
||||
fb_pixel_t *pixbuf = NULL;
|
||||
int buf_x = bbIconMinX;
|
||||
int buf_y = BBarY;
|
||||
int buf_w = g_InfoViewer->BoxEndX-bbIconMinX;
|
||||
int buf_h = InfoHeightY_Info;
|
||||
if (modus != -1) {
|
||||
pixbuf = new fb_pixel_t[buf_w * buf_h];
|
||||
//printf("\nbuf_x: %d, buf_y: %d, buf_w: %d, buf_h: %d, pixbuf: %p\n \n", buf_x, buf_y, buf_w, buf_h, pixbuf);
|
||||
frameBuffer->SaveScreen(buf_x, buf_y, buf_w, buf_h, pixbuf);
|
||||
}
|
||||
paintFoot(minX - g_InfoViewer->ChanInfoX);
|
||||
if ((modus != -1) && (pixbuf != NULL)) {
|
||||
frameBuffer->RestoreScreen(buf_x, buf_y, buf_w, buf_h, pixbuf);
|
||||
delete [] pixbuf;
|
||||
}
|
||||
int last_x = minX;
|
||||
for (i = BUTTON_MAX; i > 0;) {
|
||||
--i;
|
||||
@@ -464,7 +475,7 @@ void CInfoViewerBB::paintshowButtonBar()
|
||||
}
|
||||
g_InfoViewer->sec_timer_id = g_RCInput->addTimer(1*1000*1000, false);
|
||||
|
||||
if (g_settings.casystem_display < 2)
|
||||
if (g_settings.infobar_casystem_display < 2)
|
||||
paintCA_bar(0,0);
|
||||
|
||||
paintFoot();
|
||||
@@ -492,15 +503,14 @@ void CInfoViewerBB::paintFoot(int w)
|
||||
{
|
||||
int width = (w == 0) ? g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX : w;
|
||||
|
||||
CComponentsShapeSquare foot(g_InfoViewer->ChanInfoX, BBarY, width, InfoHeightY_Info);
|
||||
if (foot == NULL)
|
||||
foot = new CComponentsShapeSquare(g_InfoViewer->ChanInfoX, BBarY, width, InfoHeightY_Info, NULL, CC_SHADOW_ON);
|
||||
|
||||
foot.setColorBody(COL_INFOBAR_BUTTONS_BACKGROUND);
|
||||
foot.enableColBodyGradient(g_settings.theme.infobar_gradient_bottom);
|
||||
foot.setColBodyGradient(CColorGradient::gradientDark2Light, CFrameBuffer::gradientVertical);
|
||||
foot.setCorner(RADIUS_LARGE, CORNER_BOTTOM);
|
||||
foot.set2ndColor(COL_INFOBAR_PLUS_0);
|
||||
foot->setColorBody(COL_INFOBAR_BUTTONS_BACKGROUND);
|
||||
foot->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom, COL_INFOBAR_PLUS_0, g_settings.theme.infobar_gradient_bottom_direction);
|
||||
foot->setCorner(RADIUS_LARGE, CORNER_BOTTOM);
|
||||
|
||||
foot.paint(CC_SAVE_SCREEN_NO);
|
||||
foot->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
void CInfoViewerBB::showIcon_SubT()
|
||||
@@ -704,6 +714,7 @@ void CInfoViewerBB::showSysfsHdd()
|
||||
void CInfoViewerBB::showBarSys(int percent)
|
||||
{
|
||||
if (is_visible){
|
||||
sysscale->doPaintBg(false);
|
||||
sysscale->setDimensionsAll(bbIconMinX, BBarY + InfoHeightY_Info / 2 - 2 - 6, hddwidth, 6);
|
||||
sysscale->setValues(percent, 100);
|
||||
sysscale->paint();
|
||||
@@ -713,6 +724,7 @@ void CInfoViewerBB::showBarSys(int percent)
|
||||
void CInfoViewerBB::showBarHdd(int percent)
|
||||
{
|
||||
if (is_visible) {
|
||||
hddscale->doPaintBg(false);
|
||||
if (percent >= 0){
|
||||
hddscale->setDimensionsAll(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6);
|
||||
hddscale->setValues(percent, 100);
|
||||
@@ -727,8 +739,8 @@ void CInfoViewerBB::showBarHdd(int percent)
|
||||
void CInfoViewerBB::paint_ca_icons(int caid, const char *icon, int &icon_space_offset)
|
||||
{
|
||||
char buf[20];
|
||||
int endx = g_InfoViewer->BoxEndX - (g_settings.casystem_frame ? 20 : 10);
|
||||
int py = g_InfoViewer->BoxEndY + (g_settings.casystem_frame ? 4 : 2); /* hand-crafted, should be automatic */
|
||||
int endx = g_InfoViewer->BoxEndX - (g_settings.infobar_casystem_frame ? 20 : 10);
|
||||
int py = g_InfoViewer->BoxEndY + (g_settings.infobar_casystem_frame ? 4 : 2); /* hand-crafted, should be automatic */
|
||||
int px = 0;
|
||||
static map<int, std::pair<int,const char*> > icon_map;
|
||||
const int icon_space = 10, icon_number = 10;
|
||||
@@ -769,7 +781,7 @@ void CInfoViewerBB::paint_ca_icons(int caid, const char *icon, int &icon_space_o
|
||||
if (icon_offset[icon_map[caid].first] == 0)
|
||||
return;
|
||||
|
||||
if (g_settings.casystem_display == 0) {
|
||||
if (g_settings.infobar_casystem_display == 0) {
|
||||
px = endx - (icon_offset[icon_map[caid].first] - icon_space );
|
||||
} else {
|
||||
icon_space_offset += icon_sizeW[icon_map[caid].first];
|
||||
@@ -789,10 +801,10 @@ void CInfoViewerBB::paint_ca_icons(int caid, const char *icon, int &icon_space_o
|
||||
|
||||
void CInfoViewerBB::showIcon_CA_Status(int notfirst)
|
||||
{
|
||||
if (g_settings.casystem_display == 3)
|
||||
if (g_settings.infobar_casystem_display == 3)
|
||||
return;
|
||||
if(NeutrinoMessages::mode_ts == CNeutrinoApp::getInstance()->getMode() && !CMoviePlayerGui::getInstance().timeshift){
|
||||
if (g_settings.casystem_display == 2) {
|
||||
if (g_settings.infobar_casystem_display == 2) {
|
||||
fta = true;
|
||||
showOne_CAIcon();
|
||||
}
|
||||
@@ -805,11 +817,11 @@ void CInfoViewerBB::showIcon_CA_Status(int notfirst)
|
||||
int icon_space_offset = 0;
|
||||
|
||||
if(!g_InfoViewer->chanready) {
|
||||
if (g_settings.casystem_display == 2) {
|
||||
if (g_settings.infobar_casystem_display == 2) {
|
||||
fta = true;
|
||||
showOne_CAIcon();
|
||||
}
|
||||
else if(g_settings.casystem_display == 0) {
|
||||
else if(g_settings.infobar_casystem_display == 0) {
|
||||
for (int i = 0; i < (int)(sizeof(caids)/sizeof(int)); i++) {
|
||||
paint_ca_icons(caids[i], white, icon_space_offset);
|
||||
}
|
||||
@@ -821,7 +833,7 @@ void CInfoViewerBB::showIcon_CA_Status(int notfirst)
|
||||
if(!channel)
|
||||
return;
|
||||
|
||||
if (g_settings.casystem_display == 2) {
|
||||
if (g_settings.infobar_casystem_display == 2) {
|
||||
fta = channel->camap.empty();
|
||||
showOne_CAIcon();
|
||||
return;
|
||||
@@ -830,7 +842,7 @@ void CInfoViewerBB::showIcon_CA_Status(int notfirst)
|
||||
if(!notfirst) {
|
||||
#if 0
|
||||
static int icon_space_offset = 0;
|
||||
if ((g_settings.casystem_display == 1) && (icon_space_offset)) {
|
||||
if ((g_settings.infobar_casystem_display == 1) && (icon_space_offset)) {
|
||||
paintCA_bar(0,icon_space_offset);
|
||||
icon_space_offset = 0;
|
||||
}
|
||||
@@ -844,7 +856,7 @@ void CInfoViewerBB::showIcon_CA_Status(int notfirst)
|
||||
if((found = (caid == caids[i])))
|
||||
break;
|
||||
}
|
||||
if(g_settings.casystem_display == 0)
|
||||
if(g_settings.infobar_casystem_display == 0)
|
||||
paint_ca_icons(caids[i], (found ? yellow : white), icon_space_offset);
|
||||
else if(found)
|
||||
paint_ca_icons(caids[i], yellow, icon_space_offset);
|
||||
@@ -854,32 +866,41 @@ void CInfoViewerBB::showIcon_CA_Status(int notfirst)
|
||||
|
||||
void CInfoViewerBB::paintCA_bar(int left, int right)
|
||||
{
|
||||
int xcnt = (g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX - (g_settings.casystem_frame ? 24 : 0)) / 4;
|
||||
int ycnt = (bottom_bar_offset - (g_settings.casystem_frame ? 14 : 0)) / 4;
|
||||
int xcnt = (g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX - (g_settings.infobar_casystem_frame ? 24 : 0)) / 4;
|
||||
int ycnt = (bottom_bar_offset - (g_settings.infobar_casystem_frame ? 14 : 0)) / 4;
|
||||
int ca_width = g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX;
|
||||
|
||||
if (right)
|
||||
right = xcnt - ((right/4)+1);
|
||||
if (left)
|
||||
left = xcnt - ((left/4)-1);
|
||||
|
||||
if (g_settings.casystem_frame) { // with highlighted frame
|
||||
if (g_settings.infobar_casystem_frame) { // with highlighted frame
|
||||
if (!right || !left) { // paint full bar
|
||||
// background
|
||||
frameBuffer->paintBox(g_InfoViewer->ChanInfoX , g_InfoViewer->BoxEndY , g_InfoViewer->BoxEndX , g_InfoViewer->BoxEndY + bottom_bar_offset , COL_INFOBAR_PLUS_0);
|
||||
// shadow
|
||||
frameBuffer->paintBox(g_InfoViewer->ChanInfoX + 14, g_InfoViewer->BoxEndY + 4, g_InfoViewer->BoxEndX - 6 , g_InfoViewer->BoxEndY + bottom_bar_offset - 6 , COL_INFOBAR_SHADOW_PLUS_0 , RADIUS_SMALL, CORNER_ALL);
|
||||
// ca bar
|
||||
frameBuffer->paintBox(g_InfoViewer->ChanInfoX + 11, g_InfoViewer->BoxEndY + 1, g_InfoViewer->BoxEndX - 11, g_InfoViewer->BoxEndY + bottom_bar_offset - 11, COL_INFOBAR_CASYSTEM_PLUS_0, RADIUS_SMALL, CORNER_ALL);
|
||||
// highlighed frame
|
||||
frameBuffer->paintBoxFrame(g_InfoViewer->ChanInfoX + 10, g_InfoViewer->BoxEndY, g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX - 2*10, bottom_bar_offset - 10, 1, COL_INFOBAR_CASYSTEM_PLUS_2, RADIUS_SMALL, CORNER_ALL);
|
||||
// framed ca bar
|
||||
if (cabar == NULL)
|
||||
cabar = new CComponentsShapeSquare(g_InfoViewer->ChanInfoX+11, g_InfoViewer->BoxEndY+1, ca_width-22 , bottom_bar_offset-11 , NULL, CC_SHADOW_ON, COL_INFOBAR_CASYSTEM_PLUS_2, COL_INFOBAR_CASYSTEM_PLUS_0);
|
||||
//cabar->setCorner(RADIUS_SMALL, CORNER_ALL);
|
||||
cabar->enableShadow(CC_SHADOW_ON, 3);
|
||||
cabar->setFrameThickness(2);
|
||||
|
||||
// cabar->paint(CC_SAVE_SCREEN_NO);
|
||||
}else{ //TODO: remove this part, cabar object can do this
|
||||
if (cabar == NULL)
|
||||
cabar = new CComponentsShapeSquare(g_InfoViewer->ChanInfoX, g_InfoViewer->BoxEndY, ca_width , bottom_bar_offset-11, NULL, CC_SHADOW_OFF, COL_INFOBAR_CASYSTEM_PLUS_2);
|
||||
//cabar->setCorner(RADIUS_SMALL, CORNER_ALL);
|
||||
cabar->disableShadow();
|
||||
cabar->setFrameThickness(2);
|
||||
cabar->setColorBody(COL_INFOBAR_CASYSTEM_PLUS_0);
|
||||
}
|
||||
else
|
||||
frameBuffer->paintBox(g_InfoViewer->ChanInfoX + 12 + (right*4), g_InfoViewer->BoxEndY + 2, g_InfoViewer->BoxEndX - 12 - (left*4), g_InfoViewer->BoxEndY + bottom_bar_offset - 12, COL_INFOBAR_CASYSTEM_PLUS_0);
|
||||
cabar->setFrameThickness(2);
|
||||
cabar->setCorner(RADIUS_SMALL, CORNER_ALL);
|
||||
cabar->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
else
|
||||
frameBuffer->paintBox(g_InfoViewer->ChanInfoX + (right*4), g_InfoViewer->BoxEndY, g_InfoViewer->BoxEndX - (left*4), g_InfoViewer->BoxEndY + bottom_bar_offset, COL_INFOBAR_CASYSTEM_PLUS_0);
|
||||
|
||||
if (!g_settings.casystem_dotmatrix) //don't show dotmatrix
|
||||
paintBoxRel(g_InfoViewer->ChanInfoX, g_InfoViewer->BoxEndY, ca_width , bottom_bar_offset, COL_INFOBAR_CASYSTEM_PLUS_0);
|
||||
#if 1
|
||||
if (!g_settings.infobar_casystem_dotmatrix) //don't show dotmatrix
|
||||
return;
|
||||
|
||||
if (left)
|
||||
@@ -887,9 +908,10 @@ void CInfoViewerBB::paintCA_bar(int left, int right)
|
||||
|
||||
for (int i = 0 + right; i < xcnt - left; i++) {
|
||||
for (int j = 0; j < ycnt; j++) {
|
||||
frameBuffer->paintBoxRel((g_InfoViewer->ChanInfoX + (g_settings.casystem_frame ? 14 : 2)) + i*4, g_InfoViewer->BoxEndY + (g_settings.casystem_frame ? 4 : 2) + j*4, 2, 2, COL_INFOBAR_PLUS_1);
|
||||
frameBuffer->paintBoxRel((g_InfoViewer->ChanInfoX + (g_settings.infobar_casystem_frame ? 14 : 2)) + i*4, g_InfoViewer->BoxEndY + (g_settings.infobar_casystem_frame ? 4 : 2) + j*4, 2, 2, COL_INFOBAR_PLUS_1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CInfoViewerBB::changePB()
|
||||
@@ -913,9 +935,25 @@ void CInfoViewerBB::reset_allScala()
|
||||
//lasthdd = lastsys = -1;
|
||||
}
|
||||
|
||||
void CInfoViewerBB::setBBOffset()
|
||||
void CInfoViewerBB::ResetModules()
|
||||
{
|
||||
bottom_bar_offset = (g_settings.casystem_display < 2) ? (g_settings.casystem_frame ? 36 : 22) : 0;
|
||||
if (hddscale){
|
||||
delete hddscale; hddscale = NULL;
|
||||
}
|
||||
if (sysscale){
|
||||
delete sysscale; sysscale = NULL;
|
||||
}
|
||||
if (foot){
|
||||
delete foot; foot = NULL;
|
||||
}
|
||||
if (cabar){
|
||||
delete cabar; cabar = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CInfoViewerBB::initBBOffset()
|
||||
{
|
||||
bottom_bar_offset = (g_settings.infobar_casystem_display < 2) ? (g_settings.infobar_casystem_frame ? 36 : 22) : 0;
|
||||
}
|
||||
|
||||
void* CInfoViewerBB::scrambledThread(void *arg)
|
||||
|
Reference in New Issue
Block a user