Fix sprite properties dialog size when jguiscale() = 1 (problem referenced in issue #197)

This commit is contained in:
David Capello 2014-05-02 20:19:43 -03:00
parent a445ec4b07
commit cfa061e014

View File

@ -406,6 +406,15 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
const char* maxheight = elem->Attribute("maxheight");
const char* childspacing = elem->Attribute("childspacing");
if (width) {
if (!minwidth) minwidth = width;
if (!maxwidth) maxwidth = width;
}
if (height) {
if (!minheight) minheight = height;
if (!maxheight) maxheight = height;
}
if (id != NULL)
widget->setId(id);
@ -433,20 +442,20 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
widget->noBorderNoChildSpacing();
if (childspacing)
widget->child_spacing = ustrtol(childspacing, NULL, 10);
widget->child_spacing = strtol(childspacing, NULL, 10);
if (width || minwidth ||
height || minheight) {
int w = (width || minwidth) ? ustrtol(width ? width: minwidth, NULL, 10): 0;
int h = (height || minheight) ? ustrtol(height ? height: minheight, NULL, 10): 0;
widget->setMinSize(gfx::Size(w*jguiscale(), h*jguiscale()));
gfx::Size reqSize = widget->getPreferredSize();
if (minwidth || minheight) {
int w = (minwidth ? jguiscale()*strtol(minwidth, NULL, 10): reqSize.w);
int h = (minheight ? jguiscale()*strtol(minheight, NULL, 10): reqSize.h);
widget->setMinSize(gfx::Size(w, h));
}
if (width || maxwidth ||
height || maxheight) {
int w = (width || maxwidth) ? strtol(width ? width: maxwidth, NULL, 10): INT_MAX;
int h = (height || maxheight) ? strtol(height ? height: maxheight, NULL, 10): INT_MAX;
widget->setMaxSize(gfx::Size(w*jguiscale(), h*jguiscale()));
if (maxwidth || maxheight) {
int w = (maxwidth ? jguiscale()*strtol(maxwidth, NULL, 10): INT_MAX);
int h = (maxheight ? jguiscale()*strtol(maxheight, NULL, 10): INT_MAX);
widget->setMaxSize(gfx::Size(w, h));
}
if (!root)