mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-01 01:41:23 +02:00
CProgressBar: add member paintShapes()
paintShapes() replaces paintBoxRel() TODO: paint v-lines with CComponents
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
#include <neutrino.h>
|
#include <neutrino.h>
|
||||||
|
|
||||||
#include "cc_item_progressbar.h"
|
#include "cc_item_progressbar.h"
|
||||||
|
#include "cc_item_shapes.h"
|
||||||
#define ITEMW 4
|
#define ITEMW 4
|
||||||
#define POINT 2
|
#define POINT 2
|
||||||
|
|
||||||
@@ -137,16 +137,23 @@ void CProgressBar::initDimensions()
|
|||||||
col_frame = pb_active_col;
|
col_frame = pb_active_col;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CProgressBar::paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_t &col)
|
||||||
|
{
|
||||||
|
CComponentsShapeSquare shape(shx, shy, shw, shh, false);
|
||||||
|
shape.setColorBody(col);
|
||||||
|
shape.paint(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CProgressBar::paintSimple()
|
void CProgressBar::paintSimple()
|
||||||
{
|
{
|
||||||
// progress value
|
// progress value
|
||||||
if (pb_active_width != pb_last_width){ //TODO: use shape cc-item
|
if (pb_active_width != pb_last_width){
|
||||||
frameBuffer->paintBoxRel(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar
|
paintShapes(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar
|
||||||
frameBuffer->paintBoxRel(pb_start_x_passive, pb_y, pb_passive_width, pb_height, pb_passive_col); // passive bar
|
paintShapes(pb_start_x_passive, pb_y, pb_passive_width, pb_height, pb_passive_col); // passive bar
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pb_paint_zero && pb_value == 0) //TODO: use shape cc-item
|
if (pb_paint_zero && pb_value == 0) //TODO: use shape cc-item, not available for lines yet
|
||||||
frameBuffer->paintLine(pb_x , pb_y, pb_x+width-3, pb_y+height-3, pb_active_col); // zero line
|
frameBuffer->paintLine(pb_x , pb_y, pb_x+width-3, pb_y+height-3, pb_active_col); // zero line
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,8 +210,11 @@ void CProgressBar::paintAdvanced()
|
|||||||
else
|
else
|
||||||
rgb = RED + (diff << 8); // adding green
|
rgb = RED + (diff << 8); // adding green
|
||||||
color = make16color(rgb);
|
color = make16color(rgb);
|
||||||
for (j = 0; j < hcnt; j++) //TODO: use shape cc-item
|
for (j = 0; j < hcnt; j++) {
|
||||||
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, color);
|
int sh_x = pb_x + i * itemw;
|
||||||
|
int sh_y = py + j * itemh;
|
||||||
|
paintShapes(sh_x, sh_y, pointx, pointy, color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
step = yw - rd - 1;
|
step = yw - rd - 1;
|
||||||
if (step < 1)
|
if (step < 1)
|
||||||
@@ -216,8 +226,11 @@ void CProgressBar::paintAdvanced()
|
|||||||
else
|
else
|
||||||
rgb = YELLOW - (diff << 16); // removing red
|
rgb = YELLOW - (diff << 16); // removing red
|
||||||
color = make16color(rgb);
|
color = make16color(rgb);
|
||||||
for (j = 0; j < hcnt; j++) //TODO: use shape cc-item
|
for (j = 0; j < hcnt; j++) {
|
||||||
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, color);
|
int sh_x = pb_x + i * itemw;
|
||||||
|
int sh_y = py + j * itemh;
|
||||||
|
paintShapes(sh_x, sh_y, pointx, pointy, color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
off = diff;
|
off = diff;
|
||||||
b = 0;
|
b = 0;
|
||||||
@@ -231,13 +244,19 @@ void CProgressBar::paintAdvanced()
|
|||||||
else
|
else
|
||||||
rgb = YELLOW - (diff << 16); // removing red
|
rgb = YELLOW - (diff << 16); // removing red
|
||||||
color = make16color(rgb);
|
color = make16color(rgb);
|
||||||
for (j = 0; j < hcnt; j++) //TODO: use shape cc-item
|
for (j = 0; j < hcnt; j++) {
|
||||||
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, color);
|
int sh_x = pb_x + i * itemw;
|
||||||
|
int sh_y = py + j * itemh;
|
||||||
|
paintShapes(sh_x, sh_y, pointx, pointy, color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i = maxi; i < total; i++) {
|
for(i = maxi; i < total; i++) {
|
||||||
for (j = 0; j < hcnt; j++) //TODO: use shape cc-item
|
for (j = 0; j < hcnt; j++) {//TODO: use shape cc-item
|
||||||
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, pb_passive_col); //fill passive
|
int sh_x = pb_x + i * itemw;
|
||||||
|
int sh_y = py + j * itemh;
|
||||||
|
paintShapes(sh_x, sh_y, pointx, pointy, pb_passive_col); //fill passive
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -91,6 +91,8 @@ class CProgressBar : public CComponentsItem
|
|||||||
void paintSimple();
|
void paintSimple();
|
||||||
///paint version of progressbar with color and advanced display modifications
|
///paint version of progressbar with color and advanced display modifications
|
||||||
void paintAdvanced();
|
void paintAdvanced();
|
||||||
|
///painting of activ/passive bars via shape object
|
||||||
|
void paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_t &col);
|
||||||
|
|
||||||
void initDimensions();
|
void initDimensions();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user