mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
CProgressBar/CVolumeBar: fix position of active/passive bar
Assign real position values to progressbar if is bound (embedded) in a form. This is dependently from its own parent status. Status of cc_parent==NULL means, it's not bound and without parent form so we use x/y, otherwise we use real values stored by cc_xr/cc_yr. Values in cc_xr/cc_yr and cc_parent were assigned with addCCItem(). Signed-off-by: Michael Liebmann <tuxcode.bbg@gmail.com>
This commit is contained in:
@@ -112,9 +112,10 @@ void CProgressBar::initDimensions()
|
|||||||
if (pb_value > pb_max_value)
|
if (pb_value > pb_max_value)
|
||||||
pb_max_value = pb_value;
|
pb_max_value = pb_value;
|
||||||
|
|
||||||
// start positions x/y active bar
|
//assign start positions x/y active bar
|
||||||
pb_x = (cc_item_xr > -1 ? cc_item_xr : x) + fr_thickness;
|
//NOTE: real values are only reqiured, if we paint active/passive bar with own render methodes or not embedded cc-items
|
||||||
pb_y = (cc_item_yr > -1 ? cc_item_yr : y) + fr_thickness;
|
pb_x = (cc_parent ? cc_xr : x) + fr_thickness;
|
||||||
|
pb_y = (cc_parent ? cc_yr : y) + fr_thickness;
|
||||||
|
|
||||||
// width for active bar with current value
|
// width for active bar with current value
|
||||||
pb_active_width = max(0, pb_last_width);
|
pb_active_width = max(0, pb_last_width);
|
||||||
@@ -140,12 +141,12 @@ void CProgressBar::initDimensions()
|
|||||||
void CProgressBar::paintSimple()
|
void CProgressBar::paintSimple()
|
||||||
{
|
{
|
||||||
// progress value
|
// progress value
|
||||||
if (pb_active_width != pb_last_width){
|
if (pb_active_width != pb_last_width){ //TODO: use shape cc-item
|
||||||
frameBuffer->paintBoxRel(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar
|
frameBuffer->paintBoxRel(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
|
frameBuffer->paintBoxRel(pb_start_x_passive, pb_y, pb_passive_width, pb_height, pb_passive_col); // passive bar
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pb_paint_zero && pb_value == 0)
|
if (pb_paint_zero && pb_value == 0) //TODO: use shape cc-item
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +203,7 @@ 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++)
|
for (j = 0; j < hcnt; j++) //TODO: use shape cc-item
|
||||||
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, color);
|
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, color);
|
||||||
}
|
}
|
||||||
step = yw - rd - 1;
|
step = yw - rd - 1;
|
||||||
@@ -215,7 +216,7 @@ 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++)
|
for (j = 0; j < hcnt; j++) //TODO: use shape cc-item
|
||||||
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, color);
|
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, color);
|
||||||
}
|
}
|
||||||
off = diff;
|
off = diff;
|
||||||
@@ -230,12 +231,12 @@ 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++)
|
for (j = 0; j < hcnt; j++) //TODO: use shape cc-item
|
||||||
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, color);
|
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i = maxi; i < total; i++) {
|
for(i = maxi; i < total; i++) {
|
||||||
for (j = 0; j < hcnt; j++)
|
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
|
frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, pb_passive_col); //fill passive
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -231,10 +231,23 @@ void CVolumeBar::paintVolumeBarDigit()
|
|||||||
CTextBox* ctb = vb_digit->getCTextBoxObject();
|
CTextBox* ctb = vb_digit->getCTextBoxObject();
|
||||||
if (ctb)
|
if (ctb)
|
||||||
ctb->setFontUseDigitHeight();
|
ctb->setFontUseDigitHeight();
|
||||||
|
|
||||||
|
// backup original x&y pos
|
||||||
|
int _dx = vb_digit->getXPos();
|
||||||
|
int _dy = vb_digit->getYPos();
|
||||||
|
|
||||||
|
// get real x&y pos
|
||||||
int dx = vb_digit->getRealXPos();
|
int dx = vb_digit->getRealXPos();
|
||||||
int dy = vb_digit->getRealYPos();
|
int dy = vb_digit->getRealYPos();
|
||||||
|
|
||||||
|
// set real x&y pos
|
||||||
vb_digit->setDimensionsAll(dx, dy, digit_w, height);
|
vb_digit->setDimensionsAll(dx, dy, digit_w, height);
|
||||||
|
|
||||||
|
// paint digit
|
||||||
vb_digit->paint(CC_SAVE_SCREEN_NO);
|
vb_digit->paint(CC_SAVE_SCREEN_NO);
|
||||||
|
|
||||||
|
// restore original x&y pos
|
||||||
|
vb_digit->setDimensionsAll(_dx, _dy, digit_w, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user