2001-08-02 23:43:49 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// "$Id$"
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
2001-09-29 18:38:59 +04:00
|
|
|
// Fl_Help_Dialog test program.
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
2010-11-29 00:06:39 +03:00
|
|
|
// Copyright 1999-2010 by Easy Software Products.
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/COPYING.php
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
2005-04-16 04:13:17 +04:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
|
|
|
// Contents:
|
|
|
|
//
|
|
|
|
// main() - Display the help GUI...
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// Include necessary headers...
|
|
|
|
//
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
#include <FL/Fl_Help_Dialog.H>
|
2001-08-02 23:43:49 +04:00
|
|
|
|
|
|
|
|
2011-01-04 03:53:13 +03:00
|
|
|
#ifdef USING_XCODE
|
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
|
|
|
void set_app_dir() {
|
|
|
|
char app_path[2048];
|
|
|
|
CFBundleRef app = CFBundleGetMainBundle();
|
|
|
|
CFURLRef url = CFBundleCopyBundleURL(app);
|
|
|
|
CFStringRef cc_app_path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
|
|
|
|
CFStringGetCString(cc_app_path, app_path, 2048, kCFStringEncodingUTF8);
|
|
|
|
if (*app_path) {
|
|
|
|
char *n = strrchr(app_path, '/');
|
|
|
|
if (n) {
|
|
|
|
*n = 0;
|
|
|
|
chdir(app_path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
|
|
|
// 'main()' - Display the help GUI...
|
|
|
|
//
|
|
|
|
|
|
|
|
int // O - Exit status
|
|
|
|
main(int argc, // I - Number of command-line arguments
|
|
|
|
char *argv[]) // I - Command-line arguments
|
|
|
|
{
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_Help_Dialog *help; // Help dialog
|
2001-08-02 23:43:49 +04:00
|
|
|
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
help = new Fl_Help_Dialog;
|
2001-08-02 23:43:49 +04:00
|
|
|
|
2011-01-04 03:53:13 +03:00
|
|
|
int argn = 1;
|
|
|
|
|
|
|
|
#ifdef USING_XCODE
|
|
|
|
|
2015-04-09 14:05:36 +03:00
|
|
|
if (argc>argn && strncmp(argv[1], "-psn_", 5)==0) argn++;
|
|
|
|
else if (argc>argn && strncmp(argv[1], "-NSDocumentRevisionsDebugMode", 29)==0) argn += 2;
|
2011-01-04 03:53:13 +03:00
|
|
|
set_app_dir();
|
|
|
|
|
|
|
|
if (argc <= argn)
|
2014-02-09 00:44:09 +04:00
|
|
|
help->load("../../../../test/help-test.html");
|
2011-01-04 03:53:13 +03:00
|
|
|
else
|
|
|
|
help->load(argv[argn]);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
if (argc <= argn)
|
2014-02-09 00:44:09 +04:00
|
|
|
help->load("help-test.html");
|
2001-08-02 23:43:49 +04:00
|
|
|
else
|
|
|
|
help->load(argv[1]);
|
2011-01-04 03:53:13 +03:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2004-07-27 00:52:52 +04:00
|
|
|
help->show(1, argv);
|
2001-08-02 23:43:49 +04:00
|
|
|
|
|
|
|
Fl::run();
|
|
|
|
|
|
|
|
delete help;
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// End of "$Id$".
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|