[GRASS-SVN] r58303 - grass/trunk/display/d.mon

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 25 05:10:42 PST 2013


Author: martinl
Date: 2013-11-25 05:10:42 -0800 (Mon, 25 Nov 2013)
New Revision: 58303

Modified:
   grass/trunk/display/d.mon/Makefile
   grass/trunk/display/d.mon/main.c
Log:
d.mon: change -r flag - release and *stop* currently selected monitor
       add -u flag to open output file in update mode, otherwise output file is simply overwritten


Modified: grass/trunk/display/d.mon/Makefile
===================================================================
--- grass/trunk/display/d.mon/Makefile	2013-11-25 10:48:06 UTC (rev 58302)
+++ grass/trunk/display/d.mon/Makefile	2013-11-25 13:10:42 UTC (rev 58303)
@@ -2,8 +2,8 @@
 
 PGM = d.mon
 
-LIBES = $(GISLIB)
-DEPENDENCIES= $(GISDEP)
+LIBES = $(GISLIB) $(DISPLAYLIB)
+DEPENDENCIES= $(GISDEP) $(DISPLAYDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make
 

Modified: grass/trunk/display/d.mon/main.c
===================================================================
--- grass/trunk/display/d.mon/main.c	2013-11-25 10:48:06 UTC (rev 58302)
+++ grass/trunk/display/d.mon/main.c	2013-11-25 13:10:42 UTC (rev 58303)
@@ -16,6 +16,7 @@
 #include <string.h>
 
 #include <grass/gis.h>
+#include <grass/display.h>
 #include <grass/glocale.h>
 
 #include "proto.h"
@@ -26,7 +27,7 @@
     struct Option *start_opt, *select_opt, *stop_opt, *output_opt,
       *width_opt, *height_opt, *bgcolor_opt;
     struct Flag *list_flag, *selected_flag, *select_flag, *release_flag, 
-	*cmd_flag, *truecolor_flag;
+        *cmd_flag, *truecolor_flag, *update_flag;
     
     int nopts, ret;
     const char *mon;
@@ -105,14 +106,20 @@
 
     release_flag = G_define_flag();
     release_flag->key = 'r';
-    release_flag->description = _("Release currently selected monitor and exit");
+    release_flag->description = _("Release and stop currently selected monitor and exit");
     release_flag->guisection = _("Manage");
 
     truecolor_flag = G_define_flag();
     truecolor_flag->key = 't';
     truecolor_flag->description = _("Disable true colors");
-    truecolor_flag->guisection = _("Manage");
+    truecolor_flag->guisection = _("Settings");
 
+    update_flag = G_define_flag();
+    update_flag->key = 'u';
+    update_flag->label = _("Open output file in update mode");
+    update_flag->description = _("Requires --overwrite flag. If not given the output file is overwritten.");
+    update_flag->guisection = _("Settings");
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
     
@@ -132,6 +139,7 @@
 	    else if (mon) { /* release */
 		G_unsetenv("MONITOR");
 		G_verbose_message(_("Monitor <%s> released"), mon); 
+                ret = stop_mon(mon);
 	    }
 	}
 	else
@@ -161,10 +169,19 @@
 	(!start_opt->answer || strncmp(start_opt->answer, "wx", 2) == 0))
 	G_warning(_("Option <%s> ignored"), output_opt->key);
     
-    if (start_opt->answer)
+    if (start_opt->answer) {
 	ret = start_mon(start_opt->answer, output_opt->answer, !select_flag->answer,
 			width_opt->answer, height_opt->answer, bgcolor_opt->answer,
 			!truecolor_flag->answer);
+        if (output_opt->answer && !update_flag->answer) {
+            if (D_open_driver() != 0)
+                G_fatal_error(_("No graphics device selected. "
+                                "Use d.mon to select graphics device."));
+            D_setup_unity(0);
+            D_erase(bgcolor_opt->answer);
+            D_close_driver();
+        }
+    }
     
     if (stop_opt->answer)
 	ret = stop_mon(stop_opt->answer);



More information about the grass-commit mailing list