Prechádzať zdrojové kódy

display modules: sync error message, add D_save_command()

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47179 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 rokov pred
rodič
commit
c890ce7712

+ 4 - 2
display/d.barscale/main.c

@@ -125,8 +125,9 @@ int main(int argc, char **argv)
     fontsize = atoi(fsize->answer);
     fontsize = atoi(fsize->answer);
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     D_setup(0);
     D_setup(0);
 
 
     /* Parse and select background color */
     /* Parse and select background color */
@@ -140,6 +141,7 @@ int main(int argc, char **argv)
     /* Draw the scale */
     /* Draw the scale */
     draw_scale(top->answer, fontsize);
     draw_scale(top->answer, fontsize);
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 4 - 2
display/d.colortable/main.c

@@ -138,7 +138,8 @@ int main(int argc, char **argv)
     if (Rast_read_fp_range(map_name, "", &fp_range) == -1)
     if (Rast_read_fp_range(map_name, "", &fp_range) == -1)
 	G_fatal_error(_("Range file for <%s> not available"), map_name);
 	G_fatal_error(_("Range file for <%s> not available"), map_name);
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
 
 
     D_setup_unity(0);
     D_setup_unity(0);
     D_get_src(&t, &b, &l, &r);
     D_get_src(&t, &b, &l, &r);
@@ -280,7 +281,8 @@ int main(int argc, char **argv)
 	    D_polygon_rel(x_box, y_box, 5);
 	    D_polygon_rel(x_box, y_box, 5);
 	}
 	}
     }
     }
-
+    
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 2 - 1
display/d.font/main.c

@@ -84,7 +84,8 @@ int main(int argc, char **argv)
 
 
     /* load the font */
     /* load the font */
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
 
 
     if (flag1->answer) {	/* List font names */
     if (flag1->answer) {	/* List font names */
 	print_font_list(stdout, 0);
 	print_font_list(stdout, 0);

+ 4 - 3
display/d.fontlist/main.c

@@ -51,8 +51,9 @@ int main(int argc, char **argv)
 	exit(EXIT_FAILURE);
 	exit(EXIT_FAILURE);
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     if (flagL->answer)
     if (flagL->answer)
 	D_font_info(&list, &count);
 	D_font_info(&list, &count);
     else
     else
@@ -60,7 +61,7 @@ int main(int argc, char **argv)
 
 
     for (i = 0; i < count; i++)
     for (i = 0; i < count; i++)
 	fprintf(stdout, "%s\n", list[i]);
 	fprintf(stdout, "%s\n", list[i]);
-
+    
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 5 - 3
display/d.geodesic/main.c

@@ -93,8 +93,9 @@ int main(int argc, char *argv[])
 
 
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+      	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     line_color = D_translate_color(parm.lcolor->answer);
     line_color = D_translate_color(parm.lcolor->answer);
     if (!line_color)
     if (!line_color)
 	line_color = D_translate_color(parm.lcolor->answer =
 	line_color = D_translate_color(parm.lcolor->answer =
@@ -113,7 +114,8 @@ int main(int argc, char *argv[])
 	text_color = D_translate_color(parm.tcolor->answer);
 	text_color = D_translate_color(parm.tcolor->answer);
 
 
     plot(lon1, lat1, lon2, lat2, line_color, text_color);
     plot(lon1, lat1, lon2, lat2, line_color, text_color);
-
+    
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 4 - 2
display/d.graph/main.c

@@ -98,8 +98,9 @@ int main(int argc, char **argv)
 
 
     /* open graphics window */
     /* open graphics window */
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     /* Parse and select color */
     /* Parse and select color */
     if (opt2->answer != NULL) {
     if (opt2->answer != NULL) {
 	color = G_str_to_color(opt2->answer, &R, &G, &B);
 	color = G_str_to_color(opt2->answer, &R, &G, &B);
@@ -129,6 +130,7 @@ int main(int argc, char **argv)
     set_text_size();
     set_text_size();
     graphics(infile);
     graphics(infile);
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 4 - 3
display/d.grid/main.c

@@ -227,9 +227,9 @@ int main(int argc, char **argv)
 
 
     /* Setup driver and check important information */
     /* Setup driver and check important information */
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     /* Parse and select grid color */
     /* Parse and select grid color */
     colorg = D_parse_color(opt1->answer, FALSE);
     colorg = D_parse_color(opt1->answer, FALSE);
     /* Parse and select border color */
     /* Parse and select border color */
@@ -264,6 +264,7 @@ int main(int argc, char **argv)
 	plot_border(size, east, north);
 	plot_border(size, east, north);
     }
     }
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 5 - 2
display/d.his/main.c

@@ -114,8 +114,9 @@ int main(int argc, char **argv)
     /* Do screen initializing stuff */
     /* Do screen initializing stuff */
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     /* Prepare the raster cell drawing functions */
     /* Prepare the raster cell drawing functions */
     D_setup(0);
     D_setup(0);
     D_set_overlay_mode(nulldraw->answer ? 1 : 0);
     D_set_overlay_mode(nulldraw->answer ? 1 : 0);
@@ -237,6 +238,8 @@ int main(int argc, char **argv)
     G_percent(window.rows, window.rows, 5);
     G_percent(window.rows, window.rows, 5);
     D_cell_draw_end();
     D_cell_draw_end();
 
 
+    D_save_command(G_recreate_command());
+    
     /* Close down connection to display driver */
     /* Close down connection to display driver */
     D_close_driver();
     D_close_driver();
 
 

+ 4 - 2
display/d.histogram/main.c

@@ -187,8 +187,9 @@ int main(int argc, char **argv)
     /* set up the graphics driver and initialize its color-table */
     /* set up the graphics driver and initialize its color-table */
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     D_setup_unity(0);			/* 0 = don't clear frame */
     D_setup_unity(0);			/* 0 = don't clear frame */
     D_get_src(&t, &b, &l, &r);
     D_get_src(&t, &b, &l, &r);
 
 
@@ -213,6 +214,7 @@ int main(int argc, char **argv)
     else
     else
 	bar(&dist_stats, &pcolors);
 	bar(&dist_stats, &pcolors);
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 4 - 3
display/d.info/main.c

@@ -65,9 +65,9 @@ int main(int argc, char *argv[])
     }
     }
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     if (rflag->answer || dflag->answer || fflag->answer)
     if (rflag->answer || dflag->answer || fflag->answer)
 	D_get_window(&t, &b, &l, &r);
 	D_get_window(&t, &b, &l, &r);
 
 
@@ -109,6 +109,7 @@ int main(int argc, char *argv[])
 	fprintf(stdout, "nsres=%.15g\n", (n-s)/(b-t) );
 	fprintf(stdout, "nsres=%.15g\n", (n-s)/(b-t) );
     }
     }
 
 
+    
     D_close_driver();
     D_close_driver();
 
 
     return EXIT_SUCCESS;
     return EXIT_SUCCESS;

+ 5 - 3
display/d.labels/main.c

@@ -114,14 +114,16 @@ int main(int argc, char **argv)
 	G_fatal_error(_("Unable to open label file <%s>"), label_name);
 	G_fatal_error(_("Unable to open label file <%s>"), label_name);
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+      	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     D_setup(0);
     D_setup(0);
 
 
     /* Go draw the raster map */
     /* Go draw the raster map */
     do_labels(infile, !horiz_flag->answer);
     do_labels(infile, !horiz_flag->answer);
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
-    exit(0);
+    exit(EXIT_SUCCESS);
 }
 }

+ 5 - 2
display/d.legend/main.c

@@ -260,8 +260,9 @@ int main(int argc, char **argv)
     Rast_set_c_null_value(&null_cell, 1);
     Rast_set_c_null_value(&null_cell, 1);
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+      	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     white = D_translate_color(DEFAULT_FG_COLOR);
     white = D_translate_color(DEFAULT_FG_COLOR);
     black = D_translate_color(DEFAULT_BG_COLOR);
     black = D_translate_color(DEFAULT_BG_COLOR);
 
 
@@ -902,6 +903,8 @@ int main(int argc, char **argv)
 	}
 	}
     }
     }
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
+    
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);
 }
 }

+ 5 - 1
display/d.linegraph/main.c

@@ -255,7 +255,9 @@ int main(int argc, char **argv)
 
 
     /* get coordinates of current screen window, in pixels */
     /* get coordinates of current screen window, in pixels */
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     D_setup_unity(0);
     D_setup_unity(0);
     D_get_src(&t, &b, &l, &r);
     D_get_src(&t, &b, &l, &r);
 
 
@@ -567,7 +569,9 @@ int main(int argc, char **argv)
     D_use_color(title_color);
     D_use_color(title_color);
     D_polyline_abs(x_line, y_line, 3);
     D_polyline_abs(x_line, y_line, 3);
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
+    
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);
 }
 }
 
 

+ 3 - 3
display/d.path/main.c

@@ -150,8 +150,9 @@ int main(int argc, char **argv)
 
 
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+      	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     color = G_standard_color_rgb(BLACK);
     color = G_standard_color_rgb(BLACK);
     if (G_str_to_color(color_opt->answer, &r, &g, &b)) {
     if (G_str_to_color(color_opt->answer, &r, &g, &b)) {
 	color.r = r;
 	color.r = r;
@@ -191,7 +192,6 @@ int main(int argc, char **argv)
 
 
     coor_path(&Map, &hcolor, bold_f->answer, x1, y1, x2, y2);
     coor_path(&Map, &hcolor, bold_f->answer, x1, y1, x2, y2);
 
 
-
     D_close_driver();
     D_close_driver();
 
 
     Vect_close(&Map);
     Vect_close(&Map);

+ 4 - 3
display/d.profile/main.c

@@ -260,8 +260,9 @@ int main(int argc, char **argv)
 
 
     /* establish connection with graphics driver */
     /* establish connection with graphics driver */
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     D_setup2(1, 0, 1.05, -0.05, -0.15, 1.05);
     D_setup2(1, 0, 1.05, -0.05, -0.15, 1.05);
 
 
     plot_axes();
     plot_axes();
@@ -313,7 +314,7 @@ int main(int argc, char **argv)
 
 
     D_end();
     D_end();
     D_stroke();
     D_stroke();
-
+    
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 5 - 3
display/d.rast.arrow/main.c

@@ -221,8 +221,9 @@ int main(int argc, char **argv)
 
 
     /* Setup driver and check important information */
     /* Setup driver and check important information */
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+      	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     D_setup(0);
     D_setup(0);
 
 
     /* Read in the map window associated with window */
     /* Read in the map window associated with window */
@@ -500,9 +501,10 @@ int main(int argc, char **argv)
     if (opt7->answer)
     if (opt7->answer)
 	Rast_close(mag_fd);
 	Rast_close(mag_fd);
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
-    exit(0);
+    exit(EXIT_SUCCESS);
 }
 }
 
 
 /* --- end of main --- */
 /* --- end of main --- */

+ 4 - 2
display/d.rast.num/main.c

@@ -190,8 +190,9 @@ int main(int argc, char **argv)
     /* Setup driver and check important information */
     /* Setup driver and check important information */
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+      	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     D_setup2(0, 0, t, b, l, r);
     D_setup2(0, 0, t, b, l, r);
 
 
     D_ns = fabs(D_get_u_to_d_yconv());
     D_ns = fabs(D_get_u_to_d_yconv());
@@ -241,6 +242,7 @@ int main(int argc, char **argv)
 
 
     Rast_close(layer_fd);
     Rast_close(layer_fd);
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 5 - 3
display/d.rgb/main.c

@@ -77,8 +77,9 @@ int main(int argc, char **argv)
 
 
     /* Do screen initializing stuff */
     /* Do screen initializing stuff */
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     overlay = !flag_n->answer;
     overlay = !flag_n->answer;
 
 
     D_setup(0);
     D_setup(0);
@@ -125,7 +126,8 @@ int main(int argc, char **argv)
     }
     }
     G_percent(window.rows, window.rows, 5);
     G_percent(window.rows, window.rows, 5);
     D_cell_draw_end();
     D_cell_draw_end();
-
+    
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     /* Close the raster maps */
     /* Close the raster maps */

+ 4 - 2
display/d.rhumbline/main.c

@@ -93,8 +93,9 @@ int main(int argc, char *argv[])
 
 
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     line_color = D_translate_color(parm.lcolor->answer);
     line_color = D_translate_color(parm.lcolor->answer);
     if (!line_color)
     if (!line_color)
 	line_color = D_translate_color(parm.lcolor->answer =
 	line_color = D_translate_color(parm.lcolor->answer =
@@ -115,6 +116,7 @@ int main(int argc, char *argv[])
 
 
     plot(lon1, lat1, lon2, lat2, line_color, text_color);
     plot(lon1, lat1, lon2, lat2, line_color, text_color);
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 4 - 3
display/d.text/main.c

@@ -288,9 +288,9 @@ int main(int argc, char **argv)
     bold = flag.b->answer;
     bold = flag.b->answer;
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     if (opt.font->answer)
     if (opt.font->answer)
 	D_font(opt.font->answer);
 	D_font(opt.font->answer);
     else if (opt.path->answer)
     else if (opt.path->answer)
@@ -357,6 +357,7 @@ int main(int argc, char **argv)
 	D_text_size(5, 5);
 	D_text_size(5, 5);
 	D_text_rotation(0.0);
 	D_text_rotation(0.0);
 
 
+	D_save_command(G_recreate_command());
 	D_close_driver();
 	D_close_driver();
 
 
 	exit(EXIT_SUCCESS);
 	exit(EXIT_SUCCESS);

+ 4 - 2
display/d.thematic.area/main.c

@@ -363,8 +363,9 @@ int main(int argc, char **argv)
     if (!nodraw_flag->answer) {
     if (!nodraw_flag->answer) {
 	/* Now's let's prepare the actual plotting */
 	/* Now's let's prepare the actual plotting */
 	if (D_open_driver() != 0)
 	if (D_open_driver() != 0)
-	    G_fatal_error(_("No graphics device selected"));
-
+	    G_fatal_error(_("No graphics device selected. "
+			    "Use d.mon to select graphics device."));
+	
 	D_setup(0);
 	D_setup(0);
 
 
 	if (verbose)
 	if (verbose)
@@ -407,6 +408,7 @@ int main(int argc, char **argv)
 
 
 	}			/* end window check if */
 	}			/* end window check if */
 
 
+	D_save_command(G_recreate_command());
 	D_close_driver();
 	D_close_driver();
 
 
     }				/* end of nodraw_flag condition */
     }				/* end of nodraw_flag condition */

+ 4 - 2
display/d.vect.chart/main.c

@@ -250,8 +250,9 @@ int main(int argc, char **argv)
 	ctype = CTYPE_BAR;
 	ctype = CTYPE_BAR;
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     /* should we plot the maximum reference on bar plots? */
     /* should we plot the maximum reference on bar plots? */
     if (max_reference_opt->answer != NULL) {
     if (max_reference_opt->answer != NULL) {
 
 
@@ -272,6 +273,7 @@ int main(int argc, char **argv)
 	       sizecol_opt->answer, size, scale,
 	       sizecol_opt->answer, size, scale,
 	       &ocolor, colors, y_center, max_reference);
 	       &ocolor, colors, y_center, max_reference);
 
 
+    D_save_command(G_recreate_command());
     D_close_driver();
     D_close_driver();
 
 
     Vect_close(&Map);
     Vect_close(&Map);

+ 5 - 1
display/d.where/main.c

@@ -166,9 +166,13 @@ int main(int argc, char **argv)
 	fp = stdin;
 	fp = stdin;
 
 
     if (D_open_driver() != 0)
     if (D_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
+	G_fatal_error(_("No graphics device selected. "
+			"Use d.mon to select graphics device."));
+    
     D_setup(0);
     D_setup(0);
+
     where_am_i(coords->answers, fp, have_spheroid, decimal->answer, dcoord->answer);
     where_am_i(coords->answers, fp, have_spheroid, decimal->answer, dcoord->answer);
+    
     D_close_driver();
     D_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);