Remove FGMakeUpperCase listener
After discussing the problems, it was decided to remove this feature (https://sourceforge.net/p/flightgear/flightgear/merge-requests/295/).
This commit is contained in:
parent
7d78c40086
commit
71c92c754d
3 changed files with 2 additions and 41 deletions
|
@ -850,22 +850,5 @@ fgTie (const char * name, T * obj, int index,
|
||||||
"Failed to tie property " << name << " to indexed object methods");
|
"Failed to tie property " << name << " to indexed object methods");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class FGMakeUpperCase : public SGPropertyChangeListener {
|
|
||||||
public:
|
|
||||||
void valueChanged(SGPropertyNode *node) {
|
|
||||||
if (node->getType() != simgear::props::STRING)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::string value = node->getStringValue();
|
|
||||||
std::string value_orig = value;
|
|
||||||
std::transform(value.begin(), value.end(), value.begin(), ::toupper);
|
|
||||||
if (value != value_orig) {
|
|
||||||
node->setStringValue(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __FG_PROPS_HXX
|
#endif // __FG_PROPS_HXX
|
||||||
|
|
||||||
|
|
|
@ -485,25 +485,6 @@ void fgInitSecureMode()
|
||||||
SGPropertyNode::PROTECTED);
|
SGPropertyNode::PROTECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void upper_case_property(const char *name)
|
|
||||||
{
|
|
||||||
using namespace simgear;
|
|
||||||
SGPropertyNode *p = fgGetNode(name, false);
|
|
||||||
if (!p) {
|
|
||||||
p = fgGetNode(name, true);
|
|
||||||
p->setStringValue("");
|
|
||||||
} else {
|
|
||||||
props::Type t = p->getType();
|
|
||||||
if (t == props::NONE || t == props::UNSPECIFIED)
|
|
||||||
p->setStringValue("");
|
|
||||||
else
|
|
||||||
assert(t == props::STRING);
|
|
||||||
}
|
|
||||||
SGPropertyChangeListener* muc = new FGMakeUpperCase;
|
|
||||||
globals->addListenerToCleanup(muc);
|
|
||||||
p->addChangeListener(muc);
|
|
||||||
}
|
|
||||||
|
|
||||||
// this hack is needed to avoid weird viewport sizing within OSG on Windows.
|
// this hack is needed to avoid weird viewport sizing within OSG on Windows.
|
||||||
// still required as of March 2017, sad times.
|
// still required as of March 2017, sad times.
|
||||||
// see for example https://sourceforge.net/p/flightgear/codetickets/1958/
|
// see for example https://sourceforge.net/p/flightgear/codetickets/1958/
|
||||||
|
@ -687,9 +668,6 @@ int fgMainInit( int argc, char **argv )
|
||||||
globals->set_channel_options_list( col );
|
globals->set_channel_options_list( col );
|
||||||
|
|
||||||
fgValidatePath(globals->get_fg_home(), false); // initialize static variables
|
fgValidatePath(globals->get_fg_home(), false); // initialize static variables
|
||||||
upper_case_property("/sim/presets/airport-id");
|
|
||||||
upper_case_property("/sim/presets/runway");
|
|
||||||
upper_case_property("/sim/tower/airport-id");
|
|
||||||
|
|
||||||
if (showLauncher) {
|
if (showLauncher) {
|
||||||
// to minimise strange interactions when launcher and config files
|
// to minimise strange interactions when launcher and config files
|
||||||
|
|
|
@ -1446,7 +1446,7 @@ fgOptScenario( const char *arg )
|
||||||
static int
|
static int
|
||||||
fgOptAirport( const char *arg )
|
fgOptAirport( const char *arg )
|
||||||
{
|
{
|
||||||
fgSetString("/sim/presets/airport-id", arg );
|
fgSetString("/sim/presets/airport-id", simgear::strutils::uppercase({arg}) );
|
||||||
fgSetBool("/sim/presets/airport-requested", true );
|
fgSetBool("/sim/presets/airport-requested", true );
|
||||||
return FG_OPTIONS_OK;
|
return FG_OPTIONS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1454,7 +1454,7 @@ fgOptAirport( const char *arg )
|
||||||
static int
|
static int
|
||||||
fgOptRunway( const char *arg )
|
fgOptRunway( const char *arg )
|
||||||
{
|
{
|
||||||
fgSetString("/sim/presets/runway", arg );
|
fgSetString("/sim/presets/runway", simgear::strutils::uppercase({arg}) );
|
||||||
fgSetBool("/sim/presets/runway-requested", true );
|
fgSetBool("/sim/presets/runway-requested", true );
|
||||||
return FG_OPTIONS_OK;
|
return FG_OPTIONS_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue