3
/*--------------------------------------------------------------------------*/
4
/* fig specific section */
5
/*--------------------------------------------------------------------------*/
7
typedef struct figrecord {
8
int bgnd, fgnd, fontno;
11
static int fig_fontsize; /* XFIG specifics */
12
static int fig_fontno_offset; /* 0=Tms,12=Cour,16=Helv,28=Palat */
13
static figrecord figrec[5];
15
static int fig_fontno; /* current values go here*/
16
static int fig_fgnd, fig_bgnd; /* ... to here*/
18
static void menu_fig(figrecord *figrec, BOOL *lc, char *txt, char *parstring)
24
printf("\n----------------------------------------------------------------\n"
25
"Enter the text attributes for printing of **>%s<** residues:\n",
27
printf("First choose the color/gray-value of the letter **>background<**\n"
28
"Different letters specify different colors,\n"
29
"(B) black (W) white (1,2,3,4) 4 different gray values, 4 is darkest\n\n"
30
"choose from BW1234 ( * %c * ) : ", parstring[0]);
31
Fgets(instring, 51, stdin);
34
if (*instring == '\0')
39
if (strchr("BW1234", code) == NULL)
42
case 'B': figrec->bgnd = 21; break;
43
case 'W': figrec->bgnd = 0; break;
44
case '1': figrec->bgnd = 4; break;
45
case '2': figrec->bgnd = 8; break;
46
case '3': figrec->bgnd = 12; break;
47
case '4': figrec->bgnd = 16; break;
50
printf("\n\nNow choose the color/gray-value of the letter **>foreground<**\n"
51
"lowercase choices mean lowercase letters in the sequence:\n"
52
"(B,b) black,normal (E,e) black, emphasized\n"
53
"(W,w) white normal (F,f) white, emphasized\n"
54
"(L,l) Blue (M,m) Magenta (Y,y) Yellow (G,g) Green (R,r) Red\n\n"
55
"choose from BbEeWwFfLlMmYyGgRr ( * %c * ) : ", parstring[1]);
56
Fgets(instring, 51, stdin);
59
if (*instring == '\0')
63
if (strchr("BEWFLMYGR", toupper(code)) == NULL)
108
static void ask_fig(void)
115
printf("-------------------------------------------------------------\n");
116
Fgets(parstring, 6, parfile);
118
menu_fig(&figrec[0], &lc[0], "different", parstring);
119
Fgets(parstring, 6, parfile);
121
menu_fig(&figrec[1], &lc[1], "identical", parstring);
122
Fgets(parstring, 6, parfile);
125
menu_fig(&figrec[2], &lc[2], "similar", parstring);
127
figrec[2] = figrec[0];
130
Fgets(parstring, 6, parfile);
133
menu_fig(&figrec[3], &lc[3], "conserved", parstring);
135
figrec[3] = figrec[1];
140
figrec[4].fontno = 0;
143
fscanf(parfile, "%d%*[^\n]", &fig_fontno_offset);
145
fscanf(parfile, "%d%*[^\n]", &fig_fontsize);
149
printf("Character size in Points ( * %4d * ) : ", fig_fontsize);
150
Fgets(instring, 41, stdin);
151
if (*instring != '\0')
152
fig_fontsize = str2int((void *)instring);
153
} while (fig_fontsize < 1 || fig_fontsize > 100);
156
printf("name of fig-file : ");
162
static void FIGinit(double *xpos, double *ypos) {
163
assert(outopen(&outfile, outname) != NULL);
164
dev_minx = fig_fontsize * 4.0;
165
dev_miny = fig_fontsize * 4.0;
168
dev_xsize = fig_fontsize + 1.0;
169
dev_ysize = fig_fontsize;
172
uwriteln(&outfile, "#FIG 2.1");
173
uwriteln(&outfile, "80 2");
176
static void FIGsetcolor(int colno) {
177
dev_xsize = fig_fontsize + 1.0;
178
fig_fontno = fig_fontno_offset + figrec[colno].fontno;
179
fig_fgnd = figrec[colno].fgnd;
180
fig_bgnd = figrec[colno].bgnd;
183
static void FIGcharout(char c, double *xpos, double *ypos) {
185
if (fig_bgnd > 0) { /*draw box*/
186
double bxshift, byshift;
187
int bx1, by1, bx2, by2;
189
bxshift = fig_fontsize * 0.25;
190
byshift = fig_fontsize * 0.15;
191
bx1 = (int)(*xpos + 0.5 - bxshift);
192
bx2 = (int)(*xpos + dev_xsize + 0.5 - bxshift);
193
by2 = (int)(*ypos + 0.5 + byshift);
194
by1 = (int)(*ypos - dev_ysize + 0.5 + byshift);
197
uwriteln(&outfile, "6 %5d%5d%5d%5d", bx2, by1, bx1, by2);
198
uwriteln(&outfile, "2 2 0 0 0 5 0 " /*box*/
199
"%3d 0.0 0 0 0", fig_bgnd);
200
fprintf(outfile.f, "\t ");
201
fprintf(outfile.f, "%5d%5d%5d%5d%5d%5d", bx2, by2, bx2, by1, bx1, by1);
202
uwriteln(&outfile, "%5d%5d%5d%5d 9999 9999", bx1, by2, bx2, by2);
205
fprintf(outfile.f, "4 0 %2d%3d", fig_fontno, fig_fontsize);
206
fprintf(outfile.f, " 0 %2d 0 0.0 4 ", fig_fgnd);
207
fprintf(outfile.f, "%3ld%3ld",(long)(dev_ysize+0.5), (long)(dev_xsize+0.5));
208
fprintf(outfile.f, "%5ld%5ld %c",(long)(*xpos+0.5), (long)(*ypos+0.5), c);
209
uwriteln(&outfile, "\001");
211
if (fig_bgnd > 0) /*end of compound*/
212
uwriteln(&outfile, "-6");
217
static void FIGnewline(double *xpos, double *ypos) {
222
static void FIGnewpage(double *xpos, double *ypos) {
223
/* this should never happen*/
224
FIGnewline(xpos, ypos);
227
static void FIGexit(void) {
228
if (outfile.f != NULL)
233
GraphicsDevice Fig = {