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