[GRASS-SVN] r63760 - grass/trunk/display/d.mon
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Dec 25 07:57:13 PST 2014
Author: martinl
Date: 2014-12-25 07:57:13 -0800 (Thu, 25 Dec 2014)
New Revision: 63760
Modified:
grass/trunk/display/d.mon/main.c
grass/trunk/display/d.mon/proto.h
grass/trunk/display/d.mon/start.c
Log:
d.mon: erase output file when --overwrite is given
Modified: grass/trunk/display/d.mon/main.c
===================================================================
--- grass/trunk/display/d.mon/main.c 2014-12-25 15:10:42 UTC (rev 63759)
+++ grass/trunk/display/d.mon/main.c 2014-12-25 15:57:13 UTC (rev 63760)
@@ -127,7 +127,7 @@
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->description = _("Requires --overwrite flag");
update_flag->guisection = _("Settings");
x_flag = G_define_flag();
@@ -204,7 +204,7 @@
ret = start_mon(start_opt->answer, output_opt->answer, !select_flag->answer,
width, height, bgcolor_opt->answer,
- !truecolor_flag->answer, x_flag->answer);
+ !truecolor_flag->answer, x_flag->answer, update_flag->answer);
if (output_opt->answer && !update_flag->answer) {
D_open_driver();
D_setup_unity(0);
Modified: grass/trunk/display/d.mon/proto.h
===================================================================
--- grass/trunk/display/d.mon/proto.h 2014-12-25 15:10:42 UTC (rev 63759)
+++ grass/trunk/display/d.mon/proto.h 2014-12-25 15:57:13 UTC (rev 63760)
@@ -1,6 +1,6 @@
/* start */
int start_mon(const char *, const char *, int, int, int,
- const char *, int, int);
+ const char *, int, int, int);
/* select.c */
int select_mon(const char *);
Modified: grass/trunk/display/d.mon/start.c
===================================================================
--- grass/trunk/display/d.mon/start.c 2014-12-25 15:10:42 UTC (rev 63759)
+++ grass/trunk/display/d.mon/start.c 2014-12-25 15:57:13 UTC (rev 63760)
@@ -7,13 +7,13 @@
#include "proto.h"
-static void start(const char *, const char *);
+static void start(const char *, const char *, int);
static void start_wx(const char *, const char *, const char *,
const char *, int, int, int);
static void error_handler(void *);
/* start file-based monitor */
-void start(const char *name, const char *output)
+void start(const char *name, const char *output, int update)
{
char *env_name, output_path[GPATH_MAX];
const char *output_name;
@@ -27,9 +27,11 @@
output_name = D_get_file();
if (!output_name)
return;
- if (access(output_name, F_OK) == 0) {
+ if (!update && access(output_name, F_OK) == 0) {
if (G_get_overwrite()) {
G_warning(_("File '%s' already exists and will be overwritten"), output_name);
+ D_setup_unity(0);
+ D_erase("white");
}
else {
D_close_driver();
@@ -105,7 +107,7 @@
int start_mon(const char *name, const char *output, int select,
int width, int height, const char *bgcolor,
- int truecolor, int x_only)
+ int truecolor, int x_only, int update)
{
char *u_name;
char *env_name, *env_value, *cmd_value;
@@ -185,7 +187,7 @@
start_wx(name, tempfile, env_value, cmd_value,
width, height, x_only);
else
- start(name, output);
+ start(name, output, update);
return 0;
}
More information about the grass-commit
mailing list