From: mfranz Date: Fri, 21 Oct 2005 17:47:48 +0000 (+0000) Subject: add support for a property, which hides whole XML groups (widgets X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=58179758af3a5a6e4875bdc40fd35c05481d2413;p=flightgear.git add support for a property, which hides whole XML groups (widgets or data blocks) from layouter and dialog creator. This is required for dynamically generated/modified dialogs. Parts in the XML file can be hidden and turned on by the C++ code. Other hidden parts can be used as templates that are multiply used. Hidden datablocks can contain strings that are used in dialog context, that are easier to translate or modify in the XML file. --- diff --git a/src/GUI/dialog.cxx b/src/GUI/dialog.cxx index 722fab29f..7d1475bb9 100644 --- a/src/GUI/dialog.cxx +++ b/src/GUI/dialog.cxx @@ -406,6 +406,9 @@ FGDialog::display (SGPropertyNode * props) puObject * FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight) { + if (props->getBoolValue("hide")) + return 0; + bool presetSize = props->hasValue("width") && props->hasValue("height"); int width = props->getIntValue("width", parentWidth); int height = props->getIntValue("height", parentHeight); diff --git a/src/GUI/layout.cxx b/src/GUI/layout.cxx index 6783187db..b887894cc 100644 --- a/src/GUI/layout.cxx +++ b/src/GUI/layout.cxx @@ -39,6 +39,9 @@ void LayoutWidget::calcPrefSize(int* w, int* h) { *w = *h = 0; // Ask for nothing by default + if (getBool("hide")) + return; + int legw = stringLength(getStr("legend")); int labw = stringLength(getStr("label")); @@ -94,6 +97,9 @@ void LayoutWidget::calcPrefSize(int* w, int* h) // Set up geometry such that the widget lives "inside" the specified void LayoutWidget::layout(int x, int y, int w, int h) { + if (getBool("hide")) + return; + setNum("__bx", x); setNum("__by", y); setNum("__bw", w); @@ -192,6 +198,9 @@ void LayoutWidget::doHVBox(bool doLayout, bool vertical, int* w, int* h) int nEq = 0, eqA = 0, eqB = 0, eqTotalA = 0; for(i=0; i