From f27d7b2340ea1f53239965325ed1cd455551f1ec Mon Sep 17 00:00:00 2001 From: mfranz Date: Mon, 26 Mar 2007 15:17:38 +0000 Subject: [PATCH] layout-props.cxx: hrule/vrule shall be accepted as widgets even if they have no children (in which case they default to 1px thickness & stretch). This allows to just write instead of . One can still use 3, of course. layout.cxx: drop silly do??Box calls for hrule/vrule (yes, I wrote that :-) --- src/GUI/layout-props.cxx | 15 +++++++++++---- src/GUI/layout.cxx | 5 +---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/GUI/layout-props.cxx b/src/GUI/layout-props.cxx index b2fe085da..8533c17c8 100644 --- a/src/GUI/layout-props.cxx +++ b/src/GUI/layout-props.cxx @@ -42,11 +42,16 @@ LayoutWidget LayoutWidget::parent() int LayoutWidget::nChildren() { - // Hack: assume that any non-leaf nodes are widgets... + // Hack: assume that any non-leaf nodes but "hrule" and "vrule" + // are widgets... int n = 0; - for(int i=0; i<_prop->nChildren(); i++) - if(_prop->getChild(i)->nChildren() != 0) + for(int i=0; i<_prop->nChildren(); i++) { + SGPropertyNode* p = _prop->getChild(i); + const char* name = p->getName(); + if(p->nChildren() != 0 || !strcmp(name, "hrule") + || !strcmp(name, "vrule")) n++; + } return n; } @@ -57,7 +62,9 @@ LayoutWidget LayoutWidget::getChild(int idx) int n = 0; for(int i=0; i<_prop->nChildren(); i++) { SGPropertyNode* p = _prop->getChild(i); - if(p->nChildren() != 0) { + const char* name = p->getName(); + if(p->nChildren() != 0 || !strcmp(name, "hrule") + || !strcmp(name, "vrule")) { if(idx == n) return LayoutWidget(p); n++; } diff --git a/src/GUI/layout.cxx b/src/GUI/layout.cxx index 730142d04..8d3aae86f 100644 --- a/src/GUI/layout.cxx +++ b/src/GUI/layout.cxx @@ -185,10 +185,7 @@ void LayoutWidget::layout(int x, int y, int w, int h) if (eq(layout, "hbox" )) doHVBox(true, false); else if(eq(layout, "vbox" )) doHVBox(true, true); else if(eq(layout, "table")) doTable(true); - } else if(isType("hrule")) - doHVBox(true, false); - else if(isType("vrule")) - doHVBox(true, true); + } } // Convention: the "A" cooridinate refers to the major axis of the