[GRASS-SVN] r54643 - grass/trunk/general/g.cairocomp

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 15 06:56:27 PST 2013


Author: martinl
Date: 2013-01-15 06:56:26 -0800 (Tue, 15 Jan 2013)
New Revision: 54643

Modified:
   grass/trunk/general/g.cairocomp/main.c
Log:
g.cairocomp: options cosmetics


Modified: grass/trunk/general/g.cairocomp/main.c
===================================================================
--- grass/trunk/general/g.cairocomp/main.c	2013-01-15 13:11:17 UTC (rev 54642)
+++ grass/trunk/general/g.cairocomp/main.c	2013-01-15 14:56:26 UTC (rev 54643)
@@ -23,6 +23,7 @@
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <grass/gis.h>
+#include <grass/colors.h>
 #include <grass/glocale.h>
 
 static int width, height;
@@ -142,10 +143,12 @@
 {
     int r, g, b, a;
     double fr, fg, fb, fa;
-
-    if (sscanf(color, "%d:%d:%d:%d", &r, &g, &b, &a) != 4)
+    
+    a = 255;
+    if (sscanf(color, "%d:%d:%d:%d", &r, &g, &b, &a) != 4 ||
+        G_str_to_color(color, &r, &g, &b) != 1)
 	G_fatal_error(_("Invalid color: %s"), color);
-
+    
     fr = r / 255.0;
     fg = g / 255.0;
     fb = b / 255.0;
@@ -191,23 +194,16 @@
 
     module = G_define_module();
     G_add_keyword(_("general"));
-    G_add_keyword(_("gui"));
-    module->description = _("Overlays multiple X Pixmaps");
+    G_add_keyword(_("display"));
+    module->description = _("Overlays multiple X Pixmaps.");
 
-    opt.in = G_define_option();
-    opt.in->key = "input";
-    opt.in->type = TYPE_STRING;
+    opt.in = G_define_standard_option(G_OPT_F_INPUT);
     opt.in->required = YES;
     opt.in->multiple = YES;
-    opt.in->description = _("Names of input files");
-    opt.in->gisprompt = "old_file,file,input";
+    opt.in->description = _("Name of input file(s)");
 
-    opt.out = G_define_option();
-    opt.out->key = "output";
-    opt.out->type = TYPE_STRING;
+    opt.out = G_define_standard_option(G_OPT_F_OUTPUT);
     opt.out->required = YES;
-    opt.out->description = _("Name of output file");
-    opt.out->gisprompt = "new_file,file,output";
 
     opt.visual = G_define_option();
     opt.visual->key = "visual";
@@ -239,10 +235,9 @@
     opt.height->required = YES;
     opt.height->description = _("Image height");
 
-    opt.bg = G_define_option();
-    opt.bg->key = "background";
-    opt.bg->type = TYPE_STRING;
-    opt.bg->description = _("Background color");
+    opt.bg = G_define_standard_option(G_OPT_C_BG);
+    opt.bg->label = _("Background color (R:G:B:A)");
+    opt.bg->answer = NULL;
 
     flag_d = G_define_flag();
     flag_d->key = 'd';



More information about the grass-commit mailing list