mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 00:11:08 +02:00
CComponentsInfoBox: save/restore screen
- Own save/restore screen routine
- Shadow can be switched off
- Small fixes
Origin commit data
------------------
Branch: ni/coolstream
Commit: 1a654403cc
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2012-07-20 (Fri, 20 Jul 2012)
Origin message was:
------------------
* CComponentsInfoBox: save/restore screen
- Own save/restore screen routine
- Shadow can be switched off
- Small fixes
------------------
This commit was generated by Migit
This commit is contained in:
@@ -52,17 +52,17 @@ CComponents::~CComponents()
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
//paint framebuffer stuff and fill buffer
|
||||
void CComponents::paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg)
|
||||
{
|
||||
for(int i=0; i< items_count ;i++){
|
||||
if (do_save_bg){
|
||||
fbdata[i].pixbuf = new fb_pixel_t[fbdata[i].dx * fbdata[i].dy];
|
||||
frameBuffer->SaveScreen(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].pixbuf);
|
||||
}
|
||||
int i;
|
||||
for(i=0; i< items_count ;i++){
|
||||
if (do_save_bg)
|
||||
fbdata[i].pixbuf = saveScreen(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy);
|
||||
v_screen_val.push_back(fbdata[i]);
|
||||
}
|
||||
|
||||
for(i=0; i< items_count ;i++){
|
||||
if (fbdata[i].is_frame)
|
||||
frameBuffer->paintBoxFrame(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].frame_thickness, fbdata[i].color, fbdata[i].r);
|
||||
else
|
||||
@@ -70,6 +70,14 @@ void CComponents::paintFbItems(struct comp_fbdata_t * fbdata, const int items_co
|
||||
}
|
||||
}
|
||||
|
||||
//screen area save
|
||||
inline fb_pixel_t* CComponents::saveScreen(int ax, int ay, int dx, int dy)
|
||||
{
|
||||
fb_pixel_t* pixbuf = new fb_pixel_t[dx * dy];
|
||||
frameBuffer->SaveScreen(ax, ay, dx, dy, pixbuf);
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
//restore screen
|
||||
inline void CComponents::restore()
|
||||
{
|
||||
@@ -184,7 +192,7 @@ void CComponentsDetailLine::hide()
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
//sub class CComponentsInfoBox
|
||||
CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int h, const int w, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow, bool has_shadow)
|
||||
CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int h, const int w, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
@@ -196,6 +204,8 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i
|
||||
col_body = color_body;
|
||||
col_shadow = color_shadow;
|
||||
fr_thickness = 2;
|
||||
bg_saved = false;
|
||||
v_infobox_val.clear();
|
||||
}
|
||||
|
||||
#define INFOBOX_ITEMS_COUNT 3
|
||||
@@ -207,11 +217,40 @@ void CComponentsInfoBox::paint(bool do_save_bg)
|
||||
comp_fbdata_t fbdata[INFOBOX_ITEMS_COUNT] =
|
||||
{
|
||||
{x+SHADOW_OFFSET, y+SHADOW_OFFSET, width, height, col_shadow, rad, NULL, NULL, false, 0},
|
||||
{x, y, width, height, col_frame, rad, NULL, NULL, true, fr_thickness},
|
||||
{x, y, width, height, col_frame, rad, NULL, NULL, false, 0},
|
||||
{x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness, col_body, rad, NULL, NULL, false, 0},
|
||||
};
|
||||
|
||||
paintFbItems(fbdata, INFOBOX_ITEMS_COUNT, do_save_bg);
|
||||
int start = (shadow) ? 0 : 1;
|
||||
if (do_save_bg) {
|
||||
if (!bg_saved) {
|
||||
v_infobox_val.clear();
|
||||
for(int i = start; i < INFOBOX_ITEMS_COUNT; i++) {
|
||||
fbdata[i].pixbuf = saveScreen(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy);
|
||||
v_infobox_val.push_back(fbdata[i]);
|
||||
fbdata[i].pixbuf = NULL;
|
||||
}
|
||||
bg_saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
paintFbItems((comp_fbdata_t*)&fbdata[start], INFOBOX_ITEMS_COUNT - start, false);
|
||||
}
|
||||
|
||||
//restore infobox
|
||||
void CComponentsInfoBox::restore(bool clear_)
|
||||
{
|
||||
if (!v_infobox_val.empty()) {
|
||||
for(size_t i =0; i< v_infobox_val.size() ;i++) {
|
||||
if (v_infobox_val[i].pixbuf != NULL) {
|
||||
frameBuffer->RestoreScreen(v_infobox_val[i].x, v_infobox_val[i].y, v_infobox_val[i].dx, v_infobox_val[i].dy, v_infobox_val[i].pixbuf);
|
||||
if (clear_)
|
||||
delete[] v_infobox_val[i].pixbuf;
|
||||
}
|
||||
}
|
||||
if (clear_)
|
||||
v_infobox_val.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsInfoBox::hide()
|
||||
@@ -231,4 +270,3 @@ void CComponentsInfoBox::hide()
|
||||
col_shadow = c_tmp2;
|
||||
col_frame = c_tmp3;
|
||||
}
|
||||
|
||||
|
@@ -54,6 +54,7 @@ class CComponents
|
||||
std::vector<comp_fbdata_t> v_screen_val;
|
||||
|
||||
void paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg = true);
|
||||
fb_pixel_t* saveScreen(int ax, int ay, int dx, int dy);
|
||||
void clear();
|
||||
|
||||
public:
|
||||
@@ -92,14 +93,16 @@ class CComponentsInfoBox : public CComponents
|
||||
int rad,fr_thickness;
|
||||
bool shadow;
|
||||
fb_pixel_t col_frame, col_body, col_shadow;
|
||||
bool bg_saved;
|
||||
std::vector<comp_fbdata_t> v_infobox_val;
|
||||
|
||||
public:
|
||||
CComponentsInfoBox( const int x_pos, const int y_pos, const int h, const int w,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENTDARK_PLUS_0,fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0,
|
||||
bool has_shadow = true);
|
||||
CComponentsInfoBox( const int x_pos, const int y_pos, const int h, const int w, bool has_shadow = true,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENTDARK_PLUS_0,fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
void paint(bool do_save_bg = true);
|
||||
void hide();
|
||||
void restore(bool clear_);
|
||||
void setColor(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;};
|
||||
};
|
||||
|
||||
|
@@ -1049,7 +1049,7 @@ void CMenuWidget::paintHint(int pos)
|
||||
int rad = RADIUS_LARGE;
|
||||
|
||||
int xpos = x - ConnectLineBox_Width;
|
||||
int ypos2 = y + height + rad + SHADOW_OFFSET;
|
||||
int ypos2 = y + height + rad + SHADOW_OFFSET + 2;
|
||||
int iwidth = width+sb_width;
|
||||
|
||||
if (hint_painted) {
|
||||
@@ -1058,7 +1058,8 @@ void CMenuWidget::paintHint(int pos)
|
||||
details_line->restore();
|
||||
/* clear info box */
|
||||
if (info_box != NULL)
|
||||
pos == -1 ? info_box->hide() : info_box->restore();
|
||||
if (pos == -1)
|
||||
info_box->restore(true);
|
||||
hint_painted = false;
|
||||
}
|
||||
if (pos < 0)
|
||||
@@ -1069,7 +1070,7 @@ printf("paintHint: icon %s text %s\n", item->hintIcon.c_str(), g_Locale->getText
|
||||
|
||||
if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) {
|
||||
if (info_box != NULL)
|
||||
info_box->hide();
|
||||
info_box->restore(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1080,7 +1081,7 @@ printf("paintHint: icon %s text %s\n", item->hintIcon.c_str(), g_Locale->getText
|
||||
//details line
|
||||
int ypos1 = item->getYPosition();
|
||||
int ypos1a = ypos1 + (iheight/2)-2;
|
||||
int ypos2a = ypos2 + (hint_height/2);
|
||||
int ypos2a = ypos2 + (hint_height/2)-2;
|
||||
int markh = hint_height > rad*2 ? hint_height - rad*2 : hint_height;
|
||||
int imarkh = iheight/2+1;
|
||||
|
||||
|
Reference in New Issue
Block a user