[GRASS-SVN] r55869 - grass/branches/releasebranch_6_4/vector/v.digit
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 17 23:34:06 PDT 2013
Author: hamish
Date: 2013-04-17 23:34:05 -0700 (Wed, 17 Apr 2013)
New Revision: 55869
Modified:
grass/branches/releasebranch_6_4/vector/v.digit/centre.c
grass/branches/releasebranch_6_4/vector/v.digit/driver.c
grass/branches/releasebranch_6_4/vector/v.digit/global.h
grass/branches/releasebranch_6_4/vector/v.digit/main.c
Log:
don't mess with the current WIND file, use WIND_OVERRIDE instead (merge r49668 from devbr6)
Modified: grass/branches/releasebranch_6_4/vector/v.digit/centre.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/centre.c 2013-04-18 06:13:53 UTC (rev 55868)
+++ grass/branches/releasebranch_6_4/vector/v.digit/centre.c 2013-04-18 06:34:05 UTC (rev 55869)
@@ -1,19 +1,16 @@
-/* ***************************************************************
- * *
- * * MODULE: v.digit
- * *
- * * AUTHOR(S): Radim Blazek
- * *
- * * PURPOSE: Edit vector
- * *
- * * COPYRIGHT: (C) 2001 by the GRASS Development Team
- * *
- * * This program is free software under the
- * * GNU General Public License (>=v2).
- * * Read the file COPYING that comes with GRASS
- * * for details.
- * *
- * **************************************************************/
+/***************************************************************
+ *
+ * MODULE: v.digit
+ * AUTHOR(S): Radim Blazek
+ * PURPOSE: Edit vector
+ *
+ * COPYRIGHT: (C) 2001 by the GRASS Development Team
+ * This program is free software under the
+ * GNU General Public License (>=v2).
+ * Read the file COPYING that comes with GRASS
+ * for details.
+ *
+ **************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -24,7 +21,8 @@
#include "global.h"
#include "proto.h"
-/* This function is started from the GUI, it regularly updates GUI and checks GUI requirements.
+/* This function is started from the GUI, it regularly updates GUI and
+ * checks GUI requirements.
* If Tool_next is set by GUI, the tool is started by the tool_centre()
*/
void tool_centre(void)
@@ -174,8 +172,10 @@
Vect_build(&Map);
Vect_close(&Map);
- if (1 == G_put_window(&GRegion))
- G_message(_("Region restored to original extent."));
+ /* abandon temporary region, back to the real one */
+ /* is unsetenv() portable? */
+ putenv("WIND_OVERRIDE=");
+ G_remove("windows", temp_wind_file);
/* clear the screen */
Tcl_Eval(Toolbox, ".screen.canvas delete all");
Modified: grass/branches/releasebranch_6_4/vector/v.digit/driver.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/driver.c 2013-04-18 06:13:53 UTC (rev 55868)
+++ grass/branches/releasebranch_6_4/vector/v.digit/driver.c 2013-04-18 06:34:05 UTC (rev 55869)
@@ -2,6 +2,7 @@
#include <grass/raster.h>
#include <grass/display.h>
#include <grass/colors.h>
+#include <grass/glocale.h>
#include "global.h"
#include "proto.h"
@@ -78,7 +79,7 @@
/* Set the map region associated with graphics frame */
G_get_set_window(®ion);
if (G_set_window(®ion) < 0)
- G_fatal_error("Invalid graphics coordinates");
+ G_fatal_error(_("Can't set window"));
/* Determine conversion factors */
if (D_do_conversions(®ion, t, b, l, r))
Modified: grass/branches/releasebranch_6_4/vector/v.digit/global.h
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/global.h 2013-04-18 06:13:53 UTC (rev 55868)
+++ grass/branches/releasebranch_6_4/vector/v.digit/global.h 2013-04-18 06:34:05 UTC (rev 55869)
@@ -155,7 +155,7 @@
Global SYMB Symb[SYMB_COUNT];
Global struct Map_info Map;
-Global struct Cell_head GRegion; /* Current region (synchronized with GRASS WIND) */
+Global char temp_wind_file[24];
Global Tcl_Interp *Toolbox;
Global int Tool_next; /* Next tool to be run */
Global double Xscale, Yscale; /* Scale factors = size_in_map / size_on_screen */
Modified: grass/branches/releasebranch_6_4/vector/v.digit/main.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/main.c 2013-04-18 06:13:53 UTC (rev 55868)
+++ grass/branches/releasebranch_6_4/vector/v.digit/main.c 2013-04-18 06:34:05 UTC (rev 55869)
@@ -12,6 +12,8 @@
#define MAIN
#include <stdio.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
#include <tcl.h>
#include <tk.h>
#include <grass/gis.h>
@@ -97,6 +99,7 @@
char **tokens;
char *fake_argv[4];
char toolbox[GPATH_MAX];
+ struct Cell_head GRegion;
G_gisinit(argv[0]);
@@ -139,9 +142,14 @@
G_debug(2, "cmd %d : %s", i, Bgcmd[i].cmd);
Tool_next = TOOL_NOTHING;
+
G_get_window(&GRegion);
G_debug(1, "Region: N = %f S = %f E = %f W = %f", GRegion.north,
GRegion.south, GRegion.east, GRegion.west);
+ /* set up temporary region */
+ sprintf(temp_wind_file, "tmp_vdigit_%d", getpid());
+ G__put_window(&GRegion, "windows", temp_wind_file);
+ G_putenv("WIND_OVERRIDE", temp_wind_file);
/* Open map */
mapset = G_find_vector2(map_opt->answer, G_mapset());
More information about the grass-commit
mailing list