| 1 |
/*=========================================================================== |
| 2 |
Copyright (C) 1995-2005 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 |
/* Attributes groups of colors */ |
| 30 |
/* |
| 31 |
Group 0 : Background (Wheat) -bkg |
| 32 |
Group 1 : Input Fields (PapayaWhip) -inpf |
| 33 |
Group 2 : Action Buttons (PapayaWhip) -act |
| 34 |
Group 3 : Short Help (PaleGreen2) -sh |
| 35 |
Group 4 : Quit Buttons (SeaGreen3) -quit |
| 36 |
Group 5 : Low level steps (Yellow) -lstp |
| 37 |
Group 6 : High level steps (SeaGreen3) -hstp |
| 38 |
*/ |
| 39 |
|
| 40 |
|
| 41 |
/* |
| 42 |
|
| 43 |
.VERSION |
| 44 |
051014 last modif |
| 45 |
|
| 46 |
*/ |
| 47 |
|
| 48 |
#include <ExternResources.h> |
| 49 |
#include <string.h> |
| 50 |
#include <stdio.h> |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
#define NOPT 20 |
| 55 |
|
| 56 |
void SetResources(count, argpntrs) |
| 57 |
|
| 58 |
int count; |
| 59 |
char *argpntrs[]; |
| 60 |
|
| 61 |
{ |
| 62 |
|
| 63 |
int opt,narg,vbmode; |
| 64 |
char Option[NOPT][ShortLen], Resource[NOPT][LongLen]; |
| 65 |
|
| 66 |
strcpy(Option[0],"-tf"); /* Text Font */ |
| 67 |
strcpy(Option[1],"-btf"); /* Bold Text Font */ |
| 68 |
strcpy(Option[2],"-bf"); /* Big Font */ |
| 69 |
strcpy(Option[3],"-bbf"); /* Bold Big Font */ |
| 70 |
strcpy(Option[4],"-tfg"); /* Text Foreground */ |
| 71 |
strcpy(Option[5],"-tbg"); /* Text Background */ |
| 72 |
strcpy(Option[6],"-wbg"); /* Window Background */ |
| 73 |
strcpy(Option[7],"-shbg"); /* Short Help Background */ |
| 74 |
strcpy(Option[8],"-bbg"); /* Button Background */ |
| 75 |
strcpy(Option[9],"-bfg"); /* Button Foreground */ |
| 76 |
strcpy(Option[10],"-ag"); /* Window Geometry */ |
| 77 |
strcpy(Option[11],"-hg"); /* Extended Help Geometry */ |
| 78 |
strcpy(Option[12],"-sbg"); /* Selection Box Geometry */ |
| 79 |
strcpy(Option[13],"NULL"); /* Must terminate the list of options */ |
| 80 |
|
| 81 |
strcpy(Resource[0], TextFont); |
| 82 |
strcpy(Resource[1], BoldTextFont); |
| 83 |
strcpy(Resource[2], BigFont); |
| 84 |
strcpy(Resource[3], BoldBigFont); |
| 85 |
strcpy(Resource[4], TextForeground); |
| 86 |
strcpy(Resource[5], TextBackground); |
| 87 |
strcpy(Resource[6], WindowBackground); |
| 88 |
strcpy(Resource[7], SHelpBackground); |
| 89 |
strcpy(Resource[8], ButtonBackground); |
| 90 |
strcpy(Resource[9], ButtonForeground); |
| 91 |
strcpy(Resource[10], ApplicGeometry); |
| 92 |
strcpy(Resource[11], ExtHelpGeometry); |
| 93 |
strcpy(Resource[12], SelBoxGeometry); |
| 94 |
|
| 95 |
vbmode = 0; |
| 96 |
|
| 97 |
if ( count > 1 ) |
| 98 |
{ |
| 99 |
|
| 100 |
/* Examine once all arguments to detect the verbose mode */ |
| 101 |
|
| 102 |
for (narg = 1; narg < count; narg++) |
| 103 |
{ |
| 104 |
if (strcmp(argpntrs[narg],"-v") == 0) vbmode = 1; |
| 105 |
} |
| 106 |
|
| 107 |
/* Examine all arguments to detect the FileSelection mode |
| 108 |
(option -fs) or modify the default of parametrable |
| 109 |
resources 9list provided by Option[]. |
| 110 |
The value of the resource is assumed to be provided as the |
| 111 |
next argument (e.g. -bkg Blue, and not -bkgBlue ) */ |
| 112 |
|
| 113 |
|
| 114 |
for (narg = 1; narg < count; narg++) |
| 115 |
{ |
| 116 |
if (argpntrs[narg][0] == '-') |
| 117 |
{ |
| 118 |
opt = -1; /* Initialization */ |
| 119 |
while (strcmp(Option[++opt],"NULL") != 0) |
| 120 |
{ |
| 121 |
if (strcmp(Option[opt],argpntrs[narg]) == 0) |
| 122 |
{ |
| 123 |
if (vbmode == 1) |
| 124 |
printf("\n Option %s : \n Default = %s \n New value = %s\n", |
| 125 |
Option[opt], Resource[opt], argpntrs[narg+1]); |
| 126 |
strcpy(Resource[opt],argpntrs[narg+1]); |
| 127 |
} |
| 128 |
} |
| 129 |
} |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
strcpy(TextFont, Resource[0]); |
| 134 |
strcpy(BoldTextFont, Resource[1]); |
| 135 |
strcpy(BigFont, Resource[2]); |
| 136 |
strcpy(BoldBigFont, Resource[3]); |
| 137 |
strcpy(TextForeground, Resource[4]); |
| 138 |
strcpy(TextBackground, Resource[5]); |
| 139 |
strcpy(WindowBackground, Resource[6]); |
| 140 |
strcpy(SHelpBackground, Resource[7]); |
| 141 |
strcpy(ButtonBackground, Resource[8]); |
| 142 |
strcpy(ButtonForeground, Resource[9]); |
| 143 |
strcpy(ApplicGeometry, Resource[10]); |
| 144 |
strcpy(ExtHelpGeometry, Resource[11]); |
| 145 |
strcpy(SelBoxGeometry, Resource[12]); |
| 146 |
|
| 147 |
} |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|