33
int color = 0, fontsize = PS_FONT_DEFAULT_SIZE;
36
int fontsize = PS_FONT_DEFAULT_SIZE;
36
40
char ch, *key, *data;
41
PSCOLOR color, text_color;
38
43
PS.grid_font = G_store("Helvetica");
39
44
PS.grid_fontsize = 0;
40
PS.grid_color = BLACK;
41
45
PS.grid_numbers = 0;
42
46
PS.grid_cross = 0.;
43
47
PS.grid_width = 0.25;
48
set_color(&color, 0, 0, 0);
49
set_color(&text_color, 0, 0, 0);
45
51
while (input(2, buf, help)) {
46
52
if (!key_data(buf, &key, &data))
49
55
if (KEY("color")) {
50
color = get_color_number(data);
52
error(key, data, "illegal color request");
56
ret = G_str_to_color(data, &r, &g, &b);
58
set_color(&color, r, g, b);
59
else if (ret == 2) /* i.e. "none" */
60
/* unset_color(&color); */
61
error(key, data, _("Unsupported color request"));
54
PS.grid_color = color;
63
error(key, data, _("illegal color request"));
61
71
if (strlen(data) == 0) {
73
set_color(&text_color, 0, 0, 0);
66
76
switch (sscanf(data, "%d %[^\n]", &spacing, temp)) {
78
set_color(&text_color, 0, 0, 0);
71
color = get_color_number(temp);
81
ret = G_str_to_color(temp, &r, &g, &b);
83
set_color(&text_color, r, g, b);
84
else if (ret == 2) /* i.e. "none" */
85
error(key, data, _("Unsupported color request"));
87
error(key, data, _("illegal color request"));
77
error(key, data, "illegal numbers request");
95
error(key, data, _("illegal numbers request"));
79
97
PS.grid_numbers = spacing;
80
PS.grid_numbers_color = color;
98
PS.grid_numbers_color = text_color;
105
123
if ((sscanf(data, "%lf%c", &PS.grid_width, &ch) < 1) ||
106
124
(PS.grid_width < 0.)) {
107
125
PS.grid_width = 1.;
108
error(key, data, "illegal grid width request");
126
error(key, data, _("illegal grid width request"));
111
PS.grid_width = PS.grid_width / 72.0;
129
PS.grid_width = PS.grid_width * 72.0;
114
error(key, data, "illegal request (getgrid)");
132
error(key, data, _("illegal request (grid)"));
117
135
PS.grid_fontsize = fontsize;
136
PS.grid_color = color;
125
144
int getgeogrid(void)
128
int color = 0, fontsize = PS_FONT_DEFAULT_SIZE;
147
int fontsize = PS_FONT_DEFAULT_SIZE;
131
151
char ch, *key, *data;
152
PSCOLOR color, text_color;
133
154
PS.geogrid_font = G_store("Helvetica");
134
155
PS.geogrid_fontsize = 0;
135
PS.geogrid_color = BLACK;
136
156
PS.geogrid_numbers = 0;
137
157
PS.geogrid_width = 0.25;
158
set_color(&color, 0, 0, 0);
159
set_color(&text_color, 0, 0, 0);
139
161
while (input(2, buf, help2)) {
140
162
if (!key_data(buf, &key, &data))
143
165
if (KEY("color")) {
144
color = get_color_number(data);
146
error(key, data, "illegal color request");
166
ret = G_str_to_color(data, &r, &g, &b);
168
set_color(&color, r, g, b);
169
else if (ret == 2) /* i.e. "none" */
170
/* unset_color(&color); */
171
error(key, data, _("Unsupported color request"));
148
PS.geogrid_color = color;
173
error(key, data, _("illegal color request"));
155
181
if (strlen(data) == 0) {
183
set_color(&text_color, 0, 0, 0);
160
186
switch (sscanf(data, "%d %[^\n]", &spacing, temp)) {
188
set_color(&text_color, 0, 0, 0);
165
color = get_color_number(temp);
191
ret = G_str_to_color(temp, &r, &g, &b);
193
set_color(&text_color, r, g, b);
194
else if (ret == 2) /* i.e. "none" */
195
error(key, data, _("Unsupported color request"));
197
error(key, data, _("illegal color request"));
172
error(key, data, "illegal numbers request");
206
error(key, data, _("illegal numbers request"));
174
208
PS.geogrid_numbers = spacing;
175
PS.geogrid_numbers_color = color;
209
PS.geogrid_numbers_color = text_color;
197
231
if ((sscanf(data, "%lf%c", &PS.geogrid_width, &ch) < 1) ||
198
232
(PS.geogrid_width < 0.)) {
199
233
PS.geogrid_width = 1.;
200
error(key, data, "illegal grid width request");
234
error(key, data, _("illegal grid width request"));
203
PS.geogrid_width = PS.geogrid_width / 72.0;
237
PS.geogrid_width = PS.geogrid_width * 72.0;
206
error(key, data, "illegal request (getgrid)");
240
error(key, data, _("illegal request (geogrid)"));
209
243
PS.geogrid_fontsize = fontsize;
244
PS.geogrid_color = color;