!-----------------------------------------------------------------------
!  Support procedure for the Help menu in the widget. A button will
! be built with the GUI\URI command if the input file exists, or with
! the GUI\BUTTON command (which prints the appropriate message) if not.
! The first argument is assumed to be a local file (and not a remote
! URL).
!   Arguments:
!     1  File (full path)
!     2  Button name
!-----------------------------------------------------------------------
!
begin procedure gui-button-help-message
  define character*15 rname
  let rname "GUI-BUTTON-HELP"
  !
  define character*6 version
  let version `gag_version`
  message e 'rname' "File &1 not found"
  message i 'rname' "You have two ways to install the documentation:"
  message i 'rname' "1) from the sources, type ""make doc"" and ""make install-doc"""
  message i 'rname' "   (this requires several dependencies), or"
  message i 'rname' "2) download the file ""gildas-doc-"'version'".tar.gz"" from"
  message i 'rname' "   http://www.iram.fr/IRAMFR/GILDAS/, uncompress it, and replace"
  message i 'rname' "   the doc/ directory in your ""gildas-exe-"'version'""" installation."
  !
  return error
end procedure gui-button-help-message

define character*15 rname
let rname "GUI-BUTTON-HELP"
!
if pro%narg.ne.2 then
  message e 'rname' "Invalid number of arguments"
  message e 'rname' "Arguments must be 1) the file path and 2) the button name"
  return error
endif
!
if file("&1") then
  gui\uri "&1" "&2"
else
  gui\button "@ gui-button-help-message &1"  "&2"
endif
