3
/*----------------------------------------*/
4
/* RTF specific section */
5
/*----------------------------------------*/
7
typedef struct rtfrecord {
11
static rtfrecord rtfrec[5]; /*RTF-specifics*/
14
static void menu_rtf(rtfrecord *rtfrec, BOOL *lc, char *txt, char *parstring)
20
printf("\n-------------------------------------------------------------\n"
21
"Enter the text attributes for printing of ***>%s<*** residues:\n", txt);
22
printf("First choose the color/gray-value of the letter ***>background<***\n"
23
"Different letters specify different colors,\n"
24
"!! Background colors are not supported on most RTF-programs !!\n"
25
"(R) red (G) green (B) blue (C) cyan\n"
26
"(M) magenta (Y) yellow (K) black (W) white\n"
27
"(D) dark gray (L) light gray\n\n"
28
"choose from RGBCMYKWDL ( * %c * ) : ", parstring[0]);
29
Fgets(instring, 41, stdin);
32
if (*instring == '\0')
37
if (strchr("RGBCMYKWDL", code) == NULL)
40
case 'R': rtfrec->bgnd = 2; break;
41
case 'G': rtfrec->bgnd = 3; break;
42
case 'B': rtfrec->bgnd = 4; break;
43
case 'C': rtfrec->bgnd = 5; break;
44
case 'M': rtfrec->bgnd = 6; break;
45
case 'Y': rtfrec->bgnd = 7; break;
46
case 'K': rtfrec->bgnd = 0; break;
47
case 'W': rtfrec->bgnd = 1; break;
48
case 'D': rtfrec->bgnd = 8; break;
49
case 'L': rtfrec->bgnd = 9; break;
52
printf("\n\nNow choose the color/gray-value of the letter ***>foreground<***\n"
53
"lowercase choices mean lowercase letters in the sequence:\n"
54
"(R) red (G) green (B) blue (C) cyan\n"
55
"(M) magenta (Y) yellow (K) black (W) white\n"
56
"(D) dark gray (L) light gray\n\n"
57
"choose from RrGgBbCcMmYyKkWwDdLl ( * %c * ) : ", parstring[1]);
58
Fgets(instring, 41, stdin);
61
if (*instring == '\0')
65
if (strchr("RGBCMYKWDL", code) == NULL)
70
case 'R': rtfrec->fgnd = 2; break;
71
case 'G': rtfrec->fgnd = 3; break;
72
case 'B': rtfrec->fgnd = 4; break;
73
case 'C': rtfrec->fgnd = 5; break;
74
case 'M': rtfrec->fgnd = 6; break;
75
case 'Y': rtfrec->fgnd = 7; break;
76
case 'K': rtfrec->fgnd = 0; break;
77
case 'W': rtfrec->fgnd = 1; break;
78
case 'D': rtfrec->fgnd = 8; break;
79
case 'L': rtfrec->fgnd = 9; break;
84
static void ask_rtf(void)
90
printf("-------------------------------------------------------------\n");
93
Fgets(parstring, 6, parfile);
95
menu_rtf(rtfrec, lc, "different", parstring);
96
Fgets(parstring, 6, parfile);
98
menu_rtf(&rtfrec[1], &lc[1], "identical", parstring);
99
Fgets(parstring, 6, parfile);
102
menu_rtf(&rtfrec[2], &lc[2], "similar", parstring);
104
rtfrec[2] = rtfrec[0];
107
Fgets(parstring, 6, parfile);
110
menu_rtf(&rtfrec[3], &lc[3], "conserved", parstring);
112
rtfrec[3] = rtfrec[1];
118
fscanf(parfile, "%d%*[^\n]", &rtfcell);
122
printf("Character size in Points ( * %2d * ) : ", rtfcell);
123
Fgets(instring, 41, stdin);
124
if (*instring != '\0')
125
rtfcell = str2int((void *)instring);
126
} while (rtfcell < 1 || rtfcell > 40);
129
printf("filename for RTF-output : ");
135
static void RTFinit(double *xpos, double *ypos) {
140
dev_xsize = rtfcell * 120.0 / 10;
141
dev_ysize = rtfcell * 20.0;
144
assert(outopen(&outfile, outname) != NULL);
145
uwriteln(&outfile, "{\\rtf1\\ansi\\deff0");
146
uwriteln(&outfile, "{\\fonttbl{\\f0\\fmodern Courier New;}}");
147
uwriteln(&outfile, "{\\info{\\author BOXSHADE}}");
148
uwriteln(&outfile, "{\\colortbl\n"
149
"\\red0\\green0\\blue0;"
150
"\\red255\\green255\\blue255;"
151
"\\red255\\green0\\blue0;"
152
"\\red0\\green255\\blue0;"
153
"\\red0\\green0\\blue255;"
154
"\\red0\\green255\\blue255;"
155
"\\red255\\green0\\blue255;"
156
"\\red255\\green255\\blue0;"
157
"\\red128\\green128\\blue128;"
158
"\\red192\\green192\\blue192;}");
159
uwriteln(&outfile, "\\paperw11880\\paperh16820\\margl1000\\margr500");
160
uwriteln(&outfile, "\\margt910\\margb910\\sectd\\cols1\\pard\\plain");
161
uwriteln(&outfile, "\\fs%d", rtfcell * 2);
164
static void RTFsetcolor(int colno) {
165
uwriteln(&outfile, "");
166
fprintf(outfile.f, "\\highlight%d\\cf%d ",
167
rtfrec[colno].bgnd, rtfrec[colno].fgnd);
170
static void RTFcharout(char c, double *xpos, double *ypos) {
175
static void RTFnewline(double *xpos, double *ypos) {
176
uwriteln(&outfile, "\n\\highlight%d\\cf%d \\line",
177
rtfrec[0].bgnd, rtfrec[0].fgnd);
182
static void RTFnewpage(double *xpos, double *ypos) {
183
uwriteln(&outfile, "\\page");
188
static void RTFexit(void) {
189
uwriteln(&outfile, "}");
190
if (outfile.f != NULL)
196
GraphicsDevice Rtf = {