[GRASS-SVN] r45314 - grass/branches/develbranch_6/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 5 19:15:50 EST 2011


Author: hamish
Date: 2011-02-05 16:15:50 -0800 (Sat, 05 Feb 2011)
New Revision: 45314

Modified:
   grass/branches/develbranch_6/ps/ps.map/colortable.h
   grass/branches/develbranch_6/ps/ps.map/ps_fclrtbl.c
   grass/branches/develbranch_6/ps/ps.map/r_colortable.c
Log:
full rgb support for FP legend boundary/text color; i18n

Modified: grass/branches/develbranch_6/ps/ps.map/colortable.h
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/colortable.h	2011-02-04 20:16:41 UTC (rev 45313)
+++ grass/branches/develbranch_6/ps/ps.map/colortable.h	2011-02-06 00:15:50 UTC (rev 45314)
@@ -4,6 +4,7 @@
  */
 
 #include <stdio.h>
+#include "clr.h"
 
 struct colortable
 {
@@ -14,7 +15,7 @@
     char *name;
     char *mapset;
     int fontsize;
-    int color;
+    PSCOLOR color;
     int cols;
     int nodata;
     int tickbar;

Modified: grass/branches/develbranch_6/ps/ps.map/ps_fclrtbl.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/ps_fclrtbl.c	2011-02-04 20:16:41 UTC (rev 45313)
+++ grass/branches/develbranch_6/ps/ps.map/ps_fclrtbl.c	2011-02-06 00:15:50 UTC (rev 45314)
@@ -152,7 +152,7 @@
 
     /* Frame around */
     fprintf(PS.fp, "NP\n");
-    set_rgb_color(ct.color);
+    set_ps_color(&ct.color);
     fprintf(PS.fp, "%.8f W\n", lwidth);
     fprintf(PS.fp, "%f %f %f %f B\n", x1,
 	    t - (ncols - 1) * cwidth - (cwidth + lwidth) / 2, x2,

Modified: grass/branches/develbranch_6/ps/ps.map/r_colortable.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/r_colortable.c	2011-02-04 20:16:41 UTC (rev 45313)
+++ grass/branches/develbranch_6/ps/ps.map/r_colortable.c	2011-02-06 00:15:50 UTC (rev 45314)
@@ -5,8 +5,10 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <grass/glocale.h>
 #include "colortable.h"
 #include "ps_info.h"
+#include "clr.h"
 #include "local_proto.h"
 
 #define KEY(x) (strcmp(key,x)==0)
@@ -32,14 +34,16 @@
     char buf[1024];
     char *key, *data;
     char name[GNAME_MAX], mapset[GMAPSET_MAX];
-    int color, fontsize, cols, nodata, tickbar, discrete;
+    int fontsize, cols, nodata, tickbar, discrete;
     double w, h, x, y;
     int range_override;
     double min, max, tmpD;
+    int r, g, b, ret;
+    PSCOLOR color;
 
 
     fontsize = 0;
-    color = BLACK;
+    set_color(&color, 0, 0, 0);
     cols = 1;
     h = w = x = y = 0.0;
     ct.nodata = TRUE;
@@ -54,7 +58,7 @@
 	if (KEY("where")) {
 	    if (sscanf(data, "%lf %lf", &x, &y) != 2) {
 		x = y = 0.0;
-		error(key, data, "illegal where request");
+		error(key, data, _("illegal where request"));
 	    }
 	    else
 		continue;
@@ -62,7 +66,7 @@
 
 	if (KEY("width")) {
 	    if (sscanf(data, "%lf", &w) != 1 || w <= 0) {
-		error(key, data, "illegal width request");
+		error(key, data, _("illegal width request"));
 	    }
 	    else
 		continue;
@@ -70,7 +74,7 @@
 
 	if (KEY("height")) {
 	    if (sscanf(data, "%lf", &h) != 1 || h <= 0) {
-		error(key, data, "illegal height request");
+		error(key, data, _("illegal height request"));
 	    }
 	    else
 		continue;
@@ -87,7 +91,7 @@
 	if (KEY("range")) {
 	    if (sscanf(data, "%lf %lf", &min, &max) != 2) {
 		range_override = FALSE;
-		error(key, data, "illegal range request");
+		error(key, data, _("illegal range request"));
 	    }
 	    else {
 		range_override = TRUE;
@@ -103,7 +107,7 @@
 	if (KEY("cols")) {
 	    if (sscanf(data, "%d", &cols) != 1) {
 		cols = 1;
-		error(key, data, "illegal columns request");
+		error(key, data, _("illegal columns request"));
 	    }
 	    else
 		continue;
@@ -117,11 +121,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 (colortable)"));
+	    else
+		error(key, data, _("illegal color request (colortable)"));
+
 	    continue;
 	}
 
@@ -147,7 +155,7 @@
 	    continue;
 	}
 
-	error(key, data, "illegal colortabe sub-request");
+	error(key, data, _("illegal colortabe sub-request"));
     }
 
     ct.x = x;
@@ -158,7 +166,7 @@
     /* Check for Raster */
     if (!ct.name) {
 	if (!PS.cell_name) {
-	    error(key, data, "No raster selected for colortable !");
+	    error(key, data, _("No raster selected for colortable!"));
 	}
 	else {
 	    ct.name = PS.cell_name;



More information about the grass-commit mailing list