| 1 |
/*=========================================================================== |
| 2 |
Copyright (C) 1995-2009 European Southern Observatory (ESO) |
| 3 |
|
| 4 |
This program is free software; you can redistribute it and/or |
| 5 |
modify it under the terms of the GNU General Public License as |
| 6 |
published by the Free Software Foundation; either version 2 of |
| 7 |
the License, or (at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public |
| 15 |
License along with this program; if not, write to the Free |
| 16 |
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, |
| 17 |
MA 02139, USA. |
| 18 |
|
| 19 |
Correspondence concerning ESO-MIDAS should be addressed as follows: |
| 20 |
Internet e-mail: [email protected] |
| 21 |
Postal address: European Southern Observatory |
| 22 |
Data Management Division |
| 23 |
Karl-Schwarzschild-Strasse 2 |
| 24 |
D 85748 Garching bei Muenchen |
| 25 |
GERMANY |
| 26 |
===========================================================================*/ |
| 27 |
|
| 28 |
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ |
| 29 |
/* .IDENT misc.c */ |
| 30 |
/* .AUTHORS Pascal Ballester (ESO/Garching) */ |
| 31 |
/* Cristian Levin (ESO/La Silla) */ |
| 32 |
/* .KEYWORDS XLong, Spectroscopy, Long-Slit */ |
| 33 |
/* .PURPOSE */ |
| 34 |
/* .VERSION 1.0 Package Creation 17-MAR-1993 */ |
| 35 |
/* */ |
| 36 |
/* 090819 */ |
| 37 |
/* ------------------------------------------------------- */ |
| 38 |
|
| 39 |
#include <gl_defs.h> |
| 40 |
#include <xm_defs.h> |
| 41 |
#include <main_defs.h> |
| 42 |
#include <spec_comm.h> |
| 43 |
#include <UxLib.h> |
| 44 |
|
| 45 |
#include <midas_def.h> |
| 46 |
|
| 47 |
|
| 48 |
#define HELP_FILE "gui/XIdent/help/ident.hlp" |
| 49 |
#define HELP_DELIMITER '~' |
| 50 |
|
| 51 |
static char help_text[4000]; /* Max of 50 lines */ |
| 52 |
|
| 53 |
void DisplayShortHelp( sw ) |
| 54 |
Widget sw; /* current widget */ |
| 55 |
{ |
| 56 |
char s[256]; |
| 57 |
|
| 58 |
s[0] = '\0'; |
| 59 |
|
| 60 |
if ( sw == UxGetWidget(UxFindSwidget("pb_begin")) ) |
| 61 |
strcpy(s, "Begin the identification process"); |
| 62 |
else if ( sw == UxGetWidget(UxFindSwidget("pb_continue")) ) |
| 63 |
strcpy(s, "Add more identifications"); |
| 64 |
else if ( sw == UxGetWidget(UxFindSwidget("pb_delete")) ) |
| 65 |
strcpy(s, "Delete existent identifications"); |
| 66 |
|
| 67 |
if ( s[0] != '\0' ) |
| 68 |
UxPutText(UxFindSwidget("SHelp"), s); |
| 69 |
} |
| 70 |
|
| 71 |
void DisplayExtendedHelp( sw ) |
| 72 |
Widget sw; /* current widget */ |
| 73 |
{ |
| 74 |
char s[4000]; |
| 75 |
char *find_extended_help(); |
| 76 |
|
| 77 |
s[0] = '\0'; |
| 78 |
|
| 79 |
if ( sw == UxGetWidget(UxFindSwidget("menu_help_window")) ) |
| 80 |
strcpy(s, find_extended_help("HELP_WINDOW")); |
| 81 |
else if ( sw == UxGetWidget(UxFindSwidget("pb_begin")) ) |
| 82 |
strcpy(s, find_extended_help("IDENT_BEGIN")); |
| 83 |
else if ( sw == UxGetWidget(UxFindSwidget("pb_continue")) ) |
| 84 |
strcpy(s, find_extended_help("IDENT_CONTINUE")); |
| 85 |
else if ( sw == UxGetWidget(UxFindSwidget("pb_delete")) ) |
| 86 |
strcpy(s, find_extended_help("IDENT_DELETE")); |
| 87 |
|
| 88 |
if ( s[0] != '\0' ) { |
| 89 |
UxPopupInterface(UxFindSwidget("HelpShell"), no_grab); |
| 90 |
UxPutText(UxFindSwidget("tx_extended_help"), s); |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
char *find_extended_help( key ) |
| 95 |
char *key; |
| 96 |
{ |
| 97 |
char midashome[512], midvers[80], help_pathname[512]; |
| 98 |
char c, h, s[MAXLINE]; |
| 99 |
FILE *fp; |
| 100 |
int idx = 0; |
| 101 |
|
| 102 |
osfphname("MIDVERS", midvers); |
| 103 |
osfphname("MIDASHOME", midashome); |
| 104 |
sprintf( help_pathname, "%s/%s/%s", midashome, midvers, HELP_FILE ); |
| 105 |
if ( (fp = fopen(help_pathname, "r")) == NULL ) { |
| 106 |
sprintf(s, "XLong Help file [%s] not found.\r\n", help_pathname); |
| 107 |
SCTPUT(s); |
| 108 |
return(""); |
| 109 |
} |
| 110 |
|
| 111 |
while ( (c = getc(fp)) != EOF ) |
| 112 |
if ( c == HELP_DELIMITER && |
| 113 |
!strncmp(key, fgets(s, MAXLINE, fp), strlen(key)) ) { |
| 114 |
while ( (h = getc(fp)) != EOF && h != HELP_DELIMITER ) |
| 115 |
help_text[idx++] = h; |
| 116 |
help_text[idx] = '\0'; |
| 117 |
fclose(fp); |
| 118 |
return(help_text); |
| 119 |
} |
| 120 |
fclose(fp); |
| 121 |
return(""); |
| 122 |
} |