CComponentsForm: fix fitting of item on the right and bottom edges

Frame of form was overpainted by item,
small whitespace fixes


Origin commit data
------------------
Branch: ni/coolstream
Commit: 5cb7d66993
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-08-28 (Wed, 28 Aug 2013)



------------------
This commit was generated by Migit
This commit is contained in:
2013-08-28 20:53:11 +02:00
parent 53bb6a12d4
commit cc799a6055

View File

@@ -95,7 +95,7 @@ void CComponentsForm::clearCCItems()
#ifdef DEBUG_CC
printf(" [CComponentsForm] %s... delete form cc-item %d of %d (type=%d)\n", __FUNCTION__, i+1, v_cc_items.size(), v_cc_items[i]->getItemType());
#endif
delete v_cc_items[i];
delete v_cc_items[i];
v_cc_items[i] = NULL;
}
}
@@ -309,10 +309,10 @@ void CComponentsForm::paintCCItems()
cc_item->setRealXPos(auto_x + xpos + 1);
auto_x += w_item;
}
else{
else{
cc_item->setRealXPos(this_x + xpos);
auto_x = (cc_item->getRealXPos() + w_item);
}
}
//set required y-position to item
if (ypos == CC_APPEND){
@@ -320,17 +320,17 @@ void CComponentsForm::paintCCItems()
cc_item->setRealYPos(auto_y + ypos + 1);
auto_y += h_item;
}
else{
else{
cc_item->setRealYPos(this_y + ypos);
auto_y = (cc_item->getRealYPos() + h_item);
}
}
//These steps check whether the element can be painted into the container.
//These steps check whether the element can be painted into the container.
//Is it too wide or too high, it will be shortened and displayed in the log.
//This should be avoid!
//checkwidth and adapt if required
int right_frm = (cc_parent ? cc_xr : x) + width - 2*fr_thickness;
//checkwidth and adapt if required
int right_frm = (cc_parent ? cc_xr : x) + width - fr_thickness;
int right_item = cc_item->getRealXPos() + w_item;
int w_diff = right_item - right_frm;
int new_w = w_item - w_diff;
@@ -341,7 +341,7 @@ void CComponentsForm::paintCCItems()
}
//check height and adapt if required
int bottom_frm = (cc_parent ? cc_yr : y) + height - 2*fr_thickness;
int bottom_frm = (cc_parent ? cc_yr : y) + height - fr_thickness;
int bottom_item = cc_item->getRealYPos() + h_item;
int h_diff = bottom_item - bottom_frm;
int new_h = h_item - h_diff;