1 | // |
---|
2 | // "$Id: help.cxx 8176 2011-01-04 00:53:13Z matt $" |
---|
3 | // |
---|
4 | // Fl_Help_Dialog test program. |
---|
5 | // |
---|
6 | // Copyright 1999-2010 by Easy Software Products. |
---|
7 | // |
---|
8 | // This library is free software; you can redistribute it and/or |
---|
9 | // modify it under the terms of the GNU Library General Public |
---|
10 | // License as published by the Free Software Foundation; either |
---|
11 | // version 2 of the License, or (at your option) any later version. |
---|
12 | // |
---|
13 | // This library is distributed in the hope that it will be useful, |
---|
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | // Library General Public License for more details. |
---|
17 | // |
---|
18 | // You should have received a copy of the GNU Library General Public |
---|
19 | // License along with this library; if not, write to the Free Software |
---|
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
21 | // USA. |
---|
22 | // |
---|
23 | // Please report all bugs and problems on the following page: |
---|
24 | // |
---|
25 | // http://www.fltk.org/str.php |
---|
26 | // |
---|
27 | // Contents: |
---|
28 | // |
---|
29 | // main() - Display the help GUI... |
---|
30 | // |
---|
31 | |
---|
32 | // |
---|
33 | // Include necessary headers... |
---|
34 | // |
---|
35 | |
---|
36 | #include <FL/Fl_Help_Dialog.H> |
---|
37 | |
---|
38 | |
---|
39 | #ifdef USING_XCODE |
---|
40 | #include <ApplicationServices/ApplicationServices.h> |
---|
41 | void set_app_dir() { |
---|
42 | char app_path[2048]; |
---|
43 | CFBundleRef app = CFBundleGetMainBundle(); |
---|
44 | CFURLRef url = CFBundleCopyBundleURL(app); |
---|
45 | CFStringRef cc_app_path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle); |
---|
46 | CFStringGetCString(cc_app_path, app_path, 2048, kCFStringEncodingUTF8); |
---|
47 | if (*app_path) { |
---|
48 | char *n = strrchr(app_path, '/'); |
---|
49 | if (n) { |
---|
50 | *n = 0; |
---|
51 | chdir(app_path); |
---|
52 | } |
---|
53 | } |
---|
54 | } |
---|
55 | #endif |
---|
56 | |
---|
57 | |
---|
58 | // |
---|
59 | // 'main()' - Display the help GUI... |
---|
60 | // |
---|
61 | |
---|
62 | int // O - Exit status |
---|
63 | main(int argc, // I - Number of command-line arguments |
---|
64 | char *argv[]) // I - Command-line arguments |
---|
65 | { |
---|
66 | Fl_Help_Dialog *help; // Help dialog |
---|
67 | |
---|
68 | |
---|
69 | help = new Fl_Help_Dialog; |
---|
70 | |
---|
71 | int argn = 1; |
---|
72 | |
---|
73 | #ifdef USING_XCODE |
---|
74 | |
---|
75 | if (argc>argn && strncmp(argv[1], "-psn_", 5)==0) |
---|
76 | argn++; |
---|
77 | set_app_dir(); |
---|
78 | |
---|
79 | if (argc <= argn) |
---|
80 | help->load("../../../../documentation/html/intro.html"); |
---|
81 | else |
---|
82 | help->load(argv[argn]); |
---|
83 | |
---|
84 | #else |
---|
85 | |
---|
86 | if (argc <= argn) |
---|
87 | help->load("../documentation/html/intro.html"); |
---|
88 | else |
---|
89 | help->load(argv[1]); |
---|
90 | |
---|
91 | #endif |
---|
92 | |
---|
93 | help->show(1, argv); |
---|
94 | |
---|
95 | Fl::run(); |
---|
96 | |
---|
97 | delete help; |
---|
98 | |
---|
99 | return (0); |
---|
100 | } |
---|
101 | |
---|
102 | |
---|
103 | // |
---|
104 | // End of "$Id: help.cxx 8176 2011-01-04 00:53:13Z matt $". |
---|
105 | // |
---|