]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/dialog.cxx
fix a typo
[flightgear.git] / src / GUI / dialog.cxx
index 50703847ac00ca279e5f045f235b45e1577d9ffa..b5289a2e2a3691a1f3c6167da929cd62c7a624ae 100644 (file)
@@ -17,6 +17,8 @@
 
 enum format_type { f_INVALID, f_INT, f_LONG, f_FLOAT, f_DOUBLE, f_STRING };
 static const int FORMAT_BUFSIZE = 255;
+static const int RESIZE_MARGIN = 7;
+
 
 /**
  * Makes sure the format matches '%[ -+#]?\d*(\.\d*)?(l?[df]|s)', with
@@ -181,7 +183,8 @@ puObject *fgPopup::getActiveInputField(puObject *object)
             if ((ret = getActiveInputField(obj)))
                 return ret;
 
-    if (object->getType() & PUCLASS_INPUT && ((puInput *)object)->isAcceptingInput())
+    if (object->getType() & (PUCLASS_INPUT|PUCLASS_LARGEINPUT)
+            && ((puInput *)object)->isAcceptingInput())
         return object;
 
     return 0;
@@ -234,8 +237,8 @@ int fgPopup::checkHit(int button, int updown, int x, int y)
 
         _resizing = 0;
         if (!global_drag && _resizable) {
-            int hmargin = global_resize ? _dlgW / 3 : 10;
-            int vmargin = global_resize ? _dlgH / 3 : 10;
+            int hmargin = global_resize ? _dlgW / 3 : RESIZE_MARGIN;
+            int vmargin = global_resize ? _dlgH / 3 : RESIZE_MARGIN;
 
             if (y - _dlgY < vmargin)
                 _resizing |= BOTTOM;
@@ -467,7 +470,8 @@ FGDialog::FGDialog (SGPropertyNode *props) :
         if (open) {
             const char *s = open->getStringValue();
             FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
-            nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), props);
+            if (nas)
+                nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), props);
         }
     }
     display(props);
@@ -481,11 +485,13 @@ FGDialog::~FGDialog ()
     _props->setIntValue("lasty", y);
 
     FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
-    if (_nasal_close) {
-        const char *s = _nasal_close->getStringValue();
-        nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _props);
+    if (nas) {
+        if (_nasal_close) {
+            const char *s = _nasal_close->getStringValue();
+            nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _props);
+        }
+        nas->deleteModule(_module.c_str());
     }
-    nas->deleteModule(_module.c_str());
 
     puDeleteObject(_object);