diff --git a/src/GUI/dialog.cxx b/src/GUI/dialog.cxx index 47657f3d1..d067dbfd2 100644 --- a/src/GUI/dialog.cxx +++ b/src/GUI/dialog.cxx @@ -364,7 +364,7 @@ FGDialog::display (SGPropertyNode * props) bool userw = props->hasValue("width"); bool userh = props->hasValue("height"); - // Let the layout widget work in the same property subtree. + // Let the layout widget work in the same property subtree. LayoutWidget wid(props); int pw=0, ph=0; @@ -407,17 +407,25 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight) int height = props->getIntValue("height", parentHeight); int x = props->getIntValue("x", (parentWidth - width) / 2); int y = props->getIntValue("y", (parentHeight - height) / 2); + string type = props->getName(); + + const sgVec4 background = {0.8, 0.8, 0.9, 0.85}; + const sgVec4 foreground = {0, 0, 0, 1}; + sgVec4 color; + + if (type == "hrule" || type == "vrule") + sgCopyVec4(color, foreground); + else + sgCopyVec4(color, background); - sgVec4 color = {0.8, 0.8, 0.9, 0.85}; SGPropertyNode *ncs = props->getNode("color", false); if ( ncs ) { - color[0] = ncs->getFloatValue("red", 0.8); - color[1] = ncs->getFloatValue("green", 0.8); - color[2] = ncs->getFloatValue("blue", 0.9); - color[3] = ncs->getFloatValue("alpha", 0.85); + color[0] = ncs->getFloatValue("red", color[0]); + color[1] = ncs->getFloatValue("green", color[1]); + color[2] = ncs->getFloatValue("blue", color[2]); + color[3] = ncs->getFloatValue("alpha", color[3]); } - string type = props->getName(); if (type == "") type = "dialog"; @@ -438,8 +446,8 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight) puGroup * group = new puGroup(x, y); setupGroup(group, props, width, height, color, true); return group; - } else if (type == "hrule") { - puFrame * rule = new puFrame(3, y, parentWidth - 4, y + (height ? height : 1)); + } else if (type == "hrule" || type == "vrule") { + puFrame * rule = new puFrame(x, y, x + width, y + height); rule->setBorderThickness(0); rule->setColorScheme(color[0], color[1], color[2], color[3]); return rule; diff --git a/src/GUI/layout.cxx b/src/GUI/layout.cxx index 4bdf00190..6783187db 100644 --- a/src/GUI/layout.cxx +++ b/src/GUI/layout.cxx @@ -71,6 +71,10 @@ void LayoutWidget::calcPrefSize(int* w, int* h) else *h = 4*UNIT; } else if (isType("list") || isType("airport-list") || isType("dial")) { *w = *h = 12*UNIT; + } else if (isType("hrule")) { + *h = 1; + } else if (isType("vrule")) { + *w = 1; } // Throw it all out if the user specified a fixed preference @@ -115,7 +119,7 @@ void LayoutWidget::layout(int x, int y, int w, int h) // Correct our box for alignment. The values above correspond to // a "fill" alignment. - const char* halign = isGroup ? "fill" : "center"; + const char* halign = (isGroup || isType("hrule")) ? "fill" : "center"; if(hasField("halign")) halign = getStr("halign"); if(eq(halign, "left")) { w = prefw; @@ -126,7 +130,7 @@ void LayoutWidget::layout(int x, int y, int w, int h) x += (w - prefw)/2; w = prefw; } - const char* valign = isGroup ? "fill" : "center"; + const char* valign = (isGroup || isType("vrule")) ? "fill" : "center"; if(hasField("valign")) valign = getStr("valign"); if(eq(valign, "bottom")) { h = prefh; @@ -172,7 +176,10 @@ 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 diff --git a/src/GUI/prop_picker.cxx b/src/GUI/prop_picker.cxx index 767769ad9..ee4c1f44d 100755 --- a/src/GUI/prop_picker.cxx +++ b/src/GUI/prop_picker.cxx @@ -530,7 +530,7 @@ void fgPropPicker::updateTextForEntry(int index) if (dotFiles) index +=2; // don't leak everywhere if we're updating - if (files[index]) delete[] files[index]; + delete[] files[index]; files[index] = new char[ strlen(line.c_str())+2 ] ; strcpy ( files [ index ], line.c_str() ) ;