#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Main/fg_os.hxx>
-#include <Main/renderer.hxx>
-#include <Main/viewmgr.hxx>
-#include <Main/WindowSystemAdapter.hxx>
-#include <Main/CameraGroup.hxx>
+#include <Viewer/renderer.hxx>
+#include <Viewer/viewmgr.hxx>
+#include <Viewer/WindowSystemAdapter.hxx>
+#include <Viewer/CameraGroup.hxx>
#include <GUI/new_gui.hxx>
# include <shellapi.h>
#endif
+#ifdef SG_MAC
+# include "FGCocoaMenuBar.hxx" // for cocoaOpenUrl
+#endif
+
#include "gui.h"
using std::string;
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)
{
}
}
-#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
+#ifdef SG_MAC
+ if (address.find("://")==string::npos) {
+ address = "file://" + address;
+ }
+
+ cocoaOpenUrl(address);
+#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.");
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];
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];