diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index b5027a87c..46df4c816 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -2140,7 +2140,8 @@ namespace NLGUI std::string typeName = "???"; if (_ChildrenGroups[k]) { - const type_info &ti = typeid(*_ChildrenGroups[k]); + NLGUI::CInterfaceGroup *group = _ChildrenGroups[k]; + const type_info &ti = typeid(*group); typeName = ti.name(); } nlinfo("Group %d, name = %s, type=%s", k, _ChildrenGroups[k] ? _ChildrenGroups[k]->getId().c_str() : "???", typeName.c_str()); @@ -2156,7 +2157,8 @@ namespace NLGUI std::string typeName = "???"; if (_ChildrenGroups[k]) { - const type_info &ti = typeid(*_EltOrder[k]); + NLGUI::CViewBase *view = _EltOrder[k]; + const type_info &ti = typeid(*view); typeName = ti.name(); } CInterfaceElement *el = _EltOrder[k]; diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 8183430f1..83f1916d9 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -440,7 +440,7 @@ NLMISC_CATEGORISED_COMMAND(nel,hrtob, "Convert a human readable number into a by string secondsToHumanReadable (uint32 time) { static const char *divTable[] = { "s", "mn", "h", "d" }; - static uint divCoef[] = { 60, 60, 24 }; + static uint divCoef[] = { 60, 60, 24 }; uint div = 0; uint32 res = time; uint32 newres = res; @@ -671,13 +671,13 @@ bool launchProgram(const std::string &programName, const std::string &arguments, { #ifdef NL_OS_WINDOWS - STARTUPINFOA si; - PROCESS_INFORMATION pi; + STARTUPINFOA si; + PROCESS_INFORMATION pi; - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); - si.cb = sizeof(si); + si.cb = sizeof(si); /* SECURITY_ATTRIBUTES sa; sa.nLength = sizeof (sa); @@ -781,7 +781,7 @@ bool launchProgram(const std::string &programName, const std::string &arguments, nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err); } else if (status == 0) - { + { // Exec (the only allowed instruction after vfork) status = execvp(programName.c_str(), &argv.front()); @@ -1009,50 +1009,87 @@ NLMISC_CATEGORISED_COMMAND(nel, killProgram, "kill a program given the pid", "

31); + } + } + } + else + { + return true; + } +#else + // TODO: implement for Linux and Mac OS X + nlunreferenced(document); +#endif // NL_OS_WINDOWS + + return false; +} + bool openURL (const char *url) { #ifdef NL_OS_WINDOWS - char key[1024]; - if (GetRegKey(HKEY_CLASSES_ROOT, ".html", key) == ERROR_SUCCESS) - { - lstrcatA(key, "\\shell\\open\\command"); - - if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) - { - char *pos; - pos = strstr(key, "\"%1\""); - if (pos == NULL) { // No quotes found - pos = strstr(key, "%1"); // Check for %1, without quotes - if (pos == NULL) // No parameter at all... - pos = key+lstrlenA(key)-1; - else - *pos = '\0'; // Remove the parameter - } - else - *pos = '\0'; // Remove the parameter - - lstrcatA(pos, " "); - lstrcatA(pos, url); - int res = WinExec(key,SW_SHOWDEFAULT); - return (res>31); - } - } + return openDocWithExtension(url, "htm"); #elif defined(NL_OS_MAC) return launchProgram("open", url); #elif defined(NL_OS_UNIX) @@ -1060,53 +1097,17 @@ bool openURL (const char *url) #else nlwarning("openURL() is not implemented for this OS"); #endif // NL_OS_WINDOWS + return false; } bool openDoc (const char *document) { -#ifdef NL_OS_WINDOWS - string ext = CFile::getExtension (document); - char key[MAX_PATH + MAX_PATH]; + // get extension from document fullpath + string ext = CFile::getExtension(document); - // First try ShellExecute() - HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL,NULL, SW_SHOWDEFAULT); - - // If it failed, get the .htm regkey and lookup the program - if ((uintptr_t)result <= HINSTANCE_ERROR) - { - if (GetRegKey(HKEY_CLASSES_ROOT, ext.c_str(), key) == ERROR_SUCCESS) - { - lstrcatA(key, "\\shell\\open\\command"); - - if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) - { - char *pos; - pos = strstr(key, "\"%1\""); - if (pos == NULL) { // No quotes found - pos = strstr(key, "%1"); // Check for %1, without quotes - if (pos == NULL) // No parameter at all... - pos = key+lstrlenA(key)-1; - else - *pos = '\0'; // Remove the parameter - } - else - *pos = '\0'; // Remove the parameter - - lstrcatA(pos, " "); - lstrcatA(pos, document); - int res = WinExec(key,SW_SHOWDEFAULT); - return (res>31); - } - } - } - else - return true; -#else - // TODO: implement for Linux and Mac OS X - nlunreferenced(document); -#endif // NL_OS_WINDOWS - return false; + // try to open document + return openDocWithExtension(document, ext.c_str()); } } // NLMISC diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index 90287955d..e60146c3f 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -3913,20 +3913,12 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "") } -#if defined(NL_OS_WINDOWS) NLMISC_COMMAND (url, "launch a browser to the specified url", "") { if (args.size () != 1) return false; - HINSTANCE result = ShellExecute(NULL, "open", args[0].c_str(), NULL,NULL, SW_SHOW); - if ((intptr_t)result > 32) - return true; - else - { - log.displayNL ("ShellExecute failed %d", (uint32)(intptr_t)result); - return false; - } + return openURL(args[0].c_str()); } NLMISC_COMMAND( reconnect, "Reconnect to the same shard (self Far TP)", "") @@ -3949,8 +3941,6 @@ NLMISC_COMMAND( reconnect, "Reconnect to the same shard (self Far TP)", "") return true; } -#endif // !FINAL_VERSION - struct CItemSheetSort { const CItemSheet *IS; diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index a218d4de1..29833d4ff 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -2488,7 +2488,8 @@ void CInterfaceManager::dumpUI(bool /* indent */) if (ig->getViews()[k]) { info += id; - info += toString(", type = %s, address=0x%p", typeid(*ig->getViews()[k]).name(), ig->getViews()[k]); + NLGUI::CViewBase *view = ig->getViews()[k]; + info += toString(", type = %s, address=0x%p", typeid(*view).name(), view); } else { @@ -2504,7 +2505,8 @@ void CInterfaceManager::dumpUI(bool /* indent */) if (ig->getControls()[k]) { info += id; - info += toString(", type = %s, address=0x%p", typeid(*ig->getControls()[k]).name(), ig->getControls()[k]); + NLGUI::CCtrlBase *control = ig->getControls()[k]; + info += toString(", type = %s, address=0x%p", typeid(*control).name(), control); } else { diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 696b03880..ee8224d08 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -1922,7 +1922,7 @@ class CAHOpenURL : public IActionHandler url += "language=" + ClientCfg.LanguageCode; openURL(url.c_str()); - nlinfo("openURL %s",url.c_str()); + nlinfo("openURL %s", url.c_str()); } }; REGISTER_ACTION_HANDLER (CAHOpenURL, "open_url");