mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
cc_item.cpp/cc_detailsline.cpp: clean up and simplify fblayer init
use v_fbdata.push_back() for direct fill with contents, reduced effort
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
Classes for generic GUI-related components.
|
Classes for generic GUI-related components.
|
||||||
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
|
Copyright (C) 2012, 2013, 2018 Thilo Graf 'dbt'
|
||||||
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
|
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
@@ -102,36 +102,32 @@ void CComponentsDetailsLine::paint(bool do_save_bg)
|
|||||||
int y_mark_down = y_down-h_mark_down/2;
|
int y_mark_down = y_down-h_mark_down/2;
|
||||||
int dx_c = dl_w%2; //correction for odd values
|
int dx_c = dl_w%2; //correction for odd values
|
||||||
|
|
||||||
cc_fbdata_t fbdata[] =
|
|
||||||
{
|
|
||||||
/*buffered bg full width and height */
|
/*buffered bg full width and height */
|
||||||
{true, CC_FBDATA_TYPE_BGSCREEN, x, y_mark_top, width, y_mark_down-y_mark_top+h_mark_down+sw, 0, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BGSCREEN,x, y_mark_top, width, y_mark_down-y_mark_top+h_mark_down+sw, 0, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
/* vertical item mark | */
|
/* vertical item mark | */
|
||||||
{true, CC_FBDATA_TYPE_BOX, x+width-dl_w-sw, y_mark_top, dl_w, h_mark_top, col_body, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x+width-dl_w-sw, y_mark_top, dl_w, h_mark_top, col_body, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
{true, CC_FBDATA_TYPE_BOX, x+width-sw, y_mark_top+sw, sw, h_mark_top-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x+width-sw, y_mark_top+sw, sw, h_mark_top-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
{true, CC_FBDATA_TYPE_BOX, x+width-dl_w, y_mark_top+h_mark_top, dl_w, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x+width-dl_w, y_mark_top+h_mark_top, dl_w, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
/* horizontal item line - */
|
/* horizontal item line - */
|
||||||
{true, CC_FBDATA_TYPE_BOX, x, y-dl_w/2, width-dl_w-sw, dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x, y-dl_w/2, width-dl_w-sw, dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
{true, CC_FBDATA_TYPE_BOX, x+dl_w, y+dl_w/2+dx_c, width-2*dl_w-sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x+dl_w, y+dl_w/2+dx_c, width-2*dl_w-sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
/* vertical connect line [ */
|
/* vertical connect line [ */
|
||||||
{true, CC_FBDATA_TYPE_BOX, x, y+dl_w/2+dx_c, dl_w, y_down-y-dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x, y+dl_w/2+dx_c, dl_w, y_down-y-dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
{true, CC_FBDATA_TYPE_BOX, x+dl_w, y+dl_w/2+dx_c, sw, y_down-y-dl_w, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x+dl_w, y+dl_w/2+dx_c, sw, y_down-y-dl_w, col_shadow, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
/* horizontal info line - */
|
/* horizontal info line - */
|
||||||
{true, CC_FBDATA_TYPE_BOX, x, y_down-dl_w/2, width-dl_w-sw, dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x, y_down-dl_w/2, width-dl_w-sw, dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
{true, CC_FBDATA_TYPE_BOX, x+sw, y_down+dl_w/2+dx_c, width-dl_w-2*sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x+sw, y_down+dl_w/2+dx_c, width-dl_w-2*sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
/* vertical info mark | */
|
/* vertical info mark | */
|
||||||
{true, CC_FBDATA_TYPE_BOX, x+width-dl_w-sw, y_mark_down, dl_w, h_mark_down, col_body, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x+width-dl_w-sw, y_mark_down, dl_w, h_mark_down, col_body, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
{true, CC_FBDATA_TYPE_BOX, x+width-sw, y_mark_down+sw, sw, h_mark_down-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x+width-sw, y_mark_down+sw, sw, h_mark_down-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
{true, CC_FBDATA_TYPE_BOX, x+width-dl_w, y_mark_down+h_mark_down,dl_w, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, x+width-dl_w, y_mark_down+h_mark_down,dl_w, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
};
|
|
||||||
|
|
||||||
for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++)
|
|
||||||
v_fbdata.push_back(fbdata[i]);
|
|
||||||
}
|
}
|
||||||
paintFbItems(do_save_bg);
|
paintFbItems(do_save_bg);
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
Classes for generic GUI-related components.
|
Classes for generic GUI-related components.
|
||||||
Copyright (C) 2012-2016, Thilo Graf 'dbt'
|
Copyright (C) 2012-2018, Thilo Graf 'dbt'
|
||||||
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
|
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
@@ -162,56 +162,39 @@ void CComponentsItem::paintInit(bool do_save_bg)
|
|||||||
if (sh_bdx < 1)
|
if (sh_bdx < 1)
|
||||||
sh_bx = false;
|
sh_bx = false;
|
||||||
|
|
||||||
//init paint layers
|
//init fb layers
|
||||||
cc_fbdata_t fbdata[] =
|
|
||||||
{
|
|
||||||
//buffered bg
|
//buffered bg
|
||||||
{true, CC_FBDATA_TYPE_BGSCREEN, ix, iy, dx+sw, dy+sw, 0, 0, 0, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BGSCREEN, ix, iy, dx+sw, dy+sw, 0, 0, 0, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
//shadow corner bottom left
|
//shadow corner bottom left
|
||||||
{sh_cbl, CC_FBDATA_TYPE_SHADOW_BOX, sh_cbl_x, sh_cbl_y, sh_cdx, sh_cdy, col_shadow, box_rad, corner_type & CORNER_BOTTOM_LEFT, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({sh_cbl, CC_FBDATA_TYPE_SHADOW_BOX, sh_cbl_x, sh_cbl_y, sh_cdx, sh_cdy, col_shadow, box_rad, corner_type & CORNER_BOTTOM_LEFT, 0, NULL, NULL, NULL, false});
|
||||||
//clean up inside body
|
//clean up inside body
|
||||||
{sh_cbl, CC_FBDATA_TYPE_SHADOW_BOX, sh_cbl_x-sw+th, sh_cbl_y-sw, sh_cdx+sw, sh_cdy, col_shadow_clean, box_rad, corner_type & CORNER_BOTTOM_LEFT, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({sh_cbl, CC_FBDATA_TYPE_SHADOW_BOX, sh_cbl_x-sw+th, sh_cbl_y-sw, sh_cdx+sw, sh_cdy, col_shadow_clean, box_rad, corner_type & CORNER_BOTTOM_LEFT, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
//shadow bar bottom
|
//shadow bar bottom
|
||||||
{sh_bb, CC_FBDATA_TYPE_SHADOW_BOX, sh_bx, sh_by, sh_bdx, sw, col_shadow, 0, CORNER_NONE, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({sh_bb, CC_FBDATA_TYPE_SHADOW_BOX, sh_bx, sh_by, sh_bdx, sw, col_shadow, 0, CORNER_NONE, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
//shadow corner bottom right
|
//shadow corner bottom right
|
||||||
{sh_cbr, CC_FBDATA_TYPE_SHADOW_BOX, sh_cbr_x, sh_cbr_y, sh_cdx, sh_cdy, col_shadow, box_rad, corner_type & CORNER_BOTTOM_RIGHT, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({sh_cbr, CC_FBDATA_TYPE_SHADOW_BOX, sh_cbr_x, sh_cbr_y, sh_cdx, sh_cdy, col_shadow, box_rad, corner_type & CORNER_BOTTOM_RIGHT, 0, NULL, NULL, NULL, false});
|
||||||
//clean up inside body
|
//clean up inside body
|
||||||
{sh_cbr, CC_FBDATA_TYPE_SHADOW_BOX, sh_cbr_x-sw, sh_cbr_y-sw, sh_cdx, sh_cdy, col_shadow_clean, box_rad, corner_type & CORNER_BOTTOM_RIGHT, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({sh_cbr, CC_FBDATA_TYPE_SHADOW_BOX, sh_cbr_x-sw, sh_cbr_y-sw, sh_cdx, sh_cdy, col_shadow_clean, box_rad, corner_type & CORNER_BOTTOM_RIGHT, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
//shadow bar right
|
//shadow bar right
|
||||||
{sh_br, CC_FBDATA_TYPE_SHADOW_BOX, sh_rx, sh_ry, sw, sh_rdy, col_shadow, 0, CORNER_NONE, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({sh_br, CC_FBDATA_TYPE_SHADOW_BOX, sh_rx, sh_ry, sw, sh_rdy, col_shadow, 0, CORNER_NONE, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
//shadow corner top right
|
//shadow corner top right
|
||||||
{sh_ctr, CC_FBDATA_TYPE_SHADOW_BOX, sh_ctr_x, sh_ctr_y, sh_cdx, sh_cdy-sh_cdy_size_offset, col_shadow, box_rad, corner_type & CORNER_TOP_RIGHT, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({sh_ctr, CC_FBDATA_TYPE_SHADOW_BOX, sh_ctr_x, sh_ctr_y, sh_cdx, sh_cdy-sh_cdy_size_offset, col_shadow, box_rad, corner_type & CORNER_TOP_RIGHT, 0, NULL, NULL, NULL, false});
|
||||||
//clean up inside body
|
//clean up inside body
|
||||||
{sh_ctr, CC_FBDATA_TYPE_SHADOW_BOX, sh_ctr_x-sw, sh_ctr_y-sw+th, sh_cdx, sh_cdy-sh_cdy_size_offset+sw, col_shadow_clean, box_rad, corner_type & CORNER_TOP_RIGHT, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({sh_ctr, CC_FBDATA_TYPE_SHADOW_BOX, sh_ctr_x-sw, sh_ctr_y-sw+th, sh_cdx, sh_cdy-sh_cdy_size_offset+sw, col_shadow_clean, box_rad, corner_type & CORNER_TOP_RIGHT, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
//main box
|
//main box
|
||||||
{true, CC_FBDATA_TYPE_BOX, ix+th, iy+th, dx-2*th, dy-2*th, col_body, max(0,box_rad-th), corner_type, 0, NULL, NULL, NULL, false},
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_BOX, ix+th, iy+th, dx-2*th, dy-2*th, col_body, max(0,box_rad-th),corner_type, 0, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
//frame
|
//frame
|
||||||
{true, CC_FBDATA_TYPE_FRAME, ix, iy, dx, dy, col_frame_cur, box_rad, corner_type, th, NULL, NULL, NULL, false}
|
if (fr_thickness)
|
||||||
};
|
v_fbdata.push_back({true, CC_FBDATA_TYPE_FRAME, ix, iy, dx, dy, col_frame_cur, box_rad, corner_type, th, NULL, NULL, NULL, false});
|
||||||
|
|
||||||
for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) {
|
|
||||||
if ((fbdata[i].fbdata_type == CC_FBDATA_TYPE_FRAME) && !fr_thickness)
|
|
||||||
continue;
|
|
||||||
v_fbdata.push_back(fbdata[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//handle frame color for slected/not selected item
|
|
||||||
if (fr_thickness) {
|
|
||||||
for(size_t j =0; j< v_fbdata.size() ;j++) {
|
|
||||||
if (v_fbdata[j].fbdata_type == CC_FBDATA_TYPE_FRAME){
|
|
||||||
v_fbdata[j].color = col_frame_cur;
|
|
||||||
v_fbdata[j].frame_thickness = th;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dprintf(DEBUG_DEBUG, "\033[1;32m[CComponentsItem]\t[%s - %d], init and paint item type = %d [%s]...\033[0m\n", __func__, __LINE__, cc_item_type.id, cc_item_type.name.c_str());
|
dprintf(DEBUG_DEBUG, "\033[1;32m[CComponentsItem]\t[%s - %d], init and paint item type = %d [%s]...\033[0m\n", __func__, __LINE__, cc_item_type.id, cc_item_type.name.c_str());
|
||||||
paintFbItems(do_save_bg);
|
paintFbItems(do_save_bg);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user