# include <config.h>
#endif
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
#include <simgear/compiler.h>
#include <fstream>
openBrowser( "Docs/index.html" );
}
-bool openBrowser(string address)
+bool openBrowser(const std::string& aAddress)
{
bool ok = true;
-
+ string address(aAddress);
+
// do not resolve addresses with given protocol, i.e. "http://...", "ftp://..."
if (address.find("://")==string::npos)
{
}
cocoaOpenUrl(address);
- return ok;
-#endif
-
-#ifndef _WIN32
-
- string command = globals->get_browser();
- string::size_type pos;
- if ((pos = command.find("%u", 0)) != string::npos)
- command.replace(pos, 2, address);
- else
- command += " " + address;
-
- command += " &";
- ok = (system( command.c_str() ) == 0);
-
-#else // _WIN32
+#elif defined _WIN32
// Look for favorite browser
char win32_name[1024];
# endif
ShellExecute ( NULL, "open", win32_name, NULL, NULL,
SW_SHOWNORMAL ) ;
+#else
+ // Linux, BSD, SGI etc
+ string command = globals->get_browser();
+ string::size_type pos;
+ if ((pos = command.find("%u", 0)) != string::npos)
+ command.replace(pos, 2, address);
+ else
+ command += " \"" + address +"\"";
+ command += " &";
+ ok = (system( command.c_str() ) == 0);
#endif
mkDialog("The file is shown in your web browser window.");
char *filename = new char [24];
static int count = 1;
- static const SGPropertyNode *master_freeze
- = fgGetNode("/sim/freeze/master");
+ SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", true);
+ master_freeze->setBoolValue(true);
}
fgSetBool("/sim/menubar/visibility", false);
fgSetBool("/sim/menubar/visibility", menu_status);
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", false);
+ master_freeze->setBoolValue(false);
}
}
#endif // #if defined( TR_HIRES_SNAP)
string dir = fgGetString("/sim/paths/screenshot-dir");
if (dir.empty())
- dir = fgGetString("/sim/fg-current");
+ dir = SGPath::desktop().str();
_path.set(dir + '/');
if (_path.create_dir( 0755 )) {
SG_LOG(SG_GENERAL, SG_ALERT, "Cannot create screenshot directory '"
<< dir << "'. Trying home directory.");
- dir = fgGetString("/sim/fg-home");
+ dir = globals->get_fg_home();
}
char filename[24];
return GUISnapShotOperation::start();
#else
// obsolete code => remove when new code is stable
- static SGConstPropertyNode_ptr master_freeze = fgGetNode("/sim/freeze/master");
+ SGPropertyNode_ptr master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", true);
+ master_freeze->setBoolValue(true);
}
int mouse = fgGetMouseCursor();
if (path.create_dir( 0755 )) {
SG_LOG(SG_GENERAL, SG_ALERT, "Cannot create screenshot directory '"
<< dir << "'. Trying home directory.");
- dir = fgGetString("/sim/fg-home");
+ dir = globals->get_fg_home();
}
char filename[24];
fgSetMouseCursor(mouse);
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", false);
+ master_freeze->setBoolValue(false);
}
return result;
#endif
string message;
static int count = 1;
- static const SGPropertyNode *master_freeze
- = fgGetNode("/sim/freeze/master");
+ SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", true);
+ master_freeze->setBoolValue(true);
}
while (count < 1000) {
delete [] filename;
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", false);
+ master_freeze->setBoolValue(false);
}
}
string message;
static int count = 1;
- static const SGPropertyNode *master_freeze
- = fgGetNode("/sim/freeze/master");
+ SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", true);
+ master_freeze->setBoolValue(true);
}
while (count < 1000) {
delete [] filename;
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", false);
+ master_freeze->setBoolValue(false);
}
}
void fgPrintVisibleSceneInfoCommand()
{
- static const SGPropertyNode *master_freeze
- = fgGetNode("/sim/freeze/master");
+ SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", true);
+ master_freeze->setBoolValue(true);
}
flightgear::printVisibleSceneInfo(globals->get_renderer());
if ( !freeze ) {
- fgSetBool("/sim/freeze/master", false);
+ master_freeze->setBoolValue(false);
}
}
-
-
-