Skip to content

Commit

Permalink
change color standard options to differentiate between allowing and n…
Browse files Browse the repository at this point in the history
…ot allowing none as color instead of bg/fg color, apply the change in modules and in this way fix several modules with incorrect options

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@63797 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
petrasovaa committed Dec 28, 2014
1 parent 6cf39a4 commit 821ac0d
Show file tree
Hide file tree
Showing 25 changed files with 90 additions and 90 deletions.
6 changes: 4 additions & 2 deletions display/d.barscale/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ int main(int argc, char **argv)
_("Screen coordinates of the rectangle's top-left corner");
coords->description = _("(0,0) is lower-left of the display frame");

fg_color_opt = G_define_standard_option(G_OPT_C_FG);
fg_color_opt = G_define_standard_option(G_OPT_C);
fg_color_opt->label = _("Bar scale and text color");
fg_color_opt->guisection = _("Colors");

bg_color_opt = G_define_standard_option(G_OPT_C_BG);
bg_color_opt = G_define_standard_option(G_OPT_CN);
bg_color_opt->key = "bgcolor";
bg_color_opt->answer = DEFAULT_BG_COLOR;
bg_color_opt->label = _("Background color (drawn behind the bar)");
bg_color_opt->guisection = _("Colors");

Expand Down
2 changes: 1 addition & 1 deletion display/d.colortable/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char **argv)
opt1->description =
_("Name of raster map whose color table is to be displayed");

opt2 = G_define_standard_option(G_OPT_C_FG);
opt2 = G_define_standard_option(G_OPT_C);
opt2->answer = DEFAULT_BG_COLOR;
opt2->label =
_("Color of lines separating the colors of the color table");
Expand Down
5 changes: 4 additions & 1 deletion display/d.erase/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ int main(int argc, char *argv[])
module->description =
_("Erases the contents of the active graphics display frame with user defined color.");

color = G_define_standard_option(G_OPT_C_BG);
color = G_define_standard_option(G_OPT_C);
color->key = "bgcolor";
color->label = _("Background color");
color->answer = DEFAULT_BG_COLOR;

eraseframe = G_define_flag();
eraseframe->key = 'f';
Expand Down
6 changes: 3 additions & 3 deletions display/d.geodesic/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ int main(int argc, char *argv[])
parm.coor->required = YES;
parm.coor->description = _("Starting and ending coordinates");

parm.lcolor = G_define_standard_option(G_OPT_C_FG);
parm.lcolor = G_define_standard_option(G_OPT_C);
parm.lcolor->key = "line_color";
parm.lcolor->label = _("Line color");

parm.tcolor = G_define_standard_option(G_OPT_C_FG);
parm.tcolor = G_define_standard_option(G_OPT_C);
parm.tcolor->key = "text_color";
parm.tcolor->label = _("Text color or \"none\"");
parm.tcolor->label = _("Text color");
parm.tcolor->answer = NULL;

if (G_parser(argc, argv))
Expand Down
6 changes: 3 additions & 3 deletions display/d.grid/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ int main(int argc, char **argv)
lwidth->required = NO;
lwidth->description = _("Grid line width");

opt1 = G_define_standard_option(G_OPT_C_FG);
opt1 = G_define_standard_option(G_OPT_C);
opt1->answer = "gray";
opt1->label = _("Grid color");
opt1->guisection = _("Color");

opt4 = G_define_standard_option(G_OPT_C_FG);
opt4 = G_define_standard_option(G_OPT_C);
opt4->key = "border_color";
opt4->label = _("Border color");
opt4->guisection = _("Color");

tcolor = G_define_standard_option(G_OPT_C_FG);
tcolor = G_define_standard_option(G_OPT_C);
tcolor->key = "text_color";
tcolor->answer = "gray";
tcolor->label = _("Text color");
Expand Down
7 changes: 5 additions & 2 deletions display/d.histogram/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ int main(int argc, char **argv)

/* The color option specifies the color for the labels, tic-marks,
* and borders of the chart. */
opt2 = G_define_standard_option(G_OPT_C_FG);
opt2 = G_define_standard_option(G_OPT_C);
opt2->label = _("Color for text and axes");

bg_opt = G_define_standard_option(G_OPT_C_BG);
bg_opt = G_define_standard_option(G_OPT_CN);
bg_opt->key = "bgcolor";
bg_opt->label = _("Background color");
bg_opt->answer = DEFAULT_BG_COLOR;

#ifdef CAN_DO_AREAS
opt3 = G_define_option();
Expand Down
2 changes: 1 addition & 1 deletion display/d.legend/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int main(int argc, char **argv)
_("Use a subset of the map range for the legend (min,max)");
opt_range->guisection = _("Subset");

opt_color = G_define_standard_option(G_OPT_C_FG);
opt_color = G_define_standard_option(G_OPT_C);
opt_color->label = _("Text color");
opt_color->guisection = _("Font settings");

Expand Down
5 changes: 4 additions & 1 deletion display/d.mon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ int main(int argc, char *argv[])
res_opt->key_desc = "value";
res_opt->guisection = _("Settings");

bgcolor_opt = G_define_standard_option(G_OPT_C_BG);
bgcolor_opt = G_define_standard_option(G_OPT_CN);
bgcolor_opt->key = "bgcolor";
bgcolor_opt->label = _("Background color");
bgcolor_opt->answer = DEFAULT_BG_COLOR;
bgcolor_opt->guisection = _("Settings");

output_opt = G_define_standard_option(G_OPT_F_OUTPUT);
Expand Down
4 changes: 2 additions & 2 deletions display/d.northarrow/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ int main(int argc, char **argv)
_("Screen coordinates of the rectangle's top-left corner");
coords->description = _("(0,0) is lower-left of the display frame");

fg_color_opt = G_define_standard_option(G_OPT_C_FG);
fg_color_opt = G_define_standard_option(G_OPT_C);
fg_color_opt->label = _("Line color");
fg_color_opt->guisection = _("Colors");

bg_color_opt = G_define_standard_option(G_OPT_C_BG);
bg_color_opt = G_define_standard_option(G_OPT_CN);
bg_color_opt->key = "fill_color";
bg_color_opt->label = _("Fill color");
bg_color_opt->answer = _("black");
Expand Down
8 changes: 4 additions & 4 deletions display/d.rast.arrow/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,25 @@ int main(int argc, char **argv)
opt2->options = "grass,compass,agnps,answers";
opt2->description = _("Type of existing raster aspect map");

opt3 = G_define_standard_option(G_OPT_C_FG);
opt3 = G_define_standard_option(G_OPT_C);
opt3->key = "color";
opt3->answer = "green";
opt3->label = _("Color for drawing arrows");
opt3->guisection = _("Colors");

opt4 = G_define_standard_option(G_OPT_C_BG);
opt4 = G_define_standard_option(G_OPT_CN);
opt4->key = "grid_color";
opt4->answer = "gray";
opt4->label = _("Color for drawing drawing grid");
opt4->guisection = _("Colors");

opt5 = G_define_standard_option(G_OPT_C_BG);
opt5 = G_define_standard_option(G_OPT_CN);
opt5->key = "null_color";
opt5->answer = DEFAULT_FG_COLOR;
opt5->label = _("Color for drawing null values (X symbol)");
opt5->guisection = _("Colors");

opt6 = G_define_standard_option(G_OPT_C_BG);
opt6 = G_define_standard_option(G_OPT_CN);
opt6->key = "unknown_color";
opt6->answer = "red";
opt6->label = _("Color for showing unknown information (? symbol)");
Expand Down
7 changes: 2 additions & 5 deletions display/d.rast.num/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,15 @@ int main(int argc, char **argv)

opt.map = G_define_standard_option(G_OPT_R_MAP);

opt.text_color = G_define_standard_option(G_OPT_C_FG);
opt.text_color = G_define_standard_option(G_OPT_C);
opt.text_color->key = "text_color";
opt.text_color->label = _("Text color");
opt.text_color->description = _("Color in GRASS format for drawing text");
opt.text_color->guisection = _("Colors");

/* using G_OPT_C_BG because it gives none but semantically it is not BG */
opt.grid_color = G_define_standard_option(G_OPT_C_BG);
opt.grid_color = G_define_standard_option(G_OPT_CN);
opt.grid_color->key = "grid_color";
opt.grid_color->answer = "gray";
opt.grid_color->label = _("Grid color");
opt.grid_color->description = _("Color in GRASS format for drawing grid, or \"none\"");
opt.grid_color->guisection = _("Colors");

opt.prec = G_define_option();
Expand Down
6 changes: 3 additions & 3 deletions display/d.rast/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ int main(int argc, char **argv)
vallist->description = _("List of categories or values to be displayed");
vallist->guisection = _("Selection");

bg = G_define_standard_option(G_OPT_C_BG);
bg = G_define_standard_option(G_OPT_C);
bg->key = "bgcolor";
bg->key_desc = "color";
bg->gisprompt = "old_color,color,color";
bg->answer = DEFAULT_BG_COLOR;
bg->label = _("Background color (for null)");
bg->description = _("Either a standard color name or R:G:B triplet");
bg->guisection = _("Null cells");

flag_n = G_define_flag();
Expand Down
2 changes: 1 addition & 1 deletion display/d.rhumbline/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int main(int argc, char *argv[])
parm.coor->required = YES;
parm.coor->description = _("Starting and ending coordinates");

parm.lcolor = G_define_standard_option(G_OPT_C_FG);
parm.lcolor = G_define_standard_option(G_OPT_C);
parm.lcolor->key = "line_color";
parm.lcolor->label = _("Line color");

Expand Down
2 changes: 1 addition & 1 deletion display/d.thematic.area/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ int main(int argc, char **argv)
bwidth_opt->guisection = _("Boundaries");
bwidth_opt->description = _("Boundary width");

bcolor_opt = G_define_standard_option(G_OPT_C_FG);
bcolor_opt = G_define_standard_option(G_OPT_C);
bcolor_opt->key = "boundary_color";
bcolor_opt->label = _("Boundary color");
bcolor_opt->guisection = _("Boundaries");
Expand Down
5 changes: 2 additions & 3 deletions display/d.vect.chart/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,15 @@ int main(int argc, char **argv)
scale_opt->description = _("Scale for size (to get size in pixels)");
scale_opt->guisection = _("Chart properties");

ocolor_opt = G_define_standard_option(G_OPT_C_FG);
ocolor_opt = G_define_standard_option(G_OPT_C);
ocolor_opt->key = "outline_color";
ocolor_opt->label = _("Outline color");
ocolor_opt->guisection = _("Chart properties");

colors_opt = G_define_standard_option(G_OPT_C_FG);
colors_opt = G_define_standard_option(G_OPT_C);
colors_opt->key = "colors";
colors_opt->multiple = YES;
colors_opt->label = _("Colors used to fill charts");
colors_opt->gisprompt = "old_color,color,color";
colors_opt->guisection = _("Chart properties");

y_center_flag = G_define_flag();
Expand Down
10 changes: 5 additions & 5 deletions display/d.vect/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ int main(int argc, char **argv)


/* Colors */
color_opt = G_define_standard_option(G_OPT_C_FG);
color_opt = G_define_standard_option(G_OPT_CN);
color_opt->label = _("Feature color");
color_opt->guisection = _("Colors");

fcolor_opt = G_define_standard_option(G_OPT_C_BG);
fcolor_opt = G_define_standard_option(G_OPT_CN);
fcolor_opt->key = "fill_color";
fcolor_opt->answer = "200:200:200";
fcolor_opt->label = _("Area fill color");
Expand Down Expand Up @@ -203,19 +203,19 @@ int main(int argc, char **argv)
attrcol_opt->guisection = _("Labels");
attrcol_opt->description = _("Name of column to be displayed as a label");

lcolor_opt = G_define_standard_option(G_OPT_C_FG);
lcolor_opt = G_define_standard_option(G_OPT_C);
lcolor_opt->key = "label_color";
lcolor_opt->answer = "red";
lcolor_opt->label = _("Label color");
lcolor_opt->guisection = _("Labels");

bgcolor_opt = G_define_standard_option(G_OPT_C_BG);
bgcolor_opt = G_define_standard_option(G_OPT_CN);
bgcolor_opt->key = "label_bgcolor";
bgcolor_opt->answer = "none";
bgcolor_opt->guisection = _("Labels");
bgcolor_opt->label = _("Label background color");

bcolor_opt = G_define_standard_option(G_OPT_C_BG);
bcolor_opt = G_define_standard_option(G_OPT_CN);
bcolor_opt->key = "label_bcolor";
bcolor_opt->type = TYPE_STRING;
bcolor_opt->answer = "none";
Expand Down
3 changes: 2 additions & 1 deletion general/g.cairocomp/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ int main(int argc, char *argv[])
opt.height->required = YES;
opt.height->description = _("Image height");

opt.bg = G_define_standard_option(G_OPT_C_BG);
opt.bg = G_define_standard_option(G_OPT_C);
opt.bg->key = "bgcolor";
opt.bg->label = _("Background color (R:G:B:A)");
opt.bg->answer = NULL;

Expand Down
4 changes: 2 additions & 2 deletions general/g.parser/standard_option.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ static char* STD_OPT_STRINGS[] = {"G_OPT_UNDEFINED",
"G_OPT_F_BIN_INPUT",
"G_OPT_F_OUTPUT",
"G_OPT_F_SEP",
"G_OPT_C_FG",
"G_OPT_C_BG",
"G_OPT_C",
"G_OPT_CN",
"G_OPT_M_UNITS",
"G_OPT_M_DATATYPE",
"G_OPT_M_MAPSET",
Expand Down
4 changes: 3 additions & 1 deletion general/g.pnmcomp/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ int main(int argc, char *argv[])
opt.height->required = YES;
opt.height->description = _("Image height");

opt.bg = G_define_standard_option(G_OPT_C_BG);
opt.bg = G_define_standard_option(G_OPT_C);
opt.bg->key = "bgcolor";
opt.bg->label = _("Background color");
opt.bg->answer = NULL;

if (G_parser(argc, argv))
Expand Down
4 changes: 2 additions & 2 deletions include/gis.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ typedef enum
G_OPT_F_OUTPUT, /*!< new output file */
G_OPT_F_SEP, /*!< data field separator */

G_OPT_C_FG, /*!< foreground color */
G_OPT_C_BG, /*!< background color */
G_OPT_C, /*!< color */
G_OPT_CN, /*!< color or none */

G_OPT_M_UNITS, /*!< units */
G_OPT_M_DATATYPE, /*!< datatype */
Expand Down
16 changes: 8 additions & 8 deletions lib/gis/parser_standard_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
- G_OPT_F_SEP
- colors
- G_OPT_C_FG
- G_OPT_C_BG
- G_OPT_C
- G_OPT_CN
- misc
- G_OPT_M_DIR
Expand Down Expand Up @@ -590,7 +590,7 @@ struct Option *G_define_standard_option(int opt)
break;

/* colors */
case G_OPT_C_FG:
case G_OPT_C:
Opt->key = "color";
Opt->type = TYPE_STRING;
Opt->key_desc = "name";
Expand All @@ -599,16 +599,16 @@ struct Option *G_define_standard_option(int opt)
Opt->gisprompt = "old,color,color";
Opt->label = _("Color");
Opt->description =
_("Either a standard color name, R:G:B triplet, or \"none\"");
_("Either a standard color name or R:G:B triplet");
break;
case G_OPT_C_BG:
Opt->key = "bgcolor";
case G_OPT_CN:
Opt->key = "color";
Opt->type = TYPE_STRING;
Opt->key_desc = "name";
Opt->required = NO;
Opt->answer = DEFAULT_BG_COLOR;
Opt->answer = DEFAULT_FG_COLOR;
Opt->gisprompt = "old,color_none,color";
Opt->label = _("Background color");
Opt->label = _("Color");
Opt->description =
_("Either a standard color name, R:G:B triplet, or \"none\"");
break;
Expand Down
Loading

0 comments on commit 821ac0d

Please sign in to comment.