wid.setDefaultFont(fnt, int(fnt->getPointSize()));
int pw=0, ph=0;
+ int px, py, savex, savey;
if(!userw || !userh)
wid.calcPrefSize(&pw, &ph);
pw = props->getIntValue("width", pw);
ph = props->getIntValue("height", ph);
- int px = props->getIntValue("x", (screenw - pw) / 2);
- int py = props->getIntValue("y", (screenh - ph) / 2);
+ px = savex = props->getIntValue("x", (screenw - pw) / 2);
+ py = savey = props->getIntValue("y", (screenh - ph) / 2);
+
+ // Negative x/y coordinates are interpreted as distance from the top/right
+ // corner rather than bottom/left.
+ if (px < 0)
+ px = screenw - pw + px;
+ if (py < 0)
+ py = screenh - ph + py;
// Define "x", "y", "width" and/or "height" in the property tree if they
// are not specified in the configuration file.
_object = makeObject(props, screenw, screenh);
// Remove automatically generated properties, so the layout looks
- // the same next time around.
- if(!userx) props->removeChild("x");
- if(!usery) props->removeChild("y");
+ // the same next time around, or restore x and y to preserve negative coords.
+ if(userx)
+ props->setIntValue("x", savex);
+ else
+ props->removeChild("x");
+
+ if(usery)
+ props->setIntValue("y", savey);
+ else
+ props->removeChild("y");
+
if(!userw) props->removeChild("width");
if(!userh) props->removeChild("height");
i < value_nodes.size();
i++, j--)
entries[i] = strdup((char *)value_nodes[i]->getStringValue());
- puaComboBox * obj = new puaComboBox(x, y, x + width, y + height, entries,
+ puComboBox * obj = new puComboBox(x, y, x + width, y + height, entries,
props->getBoolValue("editable", false));
setupObject(obj, props);
setColor(obj, props, FOREGROUND|LABEL);
int slider_width = props->getIntValue("slider", parentHeight);
int wrap = props->getBoolValue("wrap", true);
if (slider_width==0) slider_width=20;
- puaLargeInput * obj = new puaLargeInput(x, y,
+ puLargeInput * obj = new puLargeInput(x, y,
x+width, x+height, 2, slider_width, wrap);
if (props->hasValue("editable")) {
i < value_nodes.size();
i++, j--)
entries[i] = strdup((char *)value_nodes[i]->getName());
- puaSelectBox * obj =
- new puaSelectBox(x, y, x + width, y + height, entries);
+ puSelectBox * obj =
+ new puSelectBox(x, y, x + width, y + height, entries);
setupObject(obj, props);
setColor(obj, props, FOREGROUND|LABEL);
return obj;