Fixed '?' icons still appearing at times in ribbons
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4948 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
54c53d000e
commit
0efd96d8da
@ -142,7 +142,7 @@ void DynamicRibbonWidget::add()
|
||||
// ---- Determine number of rows and columns
|
||||
|
||||
// Find children size (and ratio)
|
||||
m_child_width = atoi(m_properties[PROP_CHILD_WIDTH].c_str());
|
||||
m_child_width = atoi(m_properties[PROP_CHILD_WIDTH].c_str());
|
||||
m_child_height = atoi(m_properties[PROP_CHILD_HEIGHT].c_str());
|
||||
|
||||
if (m_child_width <= 0 || m_child_height <= 0)
|
||||
@ -258,7 +258,7 @@ void DynamicRibbonWidget::setSubElements()
|
||||
// stretch the *texture* within the widget (and the widget has the right aspect ratio)
|
||||
// (Yeah, that's complicated, but screenshots are saved compressed horizontally so it's hard to be clean)
|
||||
IconButtonWidget* icon = new IconButtonWidget(IconButtonWidget::SCALE_MODE_STRETCH, false, true);
|
||||
icon->m_properties[PROP_ICON]="gui/main_help.png";
|
||||
icon->m_properties[PROP_ICON]="textures/transparence.png";
|
||||
|
||||
// set size to get proper ratio (as most textures are saved scaled down to 256x256)
|
||||
icon->m_properties[PROP_WIDTH] = m_properties[PROP_CHILD_WIDTH];
|
||||
@ -705,7 +705,7 @@ void DynamicRibbonWidget::updateItemDisplay()
|
||||
}
|
||||
else
|
||||
{
|
||||
icon->setImage( "/textures/transparence.png" );
|
||||
icon->setImage( "textures/transparence.png", IconButtonWidget::ICON_PATH_TYPE_RELATIVE );
|
||||
icon->m_properties[PROP_ID] = NO_ITEM_ID;
|
||||
}
|
||||
} // next column
|
||||
|
@ -186,9 +186,19 @@ void RibbonWidget::add()
|
||||
float image_h = (float)image->getSize().Height;
|
||||
float image_w = image_h*imageRatio;
|
||||
|
||||
// if button too high to fit, scale down
|
||||
// scale to fit (FIXME: calculate the right value directly...)
|
||||
float zoom = global_zoom;
|
||||
while (button_y + image_h*zoom + needed_space_under_button > h) zoom -= 0.01f;
|
||||
|
||||
if (button_y + image_h*zoom + needed_space_under_button > h)
|
||||
{
|
||||
// scale down
|
||||
while (button_y + image_h*zoom + needed_space_under_button > h) zoom -= 0.01f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// scale up
|
||||
while (button_y + image_h*zoom + needed_space_under_button < h) zoom += 0.01f;
|
||||
}
|
||||
|
||||
// ---- add bitmap button part
|
||||
// backup and restore position in case the same object is added multiple times (FIXME: unclean)
|
||||
|
Loading…
x
Reference in New Issue
Block a user