[GRASS-SVN] r54622 - grass/branches/develbranch_6/display/d.legend
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 14 00:53:55 PST 2013
Author: hamish
Date: 2013-01-14 00:53:54 -0800 (Mon, 14 Jan 2013)
New Revision: 54622
Modified:
grass/branches/develbranch_6/display/d.legend/main.c
Log:
add support for RGB text color, or 'none'
Modified: grass/branches/develbranch_6/display/d.legend/main.c
===================================================================
--- grass/branches/develbranch_6/display/d.legend/main.c 2013-01-14 08:43:03 UTC (rev 54621)
+++ grass/branches/develbranch_6/display/d.legend/main.c 2013-01-14 08:53:54 UTC (rev 54622)
@@ -50,7 +50,7 @@
int thin;
int i, j, k;
int lines, steps;
- int new_colr, fp;
+ int fp;
int t, b, l, r;
int hide_catnum, hide_catstr, hide_nodata, do_smooth, use_mouse;
char *cstr;
@@ -91,12 +91,8 @@
opt1 = G_define_standard_option(G_OPT_R_MAP);
opt1->description = _("Name of raster map");
- opt2 = G_define_option();
- opt2->key = "color";
- opt2->type = TYPE_STRING;
- opt2->answer = DEFAULT_FG_COLOR;
- opt2->options = D_color_list();
- opt2->description = _("Sets the legend's text color");
+ opt2 = G_define_standard_option(G_OPT_C_FG);
+ opt2->label = _("Text color");
opt4 = G_define_option();
opt4->key = "lines";
@@ -189,6 +185,7 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
+
map_name = opt1->answer;
hide_catstr = hidestr->answer; /* note hide_catstr gets changed and re-read below */
@@ -198,13 +195,7 @@
use_mouse = mouse->answer;
flip = flipit->answer;
- color = 0; /* if only to get rid of the compiler warning */
- if (opt2->answer != NULL) {
- new_colr = D_translate_color(opt2->answer);
- if (new_colr == 0)
- G_fatal_error(_("Don't know the color %s"), opt2->answer);
- color = new_colr;
- }
+ color = D_parse_color(opt2->answer, TRUE);
if (opt4->answer != NULL)
sscanf(opt4->answer, "%d", &lines);
@@ -689,7 +680,7 @@
txsiz = 0; /* keep it sane */
R_text_size(txsiz, txsiz);
- R_standard_color(color);
+ D_raster_use_color(color);
ppl = (lleg) / (steps - 1);
@@ -716,7 +707,8 @@
y1 + 4 + txsiz);
}
- R_text(buff);
+ if(color)
+ R_text(buff);
} /*for */
@@ -857,7 +849,7 @@
R_polygon_rel(x_box, y_box, 5);
/* Draw text */
- R_standard_color(color);
+ D_raster_use_color(color);
if (!fp) {
/* nothing, box only */
@@ -894,7 +886,9 @@
}
R_move_abs((l + 3 + dots_per_line), (cur_dot_row) - 3);
- R_text(buff);
+
+ if(color)
+ R_text(buff);
}
if (0 == k)
@@ -916,7 +910,8 @@
}
R_standard_color(white);
R_move_abs((l + 3 + dots_per_line), (cur_dot_row));
- R_text(buff);
+ if(color)
+ R_text(buff);
}
}
if (use_mouse) {
More information about the grass-commit
mailing list