]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/WaypointList.cxx
Canvas: First version of new Canvas GUI system.
[flightgear.git] / src / GUI / WaypointList.cxx
index 57b741169d49ff9617ac9460f85829d0b9d68c7c..e8e5b36dcb40e2625d1225095519182884e225f1 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <plib/puAux.h>
 
-#include <simgear/route/waypoint.hxx>
 #include <simgear/structure/callback.hxx>
 #include <simgear/sg_inlines.h>
 
@@ -46,13 +45,17 @@ public:
     _fp(fp)
   {    
     SGPropertyNode* routeEdited = fgGetNode("/autopilot/route-manager/signals/edited", true);
+    SGPropertyNode* flightplanChanged = fgGetNode("/autopilot/route-manager/signals/flightplan-changed", true);
     routeEdited->addChangeListener(this);
+    flightplanChanged->addChangeListener(this);
   }
   
   ~FlightPlanWaypointModel()
   {
     SGPropertyNode* routeEdited = fgGetNode("/autopilot/route-manager/signals/edited", true);
+    SGPropertyNode* flightplanChanged = fgGetNode("/autopilot/route-manager/signals/flightplan-changed", true);
     routeEdited->removeChangeListener(this);
+    flightplanChanged->removeChangeListener(this);
   }
   
 // implement WaypointList::Model
@@ -108,8 +111,15 @@ public:
 // implement SGPropertyChangeListener
   void valueChanged(SGPropertyNode *prop)
   {
-    if (_cb) {
-      (*_cb)();
+    if (prop->getNameString() == "edited") {
+      if (_cb) {
+        (*_cb)();
+      }
+    }
+    
+    if (prop->getNameString() == "flightplan-changed") {
+      _fp = 
+        static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"))->flightPlan();
     }
   }
 private:
@@ -402,12 +412,12 @@ void WaypointList::drawRow(int dx, int dy, int rowIndex, int y)
   if (wp->flag(WPT_MISS)) {
     drawBox = true;
     puSetColor(col, 1.0, 0.0, 0.0, 0.3);  // red
-  } else if (wp->flag(WPT_ARRIVAL)) {
+  } else if (wp->flag(WPT_ARRIVAL) || wp->flag(WPT_DEPARTURE)) {
     drawBox = true;
     puSetColor(col, 0.0, 0.0, 0.0, 0.3);
-  } else if (wp->flag(WPT_DEPARTURE)) {
+  } else if (wp->flag(WPT_APPROACH)) {
     drawBox = true;
-    puSetColor(col, 0.0, 0.0, 0.0, 0.3);
+    puSetColor(col, 0.0, 0.0, 0.1, 0.3);
   }
   
   if (isDragSource) {