mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 01:06:19 +00:00
Merge with develop
This commit is contained in:
parent
0beb824dd3
commit
f78523e5d4
5 changed files with 94 additions and 99 deletions
|
@ -2140,7 +2140,8 @@ namespace NLGUI
|
||||||
std::string typeName = "???";
|
std::string typeName = "???";
|
||||||
if (_ChildrenGroups[k])
|
if (_ChildrenGroups[k])
|
||||||
{
|
{
|
||||||
const type_info &ti = typeid(*_ChildrenGroups[k]);
|
NLGUI::CInterfaceGroup *group = _ChildrenGroups[k];
|
||||||
|
const type_info &ti = typeid(*group);
|
||||||
typeName = ti.name();
|
typeName = ti.name();
|
||||||
}
|
}
|
||||||
nlinfo("Group %d, name = %s, type=%s", k, _ChildrenGroups[k] ? _ChildrenGroups[k]->getId().c_str() : "???", typeName.c_str());
|
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 = "???";
|
std::string typeName = "???";
|
||||||
if (_ChildrenGroups[k])
|
if (_ChildrenGroups[k])
|
||||||
{
|
{
|
||||||
const type_info &ti = typeid(*_EltOrder[k]);
|
NLGUI::CViewBase *view = _EltOrder[k];
|
||||||
|
const type_info &ti = typeid(*view);
|
||||||
typeName = ti.name();
|
typeName = ti.name();
|
||||||
}
|
}
|
||||||
CInterfaceElement *el = _EltOrder[k];
|
CInterfaceElement *el = _EltOrder[k];
|
||||||
|
|
|
@ -1025,73 +1025,47 @@ LONG GetRegKey(HKEY key, LPCSTR subkey, LPSTR retdata)
|
||||||
}
|
}
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
bool openURL (const char *url)
|
static bool openDocWithExtension (const char *document, const char *ext)
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
#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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif defined(NL_OS_MAC)
|
|
||||||
return launchProgram("open", url);
|
|
||||||
#elif defined(NL_OS_UNIX)
|
|
||||||
return launchProgram("/etc/alternatives/x-www-browser", 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];
|
|
||||||
|
|
||||||
// First try ShellExecute()
|
// First try ShellExecute()
|
||||||
HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL, NULL, SW_SHOWDEFAULT);
|
HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL, NULL, SW_SHOWDEFAULT);
|
||||||
|
|
||||||
// If it failed, get the .htm regkey and lookup the program
|
// If it failed, get the .htm regkey and lookup the program
|
||||||
if ((uintptr_t)result <= HINSTANCE_ERROR)
|
if ((uintptr_t)result <= HINSTANCE_ERROR)
|
||||||
{
|
{
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT, ext.c_str(), key) == ERROR_SUCCESS)
|
char key[MAX_PATH + MAX_PATH];
|
||||||
|
|
||||||
|
if (GetRegKey(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
lstrcatA(key, "\\shell\\open\\command");
|
lstrcatA(key, "\\shell\\open\\command");
|
||||||
|
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS)
|
if (GetRegKey(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
char *pos;
|
char *pos = strstr(key, "\"%1\"");
|
||||||
pos = strstr(key, "\"%1\"");
|
|
||||||
if (pos == NULL) { // No quotes found
|
if (pos == NULL)
|
||||||
pos = strstr(key, "%1"); // Check for %1, without quotes
|
{
|
||||||
if (pos == NULL) // No parameter at all...
|
// No quotes found
|
||||||
|
// Check for %1, without quotes
|
||||||
|
pos = strstr(key, "%1");
|
||||||
|
|
||||||
|
if (pos == NULL)
|
||||||
|
{
|
||||||
|
// No parameter at all...
|
||||||
pos = key+lstrlenA(key)-1;
|
pos = key+lstrlenA(key)-1;
|
||||||
else
|
|
||||||
*pos = '\0'; // Remove the parameter
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*pos = '\0'; // Remove the parameter
|
{
|
||||||
|
// Remove the parameter
|
||||||
|
*pos = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Remove the parameter
|
||||||
|
*pos = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
lstrcatA(pos, " ");
|
lstrcatA(pos, " ");
|
||||||
lstrcatA(pos, document);
|
lstrcatA(pos, document);
|
||||||
|
@ -1101,12 +1075,39 @@ bool openDoc (const char *document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
// TODO: implement for Linux and Mac OS X
|
// TODO: implement for Linux and Mac OS X
|
||||||
nlunreferenced(document);
|
nlunreferenced(document);
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool openURL (const char *url)
|
||||||
|
{
|
||||||
|
#ifdef NL_OS_WINDOWS
|
||||||
|
return openDocWithExtension(url, "htm");
|
||||||
|
#elif defined(NL_OS_MAC)
|
||||||
|
return launchProgram("open", url);
|
||||||
|
#elif defined(NL_OS_UNIX)
|
||||||
|
return launchProgram("/etc/alternatives/x-www-browser", url);
|
||||||
|
#else
|
||||||
|
nlwarning("openURL() is not implemented for this OS");
|
||||||
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool openDoc (const char *document)
|
||||||
|
{
|
||||||
|
// get extension from document fullpath
|
||||||
|
string ext = CFile::getExtension(document);
|
||||||
|
|
||||||
|
// try to open document
|
||||||
|
return openDocWithExtension(document, ext.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
} // NLMISC
|
} // NLMISC
|
||||||
|
|
|
@ -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", "<url>")
|
NLMISC_COMMAND (url, "launch a browser to the specified url", "<url>")
|
||||||
{
|
{
|
||||||
if (args.size () != 1)
|
if (args.size () != 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
HINSTANCE result = ShellExecute(NULL, "open", args[0].c_str(), NULL,NULL, SW_SHOW);
|
return openURL(args[0].c_str());
|
||||||
if ((intptr_t)result > 32)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log.displayNL ("ShellExecute failed %d", (uint32)(intptr_t)result);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NLMISC_COMMAND( reconnect, "Reconnect to the same shard (self Far TP)", "")
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !FINAL_VERSION
|
|
||||||
|
|
||||||
struct CItemSheetSort
|
struct CItemSheetSort
|
||||||
{
|
{
|
||||||
const CItemSheet *IS;
|
const CItemSheet *IS;
|
||||||
|
|
|
@ -2488,7 +2488,8 @@ void CInterfaceManager::dumpUI(bool /* indent */)
|
||||||
if (ig->getViews()[k])
|
if (ig->getViews()[k])
|
||||||
{
|
{
|
||||||
info += id;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -2504,7 +2505,8 @@ void CInterfaceManager::dumpUI(bool /* indent */)
|
||||||
if (ig->getControls()[k])
|
if (ig->getControls()[k])
|
||||||
{
|
{
|
||||||
info += id;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue