Merge branch 'check/next-cc'

again: it compiles, but is not really tested...

Conflicts:
	acinclude.m4
	src/driver/volume.cpp
	src/gui/infoviewer.cpp
	src/gui/osd_setup.cpp
	src/gui/start_wizard.cpp
	src/zapit/src/getservices.cpp
This commit is contained in:
Stefan Seyfried
2013-07-06 19:01:15 +02:00
91 changed files with 5546 additions and 562 deletions

View File

@@ -242,6 +242,8 @@ class CComponentsItem : public CComponents
///sets pointer to the form object in which this item is embedded.
virtual void setParent(CComponentsItem *parent){cc_parent = parent;};
///returns pointer to the form object in which this item is embedded.
virtual CComponentsItem * getParent(){return cc_parent;};
///abstract: paint item, arg: do_save_bg see paintInit() above
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0;
@@ -265,7 +267,8 @@ class CComponentsItem : public CComponents
///get current index of item, see also attribut cc_item_index
virtual int getIndex(){return cc_item_index;};
///set index to item, see also attribut cc_item_index
///set an index to item, see also attribut cc_item_index.
///To generate an index, use genIndex()
virtual void setIndex(const int& index){cc_item_index = index;};
};

View File

@@ -143,11 +143,7 @@ void CComponentsForm::addCCItem(CComponentsItem* cc_Item)
#endif
//assign item index
int count = v_cc_items.size();
char buf[64];
snprintf(buf, sizeof(buf), "%d%d", cc_item_index, count);
buf[63] = '\0';
int new_index = atoi(buf);
int new_index = genIndex();
cc_Item->setIndex(new_index);
#ifdef DEBUG_CC
printf(" %s-%d parent index = %d, assigned index ======> %d\n", __FUNCTION__, __LINE__, cc_item_index, new_index);
@@ -177,6 +173,15 @@ bool CComponentsForm::isAdded(CComponentsItem* cc_item)
return ret;
}
int CComponentsForm::genIndex()
{
int count = v_cc_items.size();
char buf[64];
snprintf(buf, sizeof(buf), "%d%d", cc_item_index, count);
buf[63] = '\0';
int ret = atoi(buf);
return ret;
}
CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id)
{
@@ -188,9 +193,13 @@ CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id)
void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item)
{
if (!v_cc_items.empty()){
if (v_cc_items[cc_item_id]){
delete v_cc_items[cc_item_id];
v_cc_items[cc_item_id] = NULL;
CComponentsItem* old_Item = v_cc_items[cc_item_id];
if (old_Item){
CComponentsItem * old_parent = old_Item->getParent();
new_cc_Item->setParent(old_parent);
new_cc_Item->setIndex(old_parent->getIndex());
delete old_Item;
old_Item = NULL;
v_cc_items[cc_item_id] = new_cc_Item;
}
}
@@ -217,12 +226,17 @@ void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_I
}
if (v_cc_items.empty()){
v_cc_items.push_back(cc_Item);
addCCItem(cc_Item);
#ifdef DEBUG_CC
printf("[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __FUNCTION__);
#endif
}else
}else{
v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item);
cc_Item->setParent(this);
//assign item index
int index = genIndex();
cc_Item->setIndex(index);
}
}
void CComponentsForm::removeCCItem(const uint& cc_item_id)
@@ -321,7 +335,8 @@ void CComponentsForm::paintCCItems()
int w_diff = right_item - right_frm;
int new_w = w_item - w_diff;
if (right_item > right_frm){
printf("[CComponentsForm] %s: item %d width is too large, definied width=%d, possible width=%d \n", __FUNCTION__, i, w_item, new_w);
printf("[CComponentsForm] %s: [form: %d] [item-index %d] [type=%d] width is too large, definied width=%d, possible width=%d \n",
__FUNCTION__, cc_item_index, cc_item->getIndex(), cc_item->getItemType(), w_item, new_w);
cc_item->setWidth(new_w);
}
@@ -331,7 +346,8 @@ void CComponentsForm::paintCCItems()
int h_diff = bottom_item - bottom_frm;
int new_h = h_item - h_diff;
if (bottom_item > bottom_frm){
printf("[CComponentsForm] %s: item %d height is too large, definied height=%d, possible height=%d \n", __FUNCTION__, i, h_item, new_h);
printf("[CComponentsForm] %s: [form: %d] [item-index %d] [type=%d] height is too large, definied height=%d, possible height=%d \n",
__FUNCTION__, cc_item_index, cc_item->getIndex(), cc_item->getItemType(), h_item, new_h);
cc_item->setHeight(new_h);
}

View File

@@ -41,6 +41,8 @@ class CComponentsForm : public CComponentsItem
std::vector<CComponentsItem*> v_cc_items;
void initVarForm();
void paintForm(bool do_save_bg);
///generates next possible index for an item, see also cc_item_index, getIndex(), setIndex()
int genIndex();
int append_h_offset;
int append_v_offset;
@@ -213,7 +215,7 @@ class CComponentsWindow : public CComponentsForm
///object: body object, this is the container for all needed items, to add with addWindowItem()
CComponentsForm * ccw_body;
///object: footer object, to get access to header properties see also getFooterObject(
CComponentsForm * ccw_footer;
CComponentsFooter * ccw_footer;
///property: caption in header, see also getHeaderObject()
std::string ccw_caption;
///property: icon name in header, see also getHeaderObject()
@@ -295,9 +297,10 @@ class CComponentsWindow : public CComponentsForm
CComponentsForm* getBodyObject(){return ccw_body;};
///returns a pointer to the internal footer object, use this to get access to footer properities
CComponentsForm* getFooterObject(){return ccw_footer;};
CComponentsFooter* getFooterObject(){return ccw_footer;};
int getStartY(); //y value for start of the area below header
///refresh position and dimension and reinitialize elemenatary properties
void Refresh(){initCCWItems();};
};
#endif

View File

@@ -69,12 +69,10 @@ void CComponentsFrmClock::initVarClock()
cc_item_type = CC_ITEMTYPE_FRM_CLOCK;
corner_rad = RADIUS_SMALL;
cl_font_type = SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO;
cl_font = NULL;
cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO];
cl_col_text = COL_MENUCONTENT;
cl_format_str = "%H:%M";
cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER;
// cl_force_segment_paint = false;
cl_thread = 0;
cl_interval = 1;
@@ -112,8 +110,6 @@ void CComponentsFrmClock::initCCLockItems()
initTimeString();
string s_time = cl_timestr;
cl_font = g_Font[cl_font_type];
//get minimal required height, width from raw text
int min_text_w = cl_font->getRenderWidth(s_time, true);;
int min_text_h = cl_font->getHeight();
@@ -254,6 +250,9 @@ void* CComponentsFrmClock::initClockThread(void *arg)
sleep(clock->cl_interval);
if (clock->paintClock) {
//refresh item property values
clock->refresh();
//paint segements, but wihtout saved backgrounds
clock->paint(CC_SAVE_SCREEN_NO);
count = time(0);

View File

@@ -57,12 +57,11 @@ class CComponentsFrmClock : public CComponentsForm
///raw time chars
char cl_timestr[20];
//TODO: please add comments!
bool paintClock;
bool activeClock;
///font
int cl_font_type;
///fontrenderer object
///object: font render object
Font *cl_font;
///text color
int cl_col_text;
@@ -88,7 +87,7 @@ class CComponentsFrmClock : public CComponentsForm
~CComponentsFrmClock();
///set font type for segments
void setClockFontType(const int& font_type){cl_font_type = font_type;};
void setClockFont(Font *font){cl_font = font;};
///set text color
void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;};

View File

@@ -51,8 +51,7 @@ CComponentsWindow::CComponentsWindow(const std::string& caption, const char* ico
ccw_caption = caption;
ccw_icon_name = iconname;
initHeader();
initBody();
initCCWItems();
}
CComponentsWindow::CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname)
@@ -211,14 +210,6 @@ void CComponentsWindow::addWindowItem(CComponentsItem* cc_Item)
ccw_body->addCCItem(cc_Item);
}
int CComponentsWindow::getStartY()
{
if (ccw_head)
return ccw_head->getHeight();
return 0;
}
void CComponentsWindow::initCCWItems()
{
#ifdef DEBUG_CC