You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.3KB

  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. // Include necessary headers...
  33. //
  34. #include <FL/Fl_Help_Dialog.H>
  35. #ifdef USING_XCODE
  36. #include <ApplicationServices/ApplicationServices.h>
  37. void set_app_dir() {
  38. char app_path[2048];
  39. CFBundleRef app = CFBundleGetMainBundle();
  40. CFURLRef url = CFBundleCopyBundleURL(app);
  41. CFStringRef cc_app_path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
  42. CFStringGetCString(cc_app_path, app_path, 2048, kCFStringEncodingUTF8);
  43. if (*app_path) {
  44. char *n = strrchr(app_path, '/');
  45. if (n) {
  46. *n = 0;
  47. chdir(app_path);
  48. }
  49. }
  50. }
  51. #endif
  52. //
  53. // 'main()' - Display the help GUI...
  54. //
  55. int // O - Exit status
  56. main(int argc, // I - Number of command-line arguments
  57. char *argv[]) // I - Command-line arguments
  58. {
  59. Fl_Help_Dialog *help; // Help dialog
  60. help = new Fl_Help_Dialog;
  61. int argn = 1;
  62. #ifdef USING_XCODE
  63. if (argc>argn && strncmp(argv[1], "-psn_", 5)==0)
  64. argn++;
  65. set_app_dir();
  66. if (argc <= argn)
  67. help->load("../../../../documentation/html/intro.html");
  68. else
  69. help->load(argv[argn]);
  70. #else
  71. if (argc <= argn)
  72. help->load("../documentation/html/intro.html");
  73. else
  74. help->load(argv[1]);
  75. #endif
  76. help->show(1, argv);
  77. Fl::run();
  78. delete help;
  79. return (0);
  80. }
  81. //
  82. // End of "$Id: help.cxx 8176 2011-01-04 00:53:13Z matt $".
  83. //