1
0
Fork 0

src/GUI/MapWidget.cxx: don't pan map with cursor keys if /gui/map/key-pan is 0.

Allows control of autopilot with cursor keys when map is being displayed.

Default is 1, which preserves old behaviour.
This commit is contained in:
Julian Smith 2020-01-15 00:13:41 +00:00
parent 99c1612ddc
commit 387b61e211

View file

@ -500,6 +500,13 @@ void MapWidget::setProperty(SGPropertyNode_ptr prop)
_root->setBoolValue("draw-data", false);
_root->setBoolValue("draw-flight-history", false);
_root->setBoolValue("magnetic-headings", true);
/* If /gui/map/key-pan is undefined, fgdata's gui/dialogs/map.xml will set it
to "" when it opens map, so if we see this we change to default value of 1.
*/
if (!strcmp( _root->getStringValue("key-pan"), "")) {
_root->setIntValue("key-pan", 1);
}
}
void MapWidget::setSize(int w, int h)
@ -555,6 +562,16 @@ int MapWidget::checkKey (int key, int updown )
if ((updown == PU_UP) || !isVisible () || !isActive () || (window != puGetWindow())) {
return FALSE ;
}
bool key_pan = _root->getIntValue("key-pan");
if (!key_pan && (0
|| key == PU_KEY_UP
|| key == PU_KEY_DOWN
|| key == PU_KEY_LEFT
|| key == PU_KEY_RIGHT
)) {
return FALSE;
}
switch (key)
{