]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/dialog.cxx
Melchior: Make line wrapping in textboxes configurable, and enable it by default
[flightgear.git] / src / GUI / dialog.cxx
index f5d199d7acf28bd12924363e52e849c33e68738d..e67f972eaae4ed86660039e345ac17ac192a0899 100644 (file)
@@ -390,6 +390,15 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
     int x = props->getIntValue("x", (parentWidth - width) / 2);
     int y = props->getIntValue("y", (parentHeight - height) / 2);
 
+    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);
+    }
+
     string type = props->getName();
     if (type == "")
         type = "dialog";
@@ -400,11 +409,11 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
             dialog = new puDialogBox(x, y);
         else
             dialog = new fgPopup(x, y);
-        setupGroup(dialog, props, width, height, true);
+        setupGroup(dialog, props, width, height, color, true);
         return dialog;
     } else if (type == "group") {
         puGroup * group = new puGroup(x, y);
-        setupGroup(group, props, width, height, false);
+        setupGroup(group, props, width, height, color, false);
         return group;
     } else if (type == "list") {
         puList * list = new puList(x, y, x + width, y + height);
@@ -487,9 +496,10 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
         return dial;
     } else if (type == "textbox") {
        int slider_width = props->getIntValue("slider", parentHeight);
+       int wrap = props->getBoolValue("wrap", true)==true;
        if (slider_width==0) slider_width=20;
        puLargeInput * puTextBox =
-                     new puLargeInput(x, y, x+width, x+height, 2, slider_width);
+                     new puLargeInput(x, y, x+width, x+height, 2, slider_width, wrap);
        if  (props->hasValue("editable"))
        {
           if (props->getBoolValue("editable")==false)
@@ -561,13 +571,13 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props)
 
 void
 FGDialog::setupGroup (puGroup * group, SGPropertyNode * props,
-                    int width, int height, bool makeFrame)
+                    int width, int height, sgVec4 color, bool makeFrame)
 {
     setupObject(group, props);
 
     if (makeFrame) {
         puFrame* f = new puFrame(0, 0, width, height);
-        f->setColorScheme(0.8, 0.8, 0.9, 0.85);
+        f->setColorScheme(color[0], color[1], color[2], color[3]);
     }
 
     int nChildren = props->nChildren();