[GRASS-SVN] r55176 - grass/branches/releasebranch_6_4/ps/ps.map
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Feb 22 03:46:49 PST 2013
Author: hamish
Date: 2013-02-22 03:46:48 -0800 (Fri, 22 Feb 2013)
New Revision: 55176
Modified:
grass/branches/releasebranch_6_4/ps/ps.map/do_geogrid.c
grass/branches/releasebranch_6_4/ps/ps.map/do_grid.c
grass/branches/releasebranch_6_4/ps/ps.map/do_header.c
grass/branches/releasebranch_6_4/ps/ps.map/getgrid.c
grass/branches/releasebranch_6_4/ps/ps.map/header.h
grass/branches/releasebranch_6_4/ps/ps.map/key_data.c
grass/branches/releasebranch_6_4/ps/ps.map/local_proto.h
grass/branches/releasebranch_6_4/ps/ps.map/main.c
grass/branches/releasebranch_6_4/ps/ps.map/ps_fclrtbl.c
grass/branches/releasebranch_6_4/ps/ps.map/ps_info.h
grass/branches/releasebranch_6_4/ps/ps.map/ps_outline.c
grass/branches/releasebranch_6_4/ps/ps.map/r_cell.c
grass/branches/releasebranch_6_4/ps/ps.map/r_header.c
Log:
backport of RGB support and bugfixes from devbr6 (#192)
Modified: grass/branches/releasebranch_6_4/ps/ps.map/do_geogrid.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/do_geogrid.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/do_geogrid.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -55,7 +55,7 @@
/* set color and set line width */
- set_rgb_color(PS.geogrid_color);
+ set_ps_color(&PS.geogrid_color);
set_line_width(PS.geogrid_width);
/* draw horizontal lines in 3 pieces -- lat-lon lines must not
@@ -167,7 +167,7 @@
/* initialize */
set_font_name(PS.geogrid_font);
set_font_size(PS.geogrid_fontsize);
- set_rgb_color(PS.geogrid_numbers_color);
+ set_ps_color(&PS.geogrid_numbers_color);
first = 1;
/* vertical grid numbers
@@ -205,7 +205,7 @@
text_box_path(x, y, RIGHT, CENTER, num_text, PS.geogrid_fontsize, 0);
set_rgb_color(WHITE);
fprintf(PS.fp, "F ");
- set_rgb_color(PS.geogrid_numbers_color);
+ set_ps_color(&PS.geogrid_numbers_color);
fprintf(PS.fp, "TIB\n");
last_bottom = y - PS.geogrid_fontsize;
if (first) {
@@ -249,7 +249,7 @@
fprintf(PS.fp, "%d bt bb sub D2 add mg sub neg TR TB\n", x);
set_rgb_color(WHITE);
fprintf(PS.fp, "F ");
- set_rgb_color(PS.geogrid_numbers_color);
+ set_ps_color(&PS.geogrid_numbers_color);
fprintf(PS.fp, "TIB\n");
last_right = x + PS.geogrid_fontsize;
}
Modified: grass/branches/releasebranch_6_4/ps/ps.map/do_grid.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/do_grid.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/do_grid.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -27,7 +27,7 @@
return 1;
/* set color and set line width to 1 */
- set_rgb_color(PS.grid_color);
+ set_ps_color(&PS.grid_color);
set_line_width(PS.grid_width);
/* draw horizontal lines in 3 pieces -- lat-lon lines must not
@@ -85,7 +85,7 @@
return 1;
/* set color and set line width to 1 */
- set_rgb_color(PS.grid_color);
+ set_ps_color(&PS.grid_color);
set_line_width(PS.grid_width);
g_north = floor(PS.w.north / PS.grid) * PS.grid;
@@ -139,7 +139,7 @@
/* initialize */
set_font_name(PS.grid_font);
set_font_size(PS.grid_fontsize);
- set_rgb_color(PS.grid_numbers_color);
+ set_ps_color(&PS.grid_numbers_color);
first = 1;
/* horizontal grid numbers
@@ -172,7 +172,7 @@
text_box_path(x, y, LEFT, CENTER, num_text, PS.grid_fontsize, 0);
set_rgb_color(WHITE);
fprintf(PS.fp, "F ");
- set_rgb_color(PS.grid_numbers_color);
+ set_ps_color(&PS.grid_numbers_color);
fprintf(PS.fp, "TIB\n");
last_bottom = y - PS.grid_fontsize;
if (first) {
@@ -211,7 +211,7 @@
fprintf(PS.fp, "%d bt bb sub D2 add mg sub neg TR TB\n", x);
set_rgb_color(WHITE);
fprintf(PS.fp, "F ");
- set_rgb_color(PS.grid_numbers_color);
+ set_ps_color(&PS.grid_numbers_color);
fprintf(PS.fp, "TIB\n");
last_right = x + PS.grid_fontsize;
}
Modified: grass/branches/releasebranch_6_4/ps/ps.map/do_header.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/do_header.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/do_header.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -20,7 +20,7 @@
char temp[100];
/* set color and font */
- set_rgb_color(hdr.color);
+ set_ps_color(&hdr.color);
fontsize = (double)hdr.fontsize;
fprintf(PS.fp, "(%s) FN %.1f SF\n", hdr.font, fontsize);
@@ -96,6 +96,7 @@
72.0 * (PS.page_width - PS.right_marg),
y + 0.2 * fontsize);
y -= dy;
+ set_ps_color(&hdr.color);
return 0;
}
else {
Modified: grass/branches/releasebranch_6_4/ps/ps.map/getgrid.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/getgrid.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/getgrid.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -5,6 +5,8 @@
#include <stdlib.h>
#include <string.h>
+#include <grass/glocale.h>
+#include "clr.h"
#include "ps_info.h"
#include "local_proto.h"
@@ -31,28 +33,35 @@
int getgrid(void)
{
int spacing;
- int color = 0, fontsize = PS_FONT_DEFAULT_SIZE;
+ int fontsize = PS_FONT_DEFAULT_SIZE;
+ int ret, r, g, b;
char temp[30];
char buf[1024];
char ch, *key, *data;
+ PSCOLOR color, text_color;
PS.grid_font = G_store("Helvetica");
PS.grid_fontsize = 0;
- PS.grid_color = BLACK;
PS.grid_numbers = 0;
PS.grid_cross = 0.;
PS.grid_width = 0.25;
+ set_color(&color, 0, 0, 0);
+ set_color(&text_color, 0, 0, 0);
while (input(2, buf, help)) {
if (!key_data(buf, &key, &data))
continue;
if (KEY("color")) {
- color = get_color_number(data);
- if (color < 0)
- error(key, data, "illegal color request");
+ ret = G_str_to_color(data, &r, &g, &b);
+ if (ret == 1)
+ set_color(&color, r, g, b);
+ else if (ret == 2) /* i.e. "none" */
+ /* unset_color(&color); */
+ error(key, data, _("Unsupported color request"));
else
- PS.grid_color = color;
+ error(key, data, _("illegal color request"));
+
continue;
}
@@ -61,24 +70,32 @@
if (strlen(data) == 0) {
spacing = 1;
- color = BLACK;
+ set_color(&text_color, 0, 0, 0);
}
switch (sscanf(data, "%d %[^\n]", &spacing, temp)) {
case 1:
- color = BLACK;
+ set_color(&text_color, 0, 0, 0);
break;
case 2:
- color = get_color_number(temp);
- if (color < 0)
+ ret = G_str_to_color(temp, &r, &g, &b);
+ if (ret == 1)
+ set_color(&text_color, r, g, b);
+ else if (ret == 2) /* i.e. "none" */
+ error(key, data, _("Unsupported color request"));
+ else
+ error(key, data, _("illegal color request"));
+
+ if (ret < 1)
spacing = -1;
+
break;
}
if (spacing < 0)
- error(key, data, "illegal numbers request");
+ error(key, data, _("illegal numbers request"));
else {
PS.grid_numbers = spacing;
- PS.grid_numbers_color = color;
+ PS.grid_numbers_color = text_color;
}
continue;
}
@@ -106,16 +123,17 @@
if ((sscanf(data, "%lf%c", &PS.grid_width, &ch) < 1) ||
(PS.grid_width < 0.)) {
PS.grid_width = 1.;
- error(key, data, "illegal grid width request");
+ error(key, data, _("illegal grid width request"));
}
if (ch == 'i')
PS.grid_width = PS.grid_width * 72.0;
continue;
}
- error(key, data, "illegal request (getgrid)");
+ error(key, data, _("illegal request (grid)"));
}
PS.grid_fontsize = fontsize;
+ PS.grid_color = color;
return 0;
}
@@ -126,27 +144,34 @@
int getgeogrid(void)
{
int spacing;
- int color = 0, fontsize = PS_FONT_DEFAULT_SIZE;
+ int fontsize = PS_FONT_DEFAULT_SIZE;
+ int ret, r, g, b;
char temp[30];
char buf[1024];
char ch, *key, *data;
+ PSCOLOR color, text_color;
PS.geogrid_font = G_store("Helvetica");
PS.geogrid_fontsize = 0;
- PS.geogrid_color = BLACK;
PS.geogrid_numbers = 0;
PS.geogrid_width = 0.25;
+ set_color(&color, 0, 0, 0);
+ set_color(&text_color, 0, 0, 0);
while (input(2, buf, help2)) {
if (!key_data(buf, &key, &data))
continue;
if (KEY("color")) {
- color = get_color_number(data);
- if (color < 0)
- error(key, data, "illegal color request");
+ ret = G_str_to_color(data, &r, &g, &b);
+ if (ret == 1)
+ set_color(&color, r, g, b);
+ else if (ret == 2) /* i.e. "none" */
+ /* unset_color(&color); */
+ error(key, data, _("Unsupported color request"));
else
- PS.geogrid_color = color;
+ error(key, data, _("illegal color request"));
+
continue;
}
@@ -155,25 +180,33 @@
if (strlen(data) == 0) {
spacing = 1;
- color = BLACK;
+ set_color(&text_color, 0, 0, 0);
}
switch (sscanf(data, "%d %[^\n]", &spacing, temp)) {
case 1:
- color = BLACK;
+ set_color(&text_color, 0, 0, 0);
break;
case 2:
- color = get_color_number(temp);
- if (color < 0)
+ ret = G_str_to_color(temp, &r, &g, &b);
+ if (ret == 1)
+ set_color(&text_color, r, g, b);
+ else if (ret == 2) /* i.e. "none" */
+ error(key, data, _("Unsupported color request"));
+ else
+ error(key, data, _("illegal color request"));
+
+ if (ret < 1)
spacing = -1;
+
break;
}
if (spacing < 0)
- error(key, data, "illegal numbers request");
+ error(key, data, _("illegal numbers request"));
else {
PS.geogrid_numbers = spacing;
- PS.geogrid_numbers_color = color;
+ PS.geogrid_numbers_color = text_color;
}
continue;
@@ -198,16 +231,17 @@
if ((sscanf(data, "%lf%c", &PS.geogrid_width, &ch) < 1) ||
(PS.geogrid_width < 0.)) {
PS.geogrid_width = 1.;
- error(key, data, "illegal grid width request");
+ error(key, data, _("illegal grid width request"));
}
if (ch == 'i')
PS.geogrid_width = PS.geogrid_width * 72.0;
continue;
}
- error(key, data, "illegal request (getgrid)");
+ error(key, data, _("illegal request (geogrid)"));
}
PS.geogrid_fontsize = fontsize;
+ PS.geogrid_color = color;
return 0;
}
Modified: grass/branches/releasebranch_6_4/ps/ps.map/header.h
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/header.h 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/header.h 2013-02-22 11:46:48 UTC (rev 55176)
@@ -4,13 +4,14 @@
*/
#include <stdio.h>
+#include "clr.h"
struct header
{
char *file;
char *font;
int fontsize;
- int color;
+ PSCOLOR color;
FILE *fp;
};
Modified: grass/branches/releasebranch_6_4/ps/ps.map/key_data.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/key_data.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/key_data.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -7,6 +7,8 @@
break;
if (*key == 0)
return 0;
+ if (*key == '#')
+ return 0;
for (data = key + 1; *data; data++)
if (*data == ' ' || *data == '\t')
break;
Modified: grass/branches/releasebranch_6_4/ps/ps.map/local_proto.h
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/local_proto.h 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/local_proto.h 2013-02-22 11:46:48 UTC (rev 55176)
@@ -188,7 +188,7 @@
int read_cell(char *, char *);
/* read_cfg.c */
-int set_paper(char *pname);
+int set_paper(char *);
void reset_map_location(void);
void print_papers(void);
Modified: grass/branches/releasebranch_6_4/ps/ps.map/main.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/main.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/main.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -103,27 +103,31 @@
rflag = G_define_flag();
rflag->key = 'r';
rflag->description = _("Rotate plot 90 degrees");
+ rflag->guisection = _("Output settings");
pflag = G_define_flag();
pflag->key = 'p';
pflag->description =
_("List paper formats ( name width height left right top bottom(margin) )");
+ pflag->guisection = _("Utility");
eflag = G_define_flag();
eflag->key = 'e';
eflag->description =
_("Create EPS (Encapsulated PostScript) instead of PostScript file");
+ eflag->guisection = _("Output settings");
bflag = G_define_flag();
bflag->key = 'b';
bflag->description =
_("Describe map-box's position on the page and exit (inches from top-left of paper)");
+ bflag->guisection = _("Utility");
input_file = G_define_option();
input_file->key = "input";
input_file->type = TYPE_STRING;
- input_file->description =
- _("File containing mapping instructions (or use input=- to enter from keyboard)");
+ input_file->label = _("File containing mapping instructions");
+ input_file->description = _("Use '-' to enter instructions from keyboard");
input_file->gisprompt = "old_file,file,input";
input_file->required = NO;
@@ -132,7 +136,8 @@
output_file->type = TYPE_STRING;
output_file->gisprompt = "new_file,file,output";
output_file->description = _("PostScript output file");
- /* output_file->required = YES; Can omit for -p list page size & exit mode */
+ /* output_file->required = YES; Can omit for -p list page size & exit mode */
+ output_file->guisection = _("Required");
map_scale = G_define_option();
map_scale->key = "scale";
@@ -140,6 +145,7 @@
map_scale->type = TYPE_STRING;
map_scale->description =
_("Scale of the output map, e.g. 1:25000 (default: Auto-sized to fit page)");
+ map_scale->guisection = _("Output settings");
copies = G_define_option();
copies->key = "copies";
@@ -147,6 +153,7 @@
copies->options = "1-20";
copies->description = _("Number of copies to print");
copies->required = NO;
+ copies->guisection = _("Output settings");
if (!isatty(0))
G_disable_interactive();
@@ -179,9 +186,7 @@
vector.x = vector.y = -1.0;
ct.x = ct.y = -1.0;
ct.width = -1.0;
- hdr.color = BLACK;
cmt.color = BLACK;
- PS.grid_color = BLACK;
m_info.font = G_store(def_font);
vector.font = G_store(def_font);
hdr.font = G_store(def_font);
@@ -222,8 +227,9 @@
PS.num_psfiles = 0;
PS.mask_color = 0;
- /* PS.map_* variables are set to 0 (not defined) and then may be reset by 'maploc'.
- * When script is read, main() should call reset_map_location() to reset map size to fit to paper */
+ /* PS.map_* variables are set to 0 (not defined) and then may be
+ * reset by 'maploc'. When script is read, main() should call
+ * reset_map_location() to reset map size to fit to paper */
PS.map_width = 0;
PS.map_height = 0;
@@ -246,13 +252,13 @@
if (check_scale(map_scale->answer))
G_strcpy(PS.scaletext, map_scale->answer);
else
- error(map_scale->answer, "", "illegal scale request");
+ error(map_scale->answer, "", _("illegal scale request"));
}
if (copies->answer) {
if (sscanf(copies->answer, "%d", &ps_copies) != 1) {
ps_copies = 1;
- error(copies->answer, "", "illegal copies request");
+ error(copies->answer, "", _("illegal copies request"));
}
copies_set = 1;
}
@@ -560,7 +566,7 @@
strcpy(PS.scaletext, data);
else {
PS.scaletext[0] = 0;
- error(key, data, "illegal scale request");
+ error(key, data, _("illegal scale request"));
}
continue;
}
@@ -739,8 +745,8 @@
ps_mask_file = G_tempfile();
ps_map();
- G_message(_("PostScript file [%s] successfully written."),
- output_file->answer);
+ G_done_msg(_("PostScript file '%s' successfully written."),
+ output_file->answer);
/* cleanup the tempfiles */
unlink(ps_mask_file);
Modified: grass/branches/releasebranch_6_4/ps/ps.map/ps_fclrtbl.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/ps_fclrtbl.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/ps_fclrtbl.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -280,9 +280,9 @@
case 2:
/* directly above the tick numbers */
if (ct.tickbar)
- xu += x1 + 0.2 * fontsize;
+ xu = x1 + 0.2 * fontsize;
else
- xu += x2 + 0.2 * fontsize;
+ xu = x2 + 0.2 * fontsize;
yu = t + 0.05*72;
label_xref = LEFT;
label_yref = LOWER;
@@ -301,9 +301,9 @@
case 4:
/* directly below the tick numbers */
if (ct.tickbar)
- xu += x1 + 0.2 * fontsize;
+ xu = x1 + 0.2 * fontsize;
else
- xu += x2 + 0.2 * fontsize;
+ xu = x2 + 0.2 * fontsize;
yu = t - height - 0.05*72;
label_xref = LEFT;
label_yref = UPPER;
Modified: grass/branches/releasebranch_6_4/ps/ps.map/ps_info.h
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/ps_info.h 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/ps_info.h 2013-02-22 11:46:48 UTC (rev 55176)
@@ -1,4 +1,5 @@
#include <grass/gis.h>
+#include "clr.h"
/* Font sizes */
#define PS_FONT_MAX_SIZE 50
@@ -42,13 +43,15 @@
int do_border;
int do_scalebar;
int num_psfiles;
- int grid, grid_color, grid_numbers, grid_numbers_color, grid_fontsize;
+ int grid, grid_numbers, grid_fontsize;
+ PSCOLOR grid_color, grid_numbers_color;
float grid_cross;
char geogridunit[64];
- int geogrid, geogrid_color, geogrid_numbers;
- int geogrid_numbers_color, geogrid_fontsize;
+ int geogrid, geogrid_numbers, geogrid_fontsize;
+ PSCOLOR geogrid_color, geogrid_numbers_color;
double grid_width, geogrid_width;
- int do_outline, outline_color;
+ int do_outline;
+ PSCOLOR outline_color;
int cell_fd;
int row_delta, col_delta;
int cells_wide, cells_high;
Modified: grass/branches/releasebranch_6_4/ps/ps.map/ps_outline.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/ps_outline.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/ps_outline.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -9,6 +9,7 @@
#include <grass/gis.h>
#include <grass/glocale.h>
#include "ps_info.h"
+#include "clr.h"
#include "local_proto.h"
static int k, col, row, top, bottom;
@@ -42,7 +43,7 @@
PS.cell_name, PS.cell_mapset);
/* set the outline color and width */
- set_rgb_color(PS.outline_color);
+ set_ps_color(&PS.outline_color);
set_line_width(PS.outline_width);
/* create temporary vector map containing outlines */
@@ -66,36 +67,45 @@
{
char buf[1024];
char ch, *key, *data;
- int color;
+ PSCOLOR color;
+ int ret, r, g, b;
PS.outline_width = 1.;
- color = BLACK;
+ set_color(&color, 0, 0, 0);
+
while (input(2, buf, help)) {
if (!key_data(buf, &key, &data))
continue;
+
if (KEY("color")) {
- color = get_color_number(data);
- if (color < 0) {
- color = BLACK;
- error(key, data, "illegal color request");
- }
+ ret = G_str_to_color(data, &r, &g, &b);
+ if (ret == 1)
+ set_color(&color, r, g, b);
+ else if (ret == 2) /* i.e. "none" */
+ /* unset_color(&color); */
+ error(key, data, _("Unsupported color request"));
+ else
+ error(key, data, _("illegal color request"));
+
continue;
}
+
if (KEY("width")) {
PS.outline_width = -1.;
ch = ' ';
if (sscanf(data, "%lf%c", &(PS.outline_width), &ch) < 1
|| PS.outline_width < 0.) {
PS.outline_width = 1.;
- error(key, data, "illegal width request");
+ error(key, data, _("illegal width request"));
}
if (ch == 'i')
PS.outline_width = PS.outline_width * 72.;
continue;
}
- error(key, data, "illegal outline sub-request");
- error(key, data, "illegal outline sub-request");
+
+ error(key, data, _("illegal outline sub-request"));
}
+
PS.outline_color = color;
PS.do_outline = 1;
Modified: grass/branches/releasebranch_6_4/ps/ps.map/r_cell.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/r_cell.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/r_cell.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -10,7 +10,8 @@
int read_cell(char *name, char *mapset)
{
- char fullname[100];
+ /* full name can be "name at mapset in mapset" */
+ char fullname[GNAME_MAX + 2 * GMAPSET_MAX + 4];
PS.do_colortable = 0;
if (PS.cell_fd >= 0) {
Modified: grass/branches/releasebranch_6_4/ps/ps.map/r_header.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/r_header.c 2013-02-22 11:31:27 UTC (rev 55175)
+++ grass/branches/releasebranch_6_4/ps/ps.map/r_header.c 2013-02-22 11:46:48 UTC (rev 55176)
@@ -5,8 +5,10 @@
#include <stdlib.h>
#include <string.h>
+#include <grass/glocale.h>
#include "header.h"
#include "ps_info.h"
+#include "clr.h"
#include "local_proto.h"
#define KEY(x) (strcmp(key,x)==0)
@@ -23,10 +25,13 @@
{
char buf[1024];
char *key, *data;
- int color, fontsize;
+ int fontsize;
+ PSCOLOR color;
+ int ret, r, g, b;
fontsize = 0;
- color = BLACK;
+ set_color(&color, 0, 0, 0);
+
while (input(2, buf, help)) {
if (!key_data(buf, &key, &data))
continue;
@@ -52,11 +57,15 @@
}
if (KEY("color")) {
- color = get_color_number(data);
- if (color < 0) {
- color = BLACK;
- error(key, data, "illegal color request");
- }
+ ret = G_str_to_color(data, &r, &g, &b);
+ if (ret == 1)
+ set_color(&color, r, g, b);
+ else if (ret == 2) /* i.e. "none" */
+ /* unset_color(&color); */
+ error(key, data, _("Unsupported color request"));
+ else
+ error(key, data, _("illegal color request"));
+
continue;
}
@@ -65,8 +74,9 @@
hdr.font = G_store(data);
continue;
}
- error(key, data, "illegal header sub-request");
+ error(key, data, _("illegal header sub-request"));
}
+
hdr.color = color;
if (fontsize)
hdr.fontsize = fontsize;
More information about the grass-commit
mailing list