~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/scripts/wx_help.script

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
 
3
 * http://www.gnu.org/licenses/gpl-3.0.html
 
4
 *
 
5
 * $Revision$
 
6
 * $Id$
 
7
 * $HeadURL$
 
8
 */
 
9
 
 
10
/*
 
11
  Sample help script for wxWidgets docs.
 
12
  Based on the original unix shell script by rjmyst3
 
13
*/
 
14
function SearchHelp(keyword)
 
15
{
 
16
    // that's all you should ever need to change in here
 
17
    local wx_version = _T("2.8")
 
18
    // on windows, adjust this for your wx installation
 
19
    local wx_doc_folder = _T("/usr/share/doc")
 
20
    
 
21
    if (PLATFORM == PLATFORM_GTK)
 
22
                wx_doc_folder += _T("/wx") + wx_version + _T("-doc")
 
23
 
 
24
 
 
25
        //
 
26
        // normally, you shouldn't have to edit anything below this point
 
27
        //
 
28
 
 
29
    local helproot = wx_doc_folder + _T("/wx-manual.html/")
 
30
    if (!IO.DirectoryExists(helproot))
 
31
    {
 
32
        local msg = _T("wxWidgets documentation not found. Its expected location is:\n\n");
 
33
        msg += wx_doc_folder;
 
34
        msg += _T("\n\n");
 
35
        msg += _T("If it is not installed, please install it and try again.\n");
 
36
        msg += _T("If it is installed to a different location, you can edit the wx_help.script to reflect that.");
 
37
        ShowWarning(msg);
 
38
        return;
 
39
    }
 
40
    
 
41
    local prefix = _T("wx") + wx_version + _T("-manual_")
 
42
 
 
43
    // replace "contents" with "classref" below to default to alphabetical class list
 
44
    local defaultpath = prefix + _T("contents.html")
 
45
 
 
46
    // If there is no keyword, launch the default page defined above
 
47
    if (keyword.IsEmpty())
 
48
    {
 
49
        App.Open(helproot + defaultpath, false)
 
50
        return
 
51
    }
 
52
 
 
53
    // convert keyword to lowercase, this should be the class name
 
54
    keyword.MakeLower()
 
55
    local classpath = helproot + prefix + keyword + _T(".html")
 
56
 
 
57
    LogDebug(_T("Opening ") + classpath)
 
58
    if (IO.FileExists(classpath))
 
59
    {
 
60
        App.Open(classpath, false)
 
61
    }
 
62
    else
 
63
    {
 
64
        LogDebug(_T("Not found, opening default page"))
 
65
        App.Open(helproot + defaultpath, false)
 
66
    }
 
67
}