68 lines
2.1 KiB
Plaintext
68 lines
2.1 KiB
Plaintext
/*
|
|
* This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
|
|
* http://www.gnu.org/licenses/gpl-3.0.html
|
|
*
|
|
* $Revision: 7443 $
|
|
* $Id: wx_help.script 7443 2011-09-01 16:29:16Z mortenmacfly $
|
|
* $HeadURL: https://mortenmacfly@svn.code.sf.net/p/codeblocks/code/branches/release-20.03/src/scripts/wx_help.script $
|
|
*/
|
|
|
|
/*
|
|
Sample help script for wxWidgets docs.
|
|
Based on the original unix shell script by rjmyst3
|
|
*/
|
|
function SearchHelp(keyword)
|
|
{
|
|
// that's all you should ever need to change in here
|
|
local wx_version = _T("2.8")
|
|
// on windows, adjust this for your wx installation
|
|
local wx_doc_folder = _T("/usr/share/doc")
|
|
|
|
if (PLATFORM == PLATFORM_GTK)
|
|
wx_doc_folder += _T("/wx") + wx_version + _T("-doc")
|
|
|
|
|
|
//
|
|
// normally, you shouldn't have to edit anything below this point
|
|
//
|
|
|
|
local helproot = wx_doc_folder + _T("/wx-manual.html/")
|
|
if (!IO.DirectoryExists(helproot))
|
|
{
|
|
local msg = _T("wxWidgets documentation not found. Its expected location is:\n\n");
|
|
msg += wx_doc_folder;
|
|
msg += _T("\n\n");
|
|
msg += _T("If it is not installed, please install it and try again.\n");
|
|
msg += _T("If it is installed to a different location, you can edit the wx_help.script to reflect that.");
|
|
ShowWarning(msg);
|
|
return;
|
|
}
|
|
|
|
local prefix = _T("wx") + wx_version + _T("-manual_")
|
|
|
|
// replace "contents" with "classref" below to default to alphabetical class list
|
|
local defaultpath = prefix + _T("contents.html")
|
|
|
|
// If there is no keyword, launch the default page defined above
|
|
if (keyword.IsEmpty())
|
|
{
|
|
App.Open(helproot + defaultpath, false)
|
|
return
|
|
}
|
|
|
|
// convert keyword to lowercase, this should be the class name
|
|
keyword.MakeLower()
|
|
local classpath = helproot + prefix + keyword + _T(".html")
|
|
|
|
LogDebug(_T("Opening ") + classpath)
|
|
if (IO.FileExists(classpath))
|
|
{
|
|
App.Open(classpath, false)
|
|
}
|
|
else
|
|
{
|
|
LogDebug(_T("Not found, opening default page"))
|
|
App.Open(helproot + defaultpath, false)
|
|
}
|
|
}
|