Get rid of global.xlink
This commit is contained in:
parent
976821e604
commit
806a6fd08c
3 changed files with 8 additions and 89 deletions
|
@ -36,97 +36,22 @@
|
|||
#include "preferences.h"
|
||||
#include "mainframe.h"
|
||||
|
||||
/*!
|
||||
the urls to fire up in the game packs help menus
|
||||
*/
|
||||
namespace {
|
||||
std::list<CopiedString> mHelpURLs;
|
||||
}
|
||||
|
||||
/*!
|
||||
needed for hooking in Gtk+
|
||||
*/
|
||||
void HandleHelpCommand(CopiedString &str)
|
||||
void Help_OpenVV(void)
|
||||
{
|
||||
OpenURL(str.c_str());
|
||||
OpenURL("https://www.vera-visions.com/");
|
||||
}
|
||||
void Help_OpenMAT(void)
|
||||
{
|
||||
OpenURL("https://www.vera-visions.com/docs/materials/");
|
||||
}
|
||||
|
||||
void process_xlink(const char *filename, const char *menu_name, const char *base_url, ui::Menu menu)
|
||||
{
|
||||
if (file_exists(filename)) {
|
||||
xmlDocPtr pDoc = xmlParseFile(filename);
|
||||
if (pDoc) {
|
||||
globalOutputStream() << "Processing .xlink file '" << filename << "'\n";
|
||||
// create sub menu
|
||||
auto menu_in_menu = create_sub_menu_with_mnemonic(menu, menu_name);
|
||||
/*if (g_Layout_enableOpenStepUX.m_value) {
|
||||
menu_tearoff(menu_in_menu);
|
||||
}*/
|
||||
// start walking the nodes, find the 'links' one
|
||||
xmlNodePtr pNode = pDoc->children;
|
||||
while (pNode && strcmp((const char *) pNode->name, "links")) {
|
||||
pNode = pNode->next;
|
||||
}
|
||||
if (pNode) {
|
||||
pNode = pNode->children;
|
||||
while (pNode) {
|
||||
if (!strcmp((const char *) pNode->name, "item")) {
|
||||
// process the URL
|
||||
CopiedString url;
|
||||
|
||||
xmlChar *prop = xmlGetProp(pNode, reinterpret_cast<const xmlChar *>( "url" ));
|
||||
ASSERT_NOTNULL(prop);
|
||||
if (strstr(reinterpret_cast<const char *>( prop ), "http://") ||
|
||||
strstr(reinterpret_cast<const char *>( prop ), "https://")) {
|
||||
// complete URL
|
||||
url = reinterpret_cast<const char *>( prop );
|
||||
} else {
|
||||
// relative URL
|
||||
StringOutputStream full(256);
|
||||
full << base_url << reinterpret_cast<const char *>( prop );
|
||||
url = full.c_str();
|
||||
}
|
||||
|
||||
mHelpURLs.push_back(url);
|
||||
|
||||
xmlFree(prop);
|
||||
|
||||
prop = xmlGetProp(pNode, reinterpret_cast<const xmlChar *>( "name" ));
|
||||
ASSERT_NOTNULL(prop);
|
||||
create_menu_item_with_mnemonic(menu_in_menu, reinterpret_cast<const char *>( prop ),
|
||||
ReferenceCaller<CopiedString, void(), HandleHelpCommand>(
|
||||
mHelpURLs.back()));
|
||||
xmlFree(prop);
|
||||
}
|
||||
pNode = pNode->next;
|
||||
}
|
||||
}
|
||||
xmlFreeDoc(pDoc);
|
||||
} else {
|
||||
globalOutputStream() << "'" << filename << "' parse failed\n";
|
||||
}
|
||||
} else {
|
||||
globalOutputStream() << "'" << filename << "' not found\n";
|
||||
}
|
||||
}
|
||||
|
||||
void create_game_help_menu(ui::Menu menu)
|
||||
{
|
||||
StringOutputStream filename(256);
|
||||
filename << AppPath_get() << "global.xlink";
|
||||
process_xlink(filename.c_str(), "General", AppPath_get(), menu);
|
||||
|
||||
#if 1
|
||||
filename.clear();
|
||||
filename << g_pGameDescription->mGameToolsPath.c_str() << "game.xlink";
|
||||
process_xlink(filename.c_str(), g_pGameDescription->getRequiredKeyValue("name"),
|
||||
g_pGameDescription->mGameToolsPath.c_str(), menu);
|
||||
#else
|
||||
for ( std::list<CGameDescription *>::iterator iGame = g_GamesDialog.mGames.begin(); iGame != g_GamesDialog.mGames.end(); ++iGame )
|
||||
{
|
||||
filename.clear();
|
||||
filename << ( *iGame )->mGameToolsPath.c_str() << "game.xlink";
|
||||
process_xlink( filename.c_str(), ( *iGame )->getRequiredKeyValue( "name" ), ( *iGame )->mGameToolsPath.c_str(), menu );
|
||||
}
|
||||
#endif
|
||||
create_menu_item_with_mnemonic(menu, "Vera Visions", makeCallbackF(Help_OpenVV));
|
||||
create_menu_item_with_mnemonic(menu, "Material Manual", makeCallbackF(Help_OpenMAT));
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ all:
|
|||
mkdir -p ../build/games
|
||||
mkdir -p ../build/gl
|
||||
mkdir -p ../build/platform.game
|
||||
cp -vf global.xlink ../build/global.xlink
|
||||
cp -vf ./platform.game/default_build_menu.xml ../build/platform.game/default_build_menu.xml
|
||||
cp -vf ./games/platform.game ../build/games/platform.game
|
||||
cp -vf ./gl/lighting_DBS_omni_fp.glp ../build/gl/lighting_DBS_omni_fp.glp
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
|
||||
<links>
|
||||
<item name="Website" url="https://www.vera-visions.com/"/>
|
||||
<item name="Material Manual" url="https://www.vera-visions.com/docs/materials/"/>
|
||||
</links>
|
Loading…
Reference in a new issue