Kaynağa Gözat

Breaking stuff part 2: the Tek4014 is obsolete
Eliminate monitors, and all that depends upon them; direct rendering only
No mouse, no panels, no pads


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32584 15284696-431f-4ddb-bdfa-cd5b030d7da7

Glynn Clements 16 yıl önce
ebeveyn
işleme
3a87c53425
100 değiştirilmiş dosya ile 184 ekleme ve 6411 silme
  1. 11 16
      display/Makefile
  2. 0 10
      display/d.ask/Makefile
  3. 0 154
      display/d.ask/description.html
  4. 0 89
      display/d.ask/main.c
  5. 1 7
      display/d.barscale/draw_scale.c
  6. 6 45
      display/d.barscale/main.c
  7. 0 47
      display/d.barscale/mouse.c
  8. 1 4
      display/d.barscale/options.h
  9. 0 9
      display/d.colors/main.c
  10. 0 8
      display/d.colortable/main.c
  11. 4 27
      display/d.erase/main.c
  12. 0 12
      display/d.extend/Makefile
  13. 0 25
      display/d.extend/description.html
  14. 0 136
      display/d.extend/main.c
  15. 0 2
      display/d.font.freetype/DEPRECATED
  16. 0 11
      display/d.font.freetype/Makefile
  17. 0 74
      display/d.font.freetype/description.html
  18. 0 274
      display/d.font.freetype/main.c
  19. 0 1
      display/d.font/main.c
  20. 0 31
      display/d.frame/Makefile
  21. 0 71
      display/d.frame/create.c
  22. 0 56
      display/d.frame/description.html
  23. 0 63
      display/d.frame/dumper.c
  24. 0 233
      display/d.frame/frame.c
  25. 0 86
      display/d.frame/list.c
  26. 0 68
      display/d.frame/select.c
  27. 20 31
      display/d.geodesic/main.c
  28. 0 47
      display/d.geodesic/mouse.c
  29. 1 12
      display/d.graph/main.c
  30. 0 2
      display/d.grid/main.c
  31. 0 10
      display/d.his/main.c
  32. 0 1
      display/d.histogram/main.c
  33. 2 15
      display/d.info/main.c
  34. 1 13
      display/d.labels/main.c
  35. 0 47
      display/d.legend/box.c
  36. 20 57
      display/d.legend/main.c
  37. 0 7
      display/d.measure/main.c
  38. 0 10
      display/d.menu/Makefile
  39. 0 240
      display/d.menu/description.html
  40. 0 200
      display/d.menu/main.c
  41. 0 13
      display/d.mon/Makefile
  42. 0 15
      display/d.mon/cmd/Makefile
  43. 0 127
      display/d.mon/cmd/description.html
  44. 0 157
      display/d.mon/cmd/main.c
  45. 0 42
      display/d.mon/pgms/Makefile
  46. 0 30
      display/d.mon/pgms/list.c
  47. 0 27
      display/d.mon/pgms/local_proto.h
  48. 0 15
      display/d.mon/pgms/open.h
  49. 0 90
      display/d.mon/pgms/release.c
  50. 0 58
      display/d.mon/pgms/select.c
  51. 0 95
      display/d.mon/pgms/start.c
  52. 0 44
      display/d.mon/pgms/status.c
  53. 0 89
      display/d.mon/pgms/stop.c
  54. 0 18
      display/d.mon/pgms/which.c
  55. 0 5
      display/d.nviz/local.h
  56. 23 122
      display/d.nviz/main.c
  57. 12 21
      display/d.path/main.c
  58. 0 3
      display/d.path/proto.h
  59. 0 155
      display/d.path/select.c
  60. 6 35
      display/d.rast.arrow/arrow.c
  61. 0 2
      display/d.rast.edit/DEPRECATED
  62. 0 10
      display/d.rast.edit/Makefile
  63. 0 112
      display/d.rast.edit/cell.c
  64. 0 216
      display/d.rast.edit/description.html
  65. 0 57
      display/d.rast.edit/draw_grid.c
  66. 0 383
      display/d.rast.edit/edit.c
  67. 0 92
      display/d.rast.edit/edit.h
  68. 0 220
      display/d.rast.edit/main.c
  69. 0 434
      display/d.rast.edit/menu.c
  70. 0 90
      display/d.rast.edit/mk_new_layer.c
  71. 0 76
      display/d.rast.edit/mk_tmp_file.c
  72. 3 17
      display/d.rast.num/number.c
  73. 1 9
      display/d.rast/display.c
  74. 1 1
      display/d.rast/local_proto.h
  75. 2 10
      display/d.rast/main.c
  76. 0 9
      display/d.rgb/main.c
  77. 21 31
      display/d.rhumbline/main.c
  78. 0 53
      display/d.rhumbline/mouse.c
  79. 0 10
      display/d.save/Makefile
  80. 0 49
      display/d.save/description.html
  81. 0 16
      display/d.save/locals.h
  82. 0 565
      display/d.save/main.c
  83. 23 80
      display/d.text.new/main.c
  84. 1 14
      display/d.thematic.area/main.c
  85. 0 6
      display/d.vect.chart/main.c
  86. 3 20
      display/d.vect/main.c
  87. 4 29
      display/d.what.rast/main.c
  88. 5 26
      display/d.what.vect/main.c
  89. 4 56
      display/d.what.vect/what.c
  90. 2 2
      display/d.what.vect/what.h
  91. 6 85
      display/d.zoom/main.c
  92. 0 34
      display/drivers/HTMLMAP/Makefile
  93. 0 3
      display/drivers/HTMLMAP/moncap.entry
  94. 0 29
      display/drivers/PNG/Makefile
  95. 0 44
      display/drivers/PNG/README
  96. 0 29
      display/drivers/PNG/main.c
  97. 0 27
      display/drivers/PNG/moncap.entry
  98. 0 29
      display/drivers/PS/Makefile
  99. 0 24
      display/drivers/PS/main.c
  100. 0 0
      display/drivers/PS/moncap.entry

+ 11 - 16
display/Makefile

@@ -2,17 +2,10 @@
 MODULE_TOPDIR = ..
 
 SUBDIRS = \
-	drivers \
-	d.ask \
 	d.barscale \
 	d.colorlist \
-	d.colors \
 	d.colortable \
 	d.erase \
-	d.extend \
-	d.extract \
-	d.font \
-	d.frame \
 	d.geodesic \
 	d.graph \
 	d.grid \
@@ -22,27 +15,29 @@ SUBDIRS = \
 	d.labels \
 	d.legend \
 	d.linegraph \
-	d.measure \
-	d.menu \
-	d.mon \
 	d.nviz \
 	d.path \
-	d.profile \
 	d.rast \
 	d.rast.arrow \
 	d.rast.num \
 	d.rgb \
 	d.rhumbline \
-	d.save \
 	d.text.new \
 	d.title \
 	d.vect \
 	d.vect.chart \
 	d.thematic.area \
-	d.what.rast \
-	d.what.vect \
-	d.where \
-	d.zoom
+
+#	d.colors \
+#	d.extract \
+#	d.font \
+#	d.measure \
+#	d.profile \
+#	d.what.rast \
+#	d.what.vect \
+#	d.where \
+#	d.zoom \
+#	drivers
 
 include $(MODULE_TOPDIR)/include/Make/Dir.make
 

+ 0 - 10
display/d.ask/Makefile

@@ -1,10 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = d.ask
-
-LIBES     = $(RASTERLIB) $(GISLIB)
-DEPENDENCIES= $(RASTERDEP) $(GISDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 154
display/d.ask/description.html

@@ -1,154 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>d.ask</EM> is designed for shell scripts that need to prompt the user for 
-the name of a data base file in the user's current GRASS mapset search path. 
-After <EM>d.ask</EM> is invoked with needed parameters, 
-the mouse becomes active and a menu containing files of the specified 
-<EM>element</EM> type is displayed on the user's graphics monitor. 
-The user is prompted by the prompt "<EM>message</EM>" to select one of the 
-listed file names with the mouse. Specifically, the query that appears 
-to the user takes the form: 
-
-<P>
-<DL>
-<DD> <B>Double</B> click on the <EM>prompt</EM> "message"
-<DD> <B>Double</B> click here to cancel
-<P>
-<DD> (A list of files of the specified <EM>element</EM> type from each 
-     of the mapsets listed in the user's mapset search path is also 
-     displayed.) 
-</DL>
-
-<P>
-
-After the user responds, the mouse is deactivated and 
-the displayed menu is erased from the screen 
-(leaving any underlying materials on display intact). 
-Three lines are written to standard output (the user's terminal screen): 
-
-<P>
-<DL>
-<DD><B>name=</B><EM>file_name</em>
-<DD><B>mapset=</B><EM>mapset_name</em>
-<DD><B>fullname=</B><EM>file_name@mapset_name</em>
-</DL>
-<P>
-
-<H3>Parameters:</H3>
-
-<DL>
-<DT><B>element=</B><EM>name,description</em>
-<DD>Name of a GRASS data base element, followed by a one word description of the 
-element. GRASS data base elements are mapset subdirectories; these include: 
-bdlg, cats, cell, cell_misc, cellhd, colr, colr2, dig, dig_ascii, dig_att, 
-dig_cats, dig_plus, dlg, group, hist, icons, noise, paint, site_lists, and 
-windows. 
-The <EM>description</EM> will be used to display an error message to the screen 
-if no files of the named element type exist in the user's mapset search path. 
-The prompt "<EM>message</EM>" will appear in the pop-up menu displayed on the 
-user's graphics monitor. The files listed in the menu will be of the 
-specified <EM>element</EM> type, and exist in mapsets listed in the user's 
-current mapset search path. 
-<DT><B>prompt=</B>"<EM>message</EM>"
-<DD>A brief message with which the user will be prompted. 
-If this message contains more than one word, it should be 
-enclosed within double quotes (""). 
-It is a non-selectable message displayed in the menu bar of a pop-up menu. 
-Selectable items in the displayed menu include a cancel option and any of the 
-files in the mapset subdirectory <EM>name</EM> in the user's mapset search path. 
-</DL>
-
-<H2>EXAMPLE</H2>
-
-Given the following input, 
-
-<P>
-<DL>
-<DD>
-<B>d.ask element=</B>cell,raster <B>prompt=</B>"raster map layer to 
-be used"
-</DL>
-
-<P>
-<EM>d.ask</EM> will prompt the user to select a raster (cell) file from among 
-those listed in the "cell" directories of the mapsets listed in his current 
-mapset search path. A pop-up menu will be displayed on the user's graphics 
-monitor, containing the prompt: 
-
-<P>
-<DL>
-<DD> <B>Double</B> click on the <EM>raster</EM> map layer to be used
-<DD> <B>Double</B> click here to cancel
-</DL>
-
-<H2>OUTPUT</H2>
-
-If the user selects a file name from the displayed menu, 
-<EM>d.ask</EM> writes three lines to standard output: 
-
-<P>
-<DL>
-<DD> <B>name=</B><EM>file_name</EM> 
-<DD> <B>mapset=</B><EM>mapset_name</EM> 
-<DD> <B>fullname=</B><EM>file_name@mapset_name</EM> 
-</DL>
-
-<P>
-The output is in the form of /bin/sh commands to set the variable 
-<EM>name</EM>
-to the file name specified by the user 
-(of the <EM>element</EM> type requested by <EM>d.ask</EM>), <EM>mapset</EM>
-to the GRASS mapset in which this file resides, and <EM>fullname</EM>
-to the name of the file and its mapset. 
-
-<P>
-
-If the user elects not to select a file but instead chooses the 
-"Double click here to cancel" option, 
-the mouse will be deactivated and no variable assignments will be 
-returned to standard output. 
-
-<P>
-
-If no files of the specified <EM>element</EM> type are found in the user's 
-current mapset search path, the mouse is activated and the following message 
-is displayed on the user's graphics monitor: 
-
-<P>
-<DL>
-<DD> <B>No <EM>element</EM> description files found</B> 
-<DD> <B>Click here to continue</B> 
-</DL>
-
-<P>
-
-<H2>NOTES</H2>
-
-Parameter values 
-(the <EM>element</EM> name and description, and <EM>prompt</EM> message) 
-cannot be supplied to <EM>d.ask</EM> interactively; 
-they must be supplied on the command line or from a file. 
-
-<H2>SEE ALSO</H2>
-
-<EM>
-<A HREF="g.ask.html">g.ask</A>,<br>
-<A HREF="g.filename.html">g.filename</A>,<br>
-<A HREF="g.findfile.html">g.findfile</A>,<br>
-<A HREF="g.gisenv.html">g.gisenv</A>,<br>
-<A HREF="g.mapsets.html">g.mapsets</A>
-</EM>
-
-<H2>BUGS</H2>
-
-This program calls other GRASS programs which may generate confusing 
-error messages. Example: an error message from the 
-program <A HREF="d.menu.html">d.menu</A> 
-will appear if a nonexistent map element is chosen. 
-
-<H2>AUTHOR</H2>
-
-Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
-
-<p>
-<i>Last changed: $Date$</i>

+ 0 - 89
display/d.ask/main.c

@@ -1,89 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       d.ask
- * AUTHOR(S):    Michael Shapiro, CERL (original contributor)
- *               Markus Neteler <neteler itc.it>, 
- *               Bernhard Reiter <bernhard intevation.de>, 
- *               Eric G. Miller <egm2 jps.net>, 
- *               Glynn Clements <glynn gclements.plus.com>, 
- *               Jan-Oliver Wagner <jan intevation.de>
- * PURPOSE:      ask user to select a database file from mapset search path
- * COPYRIGHT:    (C) 1999-2007 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 <unistd.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include <grass/raster.h>
-
-int main(int argc, char *argv[])
-{
-    struct GModule *module;
-    struct Option *element, *prompt;
-    char *tempfile;
-    char command[1024];
-    FILE *fd;
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("display");
-    module->description =
-	"Prompts the user to select a GRASS data base file from among "
-	"files displayed in a menu on the graphics monitor.";
-
-    element = G_define_option();
-    element->key = "element";
-    element->key_desc = "name,description";
-    element->type = TYPE_STRING;
-    element->required = YES;
-    element->description = "Database element , one word description";
-
-    prompt = G_define_option();
-    prompt->key = "prompt";
-    prompt->key_desc = "\"message\"";
-    prompt->type = TYPE_STRING;
-    prompt->description = "Short user prompt message";
-
-    G_disable_interactive();
-    if (G_parser(argc, argv))
-	exit(1);
-
-    /* make sure we can do graphics */
-    if (R_open_driver() != 0)
-	G_fatal_error("No graphics device selected");
-    R_close_driver();
-
-    tempfile = G_tempfile();
-    unlink(tempfile);
-    sprintf(command, "%s/etc/i.find %s %s %s %s",
-	    G_gisbase(), G_location(), G_mapset(), element->answers[0],
-	    tempfile);
-    system(command);
-
-    if (access(tempfile, 0) == 0) {
-	if (prompt->answer) {
-	    sprintf(command, "%s/etc/i.ask %s '%s'",
-		    G_gisbase(), tempfile, prompt->answer);
-	}
-	else {
-	    sprintf(command, "%s/etc/i.ask %s", G_gisbase(), tempfile);
-	}
-	exit(system(command));
-    }
-    else {
-	fd = popen("d.menu tcolor=red > /dev/null", "w");
-	if (fd) {
-	    fprintf(fd, "** no %s files found **\n", element->answers[1]);
-	    fprintf(fd, "Click here to CONTINUE\n");
-	    pclose(fd);
-	}
-	exit(0);
-    }
-}

+ 1 - 7
display/d.barscale/draw_scale.c

@@ -59,7 +59,7 @@ static const struct scale
     "5000 miles", 8046720.000, 20000000., 5},}
 };
 
-int draw_scale(char *save, int toptext)
+int draw_scale(int toptext)
 {
     double meters;
     double line_len;
@@ -93,9 +93,6 @@ int draw_scale(char *save, int toptext)
 	pr = x_pos + w + 2;	/* 1 pixel margin for both sides */
 	pb = y_pos + h + 2;	/* 1 pixel margin for both sides */
 
-	if (save)
-	    R_panel_save(save, pt, pb, pl, pr);
-
 	if (do_background) {
 	    D_raster_use_color(color1);
 
@@ -169,9 +166,6 @@ int draw_scale(char *save, int toptext)
     if (pr > r)
 	pr = r;
 
-    if (save)
-	R_panel_save(save, pt, pb, pl, pr);
-
     if (do_background) {
 	D_raster_use_color(color1);
 

+ 6 - 45
display/d.barscale/main.c

@@ -41,12 +41,11 @@ int draw = 0;
 
 int main(int argc, char **argv)
 {
-    char window_name[64];
     struct Cell_head window;
     int t, b, l, r;
     struct GModule *module;
     struct Option *opt1, *opt2, *opt3;
-    struct Flag *mouse, *feet, *top, *linescale, *northarrow, *scalebar;
+    struct Flag *feet, *top, *linescale, *northarrow, *scalebar;
     struct Cell_head W;
 
     /* Initialize the GIS calls */
@@ -56,10 +55,6 @@ int main(int argc, char **argv)
     module->keywords = _("display, cartography");
     module->description = _("Displays a barscale on the graphics monitor.");
 
-    mouse = G_define_flag();
-    mouse->key = 'm';
-    mouse->description = _("Use mouse to interactively place scale");
-
     feet = G_define_flag();
     feet->key = 'f';
     feet->description = _("Use feet/miles instead of meters");
@@ -139,13 +134,6 @@ int main(int argc, char **argv)
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    if (D_get_cur_wind(window_name))
-	G_fatal_error(_("No current window"));
-
-    if (D_set_cur_wind(window_name))
-	G_fatal_error(_("Current window not available"));
-
-
     /* Parse and select background color */
     color1 = D_parse_color(opt1->answer, 1);
     if (color1 == 0)
@@ -158,46 +146,19 @@ int main(int argc, char **argv)
     /* Read in the map window associated with window */
     G_get_window(&window);
 
-    if (D_check_map_window(&window))
-	G_fatal_error(_("Setting map window"));
+    D_check_map_window(&window);
 
     if (G_set_window(&window) == -1)
 	G_fatal_error(_("Current window not settable"));
 
     /* Determine conversion factors */
-    if (D_get_screen_window(&t, &b, &l, &r))
-	G_fatal_error(_("Getting screen window"));
+    D_get_screen_window(&t, &b, &l, &r);
+
     if (D_do_conversions(&window, t, b, l, r))
 	G_fatal_error(_("Error in calculating conversions"));
 
-    if (!mouse->answer) {
-	/* Draw the scale */
-	draw_scale(NULL, top->answer);
-
-	/* Add this command to list */
-	D_add_to_list(G_recreate_command());
-    }
-    else if (mouse_query(top->answer)) {
-	char cmdbuf[255];
-
-	sprintf(cmdbuf, "%s at=%f,%f", argv[0], east, north);
-
-	sprintf(cmdbuf, "%s bcolor=%s", cmdbuf, opt1->answer);
-	sprintf(cmdbuf, "%s tcolor=%s", cmdbuf, opt2->answer);
-	if (top->answer)
-	    strcat(cmdbuf, " -t");
-	if (feet->answer)
-	    strcat(cmdbuf, " -f");
-	if (linescale->answer)
-	    strcat(cmdbuf, " -l");
-	if (northarrow->answer)
-	    strcat(cmdbuf, " -n");
-	if (scalebar->answer)
-	    strcat(cmdbuf, " -s");
-
-	/* Add this command to list */
-	D_add_to_list(cmdbuf);
-    }
+    /* Draw the scale */
+    draw_scale(top->answer);
 
     R_close_driver();
 

+ 0 - 47
display/d.barscale/mouse.c

@@ -1,47 +0,0 @@
-#include <stdio.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-#include "options.h"
-
-int mouse_query(int toptext)
-{
-    int t, b, l, r;
-    char *panel = G_tempfile();
-    int x_pos, y_pos, button;
-
-    fprintf(stderr, "Left:  choose location\n" "Middle: cancel\n");
-
-    R_get_location_with_pointer(&x_pos, &y_pos, &button);
-
-    if (button == 2)
-	return 0;
-
-    D_get_screen_window(&t, &b, &l, &r);
-
-    for (;;) {
-	east = (x_pos * 100.0) / (r - l);
-	north = (y_pos * 100.0) / (b - t);
-
-	draw_scale(panel, toptext);
-
-	fprintf(stderr,
-		"\n"
-		"Left: choose location\n"
-		"Middle: cancel\n" "Right: confirm location\n");
-
-	R_get_location_with_pointer(&x_pos, &y_pos, &button);
-
-	switch (button) {
-	case 1:
-	    R_panel_restore(panel);
-	    break;
-	case 2:
-	    R_panel_restore(panel);
-	    return 0;
-	case 3:
-	    R_panel_delete(panel);
-	    return 1;
-	}
-    }
-}

+ 1 - 4
display/d.barscale/options.h

@@ -9,7 +9,4 @@ extern int do_bar;
 extern int draw;
 
 /* draw_scale.c */
-int draw_scale(char *save, int toptext);
-
-/* mouse.c */
-int mouse_query(int toptext);
+int draw_scale(int toptext);

+ 0 - 9
display/d.colors/main.c

@@ -37,15 +37,6 @@ int main(int argc, char **argv)
     /* Initialize the GIS calls */
     G_gisinit(argv[0]);
 
-    /* Try to get default raster name, don't fail so --interface-description works */
-    /* don't let R_open_driver() kill us */
-    R__open_quiet();
-    if (R_open_driver() == 0) {
-	if (D_get_cell_name(name) < 0)
-	    *name = 0;
-	R_close_driver();
-    }
-
     module = G_define_module();
     module->keywords = _("display");
     module->description =

+ 0 - 8
display/d.colortable/main.c

@@ -35,7 +35,6 @@ int main(int argc, char **argv)
     int cols;
 
     char buff[256];
-    char window_name[64];
     char *mapset;
     struct FPRange fp_range;
     struct Colors colors;
@@ -147,11 +146,6 @@ int main(int argc, char **argv)
     if (R_open_driver() != 0)
 	G_fatal_error("No graphics device selected");
 
-    if (D_get_cur_wind(window_name))
-	G_fatal_error("No current frame");
-    if (D_set_cur_wind(window_name))
-	G_fatal_error("Current frame not available");
-
     /* Figure out where to put boxes */
     D_get_screen_window(&t, &b, &l, &r);
 
@@ -270,8 +264,6 @@ int main(int argc, char **argv)
 	}
     }
 
-    D_add_to_list(G_recreate_command());
-
     R_close_driver();
 
     return 0;

+ 4 - 27
display/d.erase/main.c

@@ -21,10 +21,8 @@
 int main(int argc, char *argv[])
 {
     struct Option *color;
-    struct Flag *eraseframe, *dontaddtolist;
+    struct Flag *eraseframe;
     struct GModule *module;
-    char name[256], buf[128];
-    char *err;
 
     G_gisinit(argv[0]);
 
@@ -48,40 +46,19 @@ int main(int argc, char *argv[])
     eraseframe->key = 'f';
     eraseframe->description = _("Remove all frames and erase the screen");
 
-    dontaddtolist = G_define_flag();
-    dontaddtolist->key = 'x';
-    dontaddtolist->description =
-	_("Don't add to list of commands in monitor");
-
     if (argc > 1 && G_parser(argc, argv))
 	exit(1);
 
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    err = NULL;
-    if (D_get_cur_wind(name))
-	err = _("No current frame");
-    else if (D_set_cur_wind(name))
-	err = _("Current frame not available");
-    else {
-	/* D_setup(1);
-	   R_standard_color(D_translate_color(color->answer));
-	   D_erase_window(); */
-	D_erase(color->answer);
+    D_erase(color->answer);
 
-	if (eraseframe->answer) {
-	    D_full_screen();
-	}
-	if (!dontaddtolist->answer) {
-	    sprintf(buf, "d.erase color=%s", color->answer);
-	    D_add_to_list(buf);
-	}
+    if (eraseframe->answer) {
+	D_full_screen();
     }
 
     R_close_driver();
-    if (err)
-	G_fatal_error(err);
 
     exit(0);
 }

+ 0 - 12
display/d.extend/Makefile

@@ -1,12 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = d.extend
-
-LIBES = $(DISPLAYLIB) $(RASTERLIB) $(SITESLIB) $(VECTLIB) $(GISLIB)
-DEPENDENCIES = $(DISPLAYDEP) $(RASTERDEP) $(VECTDEP) $(SITESDEP) $(GISDEP)
-EXTRA_INC = $(VECT_INC)
-EXTRA_CFLAGS = $(VECT_CFLAGS)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 25
display/d.extend/description.html

@@ -1,25 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>d.extend</EM> can be used to display all objects in currently displayed
-maps.
-
-<H2>NOTES</H2>
-
-If no raster map is displayed on a monitor, the default region resolution is 
-calculated to fill window by 512 * 512 cells. Otherwise, it will use the minimum
-resolution of displayed raster maps.
-
-<P>
-
-<H2>SEE ALSO</H2>
-
-<EM><A HREF="g.region.html">g.region</A></EM>
-
-<H2>AUTHOR</H2>
-
-Huidae Cho
-&lt;<a href=mailto:grass4u@gmail.com>grass4u@gmail.com</a>&gt;<br>
-Hydro Engineering Research Laboratory, Kyungpook National University<br>
-South Korea
-
-<p><i>Last changed: $Date$</i>

+ 0 - 136
display/d.extend/main.c

@@ -1,136 +0,0 @@
-/*
- * d.extend: set window region from displayed maps.
- *
- *      Copyright (C) 2000 by the GRASS Development Team
- *      Author: Huidae Cho <grass4u@gmail.com>
- *
- *      This program is free software under the GPL (>=v2)
- *      Read the file COPYING coming with GRASS for details.
- *
- */
-
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/Vect.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-#include <grass/glocale.h>
-
-int main(int argc, char **argv)
-{
-    struct GModule *module;
-    int i, first = 1;
-    char *mapset;
-    char **rast, **vect;
-    int nrasts, nvects;
-    struct Cell_head window, temp_window;
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("display, setup");
-    module->description =
-	"Sets window region so that all currently displayed raster "
-	"and vector maps can be shown in a monitor.";
-
-    if (argc > 1 && G_parser(argc, argv))
-	exit(-1);
-
-
-    if (R_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-    if (D_get_cell_list(&rast, &nrasts) < 0)
-	rast = NULL;
-
-    if (D_get_dig_list(&vect, &nvects) < 0)
-	vect = NULL;
-
-    R_close_driver();
-
-    if (rast == NULL && vect == NULL)
-	G_fatal_error(_("No raster or vector map displayed"));
-
-    G_get_window(&window);
-
-    if (rast) {
-	for (i = 0; i < nrasts; i++) {
-	    mapset = G_find_cell2(rast[i], "");
-	    if (mapset == NULL)
-		G_fatal_error(_("Raster map <%s> not found"), rast[i]);
-	    if (G_get_cellhd(rast[i], mapset, &temp_window) >= 0) {
-		if (first) {
-		    first = 0;
-		    G_copy(&window, &temp_window, sizeof(window));
-		}
-		else {
-		    if (window.east < temp_window.east)
-			window.east = temp_window.east;
-		    if (window.west > temp_window.west)
-			window.west = temp_window.west;
-		    if (window.south > temp_window.south)
-			window.south = temp_window.south;
-		    if (window.north < temp_window.north)
-			window.north = temp_window.north;
-		    /*
-		       if(window.ns_res < nsres)
-		       nsres = window.ns_res;
-		       if(window.ew_res < ewres)
-		       ewres = window.ew_res;
-		     */
-		}
-	    }
-	}
-
-	G_adjust_Cell_head3(&window, 0, 0, 0);
-    }
-
-    if (vect) {
-	struct Map_info Map;
-
-	G_copy(&temp_window, &window, sizeof(window));
-
-	Vect_set_open_level(2);
-	for (i = 0; i < nvects; i++) {
-	    mapset = G_find_vector2(vect[i], "");
-	    if (mapset == NULL)
-		G_fatal_error(_("Vector map <%s> not found"), vect[i]);
-	    if (Vect_open_old_head(&Map, vect[i], mapset) == 2) {
-		if (first) {
-		    first = 0;
-		    window.east = Map.plus.box.E;
-		    window.west = Map.plus.box.W;
-		    window.south = Map.plus.box.S;
-		    window.north = Map.plus.box.N;
-		}
-		else {
-		    if (window.east < Map.plus.box.E)
-			window.east = Map.plus.box.E;
-		    if (window.west > Map.plus.box.W)
-			window.west = Map.plus.box.W;
-		    if (window.south > Map.plus.box.S)
-			window.south = Map.plus.box.S;
-		    if (window.north < Map.plus.box.N)
-			window.north = Map.plus.box.N;
-		}
-		Vect_close(&Map);
-	    }
-	}
-
-	if (window.north == window.south) {
-	    window.north += 0.5 * temp_window.ns_res;
-	    window.south -= 0.5 * temp_window.ns_res;
-	}
-	if (window.east == window.west) {
-	    window.east += 0.5 * temp_window.ew_res;
-	    window.west -= 0.5 * temp_window.ew_res;
-	}
-
-	G_align_window(&window, &temp_window);
-    }
-
-    G_adjust_Cell_head3(&window, 0, 0, 0);
-    G_put_window(&window);
-
-    exit(0);
-}

+ 0 - 2
display/d.font.freetype/DEPRECATED

@@ -1,2 +0,0 @@
-no longer maintained.
-Use ./d.font/ instead

+ 0 - 11
display/d.font.freetype/Makefile

@@ -1,11 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = d.font.freetype
-EXTRA_CFLAGS=$(FTINC)
-
-LIBES     = $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(FTLIB) $(ICONVLIB)
-DEPENDENCIES= $(DISPLAYDEP) $(RASTERDEP) $(GISDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 74
display/d.font.freetype/description.html

@@ -1,74 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>d.font.freetype</EM>
-selects the freetype font in which text will be displayed on the user's 
-graphics monitor.
-<BR>
-
-The text (character strings) displayed on the GRASS monitor was 
-internationalized. Internationalization does not use vector (Hershey) fonts
-as the old version, but it uses instead TrueType fonts which
-enables the display of Double Byte characters such as Japanese character set.
-To set up TrueType fonts, <em>d.font.freetype</em> performs font and character encodings.
-This internationalization can now display Japanese and other (asian) language
-texts from vector labels, legends, etc.
-
-<H2>USAGE</H2>
-
-To enable displaying of a TrueType font on the GRASS monitor, run:
-
-<div class="code"><pre>
-d.mon x0
-d.font.freetype [font=TrueTypefontname] [charset=encoding]
-
-#with:
-# [font]:    TrueType font path (full path including font file name)
-# [charset]: character encoding (EUC-JP, UTF-8, SJIS)
-
-# Examples on Redhat Linux 9.x:
-d.font.freetype font=/usr/share/fonts/ja/TrueType/kochi-gothic.ttf charset=EUC-JP
-
-d.font.freetype font=/usr/X11R6/lib/X11/fonts/TTF/luximb.ttf
-
-
-# Example on Mandrake 10:
-d.font.freetype font=/usr/X11R6/lib/X11/fonts/TTF/ipag.ttf charset=EUC-JP
-   
-d.font.freetype font=/usr/share/fonts/openoffice/Vera.ttf
-
-d.font.freetype font=/usr/share/fonts/ttf/vera/Vera.ttf
-
-# Example using the freetypecap file:
-d.font.freetype -l
-d.font.freetype font=batang
-</pre></div>
-<BR>
-
-
-<H2>DEFINITION FILE</H2>
-
-To help users select fonts conveniently, the definition file,
-<TT>$(GISBASE)/etc/freetypecap</TT>, is provided.  Its format is as follows:
-
-<div class="code"><pre>
-font:fontpath:charset:description
-*default_font:fontpath:charset:description
-</pre></div>
-
-See the file for examples.
-
-
-<H2>SEE ALSO</H2>
-
-<EM><A HREF="d.text.html">d.text</A></EM><br>
-<EM><A HREF="d.text.freetype.html">d.text.freetype</A></EM><br>
-<EM><A HREF="d.font.html">d.font</A></EM><br>
-<EM><A HREF="d.vect.html">d.vect</A></EM><br>
-
-<H2>AUTHOR</H2>
-
-<A HREF="http://www.foss4g.org">FOSS4G</A> members.<br>
-Project sponsored by IPA (Information-technology Promotion Agency, Japan)
-
-<p>
-<i>Last changed: $Date$</i>

+ 0 - 274
display/d.font.freetype/main.c

@@ -1,274 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       d.font.freetype
- * AUTHOR(S):    grass-i18n project members (original contributor)
- *               Markus Neteler <neteler itc.it>,
- *               Huidae Cho <grass4u gmail.com>, 
- *               Glynn Clements <glynn gclements.plus.com>
- * PURPOSE:      selects FreeType font to be used for text in monitor
- * COPYRIGHT:    (C) 2004-2007 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 <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <grass/config.h>
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-#include <grass/glocale.h>
-
-#include <stdio.h>
-/* #define DEBUG_LOG(S) {FILE *fp = fopen("debug.TXT","a");fputs(S,fp);fclose(fp);} */
-
-static int isTrueTypeFont(const char *);
-static int release(void);
-
-typedef struct
-{
-    char *font, *path, *charset;
-} capinfo;
-
-static int read_capfile(char *capfile, capinfo ** fonts, int *fonts_count,
-			int *cur_font, char **font_names);
-static int find_font(capinfo * fonts, int fonts_count, char *name);
-
-int main(int argc, char **argv)
-{
-    struct GModule *module;
-    struct Option *opt1;
-    struct Option *opt2;
-    struct Flag *flag1;
-
-    capinfo *fonts;
-    int fonts_count, i;
-    char *font, *charset;
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("display");
-    module->description =
-	_("Selects the font in which text will be displayed "
-	  "on the user's graphics monitor.");
-
-    opt1 = G_define_option();
-    opt1->key = "font";
-    opt1->type = TYPE_STRING;
-    opt1->required = NO;
-    opt1->description = _("Font name or pathname of TTF file");
-
-    opt2 = G_define_option();
-    opt2->key = "charset";
-    opt2->type = TYPE_STRING;
-    opt2->required = NO;
-    opt2->answer = "UTF-8";
-    opt2->description = _("Character encoding");
-
-    flag1 = G_define_flag();
-    flag1->key = 'l';
-    flag1->description = "list fonts defined in freetypecap";
-
-    /* Initialize the GIS calls */
-    G_gisinit(argv[0]);
-
-    /* Check command line */
-    if (G_parser(argc, argv))
-	exit(-1);
-
-    read_capfile(getenv("GRASS_FREETYPECAP"), &fonts, &fonts_count, NULL,
-		 NULL);
-    if (flag1->answer) {
-	if (fonts_count) {
-	    for (i = 0; i < fonts_count; i++)
-		fprintf(stdout, "%s\n", fonts[i].font);
-	}
-	exit(0);
-    }
-
-    font = opt1->answer;
-    charset = opt2->answer;
-
-    /* load the font */
-    if (R_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-    if (!font) {
-	release();
-	exit(-1);
-    }
-    else {
-	int len = strlen(font);
-
-	if (len == 0) {
-	    release();
-	    exit(-1);
-	}
-	if (fonts_count) {
-	    i = find_font(fonts, fonts_count, font);
-	    if (i >= 0) {
-		font = fonts[i].path;
-		charset = fonts[i].charset;
-	    }
-	}
-    }
-
-    if (isTrueTypeFont(font) == -1) {
-	G_fatal_error("Invalid font: %s", font);
-	exit(-1);
-    }
-
-    R_font(font);
-    R_charset(charset);
-
-    /* add this command to the list */
-    D_add_to_list(G_recreate_command());
-
-    R_close_driver();
-
-    exit(0);
-}
-
-static int isTrueTypeFont(const char *filename)
-{
-
-    FT_Library library;
-    FT_Face face;
-    FT_Error ans;
-
-    /* set freetype */
-    ans = FT_Init_FreeType(&library);
-    if (ans) {
-	return -1;
-    }
-    ans = FT_New_Face(library, filename, 0, &face);
-    if (ans == FT_Err_Unknown_File_Format) {
-	FT_Done_FreeType(library);
-	return -1;
-    }
-    else if (ans) {
-	FT_Done_FreeType(library);
-	return -1;
-    }
-
-    /* FT_done */
-    FT_Done_Face(face);
-    FT_Done_FreeType(library);
-
-    return 0;
-}
-
-static int release(void)
-{
-    R_font("romans");
-    G_message(_("Setting release of FreeType"));
-    return 0;
-}
-
-static int
-read_capfile(char *capfile, capinfo ** fonts, int *fonts_count, int *cur_font,
-	     char **font_names)
-{
-    char file[4096], *ptr;
-    int i, font_names_size = 0;
-    char buf[4096], ifont[128], ipath[4096], icharset[32];
-    FILE *fp;
-
-    *fonts = NULL;
-    *fonts_count = 0;
-    if (cur_font)
-	*cur_font = -1;
-    if (font_names)
-	*font_names = NULL;
-
-    ptr = file;
-    sprintf(file, "%s/etc/freetypecap", G_gisbase());
-    if (capfile) {
-	if (access(capfile, R_OK))
-	    G_warning
-		("%s: Unable to read FreeType definition file; use the default",
-		 capfile);
-	else
-	    ptr = capfile;
-    }
-    if (ptr == file && access(ptr, R_OK)) {
-	G_warning("%s: No FreeType definition file", ptr);
-	return -1;
-    }
-    if (!(fp = fopen(ptr, "r"))) {
-	G_warning("%s: Unable to read FreeType definition file", ptr);
-	return -1;
-    }
-
-    while (fgets(buf, sizeof(buf), fp) && !feof(fp)) {
-	capinfo *font;
-	int offset;
-	char *p;
-
-	p = strchr(buf, '#');
-	if (p)
-	    *p = 0;
-
-	if (sscanf(buf, "%[^:]:%[^:]:%[^:]", ifont, ipath, icharset) != 3)
-	    continue;
-
-	if (access(ipath, R_OK))
-	    continue;
-
-	*fonts = (capinfo *)
-	    G_realloc(*fonts, (*fonts_count + 1) * sizeof(capinfo));
-
-	font = &((*fonts)[*fonts_count]);
-
-	offset = (ifont[0] == '*') ? 1 : 0;
-
-	if (cur_font && offset > 0 && *cur_font < 0)
-	    *cur_font = *fonts_count;
-
-	font->font = G_store(ifont + offset);
-	font->path = G_store(ipath);
-	font->charset = G_store(icharset);
-
-	(*fonts_count)++;
-    }
-
-    fclose(fp);
-
-    if (!font_names)
-	return 0;
-
-    font_names_size = 0;
-    for (i = 0; i < *fonts_count; i++)
-	font_names_size += strlen((*fonts)[i].font) + 1;
-
-    G_debug(3, "font_names_size: %d", font_names_size);
-    *font_names = (char *)G_malloc(font_names_size);
-    (*font_names)[0] = '\0';
-    for (i = 0; i < *fonts_count; i++) {
-	if (i > 0)
-	    strcat(*font_names, ",");
-	strcat(*font_names, (*fonts)[i].font);
-    }
-
-    return 0;
-}
-
-static int find_font(capinfo * fonts, int fonts_count, char *name)
-{
-    int i;
-
-    for (i = 0; i < fonts_count; i++)
-	if (strcasecmp(fonts[i].font, name) == 0)
-	    return i;
-
-    return -1;
-}

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

@@ -132,7 +132,6 @@ int main(int argc, char **argv)
 	R_charset(opt3->answer);
 
     /* add this command to the list */
-    D_add_to_list(G_recreate_command());
     R_close_driver();
 
     exit(EXIT_SUCCESS);

+ 0 - 31
display/d.frame/Makefile

@@ -1,31 +0,0 @@
-MODULE_TOPDIR = ../..
-
-LIBES   = $(DISPLAYLIB) $(RASTERLIB) $(GISLIB)
-DEPLIBS = $(DISPLAYDEP) $(RASTERDEP) $(GISDEP)
-
-PGM=d.frame
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: \
-	$(ETC)/frame.create \
-	$(ETC)/frame.select \
-	$(ETC)/frame.dumper \
-	$(ETC)/frame.list \
-	$(BIN)/$(PGM)$(EXE) \
-	cmd
-
-$(ETC)/frame.create: $(OBJDIR)/create.o $(DEPLIBS)
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/create.o $(LIBES) $(MATHLIB) $(XDRLIB)
-
-$(ETC)/frame.select: $(OBJDIR)/select.o $(DEPLIBS)
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/select.o $(LIBES) $(MATHLIB) $(XDRLIB)
-
-$(ETC)/frame.dumper: $(OBJDIR)/dumper.o $(DEPLIBS)
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/dumper.o $(LIBES) $(MATHLIB) $(XDRLIB)
-
-$(ETC)/frame.list: $(OBJDIR)/list.o $(DEPLIBS)
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/list.o $(LIBES) $(MATHLIB) $(XDRLIB)
-
-$(BIN)/$(PGM)$(EXE): $(OBJDIR)/frame.o $(DEPLIBS)
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/frame.o $(LIBES) $(MATHLIB) $(XDRLIB)

+ 0 - 71
display/d.frame/create.c

@@ -1,71 +0,0 @@
-/*
- *   d.frame.new [frame=name] [at=top,bottom,left,right]
- *
- *   Establish a new window on the screen
- *   top, bottom, left, and right are % coordinates of window;
- *   0,0 is lower left; 100,100 is upper right
- */
-
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-
-int main(int argc, char *argv[])
-{
-    int stat;
-    char name[256];
-    float top, bottom, left, right;
-    struct Option *frame, *at;
-
-    frame = G_define_option();
-    frame->key = "frame";
-    frame->type = TYPE_STRING;
-    frame->required = NO;
-    frame->description = "Name to give to the new frame";
-    frame->answer = NULL;
-
-    at = G_define_option();
-    at->key = "at";
-    at->key_desc = "bottom,top,left,right";
-    at->type = TYPE_STRING;
-    at->required = NO;
-    at->description = "Where to place the frame";
-    at->answer = NULL;
-
-    if (R_open_driver() != 0)
-	G_fatal_error("No graphics device selected");
-
-    if (argc > 1 && G_parser(argc, argv))
-	exit(1);
-    if (at->answer) {
-	if (4 != sscanf(at->answer, "%f,%f,%f,%f",
-			&bottom, &top, &left, &right)) {
-	    G_usage();
-	    exit(1);
-	}
-	if (bottom < 0.0 || top > 100.0 || bottom >= top
-	    || left < 0.0 || right > 100.0 || left >= right) {
-	    fprintf(stderr, "** %s=%s ** illegal values\n",
-		    at->key, at->answer);
-	    G_usage();
-	    exit(1);
-	}
-    }
-    else {
-	get_win_w_mouse(&top, &bottom, &left, &right);
-    }
-
-    if (frame->answer == NULL)
-	R_pad_invent(frame->answer = name);
-
-    stat = D_new_window_percent(frame->answer, bottom, top, left, right);
-    if (!stat)
-	stat = D_set_cur_wind(frame->answer);
-    if (!stat)
-	D_timestamp();
-
-    R_close_driver();
-
-    exit(stat);
-}

+ 0 - 56
display/d.frame/description.html

@@ -1,56 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-This program manages display frames on the user's graphics
-monitor. Graphics are displayed in rectangular frames on whatever graphics
-monitor the user is currently directing GRASS display
-output to.  These frames are created and managed with this
-module. Note that GRASS frame contents <EM>are not</EM>
-retained when one frame covers another. You cannot
-shuffle frames from top to bottom and then back again.
-They simply define rectangular areas on the screen where
-subsequent drawing will occur.
-
-<H2>NOTES</H2>
-
-The coordinates for the <B>at=</B> option are stated in the form: 
-<EM>bottom,top,left,right</EM>. The lower-left corner of the graphics 
-monitor always is at location 0,0 while the monitor's upper-right 
-corner is always at 100,100 (the values are in percent). 
-<P>
-If <B>at=</B> options are not given during frame correction the
-user will be prompted to create the frame using the mouse.
-Likewise if a frame name is not given during frame selection, the user
-will be prompted to select an existing frame on the display monitor
-using the mouse.
-<P>
-If the user has created multiple display frames that overlap one another, 
-whatever the user displays in the active frame will overwrite 
-those portions of the underlying frame where these frames overlap. 
-<P>
-A frame by the name of <EM>full_screen</EM> is always present and may be
-selected at any time. This may be useful if you would like to de-select
-all user defined frames just before taking a screenshot.
-
-<H2>SEE ALSO</H2>
-<EM>
-<A HREF="d.erase.html">d.erase</A><br>
-<A HREF="d.extend.html">d.extend</A><br>
-<A HREF="d.info.html">d.info</A><br>
-<A HREF="d.mon.html">d.mon</A><br>
-<A HREF="d.monsize.html">d.monsize</A><br>
-<A HREF="d.mvmon.html">d.mvmon</A><br>
-<A HREF="d.redraw.html">d.redraw</A><br>
-<A HREF="d.resize.html">d.resize</A><br>
-<A HREF="d.save.html">d.save</A><br>
-<A HREF="d.split.html">d.split</A><br>
-</EM>
-
-<H2>AUTHOR</H2>
-
-James Westervelt, U.S. Army Construction Engineering 
-Research Laboratory
-<BR>
-Michael Shapiro, U.S. Army Construction Engineering 
-Research Laboratory
-<p>
-<i>Last changed: $Date$</i>

+ 0 - 63
display/d.frame/dumper.c

@@ -1,63 +0,0 @@
-#include <stdlib.h>
-#include <grass/raster.h>
-#include <stdio.h>
-#include <grass/gis.h>
-
-int main(void)
-{
-    char **pads;
-    char **items;
-    char **list;
-    int npads;
-    int nitems;
-    int count;
-    int p;
-    int i;
-    int n;
-    int stat;
-
-    if (R_open_driver() != 0)
-	G_fatal_error("No graphics device selected");
-
-    R_pad_list(&pads, &npads);
-    for (p = -1; p < npads; p++) {
-	if (p < 0) {
-	    fprintf(stdout, "SCREEN STATUS:\n");
-	    stat = R_pad_select("");
-	}
-	else {
-	    fprintf(stdout, "FRAME: %s\n", pads[p]);
-	    stat = R_pad_select(pads[p]);
-	}
-
-	if (stat) {
-	    R_pad_perror("    ERROR", stat);
-	    continue;
-	}
-
-	stat = R_pad_list_items(&items, &nitems);
-	if (stat) {
-	    R_pad_perror("    ERROR", stat);
-	    continue;
-	}
-
-	for (i = 0; i < nitems; i++) {
-	    fprintf(stdout, "    %8s:", items[i]);
-	    stat = R_pad_get_item(items[i], &list, &count);
-	    if (stat) {
-		R_pad_perror("          ERROR", stat);
-		continue;
-	    }
-	    for (n = 0; n < count; n++) {
-		if (n == 0)
-		    fprintf(stdout, "%s\n", list[n]);
-		else
-		    fprintf(stdout, "             %s\n", list[n]);
-	    }
-	    R_pad_freelist(list, count);
-	}
-    }
-
-    R_close_driver();
-    exit(0);
-}

+ 0 - 233
display/d.frame/frame.c

@@ -1,233 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       d.frame
- * AUTHOR(S):    James Westervelt, U.S. Army CERL (original contributor)
- *               Michael Shapiro, U.S. Army CERL (original contributor)
- *               Markus Neteler <neteler itc.it>
- *               Bernhard Reiter <bernhard intevation.de>, Eric G. Miller <egm2 jps.net>, 
- *               Glynn Clements <glynn gclements.plus.com>, Hamish Bowman <hamish_nospam yahoo.com>, 
- *               Jan-Oliver Wagner <jan intevation.de>
- * PURPOSE:      
- * COPYRIGHT:    (C) 1999-2007 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.
- *
- *****************************************************************************/
-/*
- *   d.frame [-cps] [frame=name] [at=bottom,top,left,right]
- *
- *   at=...       create frame here (implies -c)
- *       top, bottom, left, and right are % coordinates of window;
- *       0,0 is lower left; 100,100 is upper right
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-#include <grass/glocale.h>
-
-int check_at(char *);
-int list_all(void);
-
-int main(int argc, char *argv[])
-{
-    char buf[1024];
-    int create, select, print, debug, list;
-    struct GModule *module;
-    struct
-    {
-	struct Option *frame, *at;
-    } parm;
-    struct
-    {
-	struct Flag *debug;
-	struct Flag *list;
-	struct Flag *select;
-	struct Flag *print;
-	struct Flag *printall;
-	struct Flag *create;
-	struct Flag *erase;
-    } flag;
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("display");
-    module->description =
-	_("Manages display frames on the user's graphics monitor.");
-
-    flag.create = G_define_flag();
-    flag.create->key = 'c';
-    flag.create->description = _("Create a new frame");
-
-    flag.select = G_define_flag();
-    flag.select->key = 's';
-    flag.select->description = _("Select a frame");
-
-    flag.erase = G_define_flag();
-    flag.erase->key = 'e';
-    flag.erase->description = _("Remove all frames and erase the screen");
-
-    flag.print = G_define_flag();
-    flag.print->key = 'p';
-    flag.print->description = _("Print name of current frame");
-
-    flag.printall = G_define_flag();
-    flag.printall->key = 'a';
-    flag.printall->description = _("Print names of all frames");
-
-    flag.list = G_define_flag();
-    flag.list->key = 'l';
-    flag.list->description = _("List map names displayed in GRASS monitor");
-
-    flag.debug = G_define_flag();
-    flag.debug->key = 'D';
-    flag.debug->description = _("Debugging output");
-
-    parm.frame = G_define_option();
-    parm.frame->key = "frame";
-    parm.frame->type = TYPE_STRING;
-    parm.frame->key_desc = _("name");
-    parm.frame->required = NO;
-    parm.frame->multiple = NO;
-    parm.frame->description = _("Frame to be created/selected");
-
-    parm.at = G_define_option();
-    parm.at->key = "at";
-    parm.at->key_desc = _("bottom,top,left,right");
-    parm.at->type = TYPE_DOUBLE;
-    parm.at->required = NO;
-    parm.at->multiple = NO;
-    parm.at->description =
-	_("Where to place the frame, values in percent (implies -c)");
-    parm.at->checker = check_at;
-
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-    create = flag.create->answer;
-    print = flag.print->answer;
-    select = flag.select->answer;
-    debug = flag.debug->answer;
-    list = flag.list->answer;
-
-    /* if frame name is given without a control option, treat it as select */
-    if (parm.frame->answer && (!create && !print && !select && !list))
-	select = TRUE;
-
-    /* at= placement implies creation */
-    if (parm.at->answer)
-	create = TRUE;
-
-    if (flag.erase->answer) {
-	if (R_open_driver() != 0)
-	    G_fatal_error(_("No graphics device selected"));
-
-	if (!create)
-	    D_full_screen();
-	else {
-	    D_remove_windows();
-	    R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
-	    R_erase();
-	}
-
-	R_close_driver();
-    }
-
-    if (create) {
-	select = FALSE;
-	sprintf(buf, "%s/etc/frame.create", G_gisbase());
-	if (parm.frame->answer) {
-	    strcat(buf, " frame='");
-	    strcat(buf, parm.frame->answer);
-	    strcat(buf, "'");
-	}
-	if (parm.at->answer) {
-	    strcat(buf, " at='");
-	    strcat(buf, parm.at->answer);
-	    strcat(buf, "'");
-	}
-	if (system(buf))
-	    exit(EXIT_FAILURE);
-    }
-    if (select) {
-	sprintf(buf, "%s/etc/frame.select", G_gisbase());
-	if (parm.frame->answer) {
-	    strcat(buf, " frame='");
-	    strcat(buf, parm.frame->answer);
-	    strcat(buf, "'");
-	}
-	if (system(buf))
-	    exit(EXIT_FAILURE);
-    }
-
-    if (debug) {
-	sprintf(buf, "%s/etc/frame.dumper", G_gisbase());
-	if (system(buf))
-	    exit(EXIT_FAILURE);
-    }
-
-    if (list) {
-	sprintf(buf, "%s/etc/frame.list", G_gisbase());
-	if (system(buf))
-	    exit(EXIT_FAILURE);
-    }
-
-    if (print) {
-	if (R_open_driver() != 0)
-	    G_fatal_error(_("No graphics device selected"));
-	D_get_cur_wind(buf);
-	D_set_cur_wind(buf);
-	R_close_driver();
-	fprintf(stdout, "%s\n", buf);
-    }
-
-    if (flag.printall->answer)
-	list_all();
-
-
-    exit(EXIT_SUCCESS);
-}
-
-
-int check_at(char *s)
-{
-    float top, bottom, left, right;
-
-
-    if (s == NULL)
-	return 0;
-
-    if (4 != sscanf(s, "%f,%f,%f,%f", &bottom, &top, &left, &right)
-	|| bottom < 0.0 || top > 100.0 || bottom >= top
-	|| left < 0.0 || right > 100.0 || left >= right) {
-	fprintf(stderr, "<at=%s> invalid request\n", s);
-	return 1;
-    }
-    return 0;
-}
-
-
-int list_all(void)
-{
-    char **pads;
-    int npads;
-    int p;
-
-    if (R_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-    R_pad_list(&pads, &npads);
-
-    for (p = npads - 1; p >= 0; p--)
-	fprintf(stdout, "%s\n", pads[p]);
-
-    R_close_driver();
-
-    return 0;
-}

+ 0 - 86
display/d.frame/list.c

@@ -1,86 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-#include <grass/glocale.h>
-
-/* List the maps currently displayed in GRASS monitor MN + Huidae Cho 8/2001 */
-
-int main(void)
-{
-    char **pads;
-    int npads;
-    int p;
-    int i;
-    int stat;
-    char **rast, **vect, **list;
-    int nrasts, nvects, nlists;
-
-
-    if (R_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-    R_pad_list(&pads, &npads);
-
-    stat = R_pad_select("");
-    if (stat)
-	G_fatal_error("Failed to process the screen pad");
-
-    for (p = npads - 1; p >= 0; p--) {
-	rast = vect = list = NULL;
-	nrasts = nvects = nlists = 0;
-
-	R_pad_select(pads[p]);
-	fprintf(stdout, "frame: %s\n", pads[p]);
-
-	if (D_get_cell_list(&rast, &nrasts) < 0)
-	    rast = NULL;
-
-	if (D_get_dig_list(&vect, &nvects) < 0)
-	    vect = NULL;
-
-	if (D_get_list(&list, &nlists) < 0)
-	    list = NULL;
-
-	/*print a comma separated list: */
-	fprintf(stdout, "rast: ");
-	for (i = 0; i < nrasts; i++) {
-	    if (i > 0)
-		fprintf(stdout, ",");
-	    fprintf(stdout, "%s", rast[i]);
-	}
-	fprintf(stdout, "\n");
-
-	fprintf(stdout, "vect: ");
-	for (i = 0; i < nvects; i++) {
-	    if (i > 0)
-		fprintf(stdout, ",");
-	    fprintf(stdout, "%s", vect[i]);
-	}
-	fprintf(stdout, "\n");
-
-	fprintf(stdout, "commands:\n");
-	for (i = 0; i < nlists; i++)
-	    fprintf(stdout, "%s\n", list[i]);
-
-	if (rast)
-	    R_pad_freelist(rast, nrasts);
-
-	if (vect)
-	    R_pad_freelist(vect, nvects);
-
-	if (list)
-	    R_pad_freelist(list, nlists);
-
-	fprintf(stdout, "\n");
-    }
-
-    if (pads)
-	R_pad_freelist(pads, npads);
-
-    R_close_driver();
-
-    exit(0);
-}

+ 0 - 68
display/d.frame/select.c

@@ -1,68 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-#include <grass/glocale.h>
-
-/*
- *   d.frame.choose [frame=name] {use mouse if frame= not specified}
- *
- *   Choose a frame on the screen
- */
-
-int main(int argc, char *argv[])
-{
-    char orig_name[256];
-    char cur_name[256];
-    int stat;
-    int button;
-
-    struct Option *frame;
-
-    frame = G_define_option();
-    frame->key = "frame";
-    frame->type = TYPE_STRING;
-    frame->required = NO;
-    frame->description =
-	"Name of frame to choose (use mouse if not specified)";
-    frame->answer = NULL;
-
-    if (argc > 1 && G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-    if (R_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-    if (frame->answer) {
-	stat = D_set_cur_wind(frame->answer);
-	if (stat)
-	    G_warning(_("Error choosing frame [%s]\n"), frame->answer);
-	else
-	    D_timestamp();
-	R_close_driver();
-	exit(stat);
-    }
-
-    /* Save current frame just in case */
-    D_get_cur_wind(orig_name);
-
-    fprintf(stderr, _("\nButtons:\n"));
-    fprintf(stderr, _("Left:   Select frame\n"));
-    fprintf(stderr, _("Middle: Keep original frame\n"));
-    fprintf(stderr, _("Right:  Accept frame\n"));
-
-    button = ident_win(cur_name);
-
-    if (button == 2) {
-	D_set_cur_wind(orig_name);
-	strcpy(cur_name, orig_name);
-    }
-
-    D_timestamp();
-
-    R_close_driver();
-
-    exit(EXIT_SUCCESS);
-}

+ 20 - 31
display/d.geodesic/main.c

@@ -30,7 +30,6 @@ int main(int argc, char *argv[])
 {
     int line_color;
     int text_color;
-    int use_mouse;
     double lon1, lat1, lon2, lat2;
     char msg[100];
     char *deftcolor;
@@ -53,7 +52,7 @@ int main(int argc, char *argv[])
     parm.coor->key = "coor";
     parm.coor->key_desc = "lon1,lat1,lon2,lat2";
     parm.coor->type = TYPE_STRING;
-    parm.coor->required = NO;
+    parm.coor->required = YES;
     parm.coor->description = "Starting and ending coordinates";
 
     parm.lcolor = G_define_option();
@@ -81,28 +80,24 @@ int main(int argc, char *argv[])
 	exit(1);
     }
 
-    use_mouse = 1;
-    if (parm.coor->answer) {
-	if (parm.coor->answers[0] == NULL)
-	    G_fatal_error("No coordinates given");
-
-	if (!G_scan_easting(parm.coor->answers[0], &lon1, G_projection())) {
-	    G_usage();
-	    G_fatal_error("%s - illegal longitude", parm.coor->answers[0]);
-	}
-	if (!G_scan_northing(parm.coor->answers[1], &lat1, G_projection())) {
-	    G_usage();
-	    G_fatal_error("%s - illegal longitude", parm.coor->answers[1]);
-	}
-	if (!G_scan_easting(parm.coor->answers[2], &lon2, G_projection())) {
-	    G_usage();
-	    G_fatal_error("%s - illegal longitude", parm.coor->answers[2]);
-	}
-	if (!G_scan_northing(parm.coor->answers[3], &lat2, G_projection())) {
-	    G_usage();
-	    G_fatal_error("%s - illegal longitude", parm.coor->answers[3]);
-	}
-	use_mouse = 0;
+    if (parm.coor->answers[0] == NULL)
+	G_fatal_error("No coordinates given");
+
+    if (!G_scan_easting(parm.coor->answers[0], &lon1, G_projection())) {
+	G_usage();
+	G_fatal_error("%s - illegal longitude", parm.coor->answers[0]);
+    }
+    if (!G_scan_northing(parm.coor->answers[1], &lat1, G_projection())) {
+	G_usage();
+	G_fatal_error("%s - illegal longitude", parm.coor->answers[1]);
+    }
+    if (!G_scan_easting(parm.coor->answers[2], &lon2, G_projection())) {
+	G_usage();
+	G_fatal_error("%s - illegal longitude", parm.coor->answers[2]);
+    }
+    if (!G_scan_northing(parm.coor->answers[3], &lat2, G_projection())) {
+	G_usage();
+	G_fatal_error("%s - illegal longitude", parm.coor->answers[3]);
     }
 
     if (R_open_driver() != 0)
@@ -126,13 +121,7 @@ int main(int argc, char *argv[])
 	text_color = D_translate_color(parm.tcolor->answer);
 
     setup_plot();
-    if (use_mouse)
-	mouse(line_color, text_color);
-    else
-	plot(lon1, lat1, lon2, lat2, line_color, text_color);
-
-    if (!use_mouse)
-	D_add_to_list(G_recreate_command());
+    plot(lon1, lat1, lon2, lat2, line_color, text_color);
 
     R_close_driver();
     exit(0);

+ 0 - 47
display/d.geodesic/mouse.c

@@ -1,47 +0,0 @@
-#include <stdio.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-#include "local_proto.h"
-
-void mouse(int line_color, int text_color)
-{
-    int x1, y1, x2, y2;
-    double lat1, lon1, lat2, lon2;
-    int top, bottom, left, right;
-    int button;
-
-    right = (int)D_get_d_east();
-    left = (int)D_get_d_west();
-    top = (int)D_get_d_north();
-    bottom = (int)D_get_d_south();
-
-    x2 = x1 = (right + left) / 2;
-    y2 = y1 = (top + bottom) / 2;
-
-    fprintf(stderr, "\n");
-    fprintf(stderr, "Left:   begin\n");
-    fprintf(stderr, "Middle: draw\n");
-    fprintf(stderr, "Right:  quit\n");
-
-    while (1) {
-	R_standard_color(line_color);
-	R_get_location_with_line(x1, y1, &x2, &y2, &button);
-	if (button == 3)
-	    return;
-	if (x2 < left || x2 > right)
-	    continue;
-	if (y2 < top || y2 > bottom)
-	    continue;
-
-	if (button == 2) {
-	    lon1 = D_d_to_u_col((double)x1);
-	    lat1 = D_d_to_u_row((double)y1);
-	    lon2 = D_d_to_u_col((double)x2);
-	    lat2 = D_d_to_u_row((double)y2);
-	    plot(lon1, lat1, lon2, lat2, line_color, text_color);
-	}
-
-	x1 = x2;
-	y1 = y2;
-    }
-}

+ 1 - 12
display/d.graph/main.c

@@ -41,7 +41,6 @@
 
 int main(int argc, char **argv)
 {
-    char window_name[64];
     struct GModule *module;
     struct Option *opt1, *opt2;
     struct Flag *mapcoords;
@@ -115,14 +114,7 @@ int main(int argc, char **argv)
     else
 	mapunits = FALSE;
 
-    if (D_get_cur_wind(window_name))
-	G_fatal_error(_("No current window"));
-
-    if (D_set_cur_wind(window_name))
-	G_fatal_error(_("Current window not available"));
-
-    if (D_get_screen_window(&t, &b, &l, &r))
-	G_fatal_error(_("Getting screen window"));
+    D_get_screen_window(&t, &b, &l, &r);
 
     /* Finish graphics setup */
     R_set_window(t, b, l, r);
@@ -136,9 +128,6 @@ int main(int argc, char **argv)
     R_text_rotation(0.0);	/* reset */
     R_line_width(0);		/* reset */
 
-    if (opt1->answer)
-	D_add_to_list(G_recreate_command());
-
     R_close_driver();
 
     exit(EXIT_SUCCESS);

+ 0 - 2
display/d.grid/main.c

@@ -218,8 +218,6 @@ int main(int argc, char **argv)
 	plot_border(size, east, north);
     }
 
-    D_add_to_list(G_recreate_command());
-
     R_close_driver();
 
     exit(EXIT_SUCCESS);

+ 0 - 10
display/d.his/main.c

@@ -54,7 +54,6 @@ int main(int argc, char **argv)
     struct GModule *module;
     struct Option *opt_h, *opt_i, *opt_s, *brighten;
     struct Flag *nulldraw;
-    char window_name[64];
     int t, b, l, r;
     double bright_mult;
 
@@ -116,14 +115,6 @@ int main(int argc, char **argv)
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    if (D_get_cur_wind(window_name))
-	G_fatal_error(_("No current graphics window"));
-
-    if (D_set_cur_wind(window_name))
-	G_fatal_error(_("Current graphics window not available"));
-
-    D_set_cell_name("his result");
-
     /* Prepare the raster cell drawing functions */
     D_get_screen_window(&t, &b, &l, &r);
     D_set_overlay_mode(nulldraw->answer ? 1 : 0);
@@ -267,7 +258,6 @@ int main(int argc, char **argv)
     D_cell_draw_end();
 
     /* Close down connection to display driver */
-    D_add_to_list(G_recreate_command());
     R_close_driver();
 
     /* Close the raster maps */

+ 0 - 1
display/d.histogram/main.c

@@ -208,7 +208,6 @@ int main(int argc, char **argv)
 	bar(&dist_stats, &pcolors);
 
     R_flush();
-    D_add_to_list(G_recreate_command());
     R_close_driver();
 
     exit(EXIT_SUCCESS);

+ 2 - 15
display/d.info/main.c

@@ -24,7 +24,6 @@ int main(int argc, char *argv[])
     struct GModule *module;
     struct Flag *rflag, *dflag, *cflag, *fflag, *bflag, *gflag;
     int l, r, t, b;
-    char window_name[128];
     struct Cell_head window;
 
     G_gisinit(argv[0]);
@@ -99,18 +98,11 @@ int main(int argc, char *argv[])
     }
 
     if (bflag->answer) {
-	if (D_get_cur_wind(window_name))
-	    G_fatal_error(_("No current window"));
-	if (D_set_cur_wind(window_name))
-	    G_fatal_error(_("Current window not available"));
-
 	/* Read in the map window associated with window */
 	G_get_window(&window);
 
-	if (D_check_map_window(&window))
-	    G_fatal_error(_("Setting map window"));
-	if (D_get_screen_window(&t, &b, &l, &r))
-	    G_fatal_error(_("Getting screen window"));
+	D_check_map_window(&window);
+	D_get_screen_window(&t, &b, &l, &r);
 	if (D_do_conversions(&window, t, b, l, r))
 	    G_fatal_error(_("Error in calculating conversions"));
 
@@ -123,11 +115,6 @@ int main(int argc, char *argv[])
     }
 
     if (gflag->answer) {
-	if (D_get_cur_wind(window_name))
-	    G_fatal_error(_("No current window"));
-	if (D_set_cur_wind(window_name))
-	    G_fatal_error(_("Current window not available"));
-
 	/* Read in the map window associated with window */
 	G_get_window(&window);
 	fprintf(stdout, "w=%f\n", window.west);

+ 1 - 13
display/d.labels/main.c

@@ -27,7 +27,6 @@
 int main(int argc, char **argv)
 {
     struct Cell_head window;
-    char window_name[64];
     char *label_name;
     char *mapset;
     double minreg, maxreg, reg, dx, dy;
@@ -101,7 +100,6 @@ int main(int argc, char **argv)
 	if (reg < minreg) {
 	    G_warning(_
 		      ("Region size is lower than minreg, nothing displayed."));
-	    D_add_to_list(G_recreate_command());
 	    R_close_driver();
 	    exit(0);
 	}
@@ -111,7 +109,6 @@ int main(int argc, char **argv)
 	if (reg > maxreg) {
 	    G_warning(_
 		      ("Region size is greater than maxreg, nothing displayed."));
-	    D_add_to_list(G_recreate_command());
 	    R_close_driver();
 	    exit(0);
 	}
@@ -122,14 +119,7 @@ int main(int argc, char **argv)
     if (infile == NULL)
 	G_fatal_error(_("Unable to open label file <%s>"), label_name);
 
-    if (D_get_cur_wind(window_name))
-	G_fatal_error(_("No current window"));
-
-    if (D_set_cur_wind(window_name))
-	G_fatal_error(_("Current window not available"));
-
-    if (D_check_map_window(&window))
-	G_fatal_error(_("Setting map window"));
+    D_check_map_window(&window);
 
     if (G_set_window(&window) == -1)
 	G_fatal_error(_("Current window not settable"));
@@ -143,8 +133,6 @@ int main(int argc, char **argv)
     /* Go draw the raster map */
     do_labels(infile, !horiz_flag->answer);
 
-    D_add_to_list(G_recreate_command());
-
     R_text_rotation(0.0);	/* reset */
     R_close_driver();
 

+ 0 - 47
display/d.legend/box.c

@@ -1,47 +0,0 @@
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-
-
-int get_legend_box(int *x0, int *x1, int *y0, int *y1)
-{
-    int screen_x, screen_y;
-    int button;
-    int cur_screen_x, cur_screen_y;
-
-    D_get_screen_window(&cur_screen_y, &screen_y, &cur_screen_x, &screen_x);
-
-    fprintf(stderr, "\n\n");
-    fprintf(stderr, "Buttons:\n");
-    fprintf(stderr, "Left:   Establish a corner\n");
-    fprintf(stderr, "Middle: Cancel\n");
-    fprintf(stderr, "Right:  Accept box for legend\n\n");
-
-    do {
-	R_get_location_with_box(cur_screen_x, cur_screen_y, &screen_x,
-				&screen_y, &button);
-	button &= 0xf;
-
-
-	switch (button) {
-	case 1:
-	    cur_screen_x = screen_x;
-	    cur_screen_y = screen_y;
-	    break;
-	case 2:
-	    return (0);
-	case 3:
-	    break;
-	}
-
-    } while (button != 3);
-
-    *x0 = cur_screen_x;
-    *x1 = screen_x;
-    *y0 = cur_screen_y;
-    *y1 = screen_y;
-
-    fprintf(stderr, "\n");
-    return (1);
-
-}

+ 20 - 57
display/d.legend/main.c

@@ -40,7 +40,6 @@ int main(int argc, char **argv)
     char *mapset;
     char buff[512];
     char *map_name;
-    char window_name[64];
     int black;
     int cats_num;
     int color;
@@ -52,7 +51,7 @@ int main(int argc, char **argv)
     int lines, steps;
     int new_colr, fp;
     int t, b, l, r;
-    int hide_catnum, hide_catstr, hide_nodata, do_smooth, use_mouse;
+    int hide_catnum, hide_catstr, hide_nodata, do_smooth;
     char *cstr;
     int white;
     int x_box[5];
@@ -61,7 +60,7 @@ int main(int argc, char **argv)
     struct Colors colors;
     struct GModule *module;
     struct Option *opt1, *opt2, *opt4, *opt5, *opt6, *opt7, *opt8, *opt9;
-    struct Flag *hidestr, *hidenum, *hidenodata, *smooth, *mouse, *flipit;
+    struct Flag *hidestr, *hidenum, *hidenodata, *smooth, *flipit;
     struct Range range;
     struct FPRange fprange;
     CELL min_ind, max_ind, null_cell;
@@ -156,10 +155,6 @@ int main(int argc, char **argv)
     opt9->guisection = _("Advanced");
 
 
-    mouse = G_define_flag();
-    mouse->key = 'm';
-    mouse->description = _("Use mouse to size & place legend");
-
     hidestr = G_define_flag();
     hidestr->key = 'v';
     hidestr->description = _("Do not show category labels");
@@ -196,7 +191,6 @@ int main(int argc, char **argv)
     hide_catnum = hidenum->answer;
     hide_nodata = hidenodata->answer;
     do_smooth = smooth->answer;
-    use_mouse = mouse->answer;
     flip = flipit->answer;
 
     color = 0;			/* if only to get rid of the compiler warning  */
@@ -274,12 +268,6 @@ int main(int argc, char **argv)
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    if (D_get_cur_wind(window_name))
-	G_fatal_error(_("No current window"));
-
-    if (D_set_cur_wind(window_name))
-	G_fatal_error(_("Current window not available"));
-
     white = D_translate_color(DEFAULT_FG_COLOR);
     black = D_translate_color(DEFAULT_BG_COLOR);
 
@@ -287,39 +275,24 @@ int main(int argc, char **argv)
     D_get_screen_window(&t, &b, &l, &r);
     R_set_window(t, b, l, r);
 
-    if (use_mouse) {
-	if (!get_legend_box(&x0, &x1, &y0, &y1))
-	    exit(EXIT_SUCCESS);
-	G_debug(1, "mouse placement as percentage of display window "
-		"[bottom,top,left,right]:\n  \"at=%.1f,%.1f,%.1f,%.1f\"",
-		100. * (b - y1) / (b - t), 100. * (b - y0) / (b - t),
-		100. * x0 / (r - l), 100. * x1 / (r - l));
-
-	Y1 = 100. - (y1 - t) * 100. / (b - t);
-	Y0 = 100. - (y0 - t) * 100. / (b - t);
-	X0 = (x0 - l) * 100. / (r - l);
-	X1 = (x1 - l) * 100. / (r - l);
+    if (opt7->answer != NULL) {
+	sscanf(opt7->answers[0], "%lf", &Y1);
+	sscanf(opt7->answers[1], "%lf", &Y0);
+	sscanf(opt7->answers[2], "%lf", &X0);
+	sscanf(opt7->answers[3], "%lf", &X1);
     }
-    else {
-	if (opt7->answer != NULL) {
-	    sscanf(opt7->answers[0], "%lf", &Y1);
-	    sscanf(opt7->answers[1], "%lf", &Y0);
-	    sscanf(opt7->answers[2], "%lf", &X0);
-	    sscanf(opt7->answers[3], "%lf", &X1);
-	}
-	else {			/* default */
-	    Y1 = 12;
-	    Y0 = 88;
-	    X0 = 3;
-	    X1 = 7;
-	}
-
-	x0 = l + (int)((r - l) * X0 / 100.);
-	x1 = l + (int)((r - l) * X1 / 100.);
-	y0 = t + (int)((b - t) * (100. - Y0) / 100.);	/* make lower left the origin */
-	y1 = t + (int)((b - t) * (100. - Y1) / 100.);
+    else {			/* default */
+	Y1 = 12;
+	Y0 = 88;
+	X0 = 3;
+	X1 = 7;
     }
 
+    x0 = l + (int)((r - l) * X0 / 100.);
+    x1 = l + (int)((r - l) * X1 / 100.);
+    y0 = t + (int)((b - t) * (100. - Y0) / 100.);	/* make lower left the origin */
+    y1 = t + (int)((b - t) * (100. - Y1) / 100.);
+
     if (y0 > y1) {		/* allow for variety in order of corner */
 	flip = !flip;		/*   selection without broken output    */
 	xyTemp = y0;
@@ -496,7 +469,7 @@ int main(int argc, char **argv)
 	}
 
 	/* center really tiny legends */
-	if (!use_mouse && opt7->answer == NULL) {	/* if defualt scaling */
+	if (opt7->answer == NULL) {	/* if defualt scaling */
 	    if (!do_smooth && (dots_per_line < 4))	/* if so small that there's no box */
 		if ((b - (dots_per_line * lines)) / (b * 1.0) > 0.15)	/* if there's more than a 15% blank at the bottom */
 		    y0 = ((b - t) - (dots_per_line * lines)) / 2;
@@ -687,7 +660,7 @@ int main(int argc, char **argv)
 
 	    /* scale text to fit in window if position not manually set */
 	    /* usually not needed, except when frame is really narrow   */
-	    if (!use_mouse && opt7->answer == NULL) {	/* ie defualt scaling */
+	    if (opt7->answer == NULL) {	/* ie defualt scaling */
 		ScaleFactor = ((r - x1) / ((MaxLabelLen + 1) * txsiz * 0.81));	/* ?? txsiz*.81=actual text width. */
 		if (ScaleFactor < 1.0) {
 		    txsiz = (int)(txsiz * ScaleFactor);
@@ -775,7 +748,7 @@ int main(int argc, char **argv)
 	txsiz = (int)((y1 - y0) / (2.0 * lines));
 
 	/* scale text to fit in window if position not manually set */
-	if (!use_mouse && opt7->answer == NULL) {	/* ie defualt scaling */
+	if (opt7->answer == NULL) {	/* ie defualt scaling */
 	    ScaleFactor = ((true_r - true_l) / ((MaxLabelLen + 3) * txsiz * 0.81));	/* ?? txsiz*.81=actual text width. */
 	    if (ScaleFactor < 1.0) {
 		txsiz = (int)floor(txsiz * ScaleFactor);
@@ -917,16 +890,6 @@ int main(int argc, char **argv)
 	    R_text(buff);
 	}
     }
-    if (use_mouse) {
-	char buf[512];
-
-	mouse->answer = 0;
-	sprintf(buf, "%s at=%.1f,%.1f,%.1f,%.1f", G_recreate_command(),
-		Y1, Y0, X0, X1);
-	D_add_to_list(buf);
-    }
-    else
-	D_add_to_list(G_recreate_command());
 
     R_close_driver();
     exit(EXIT_SUCCESS);

+ 0 - 7
display/d.measure/main.c

@@ -30,7 +30,6 @@
 
 int main(int argc, char **argv)
 {
-    char frame[64];
     struct GModule *module;
     struct
     {
@@ -86,12 +85,6 @@ int main(int argc, char **argv)
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    if (D_get_cur_wind(frame))
-	G_fatal_error(_("No current frame"));
-
-    if (D_set_cur_wind(frame))
-	G_fatal_error(_("Current frame not available"));
-
     color1 = D_translate_color(parm.c1->answer);
     color2 = D_translate_color(parm.c2->answer);
     s_flag = parm.s->answer;

+ 0 - 10
display/d.menu/Makefile

@@ -1,10 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = d.menu
-
-LIBES     = $(DISPLAYLIB) $(RASTERLIB) $(GISLIB)
-DEPENDENCIES= $(DISPLAYDEP) $(RASTERDEP) $(GISDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 240
display/d.menu/description.html

@@ -1,240 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>d.menu</EM> allows the user to create a menu containing
-a TITLE and options, and to display this menu in the active
-frame on the graphics monitor.  After the menu is displayed
-in the active frame, the mouse must be used to select one of the menu
-options.  The number associated with the selected menu
-option is then printed to standard output (<tt>stdout</tt>) and the program
-exits.  This program provides
-GRASS macro writers with a mouse interface for user interaction.
-
-<P>
-Parameters can be stated on the command line, from within standard input
-(<tt>stdin</tt>), or from within a script file
-(as illustrated <A HREF="#example">below</A>).
-
-<P>
-The user can specify the menu's background, text, and line
-colors (<B>bcolor</B>, <B>tcolor</B>, and
-<B>dcolor</B>) and the menu size (<B>size</B>) on
-the command line. If the user sets at least one of these
-values on the command line, any remaining values that are
-not specified will be set (automatically) to their default values.
-
-<h2>NOTES</h2>
-
-<H3>Menu Information:</H3> 
-
-After the user has (optionally) specified menu colors and
-size, the program expects the user to enter information
-about the menu's location and content.  The menu will be
-placed in the lower right corner of the active display frame
-by default if the user does not position it elsewhere using
-the <tt>.T</tt> or <tt>.L</tt> commands.
-
-<P>
-The user specifies the menu contents by entering a menu
-TITLE followed by the option choices to appear in the menu
-when displayed.  The user <EM>must</EM> enter a menu TITLE
-and at least one menu option.
-All <tt>.dot</tt> commands are optional.
-
-<DL>
-<DT>
-<B>#</B>
-<DD>
-Comment line. (ignored)
-
-<DT>
-<B>.B</B> <EM>value</EM> 
-<DD>
-Specifies the menu's background color.
-
-<DT>
-<B>.C</B> <EM>value</EM> 
-<DD>
-Specifies the menu's text color. 
-
-<DT>
-<B>.D</B> <EM>value</EM> 
-<DD>
-Specifies the menu's dividing line color.
-
-<DT>
-<B>.F</B> <EM>value</EM> 
-<DD>
-Specifies the menu's font. May be any of the standard GRASS fonts.
-(see <EM><A HREF="d.font.html">d.font</A></EM>)
-
-<DT>
-<B>.S</B> <EM>value</EM> 
-<DD>
-Specifies the menu's font size.
-(as a percentage of the active frame's height). 
-
-<DT>
-<B>.T</B> <EM>value</EM> 
-<DD>
-Specifies the menu's distance from the active display frame's top edge 
-(as a percentage of the active frame's height). 
-
-<DT>
-<B>.L</B> <EM>value</EM> 
-<DD>
-Specifies the menu's distance from the active display frame's left edge 
-(as a percentage of the active frame's width). 
-
-<DT>
-<EM>menu TITLE</EM> 
-<DD>
-A TITLE that describes the type of options listed in the menu, 
-and that will appear at the top of the menu when it is displayed. 
-
-<DT>
-<EM>option name</EM>(s) 
-<DD>
-The options that will appear in the menu when displayed. 
-Each menu option should appear on a separate line. 
-The user may enter as many options as desired, but must enter at least 
-one menu option. 
-
-</DL>
-
-Note: The user should choose a menu size and location that will allow 
-all menu options to be displayed in the active frame. 
-
-<P>
-
-If the user enters the menu TITLE and option(s) from
-standard input (i.e., at the keyboard rather than from a
-file), the user should enter <EM>control-d</EM> to end
-input and display the menu in the active frame on the
-graphics monitor.  (Note: The <EM>d.menu</EM> program can
-also be incorporated into UNIX Bourne shell script macros.
-The below example shows how this might be done.)
-
-<A NAME="example"></a>
-
-<H2>EXAMPLES</H2>
-
-<h3>Example 1</h3>
-
-<div class="code"><pre>
-a=`d.menu << EOF
-# set the background color
-.B brown
-# set the text color
-.C yellow
-# set the text size in % of entire screen height
-.S 3
-# set the top edge
-.T 10
-# set the LEFT edge
-.L 10
-# The menu Title
-Sample Menu
-# the options
-option 1
-option 2
-option 3
-option 4
-option 5
-option 6
-EOF
-`
-
-echo "You have just chosen option $a"
-</pre></div>
-<BR>
-
-<h3>Example 2</h3>
-
-In the following example, the shell script <EM>menu2</EM>
-calls the shell script <EM>color.select</EM> which contains
-<EM>d.menu</EM> commands to display a menu in the current
-frame on the graphics monitor.  After the user selects an
-option from the display menu, the selection number is
-available for use by <EM>menu2</EM>.
-
-<H4>Contents of file <EM>menu2</EM>:</H4> 
-
-<div class="code"><PRE>
-#! /bin/csh -f
-set option = 0
-set colors = (red green blue black white )
-@ option = `color.select`
-
-if ($option &lt;= 5) then
-     set color = $colors[$option]
-     echo $color
-
-endif
-exit
-</PRE></div>
-
-<H4>Contents of file <EM>color.select</EM>:</H4> 
-
-<div class="code"><PRE>
-#! /bin/csh -f
-d.menu bcolor=red tcolor=green dcolor=yellow size=5 &lt;&lt; EOF
-.T 25
-.L 25
-Color Choices
-Option 1
-Option 2
-Option 3
-Option 4
-Option 5
-EOF
-</PRE></div>
-
-<P>
-
-If the user runs <EM>menu2</EM>, a menu will be displayed
-on the graphics monitor that has red background, green
-text, with menu options divided by yellow lines, and a text
-size of 5% of the active display frame height.  The mouse
-cursor will become active, allowing the user to select (by
-pointing with the mouse) one of the displayed menu
-options.  Here, these menu options are called
-<EM>Option 1</EM>, <EM>Option 2</EM>, and
-<EM>Option 3</EM>, etc.  The first line of text (here,
-the words <EM>Color Choices</EM>) contains the TITLE of
-the menu; this line is <B>not</B> a menu option that can be
-chosen by the user with the mouse. When the user presses
-one of the mouse buttons while pointing to the desired menu
-choice, the number of the option chosen will be available
-for capture by the shell script <EM>menu2</EM>.
-<EM>menu2</EM> is a simple example that takes this
-information and only echoes it to the screen.
-
-<H2>NOTES</H2>
-
-Although the user can vary text size, all text within the
-same menu is displayed in a single text size (and font). If
-the user specifies that items included in the menu's text
-be displayed in different sizes, all text will be displayed
-in the size stated last.
-
-<H2>SEE ALSO</H2>
-
-<EM><A HREF="d.ask.html">d.ask</A></EM><br>
-<EM><A HREF="d.font.html">d.font</A></EM><br>
-<EM><A HREF="d.frame.html">d.frame</A></EM><br>
-<EM><A HREF="d.grid.html">d.grid</A></EM><br>
-<EM><A HREF="d.legend.html">d.legend</A></EM><br>
-<EM><A HREF="d.labels.html">d.paint.labels</A></EM><br>
-<EM><A HREF="d.text.html">d.text</A></EM><br>
-<EM><A HREF="d.title.html">d.title</A></EM><br>
-
-
-<H2>AUTHOR</H2>
-
-James Westervelt,
- U.S. Army Construction Engineering 
-Research Laboratory
-
-<p>
-<i>Last changed: $Date$</i>
-

+ 0 - 200
display/d.menu/main.c

@@ -1,200 +0,0 @@
-
-/****************************************************************
- *
- * MODULE:       d.menu
- *
- * AUTHOR(S):    James Westervelt, U.S. Army CERL
- *
- * PURPOSE:      Creates an interactive menu on the display monitor using
- *               lines from stdin as options. Returns selected entry.
- *               
- * COPYRIGHT:    (c) 1999, 2006 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.
- *
- ****************************************************************
- *
- *   Lines beginning with:
- *    #      are comments and ignored
- *    .B     contains the background color
- *    .C     contains the text color
- *    .D     contains the line divider color
- *    .F     contains the font name
- *    .S     contains the text size (in pixles)
- *    .T     contains the panel's top edge
- *    .L     contains the panel's left edge
- *
- *   Of the remaining lines, the first is the menu name; the rest
- *   are the menu options.
- *
- *   Returns option number chosen.
- *
- ****************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "grass/gis.h"
-#include "grass/display.h"
-#include "grass/raster.h"
-#include "grass/glocale.h"
-
-int main(int argc, char **argv)
-{
-    int backcolor;
-    int textcolor;
-    int dividercolor;
-    int size;
-    int left;
-    int top;
-    char buff[128];
-    char *cmd_ptr;
-    char *tmp;
-    char *options[128];
-    int i;
-    int len;
-    struct GModule *module;
-    struct Option *opt1, *opt2, *opt3, *opt4;
-
-    /* Initialize the GIS calls */
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("display");
-    module->description =
-	_("Creates and displays a menu within the active "
-	  "frame on the graphics monitor.");
-
-    opt1 = G_define_option();
-    opt1->key = "bcolor";
-    opt1->type = TYPE_STRING;
-    opt1->answer = DEFAULT_BG_COLOR;
-    opt1->required = NO;
-    opt1->options = D_color_list();
-    opt1->description = _("Sets the color of the menu background");
-
-    opt2 = G_define_option();
-    opt2->key = "tcolor";
-    opt2->type = TYPE_STRING;
-    opt2->answer = DEFAULT_FG_COLOR;
-    opt2->required = NO;
-    opt2->options = D_color_list();
-    opt2->description = _("Sets the color of the menu text");
-
-    opt3 = G_define_option();
-    opt3->key = "dcolor";
-    opt3->type = TYPE_STRING;
-    opt3->answer = DEFAULT_FG_COLOR;
-    opt3->required = NO;
-    opt3->options = D_color_list();
-    opt3->description = _("Sets the color dividing lines of text");
-
-    opt4 = G_define_option();
-    opt4->key = "size";
-    opt4->type = TYPE_INTEGER;
-    opt4->answer = "3";
-    opt4->required = NO;
-    opt4->options = "1-100";
-    opt4->description = _("Sets the menu text size (in percent)");
-
-    /* Check command line */
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-    if (R_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-    backcolor = D_translate_color(opt1->answer);
-    if (backcolor == 0) {
-	R_close_driver();
-	G_fatal_error(_("Don't know the color %s"), opt1->answer);
-    }
-
-    textcolor = D_translate_color(opt2->answer);
-    if (textcolor == 0) {
-	R_close_driver();
-	G_fatal_error(_("Don't know the color %s"), opt2->answer);
-    }
-
-    dividercolor = D_translate_color(opt3->answer);
-    if (dividercolor == 0) {
-	R_close_driver();
-	G_fatal_error(_("Don't know the color %s"), opt3->answer);
-    }
-
-
-    sscanf(opt4->answer, "%d", &size);
-
-    /* Read the options */
-    i = 0;
-    while (fgets(buff, 128, stdin) != NULL) {
-	/* un-fgets it  */
-	tmp = buff;
-	while (*tmp) {
-	    if (*tmp == '\n')
-		*tmp = '\0';
-	    tmp++;
-	}
-	if (*buff == '#')
-	    continue;
-	if (*buff == '.') {
-	    for (cmd_ptr = buff + 2; *cmd_ptr == ' ' && *cmd_ptr != '\0';
-		 cmd_ptr++) ;
-	    switch (buff[1] & 0x7F) {
-
-	    case 'B':		/* background color */
-		backcolor = D_translate_color(cmd_ptr);
-		break;
-	    case 'C':		/* text color */
-		textcolor = D_translate_color(cmd_ptr);
-		break;
-	    case 'D':		/* divider color */
-		dividercolor = D_translate_color(cmd_ptr);
-		break;
-	    case 'F':		/* font */
-		R_font(cmd_ptr);
-		break;
-	    case 'S':		/* size */
-		sscanf(cmd_ptr, "%d", &size);
-		break;
-	    case 'T':		/* top edge */
-		sscanf(cmd_ptr, "%d", &top);
-		top = 100 - top;
-		break;
-	    case 'L':		/* left edge */
-		sscanf(cmd_ptr, "%d", &left);
-		break;
-
-	    default:
-		break;
-	    }
-	}
-	else {
-	    len = strlen(buff);
-	    tmp = malloc(len + 1);
-	    strcpy(tmp, buff);
-	    options[i++] = tmp;
-	}
-    }
-
-    options[i] = NULL;
-    if (i < 2) {
-	R_close_driver();
-	G_fatal_error(_("Menu must contain a title and at least one option"));
-    }
-
-    i = D_popup(backcolor, textcolor, dividercolor, top,	/* The col of the top left corner */
-		left,		/* The row of the top left corner */
-		size,		/* The size of the characters in pixles */
-		options);	/* The text */
-
-    R_close_driver();
-
-    /* Provide the result to standard output */
-    fprintf(stdout, "%d\n", i);
-
-    return 0;
-}

+ 0 - 13
display/d.mon/Makefile

@@ -1,13 +0,0 @@
-
-MODULE_TOPDIR = ../..
-
-SUBDIRS = \
-	cmd \
-	pgms
-
-include $(MODULE_TOPDIR)/include/Make/Dir.make
-
-default: parsubdirs
-
-clean: cleansubdirs
-

+ 0 - 15
display/d.mon/cmd/Makefile

@@ -1,15 +0,0 @@
-
-MODULE_TOPDIR = ../../..
-
-PGM = d.mon
-
-LIBES     = $(DISPLAYLIB) $(RASTERLIB) $(GISLIB)
-DEPENDENCIES= $(DISPLAYDEP) $(RASTERDEP) $(GISDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd
-
-
-
-

+ 0 - 127
display/d.mon/cmd/description.html

@@ -1,127 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>d.mon</em> allows the user to start,
-select, list, query the status of, release control of,
-stop, and unlock control of, available graphics monitors.
-The user can run this program either interactively (through
-a series of menus), or non-interactively by typing the name
-of the monitor to start, stop, select, or unlock, and any
-desired flags on the command line.
-
-<p>
-
-<b>These parameters perform the following functions:</b> 
-
-<ol>
-<li><b>Start a Monitor.</b> 
-<br>
-
-In order to display on-screen GRASS graphics, the user must
-<em>start</em> and <em>select</em> a graphics monitor.  By
-default, the <em>start</em> command actually runs two
-commands, to both start and select whatever monitor is
-named by the user. (The user can get a list of available
-monitors by setting the -l or -L flag on the command line.)
-Note that some monitor drivers use environment 
-<a href=variables.html>variables</a> or the specific
-<a href=displaydrivers.html>driver documentation</a>.
-<p>
-
-When a monitor is <em>started</em>, it is therefore also
-(automatically) <em>selected</em> for output, unless the
-
-<em>-s</em> flag is set by the user; the user can also
-explictly <em>select</em> a monitor that has been started
-(see (3) below).  After a monitor is started, a blank
-graphics frame should appear on whatever terminal the user
-is using to display graphics.
-
-<p>
-
-The desired monitor should be started once and need not be restarted unless 
-it is stopped (option <em>2</b>)</em> for some reason. A monitor may continue 
-to run for any length of time, even when no GRASS session is being run. 
-The monitor program runs in the background. 
-
-<li><b>Stop a Monitor.</b> 
-<br>
-Sometimes the monitor program needs to be stopped
-(terminated).  Choosing option 2 will terminate a
-user-specified monitor program.  A graphics monitor has two
-different types of status:  monitor program <em>not
-running</em>, and monitor <em>running</em>.  A monitor that
-has been started and/or selected will be listed as running;
-a monitor that has been stopped (or not started) will be
-listed as not running.  The -L (list status) flag will list
-the status of each monitor connected to the system.
-
-<p>
-
-<li><b>Select a Monitor.</b> 
-<br>
-
-When the user <em>starts</em> a monitor, it is also
-(automatically) <em>selected</em> for graphics output
-unless the user sets the <em>-s</em> flag.  In order to use
-(direct graphics output to) a monitor, the user must
-<em>select</em> that monitor for use, either by simply
-starting the monitor without the -s flag or by explictly
-selecting the monitor for output using option 3. Only
-running monitors can be selected for graphics output.  Once
-the user has <em>selected</em> a monitor for output, no
-other user can use this monitor for graphics output until
-the monitor driver is either <em>released</em> (by the
-user) or <em>unlocked</em> (by any user on the system).
-
-
-<p> 
-
-The user can run multiple graphics monitors by simply
-starting each of the graphics monitors drivers he wishes to
-direct output to.  
-
-<li><b>Release a Monitor.</b>
-<br> Once a user has <em>selected</em> a monitor for
-graphics output, it is locked for use by that user until
-either: (1) the user voluntarily releases control of the
-monitor for use by another (option 4), or (2) another GRASS
-user <em>unlocks</em> the user's control of the monitor.
-Menu option 4 appears only to the person who has selected
-the monitor (since only that user can release control of
-his selected graphics monitor.) If another user wishes to
-<em>unlock</em> the user's control of the monitor, that
-user must run <em>d.mon</em> from the command line and set
-the <b>unlock=</b><em>name</em> parameter.
-
-
-</ol>
-
-You may choose multiple options within the <em>d.mon</em>
-program.  
-
-<h2>NOTES</h2>
-
-The <em>d.mon</em> program can regulate control of graphics
-monitors both in systems using multiple monitors and in
-systems using a single graphics monitor. To increase the number
-of monitors available to each user, the ASCII file
-<em>$GISBASE/etc/monitorcap</em> needs to be modified.
-
-<h2>SEE ALSO</h2>
-
-<em><a HREF="d.erase.html">d.erase</a></em><br>
-<em><a href="pngdriver.html">pngdriver</a></em><br>
-<em><a href="xdriver.html">xdriver</a></em><br>
-<em><a href=variables.html>variables</a> list</em>
-
-<h2>AUTHOR</h2>
-
-Michael Shapiro, 
-U.S. Army Construction Engineering 
-Research Laboratory,
-<br>
-Full 24bit support by Roberto Flor, ITC-Irst, Trento, Italy
-<br>
-Code cleanup by Glynn Clements
-
-<p><i>Last changed: $Date$</i>

+ 0 - 157
display/d.mon/cmd/main.c

@@ -1,157 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       d.mon
- * AUTHOR(S):    Michael Shapiro, CERL (original contributor)
- *               Markus Neteler <neteler itc.it>,
- *               Roberto Flor <flor itc.it>, 
- *               Bernhard Reiter <bernhard intevation.de>, 
- *               Glynn Clements <glynn gclements.plus.com>, 
- *               Hamish Bowman <hamish_nospam yahoo.com>, 
- *               Jan-Oliver Wagner <jan intevation.de>
- * PURPOSE:      control graphic monitors
- * COPYRIGHT:    (C) 1999-2006 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 <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-/* Changed for truecolor 24bit support by 
- * Roberto Flor/ITC-Irst, Trento, Italy
- * August 1999
- *
- * added new parameter "nlev" to specify number of colors per color channel
- * example; nlev=8 means 8bit for each R, G, B equal to 24bit truecolor
- */
-
-int run(char *, char *);
-
-int main(int argc, char *argv[])
-{
-    int error;
-    int oops;
-    char *mon_name;
-
-    struct GModule *module;
-    struct Option *start, *stop, *select, *unlock;
-    struct Flag *list, *status, *print, *release, *no_auto_select;
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("display");
-    module->description =
-	_("To establish and control use of a graphics display monitor.");
-
-    start = G_define_option();
-    start->key = "start";
-    start->type = TYPE_STRING;
-    start->required = NO;
-    start->description = _("Name of graphics monitor to start");
-
-    stop = G_define_option();
-    stop->key = "stop";
-    stop->type = TYPE_STRING;
-    stop->required = NO;
-    stop->description = _("Name of graphics monitor to stop");
-
-    select = G_define_option();
-    select->key = "select";
-    select->type = TYPE_STRING;
-    select->required = NO;
-    select->description = _("Name of graphics monitor to select");
-
-    unlock = G_define_option();
-    unlock->key = "unlock";
-    unlock->type = TYPE_STRING;
-    unlock->required = NO;
-    unlock->description = _("Name of graphics monitor to unlock");
-
-    list = G_define_flag();
-    list->key = 'l';
-    list->description = _("List all monitors");
-
-    status = G_define_flag();
-    status->key = 'L';
-    status->description = _("List all monitors (with current status)");
-
-    print = G_define_flag();
-    print->key = 'p';
-    print->description = _("Print name of currently selected monitor");
-
-    release = G_define_flag();
-    release->key = 'r';
-    release->description = _("Release currently selected monitor");
-
-    no_auto_select = G_define_flag();
-    no_auto_select->key = 's';
-    no_auto_select->description =
-	_("Do not automatically select when starting");
-
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-    if (unlock->answer)
-	run("release -f", unlock->answer);
-
-    if (!select->answer && !no_auto_select->answer)
-	select->answer = start->answer;
-
-    G__read_env();
-    mon_name = G__getenv("MONITOR");	/* remember old monitor name */
-
-    error = 0;
-    if (status->answer)
-	error += run("status", "");
-    else if (list->answer)
-	error += run("list", "");
-    if (release->answer)
-	error += run("release", "");
-    if (stop->answer)
-	error += run("stop", stop->answer);
-    if (start->answer) {
-	error += run("start", start->answer);
-	if (error) {		/* needed procedure failed */
-	    if (mon_name != NULL) {
-		/* restore the previous environ. */
-		G__setenv("MONITOR", mon_name);
-		/* write the name to the .gisrc file */
-		G__write_env();
-	    }
-	}
-    }
-    if (select->answer) {
-	oops = run("select", select->answer);	/* couldn't select */
-	if (oops && start->answer && strcmp(start->answer, select->answer) == 0) {	/* try once more */
-	    G_message(_("Problem selecting %s. Will try once more"),
-		      select->answer);
-	    oops = run("select", select->answer);	/* couldn't select */
-	}
-	if (oops) {		/* needed procedure failed */
-	    if (mon_name != NULL) {
-		/* restore the previous environ. */
-		G__setenv("MONITOR", mon_name);
-		/* write the name to the .gisrc file */
-		G__write_env();
-	    }
-	}
-	error += oops;
-    }
-    if (print->answer)
-	error += run("which", "");
-    exit(error ? EXIT_FAILURE : EXIT_SUCCESS);
-}
-
-int run(char *pgm, char *name)
-{
-    char command[1024];
-
-    sprintf(command, "%s/etc/mon.%s %s", G_gisbase(), pgm, name);
-    return system(command);
-}

+ 0 - 42
display/d.mon/pgms/Makefile

@@ -1,42 +0,0 @@
-
-MODULE_TOPDIR = ../../..
-
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
-
-LIBES = $(RASTERLIB) $(GISLIB)
-DEPENDENCIES = $(GISDEP)
-
-default:$(ETC)/mon.list \
-	$(ETC)/mon.release \
-	$(ETC)/mon.select \
-	$(ETC)/mon.start \
-	$(ETC)/mon.status \
-	$(ETC)/mon.stop \
-	$(ETC)/mon.which
-
-$(ETC)/mon.list:	$(OBJDIR)/list.o $(DEPENDENCIES)
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/list.o $(LIBES) $(MATHLIB) $(XDRLIB)
-$(ETC)/mon.start:	$(OBJDIR)/start.o $(DEPENDENCIES)
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/start.o $(LIBES) $(MATHLIB) $(XDRLIB)
-$(ETC)/mon.status:	$(OBJDIR)/status.o $(DEPENDENCIES) 
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/status.o $(LIBES) $(MATHLIB) $(XDRLIB)
-$(ETC)/mon.stop:	$(OBJDIR)/stop.o $(DEPENDENCIES) 
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/stop.o $(LIBES) $(MATHLIB) $(XDRLIB)
-$(ETC)/mon.which:	$(OBJDIR)/which.o $(DEPENDENCIES) 
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/which.o $(GISLIB) $(MATHLIB) $(XDRLIB) 
-$(ETC)/mon.select:	$(OBJDIR)/select.o $(DEPENDENCIES) 
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/select.o $(DISPLAYLIB) $(LIBES) $(MATHLIB) $(XDRLIB)
-$(ETC)/mon.release:	$(OBJDIR)/release.o $(DEPENDENCIES) 
-	$(CC) $(LDFLAGS) -o $@ $(OBJDIR)/release.o $(LIBES)  $(MATHLIB) $(XDRLIB)
-
-#list.o: $(SRC)/include/monitors.h
-#release.o: $(SRC)/include/monitors.h
-#release.o: open.h
-#select.o: $(SRC)/include/monitors.h
-#start.o: $(SRC)/include/monitors.h
-#status.o: $(SRC)/include/monitors.h
-#status.o: open.h
-#stop.o: $(SRC)/include/monitors.h
-#stop.o: open.h

+ 0 - 30
display/d.mon/pgms/list.c

@@ -1,30 +0,0 @@
-/* list.mon - list entries in monitorcap file */
-
-#include <grass/raster.h>
-#include <stdio.h>
-#include <grass/monitors.h>
-
-int main(int argc, char *argv[])
-{
-    struct MON_CAP *cap;
-    struct MON_CAP *R_parse_monitorcap();
-    int n;
-    char *fmt1 = "%-15s %-30s\n";
-    char *fmt2 = "%-15s %-30s (%s)\n";
-
-    n = 0;
-    while ((cap = R_parse_monitorcap(MON_NEXT, "")) != NULL) {
-	if (n++ == 0) {
-	    fprintf(stdout, fmt1, "name", "description");
-	    fprintf(stdout, fmt1, "----", "-----------");
-	}
-	if (*(cap->tty) != '\0')
-	    fprintf(stdout, fmt2, cap->name, cap->comment, cap->where);
-	else
-	    fprintf(stdout, fmt1, cap->name, cap->comment);
-    }
-    if (!n)
-	fprintf(stdout, "     no known monitors\n");
-
-    return 0;
-}

+ 0 - 27
display/d.mon/pgms/local_proto.h

@@ -1,27 +0,0 @@
-/* list.c */
-int main(int, char *[]);
-
-/* release.c */
-int main(int, char *[]);
-int usage(char *);
-
-/* select.c */
-int main(int, char *[]);
-
-/* start.c */
-int main(int, char *[]);
-int start_mon(char *);
-
-/* status.c */
-int main(int, char *[]);
-
-/* stop.c */
-int main(int, char *[]);
-int usage(char *);
-int stop_mon(char *, int);
-
-/* ttyname.c */
-char *ttyname(int);
-
-/* which.c */
-int main(int, char *[]);

+ 0 - 15
display/d.mon/pgms/open.h

@@ -1,15 +0,0 @@
-/* quiet mode returns:   0 - open OK */
-/*                      -1 - driver locked */
-/*                      -2 - driver not running */
-/*                      -3 - can't open fifos */
-/*                      -4 - no such monitor */
-/*                      -5 - GIS_LOCK undefined in shell environment */
-/*                      -6 - couldn't read, write or create lock file */
-
-#define OK       0
-#define LOCKED  -1
-#define NO_RUN  -2
-#define NO_OPEN -3
-#define NO_MON  -4
-#define NO_KEY  -5
-#define LOCK_FAILED -6

+ 0 - 90
display/d.mon/pgms/release.c

@@ -1,90 +0,0 @@
-/* release.mon - turn loose of a monitor */
-/* if no name is specified, release current monitor; otherwise, release */
-/* monitor specified */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/monitors.h>
-#include "open.h"
-#include <grass/raster.h>
-#include <grass/glocale.h>
-#include "local_proto.h"
-
-int main(int argc, char *argv[])
-{
-    int override;
-    char *monitor;
-    char *option;
-    char *me;
-
-    override = 0;
-    me = argv[0];
-    while (argc > 1 && argv[1][0] == '-') {
-	if (argv[1][1] == 0)
-	    usage(me);
-	option = &argv[1][1];
-
-	while (*option) {
-	    switch (*option) {
-	    case 'f':
-		override = 1;
-		break;
-		/* Please remove before GRASS 7 is released */
-	    case 'v':
-		G_set_verbose(G_verbose_max());
-		G_warning(_("The '-v' flag is superseded and will be removed "
-			    "in future. Please use '--verbose' instead."));
-		;
-		break;
-	    default:
-		G_warning(_("%s: -%c unrecognized option"), me, *option);
-		usage(me);
-	    }
-	    option++;
-	}
-	argv++;
-	argc--;
-    }
-    if (argc > 2)
-	usage(me);
-
-    G_gisinit(argv[0]);
-    if (argc > 1)
-	G__setenv("MONITOR", argv[1]);
-    monitor = G__getenv("MONITOR");
-    if (!monitor)
-	exit(1);
-
-    if (override)
-	R_release_driver();
-    else {
-	R__open_quiet();	/* call R_open_driver to see if we */
-	switch (R_open_driver()) {	/*  own the monitor */
-	case OK:		/* if not locked or locked by us */
-	    R_close_driver();
-	case NO_RUN:		/*   or not even in memory, */
-	    R_release_driver();	/*   we may release */
-	    G_message(_("Monitor <%s> released"), monitor);
-	    break;
-	case LOCKED:		/* if locked by another, fail */
-	    G_message(_("Monitor <%s> in use by another user"), monitor);
-	    break;
-	case NO_MON:		/* if no such monitor, fail */
-	    G_warning(_("No such monitor as <%s>"), monitor);
-	    break;
-	default:		/* couldn't access lock file? */
-	    G_warning(_("Failed testing lock mechanism"));
-	    break;
-	}
-    }
-    G_unsetenv("MONITOR");
-
-    return 0;
-}
-
-int usage(char *me)
-{
-    G_fatal_error(_("Usage:  %s [-fv] [name]"), me);
-    exit(EXIT_FAILURE);
-}

+ 0 - 58
display/d.mon/pgms/select.c

@@ -1,58 +0,0 @@
-/* select a monitor for graphics */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/monitors.h>
-#include <grass/glocale.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-
-int main(int argc, char *argv[])
-{
-    char name[128];
-    const char *fenc = getenv("GRASS_ENCODING");
-    const char *font = getenv("GRASS_FONT");
-
-    if (argc != 2) {
-	G_fatal_error(_("Usage:  %s monitor_name"), argv[0]);
-	exit(EXIT_FAILURE);
-    }
-
-    G_gisinit(argv[0]);
-
-    G_unsetenv("MONITOR");
-
-    if (R_parse_monitorcap(MON_NAME, argv[1]) == NULL) {
-	G_fatal_error(_("No such monitor as <%s>"), argv[1]);
-	exit(EXIT_FAILURE);
-    }
-
-    /* change the environment variable */
-    G__setenv("MONITOR", argv[1]);
-
-    /* now try to run the monitor to see if it is running and to lock it
-     * set the font
-     * if no current frame create a full screen window.
-     */
-    /* Don't do anything else if connecting to the driver fails */
-    if (R_open_driver() != 0)
-	exit(EXIT_FAILURE);
-
-    R_font(font ? font : "romans");
-
-    if (fenc)
-	R_charset(fenc);
-
-    if (D_get_cur_wind(name) != 0)
-	D_new_window("full_screen",
-		     R_screen_top(), R_screen_bot(),
-		     R_screen_left(), R_screen_rite());
-    D_set_cur_wind("full_screen");
-
-    R_close_driver();
-
-    /* write the name to the .gisrc file */
-    G__write_env();
-    exit(EXIT_SUCCESS);
-}

+ 0 - 95
display/d.mon/pgms/start.c

@@ -1,95 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       monitor
- * AUTHOR(S):    Michael Shapiro, U.S. Army CERL (original contributor)
- *               Markus Neteler <neteler itc.it>
- *               Mike Thomas <miketh@brisbane.paradigmgeo.com>, Roberto Flor <flor itc.it>, Bernhard Reiter <bernhard intevation.de>, Eric G. Miller <egm2 jps.net>, Glynn Clements <glynn gclements.plus.com>, Jachym Cepicky <jachym les-ejk.cz>
- * PURPOSE:      GRASS monitor
- * COPYRIGHT:    (C) 1999-2007 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.
- *
- *****************************************************************************/
-/* 
- * Changed for truecolor 24bit support by 
- * Roberto Flor/ITC-Irst, Trento, Italy
- * August 1999
- *
- */
-
-
-
-/****************************************************************
- * start_mon - start a monitor running
- *
- * read $GISBASE/etc/monitorcap
- *
- * If the monitor can be started from any tty, it will be run in
- * background.  If not, i.e., if there is an entry in the monitorcap
- * file which forces the monitor to be started from a specific tty,
- * then the monitor will run in foreground.  To run the monitor in
- * background, we invoke it with only the fifo names as an argument.
- * To run it in foreground, "-" is the first argument and the fifo
- * names are the second.  When the monitor runs in background, the
- * fork is actually done in the monitor itself.  This prevents the
- * monitor startup message from appearing after the user gets his
- * prompt back.
- ****************************************************************/
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <grass/config.h>
-
-#include <grass/raster.h>
-#include <grass/monitors.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "local_proto.h"
-
-#ifdef __W98__
-
-#include <process.h>
-
-#define execl(fullpath,path,name,bg,link,nul)			\
-do {								\
-	spawnl(_P_DETACH,fullpath,path,name,"-",link,nul);	\
-	return 0;						\
-} while (0)
-
-#endif /* __W98__ */
-
-int main(int argc, char *argv[])
-{
-    if (argc != 2) {
-	G_warning(_("Usage:  %s monitor_name"), argv[0]);
-	return 1;
-    }
-
-    return start_mon(argv[1]);
-}
-
-int start_mon(char *name)
-{
-    struct MON_CAP *mon;
-
-    if ((mon = R_parse_monitorcap(MON_NAME, name)) == NULL)
-	G_fatal_error("no such monitor '%s'", name);
-
-#ifndef __MINGW32__
-    if (*mon->tty != '\0' && strcmp(mon->tty, ttyname(0)) != 0)
-	G_fatal_error("Error:  must start %s from %s\n You are on %s", name,
-		      mon->where, ttyname(0));
-#endif
-
-    G_convert_dirseps_to_host(mon->path);
-    execl(mon->path,
-	  mon->path,
-	  name, *mon->tty == '\0' ? "" : "-", mon->link, (char *)0);
-
-    perror("Could not execute monitor");
-    return 1;
-}

+ 0 - 44
display/d.mon/pgms/status.c

@@ -1,44 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <grass/raster.h>
-#include <grass/gis.h>
-#include <grass/monitors.h>
-#include "open.h"
-
-int main(int argc, char *argv[])
-{
-    struct MON_CAP *cap;
-    char *status;
-    char *fmt = "%-15s %-30s %s\n";
-    char *mon_name;
-
-    mon_name = G__getenv("MONITOR");
-
-    fprintf(stdout, fmt, "name", "description", "status");
-    fprintf(stdout, fmt, "----", "-----------", "------");
-    while ((cap = R_parse_monitorcap(MON_NEXT, "")) != NULL) {
-	G__setenv("MONITOR", cap->name);
-	R__open_quiet();
-	switch (R_open_driver()) {
-	case OK:
-	    status = mon_name && (strcmp(cap->name, mon_name) == 0)
-		? "running (selected)" : "running";
-	    R_close_driver();
-	    R_release_driver();
-	    break;
-	case NO_RUN:
-	case NO_MON:
-	    status = "not running";
-	    break;
-	case LOCKED:
-	    status = "in use";
-	    break;
-	default:
-	    status = "??";
-	    break;
-	}			/* switch */
-	fprintf(stdout, fmt, cap->name, cap->comment, status);
-    }
-
-    return 0;
-}

+ 0 - 89
display/d.mon/pgms/stop.c

@@ -1,89 +0,0 @@
-/* stop_mon - stop a running monitor */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <grass/raster.h>
-#include <grass/gis.h>
-#include <grass/monitors.h>
-#include <grass/glocale.h>
-#include "open.h"
-#include "local_proto.h"
-
-static char *me;
-
-int main(int argc, char *argv[])
-{
-    int forced;
-    char *option;
-
-    me = argv[0];
-    forced = 0;
-    while (argc > 1 && argv[1][0] == '-') {
-	if (argv[1][1] == 0)
-	    usage(me);
-	option = &argv[1][1];
-
-	while (*option) {
-	    switch (*option) {
-	    case 'f':
-		forced = 1;
-		break;
-	    default:
-		G_warning(_("%s: -%c unrecognized option"), me, *option);
-		usage(me);
-	    }
-	    option++;
-	}
-	argv++;
-	argc--;
-    }
-    if (argc != 2)
-	usage(me);
-    stop_mon(argv[1], forced);
-
-    return 0;
-}
-int usage(char *me)
-{
-    G_fatal_error(_("Usage: %s [-f] monitor_name"), me);
-    exit(EXIT_FAILURE);
-}
-
-int stop_mon(char *name, int forced)
-{
-    char *cur;
-    int unset;
-
-    unset = 0;
-    cur = G__getenv("MONITOR");
-    if (cur != NULL && strcmp(cur, name) == 0)
-	unset = 1;
-    G__setenv("MONITOR", name);
-    if (forced)
-	R_release_driver();
-    R__open_quiet();		/* call open_driver in quiet mode */
-    switch (R_open_driver()) {
-    case OK:
-	R_kill_driver();
-	/*R_close_driver(); */
-	G_message(_("Monitor '%s' terminated"), name);
-	break;
-    case NO_RUN:
-	G_warning(_("Error - Monitor '%s' was not running"), name);
-	break;
-    case NO_MON:
-	G_warning(_("No such monitor as <%s>"), name);
-	break;
-    case LOCKED:
-	G_warning(_("Error - Monitor '%s' in use by another user"), name);
-	break;
-    default:
-	G_warning(_("Error - Locking mechanism failed"));
-	break;
-    }
-    if (unset)
-	G_unsetenv("MONITOR");
-
-    return 0;
-}

+ 0 - 18
display/d.mon/pgms/which.c

@@ -1,18 +0,0 @@
-/* which_mon - show name of currently selected monitor */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-
-int main(int argc, char *argv[])
-{
-    char *name;
-
-    G_gisinit(argv[0]);
-    if ((name = G__getenv("MONITOR")) == NULL)
-	fprintf(stdout, "No monitor currently selected for output\n");
-    else
-	fprintf(stdout, "Currently selected monitor: %s\n", name);
-    exit(EXIT_SUCCESS);
-}

+ 0 - 5
display/d.nviz/local.h

@@ -1,8 +1,3 @@
-static int move(int, int);
-static int cont(int, int);
-static int min_range[5], max_range[5];
-static int which_range;
-static int change_range;
 static double dist, e = 0, n = 0;
 static double DIST, HT;
 int do_profile(double, double, double, double, char *, int, int);

+ 23 - 122
display/d.nviz/main.c

@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
     char outfile[GNAME_MAX];
     int fd, projection;
     char buf[512], buf1[1024], buf2[1024];
-    int screen_x, screen_y, button;
+    int screen_x, screen_y;
     int i, k;
     int frame_start = 0;
     double e1, e2, n1, n2;
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
     {
 	struct Option *opt1, *route, *name, *output, *dist, *ht, *frames,
 	    *start;
-	struct Flag *i, *f, *c, *k, *o, *e;
+	struct Flag *f, *c, *k, *o, *e;
     }
     parm;
     struct GModule *module;
@@ -112,10 +112,6 @@ int main(int argc, char *argv[])
     parm.start->description = _("Start frame number (default=0)");
 
 
-    parm.i = G_define_flag();
-    parm.i->key = 'i';
-    parm.i->description = _("Interactively select route");
-
     parm.f = G_define_flag();
     parm.f->key = 'f';
     parm.f->description = _("Full render -- Save images");
@@ -142,7 +138,7 @@ int main(int argc, char *argv[])
 	exit(EXIT_FAILURE);
 
     /* check arguments */
-    if ((!parm.i->answer) && (!parm.route->answer))
+    if (!parm.route->answer)
 	G_fatal_error(_
 		      ("Either -i flag and/or route parameter must be used"));
 
@@ -241,97 +237,32 @@ int main(int argc, char *argv[])
 	fprintf(fp, "%s", buf1);
     }
 
-    /* Get coords */
-    /* Select points interactively */
-    if (parm.i->answer) {
-	int count = 0;
-
-	if (R_open_driver() != 0)
-	    G_fatal_error(_("No graphics device selected"));
-	D_setup(0);
-
-	G_setup_plot(D_get_d_north(),
-		     D_get_d_south(),
-		     D_get_d_west(), D_get_d_east(), move, cont);
-
-	dist = 0;
-
-	fprintf(stderr, "\n\n");
-	fprintf(stderr, "Use mouse to select Start Point\n");
-	R_get_location_with_pointer(&screen_x, &screen_y, &button);
-	e1 = D_d_to_u_col((double)screen_x);
-	n1 = D_d_to_u_row((double)screen_y);
-
-	fprintf(stderr, "\nUse mouse to select route \n");
-	fprintf(stderr, "Buttons:\n");
-	fprintf(stderr, "Left:   Mark next point\n");
-	fprintf(stderr, "Middle: Mark next point\n");
-	fprintf(stderr, "Right:  Finish route and exit\n\n");
-
-	while (button != 3) {
-	    count++;
-	    R_get_location_with_line((int)(0.5 + D_u_to_d_col(e1)),
-				     (int)(0.5 + D_u_to_d_row(n1)), &screen_x,
-				     &screen_y, &button);
-	    if (button == 1 || button == 2) {
-		e2 = D_d_to_u_col((double)screen_x);
-		n2 = D_d_to_u_row((double)screen_y);
-	    }
-	    else {
-		if (e2 == -9999. || n2 == -9999.) {
-		    G_fatal_error(_("You must select more than one point"));
-
-		}
-		break;
-	    }
-
-	    /* draw line from p1 to p2 */
-	    G_plot_line(e1, n1, e2, n2);
-
-	    /* Get profile info */
-	    do_profile(e1, e2, n1, n2, name, fd, data_type);
-
-	    n1 = n2;
-	    e1 = e2;
-	    R_stabilize();
-	}
-
-	if (count < 4) {
-	    G_fatal_error(_("You must select at least four points"));
-
-	}
+    /* Coords from Command Line */
+    for (i = 0; parm.route->answers[i]; i += 2) {
+	/* Test for number coordinate pairs */
+	k = i;
+    }
 
-	R_close_driver();
+    if (k < 6) {
+	/* Only one coordinate pair supplied */
+	G_fatal_error(_("You must provide at least four points %d"), k);
 
     }
     else {
+	for (i = 0; i <= k - 2; i += 2) {
+	    sscanf(parm.route->answers[i], "%lf", &e1);
+	    sscanf(parm.route->answers[i + 1], "%lf", &n1);
+	    sscanf(parm.route->answers[i + 2], "%lf", &e2);
+	    sscanf(parm.route->answers[i + 3], "%lf", &n2);
+	    /* Get profile info */
+	    do_profile(e1, e2, n1, n2, name, fd, data_type);
 
-	/* Coords from Command Line */
-	for (i = 0; parm.route->answers[i]; i += 2) {
-	    /* Test for number coordinate pairs */
-	    k = i;
-	}
-
-	if (k < 6) {
-	    /* Only one coordinate pair supplied */
-	    G_fatal_error(_("You must provide at least four points %d"), k);
-
-	}
-	else {
-	    for (i = 0; i <= k - 2; i += 2) {
-		sscanf(parm.route->answers[i], "%lf", &e1);
-		sscanf(parm.route->answers[i + 1], "%lf", &n1);
-		sscanf(parm.route->answers[i + 2], "%lf", &e2);
-		sscanf(parm.route->answers[i + 3], "%lf", &n2);
-		/* Get profile info */
-		do_profile(e1, e2, n1, n2, name, fd, data_type);
-
-		/* Get last coord */
-		if (i == k - 2)
-		    do_profile(e2, e2, n2, n2, name, fd, data_type);
-	    }
+	    /* Get last coord */
+	    if (i == k - 2)
+		do_profile(e2, e2, n2, n2, name, fd, data_type);
 	}
-    }				/* done with coordinates */
+    }
+	/* done with coordinates */
 
 
     /* Output final part of script */
@@ -475,36 +406,6 @@ int do_profile
 }				/* done with do_profile */
 
 
-static int move(int x, int y)
-{
-    D_move_abs(x, y);
-
-    return 0;
-}
-
-static int cont(int x, int y)
-{
-    if (D_cont_abs(x, y)) {	/* clipped */
-	change_range = 1;
-    }
-    else {			/* keep track of left,right x for lines drawn in window */
-
-	if (change_range) {
-	    which_range++;
-	    min_range[which_range] = max_range[which_range] = x;
-	    change_range = 0;
-	}
-	else {
-	    if (x < min_range[which_range])
-		min_range[which_range] = x;
-	    else if (x > max_range[which_range])
-		max_range[which_range] = x;
-	}
-    }
-
-    return 0;
-}
-
 /*****************************
  * read_rast
  * function to get raster value at set location

+ 12 - 21
display/d.path/main.c

@@ -40,7 +40,6 @@ int main(int argc, char **argv)
     int type, afield, nfield, geo;
     struct color_rgb color, hcolor, bgcolor;
     int r, g, b;
-    int use_mouse;
     double x1, y1, x2, y2;
 
     /* Initialize the GIS calls */
@@ -62,7 +61,7 @@ int main(int argc, char **argv)
     coor_opt->key = "coor";
     coor_opt->key_desc = "x1,y1,x2,y2";
     coor_opt->type = TYPE_STRING;
-    coor_opt->required = NO;
+    coor_opt->required = YES;
     coor_opt->description = _("Starting and ending coordinates");
 
     afield_opt = G_define_standard_option(G_OPT_V_FIELD);
@@ -137,22 +136,17 @@ int main(int argc, char **argv)
     nfield = atoi(nfield_opt->answer);
 
 
-    use_mouse = TRUE;
-    if (coor_opt->answer) {
-	if (coor_opt->answers[0] == NULL)
-	    G_fatal_error(_("No coordinates given"));
+    if (coor_opt->answers[0] == NULL)
+	G_fatal_error(_("No coordinates given"));
 
-	if (!G_scan_easting(coor_opt->answers[0], &x1, G_projection()))
-	    G_fatal_error(_("%s - illegal x value"), coor_opt->answers[0]);
-	if (!G_scan_northing(coor_opt->answers[1], &y1, G_projection()))
-	    G_fatal_error(_("%s - illegal y value"), coor_opt->answers[1]);
-	if (!G_scan_easting(coor_opt->answers[2], &x2, G_projection()))
-	    G_fatal_error(_("%s - illegal x value"), coor_opt->answers[2]);
-	if (!G_scan_northing(coor_opt->answers[3], &y2, G_projection()))
-	    G_fatal_error(_("%s - illegal y value"), coor_opt->answers[3]);
-
-	use_mouse = FALSE;
-    }
+    if (!G_scan_easting(coor_opt->answers[0], &x1, G_projection()))
+	G_fatal_error(_("%s - illegal x value"), coor_opt->answers[0]);
+    if (!G_scan_northing(coor_opt->answers[1], &y1, G_projection()))
+	G_fatal_error(_("%s - illegal y value"), coor_opt->answers[1]);
+    if (!G_scan_easting(coor_opt->answers[2], &x2, G_projection()))
+	G_fatal_error(_("%s - illegal x value"), coor_opt->answers[2]);
+    if (!G_scan_northing(coor_opt->answers[3], &y2, G_projection()))
+	G_fatal_error(_("%s - illegal y value"), coor_opt->answers[3]);
 
 
     if (R_open_driver() != 0)
@@ -204,10 +198,7 @@ int main(int argc, char **argv)
     Vect_net_build_graph(&Map, type, afield, nfield, afcol->answer,
 			 abcol->answer, ncol->answer, geo, 0);
 
-    if (use_mouse)
-	path(&Map, &color, &hcolor, &bgcolor, bold_f->answer);
-    else
-	coor_path(&Map, &hcolor, bold_f->answer, x1, y1, x2, y2);
+    coor_path(&Map, &hcolor, bold_f->answer, x1, y1, x2, y2);
 
 
     R_close_driver();

+ 0 - 3
display/d.path/proto.h

@@ -1,5 +1,2 @@
-int path(struct Map_info *, const struct color_rgb *,
-	 const struct color_rgb *, const struct color_rgb *, int);
-
 int coor_path(struct Map_info *, const struct color_rgb *, int,
 	      double, double, double, double);

+ 0 - 155
display/d.path/select.c

@@ -12,161 +12,6 @@
 
 #define WDTH 5
 
-int display(struct Map_info *Map, struct line_pnts *,
-	    const struct color_rgb *, int, int, int);
-
-int path(struct Map_info *Map, const struct color_rgb *color,
-	 const struct color_rgb *hcolor, const struct color_rgb *bgcolor,
-	 int be_bold)
-{
-    int button, ret;
-    int screen_x, screen_y;
-    double x, y, nx, ny, fx, fy, tx, ty, msize;
-    double x1, y1, x2, y2, maxdist;
-    struct line_pnts *Points;
-    int node;
-    int from_disp = 0, to_disp = 0, sp_disp = 0, from_node = 0, to_node = 0;
-
-    Points = Vect_new_line_struct();
-
-    msize = 10 * (D_d_to_u_col(2.0) - D_d_to_u_col(1.0));	/* do it better */
-    G_debug(1, "msize = %f\n", msize);
-
-    G_message(_("\nMouse Buttons:"));
-    fprintf(stderr, _("Left:   Select From\n"));
-    fprintf(stderr, _("Middle: Select To\n"));
-    fprintf(stderr, _("Right:  Quit\n\n"));
-
-    while (1) {
-	R_get_location_with_pointer(&screen_x, &screen_y, &button);
-
-	x = D_d_to_u_col((double)(screen_x));
-	y = D_d_to_u_row((double)(screen_y));
-	/* fprintf (stderr, "%f %f\n", x, y); */
-
-	x1 = D_d_to_u_col((double)(screen_x - WDTH));
-	y1 = D_d_to_u_row((double)(screen_y - WDTH));
-	x2 = D_d_to_u_col((double)(screen_x + WDTH));
-	y2 = D_d_to_u_row((double)(screen_y + WDTH));
-
-	x1 = fabs(x2 - x1);
-	y1 = fabs(y2 - y1);
-
-	if (x1 > y1)
-	    maxdist = x1;
-	else
-	    maxdist = y1;
-	G_debug(1, "Maximum distance in map units = %f\n", maxdist);
-
-	node = Vect_find_node(Map, x, y, 0.0, maxdist, 0);
-
-	if (node > 0) {
-	    Vect_get_node_coor(Map, node, &nx, &ny, NULL);
-	    fprintf(stderr, _("Node %d: %f %f\n"), node, nx, ny);
-	}
-
-	if (sp_disp) {		/* erase old */
-	    /* delete old highlight */
-
-	    display(Map, Points, color, from_node, to_node, be_bold);
-
-	    R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
-	    if (!from_node)
-		G_plot_line(Points->x[0], Points->y[0], Points->x[1],
-			    Points->y[1]);
-
-	    if (!to_node)
-		G_plot_line(Points->x[Points->n_points - 2],
-			    Points->y[Points->n_points - 2],
-			    Points->x[Points->n_points - 1],
-			    Points->y[Points->n_points - 1]);
-	}
-
-	switch (button) {
-	case 1:
-	    if (from_disp) {
-		R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
-		G_plot_icon(fx, fy, G_ICON_BOX, 0.0, msize);
-	    }
-	    if (node > 0) {
-		fx = nx;
-		fy = ny;
-		from_node = 1;
-	    }
-	    else {
-		fx = x;
-		fy = y;
-		from_node = 0;
-	    }
-	    R_RGB_color(hcolor->r, hcolor->g, hcolor->b);
-	    G_plot_icon(fx, fy, G_ICON_BOX, 0.0, msize);
-	    R_flush();
-	    from_disp = 1;
-	    break;
-	case 2:
-	    if (to_disp) {
-		R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
-		G_plot_icon(tx, ty, G_ICON_CROSS, 0.0, msize);
-	    }
-	    if (node > 0) {
-		tx = nx;
-		ty = ny;
-		to_node = 1;
-	    }
-	    else {
-		tx = x;
-		ty = y;
-		to_node = 0;
-	    }
-	    R_RGB_color(hcolor->r, hcolor->g, hcolor->b);
-	    G_plot_icon(tx, ty, G_ICON_CROSS, 0.0, msize);
-	    R_flush();
-	    to_disp = 1;
-	    break;
-	case 3:
-	    if (from_disp) {
-		R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
-		G_plot_icon(fx, fy, G_ICON_BOX, 0.0, msize);
-	    }
-	    if (to_disp) {
-		R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
-		G_plot_icon(tx, ty, G_ICON_CROSS, 0.0, msize);
-	    }
-	    return 1;
-	    break;
-	}
-	if (from_disp && to_disp) {
-	    double fdist, tdist, cost;
-
-	    G_debug(2, "find path %f %f -> %f %f", fx, fy, tx, ty);
-
-	    ret =
-		Vect_net_shortest_path_coor(Map, fx, fy, 0.0, tx, ty, 0.0,
-					    5 * maxdist, 5 * maxdist, &cost,
-					    Points, NULL, NULL, NULL, &fdist,
-					    &tdist);
-	    if (ret == 0) {
-		fprintf(stdout, _("Destination unreachable\n"));
-		sp_disp = 0;
-	    }
-	    else {
-		fprintf(stdout, _("Costs on the network = %f\n"), cost);
-		fprintf(stdout, _("  Distance to the network = %f, "
-				  "distance from the network = %f\n\n"),
-			fdist, tdist);
-
-		display(Map, Points, hcolor, 1, 1, be_bold);
-		sp_disp = 1;
-	    }
-
-	}
-	R_flush();
-    };
-
-    return 0;
-}
-
-
 int display(struct Map_info *Map, struct line_pnts *Points,
 	    const struct color_rgb *color, int first, int last, int be_bold)
 {

+ 6 - 35
display/d.rast.arrow/arrow.c

@@ -64,7 +64,6 @@ int D_x, D_y;
 double D_ew, D_ns;
 char *mapset;
 char layer_name[128];
-int layer_set;
 int map_type, arrow_color, grid_color, x_color, unknown_color;
 
 
@@ -72,10 +71,8 @@ int main(int argc, char **argv)
 {
     extern double D_ew, D_ns;
     extern int D_x, D_y;
-    char window_name[128];
     struct Cell_head window;
     int t, b, l, r;
-    char full_name[128];
     RASTER_MAP_TYPE raster_type, mag_raster_type = -1;
     int layer_fd;
     void *raster_row, *ptr;
@@ -115,7 +112,7 @@ int main(int argc, char **argv)
     opt1 = G_define_option();
     opt1->key = "map";
     opt1->type = TYPE_STRING;
-    opt1->required = NO;
+    opt1->required = YES;
     opt1->multiple = NO;
     opt1->gisprompt = "old,cell,raster";
     opt1->description = _("Name of raster aspect map to be displayed");
@@ -189,15 +186,9 @@ int main(int argc, char **argv)
 	exit(-1);
 
 
-    if (opt1->answer) {
-	G_strncpy(layer_name, opt1->answer, sizeof(layer_name) - 1);
-	if ((mapset = G_find_cell2(layer_name, "")) == NULL)
-	    G_fatal_error(_("Raster map <%s> not found"), layer_name);
-	layer_set = 1;
-    }
-    else
-	layer_set = 0;
-
+    G_strncpy(layer_name, opt1->answer, sizeof(layer_name) - 1);
+    if ((mapset = G_find_cell2(layer_name, "")) == NULL)
+	G_fatal_error(_("Raster map <%s> not found"), layer_name);
 
     arrow_color = D_translate_color(opt3->answer);
     x_color = D_translate_color(opt5->answer);
@@ -245,17 +236,10 @@ int main(int argc, char **argv)
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    if (D_get_cur_wind(window_name))
-	G_fatal_error(_("No current window"));
-
-    if (D_set_cur_wind(window_name))
-	G_fatal_error(_("Current window not available"));
-
     /* Read in the map window associated with window */
     G_get_window(&window);
 
-    if (D_check_map_window(&window))
-	G_fatal_error(_("Setting map window"));
+    D_check_map_window(&window);
 
     if (G_set_window(&window) == -1)
 	G_fatal_error(_("Current window not settable"));
@@ -362,19 +346,6 @@ int main(int argc, char **argv)
 	}
     }
 
-    /* if we didn't get a layer name from the arg options, then
-       get name of layer that is on the screen */
-    if (!layer_set) {
-	if (D_get_cell_name(full_name))
-	    G_fatal_error(_("No raster map exists in the current window"));
-
-	mapset = G_find_cell(full_name, "");
-	if (mapset == NULL)
-	    G_fatal_error(_("Raster map <%s> not found"), full_name);
-
-	sscanf(full_name, "%s", layer_name);
-    }
-
     /* open the raster map */
     layer_fd = G_open_cell_old(layer_name, mapset);
     if (layer_fd < 0)
@@ -596,7 +567,7 @@ int main(int argc, char **argv)
     G_close_cell(layer_fd);
     if (opt7->answer)
 	G_close_cell(mag_fd);
-    D_add_to_list(G_recreate_command());
+
     R_close_driver();
 
     exit(0);

+ 0 - 2
display/d.rast.edit/DEPRECATED

@@ -1,2 +0,0 @@
-no longer maintained.
-Please use ../../scripts/d.rast.edit/

+ 0 - 10
display/d.rast.edit/Makefile

@@ -1,10 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = d.rast.edit.old
-
-LIBES     = $(DISPLAYLIB) $(RASTERLIB) $(GISLIB)
-DEPENDENCIES= $(DISPLAYDEP) $(RASTERDEP) $(GISDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 112
display/d.rast.edit/cell.c

@@ -1,112 +0,0 @@
-#include <stdlib.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "edit.h"
-
-static int cell_draw(char *, char *, struct Colors *, int);
-
-
-/*!
- * \brief 
- *
- * If the map is a floating-point map, read the map using
- * <tt>G_get_d_raster_row()</tt> and plot using <tt>D_draw_d_cell()</tt>. If the
- * map is an integer map, read the map using <tt>G_get_c_raster_row()</tt> and
- * plot using <tt>D_draw_cell()</tt>.
- *
- *  \param name
- *  \param mapset
- *  \param overlay
- *  \return int
- */
-
-int Dcell(char *name, char *mapset, int overlay)
-{
-    struct Cell_head wind;
-    struct Colors colors;
-    char buff[128];
-    int offset;
-
-    G_get_set_window(&wind);
-
-    if (D_check_map_window(&wind))
-	G_fatal_error(_("Setting map window"));
-
-    if (G_set_window(&wind) == -1)
-	G_fatal_error(_("Current window not settable"));
-
-    /* Get existing map window for this graphics window, or save window */
-    /* cell maps wipe out a picture, so we clear info on the window too */
-    if (!overlay && D_clear_window())
-	G_fatal_error(_("Can't clear current graphics window"));
-
-    /* Save the current map window with the graphics window */
-    D_check_map_window(&wind);
-    G_set_window(&wind);
-
-    /* Set the colors for the display */
-    if (G_read_colors(name, mapset, &colors) == -1)
-	G_fatal_error(_("Color file for <%s> not available"), name);
-
-    /* Go draw the cell file */
-    cell_draw(name, mapset, &colors, overlay);
-
-    /* release the colors now */
-    G_free_colors(&colors);
-
-    /* record the cell file */
-    /* If overlay add it to the list instead of setting the cell name */
-    /* added 6/91 DBS @ CWU */
-    if (overlay) {
-	sprintf(buff, "d.rast -o map=%s",
-		G_fully_qualified_name(name, mapset));
-	D_add_to_list(buff);
-    }
-    else {
-	D_set_cell_name(G_fully_qualified_name(name, mapset));
-    }
-
-    return 0;
-}
-
-/* I modified this function to read and draw raster cell as doubles */
-static int cell_draw(char *name, char *mapset, struct Colors *colors,
-		     int overlay)
-{
-    int cellfile;
-    DCELL *xarray;
-    int cur_A_row;
-    int t, b, l, r;
-
-    /* Set up the screen, conversions, and graphics */
-    D_get_screen_window(&t, &b, &l, &r);
-    if (D_cell_draw_setup(t, b, l, r))
-	G_fatal_error(_("Cannot use current window"));
-
-    D_set_overlay_mode(overlay);
-
-    /* Make sure map is available */
-    if ((cellfile = G_open_cell_old(name, mapset)) == -1)
-	G_fatal_error(_("Unable to open raster map <%s>"), name);
-
-    /* Allocate space for cell buffer */
-    xarray = G_allocate_d_raster_buf();
-
-    /* loop for array rows */
-    for (cur_A_row = 0; cur_A_row != -1;) {
-	/* Get window (array) row currently required */
-	G_get_d_raster_row(cellfile, xarray, cur_A_row);
-
-	/* Draw the cell row, and get the next row number */
-	cur_A_row = D_draw_d_raster(cur_A_row, xarray, colors);
-    }
-    R_flush();
-
-    /* Wrap up and return */
-    G_close_cell(cellfile);
-    G_free(xarray);
-
-    return (0);
-}

+ 0 - 216
display/d.rast.edit/description.html

@@ -1,216 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-The <EM>d.rast.edit</EM> program allows users to interactively
-edit cell category values in a raster map layer displayed to the
-graphics monitor using a mouse cursor.
-This program determines the name of the raster map layer
-currently displayed in the active frame on the selected graphics monitor
-(if none, program will abort).
-The user is then prompted for the name of a new raster layer
-to be created in his mapset.
-<EM>d.rast.edit</EM> does not modify the user's original raster map layer.
-
-<H2>Geographic Region Concerns</H2>
-
-<EM>d.rast.edit</EM> reads the region definition for the raster map layer
-being edited from its cell header file.
-The new, edited copy of the raster layer will be created with the
-same resolution and region dimensions.  If the current region resolution
-does not match the raster map layer's resolution, the program will abort.
-The north, south, east, and west geographic region settings
-of the current region can be set to any view, as long as they fall within
-the boundaries of the raster map layer described in its cell header.
-This is important, since the current view must be such that
-individual cell locations are easily visible and sufficiently large 
-on the graphics monitor to be pointed at with the mouse cursor.
-Any mask in place will be ignored when writing the new raster map layer.
-
-<H2>Mouse Menus</H2>
-
-Cell editing is done using a mouse cursor to choose menu selections
-and indicate areas on the displayed raster map that are to be edited.
-
-<P>
-Selections available via the <EM>Main Menu</EM> and the
-subsequent functions or sub-menus are described below:
-<DL>
-<DD>
-1. Edit
-<BR>
-
-<B>invokes edit mode</B>, during which no graphic menus are used,
-so that none of the displayed map is hidden. 
-At the start of the edit mode, a grid is drawn over displayed
-cells to help distinguish cell boundaries.  
-Interaction with the program during edit mode
-is done by using the three mouse buttons as follows:
-
-<DL>
-<DD> Left Button
-<BR>
-<B>what's here</B>.  Identify the category value of the
-cell under the mouse cursor when the button is pressed.
-The category value of this cell is printed in the text frame.
-<P>
-<DD> Middle Button
-<BR>
-<B>edit</B>.  The current category value of the cell under the mouse
-cursor is iterated and a prompt for a new cell value
-appears on the textual command frame.  (Remember to
-move the mouse to the text frame).  Enter a new cell category
-value which is within the range of current category
-values for the map layer.  Note:  the edited cell
-is displayed in the color of the newly-assigned category value,
-but is hatched with lines of the grid color to indicate
-it has been edited, since, if the value of the cell
-is polled (before leaving edit mode), the old category value
-will be reported.
-<P>
-<DD> Right Button
-<BR>
-<B>exit edit mode</B>.  Command is returned to the <EM>Main Menu</EM>
-on the graphics monitor.  If cell value changes were made
-during edit mode, they will be saved upon exit.
-</DL>
-
-<P>
-2. Redraw
-<BR>
-<B>redisplays</B> the raster map layer on the graphics monitor.
-<P>
-3. Zoom
-
-<BR>
-calls the <EM><A HREF="d.zoom.html">d.zoom</A>
-</EM> program, to allow changing the view of the
-raster layer.
-<B>Zoom's</B> instructions will appear on the text command window.
-Interaction is conducted using mouse keys.
-
-<P>
-4. Arrow
-<BR>
-This function is available for users editing aspect maps.  The
-<EM><A HREF="d.rast.arrow.html">d.rast.arrow</A></EM> program is called, which draws arrows over the displayed
-cells to indicate the downslope direction of the cell.
-After selecting the <EM>arrow</EM> selection from the main menu, sub-menus
-will appear, allowing input options to be set for the <EM>
-<A HREF="d.rast.arrow.html">d.rast.arrow</A></EM>
-program.  The first sub-menu selects the type of aspect data displayed.
-(regular "GRASS" format, as produced by <EM>
-<A HREF="r.slope.aspect.html">r.slope.aspect</A>
-</EM>;
-a format prepared as input to the "AGNPS" program; and a format prepared
-for the "ANSWERS" program. The <EM>
-<A HREF="d.rast.arrow.html">d.rast.arrow</A></EM> program can accept the
-name of a layer not drawn on the display for use as input, and 
-an option is given to input the name of that layer, if desired.
-Otherwise, the currently displayed map layer will be used.
-Next, the color options of <EM>
-<A HREF="d.rast.arrow.html">d.rast.arrow</A></EM> may be set via separate menus,
-or a choice for using default settings may be used.
-
-<P>
-5. Number
-<BR>
-calls the <EM>
-<A HREF="d.rast.num.html">d.rast.num</A></EM> program, which will print the cell category values
-over the displayed cells on the graphic monitor.
-
-<P>
-6. Exit
-<BR>
-<B>quit</B> the <EM>d.rast.edit</EM> program.  If edits have been made,
-the new raster map layer will be created.  Support files are constructed.
-Category labels and color maps (if any) are copied from the original layer.
-<EM>d.rast.edit</EM> redisplays the original raster map file on the monitor
-as it exits.
-</DL>
-
-<H2>NOTES</H2>
-
-<EM>d.rast.edit</EM> will not create a new raster map layer if
-the user makes no cell edits while running the program.
-
-<P>
-Be careful not to cover the graphics monitor window with another
-frame during the editing process.  In some cases, the <EM>redraw</EM> option
-will be able to remove traces of other frames;  otherwise, the graphics monitor
-will not be refreshed until after <EM>d.rast.edit</EM> exits.  Further note,
-however, that this has only been tested on <EM>SUN</EM> workstations, using a
-modified <EM>SUNVIEW</EM> graphics monitor driver.
-
-<P>
-The primary bane of the <EM>d.rast.edit</EM> program involves large map layers
-(with lots of rows and columns) and/or slow computers,
-since the program must read and write raster map layers row by row for the full
-size of the map layer as dictated by its region size and resolution.
-(The current region settings of north, south, east, and west
-will not limit the size of the edited copy of the map layer,
-since by use of the <EM><A HREF="d.zoom.html">d.zoom</A></EM> program, these values
-may change several times during the editing session). 
-Their effects could be lessened if the program
-were to create a table of changes that it could incorporate into
-the new raster map on a forked process started when the user exits, or 
-otherwise allow the user to issue a "save" command when he has
-made all desired edits to the raster map.  Currently, for instance, if
-the user needs to use <EM> <A HREF="d.zoom.html">d.zoom</A></EM> to access a different area of the 
-map, he must wait for a read and write for each entrance
-and egress of the edit mode.
-
-<P>
-There is no "undo" command or way to exit edit mode without saving
-changes.
-
-<P>
-It would be nice to incorporate a scrollable version of <EM>
-<A HREF="d.legend.html">d.legend</A>
-</EM>
-(such that one could see a legend for files with many categories on
-a standard size sub-frame).  It would be even nicer to be able
-to select the category values from a graphical legend when editing
-cell values (thereby saving a trip to the text frame to type in the
-new value).
-
-<P>
-Perhaps method(s) for multiple  or mass cell edits would be useful.
-This could be done by providing modes in which the user may:
-1) edit a block of cells to a given value by drawing a box;
-2) be able to choose a given value which is automatically used as
-the new value on each cell chosen until a different value is desired.
-
-<P>
-There is no interrupt handling.  This could leave files in .tmp
-or (rarely) result in half-baked raster maps.  The original file
-would survive unscathed by an interrupt at most any point in execution,
-but the graphics monitor may be left in an indeterminate state
-(try <EM>
-<A HREF="d.erase.html">d.erase</A>
-</EM> or <EM>
-<A HREF="d.mon.html">d.mon</A>
- select=monitor_name</EM>
-to bring it back into shape).  Beware of exiting the program
-by means other than using <EM>exit</EM> on the <EM>Main Menu</EM>.
-
-<P>
-The program has no method to enter new values beyond the current range of
-categories, but additional programming could make it so.
-
-<H2>SEE ALSO</H2>
-
-<em><a href="d.erase.html">d.erase</a></em>,
-<em><a href="d.frame.html">d.frame</a></em>,
-<em><a href="d.mon.html">d.mon</a></em>,
-<em><a href="d.rast.html">d.rast</a></em>,
-<em><a href="d.rast.arrow.html">d.rast.arrow</a></em>,
-<em><a href="d.rast.num.html">d.rast.num</a></em>,
-<em><a href="d.zoom.html">d.zoom</a></em>,
-<em><a href="g.region.html">g.region</a></em>,
-<em><a href="r.slope.aspect.html">r.slope.aspect</a></em>
-
-<H2>AUTHOR</H2>
-
-Chris Rewerts, Agricultural Engineering, 
-Purdue University
-<p>
-<i>Last changed: $Date$</i>

+ 0 - 57
display/d.rast.edit/draw_grid.c

@@ -1,57 +0,0 @@
-/*
-   Chris Rewerts, Agricultural Engineering, Purdue University
-   April 1991
- */
-
-#include "edit.h"
-int draw_grid(void)
-{
-    double U_start;
-    double D_south, D_west;
-    double D_north, D_east;
-    double U_to_D_xconv, U_to_D_yconv;
-    double U_west, U_south;
-    double U_east, U_north;
-    double U_x, U_y;
-    int D_x, D_y;
-    double ew_res, ns_res;
-
-
-    /* draw grid */
-
-    ew_res = real_window.ew_res;
-    ns_res = real_window.ns_res;
-    U_west = D_get_u_west();
-    U_east = D_get_u_east();
-    U_south = D_get_u_south();
-    U_north = D_get_u_north();
-    U_to_D_xconv = D_get_u_to_d_xconv();
-    U_to_D_yconv = D_get_u_to_d_yconv();
-
-    D_south = D_get_d_south();
-    D_north = D_get_d_north();
-    D_east = D_get_d_east();
-    D_west = D_get_d_west();
-
-    R_standard_color(grid_color);
-
-    /* Draw vertical grids */
-    U_start = U_east;
-    for (U_x = U_start; U_x >= U_west; U_x -= ew_res) {
-	D_x = (int)((U_x - U_west) * U_to_D_xconv + D_west);
-	R_move_abs(D_x, (int)D_south);
-	R_cont_abs(D_x, (int)D_north);
-    }
-
-    /* Draw horizontal grids */
-    U_start = U_north;
-    for (U_y = U_start; U_y >= U_south; U_y -= ns_res) {
-	D_y = (int)((U_south - U_y) * U_to_D_yconv + D_south);
-	R_move_abs((int)D_west, D_y);
-	R_cont_abs((int)D_east, D_y);
-    }
-
-    R_stabilize();
-
-    return 0;
-}

+ 0 - 383
display/d.rast.edit/edit.c

@@ -1,383 +0,0 @@
-/*
- * Chris Rewerts, Agricultural Engineering, Purdue University April 1991
- * 
- * The material here based originally on Dwhat. Idea is to allow user to mouse
- * on a cell layer on the graphics window, and we figure out which location
- * (row and col) in the raster map corresponds to the location clicked on the
- * screen. We find "real" row and col based on the cellhd window, to allow
- * for the displayed cell map to be in any given "current" window.
- * 
- * December 1993 Chris Rewerts, CERL, Made changes in the method to check the
- * current region against that of the original map's header.
- * 
- */
-
-#include <string.h>
-#include <ctype.h>
-#include "edit.h"
-#define MAX(A, B) ((A) > (B) ? (A) : (B))
-#define MIN(A, B) ((A) < (B) ? (A) : (B))
-
-int edit(void)
-{
-    char string[10], val_str[100], val_str1[100], val_str2[100];
-    char line[128];
-    int num_ok;
-    int t, b, l, r;
-    int select_count = 0;
-    int i;
-    int row = 0, col = 0, real_row = 0, real_col = 0;
-    DCELL *buf, c, num;
-    struct Cell_head edit_window;
-    int screen_x, screen_y;
-    double east, north;
-    int button;
-    int fd;
-    int red, green, blue;
-    int D_y, D_x;
-    double D_ew, D_ns;
-    double D_north, D_south, D_east, D_west;
-
-    double x1, y1, x2, y2;
-    double edit_win_ewdist, edit_win_nsdist;
-    double real_win_ewdist, real_win_nsdist;
-    double pct_ewdiff, pct_nsdiff;
-
-    sprintf(val_str1, "%.10f", min_value);
-    sprintf(val_str2, "%.10f", max_value);
-    G_trim_decimal(val_str1);
-    G_trim_decimal(val_str2);
-    fd = G_open_cell_old(current_name, current_mapset);
-    if (fd < 0) {
-	sprintf(line, "unable to open [%s] in [%s]\n",
-		current_name, current_mapset);
-	error(1, line);
-    }
-    G__get_window(&edit_window, "", "WIND", user_mapset);
-
-    /*
-     * set the window to the user's current region, and do test to check
-     * the ns & ew distance of resolution in meters we use G_distance to
-     * give us the meters from points plus the resolution (for ew and
-     * ns).
-     */
-
-    G_set_window(&edit_window);
-
-    x1 = edit_window.west;
-    x2 = edit_window.west + edit_window.ew_res;
-    y1 = edit_window.south;
-    y2 = edit_window.south + edit_window.ns_res;
-    edit_win_ewdist = G_distance(x1, y1, x2, y1);
-    edit_win_nsdist = G_distance(x1, y1, x1, y2);
-
-    /*
-     * now set the window to the map's header, and do test to check the
-     * distance of resolution in meters
-     */
-
-    G_set_window(&real_window);
-
-    x1 = real_window.west;
-    x2 = real_window.west + real_window.ew_res;
-    y1 = real_window.south;
-    y2 = real_window.south + real_window.ns_res;
-    real_win_ewdist = G_distance(x1, y1, x2, y1);
-    real_win_nsdist = G_distance(x1, y1, x1, y2);
-
-    /*
-     * now see if the difference is significant enough to munge what we
-     * have to do in the point/click/edit process. for both ns and ew, we
-     * calc the percent difference between the real (cellhd) window and
-     * the current (edit) window meters of distance we found. our
-     * arbitrary cutoff is 1 percent
-     */
-
-    pct_ewdiff = ((MAX(real_win_ewdist, edit_win_ewdist) /
-		   MIN(real_win_ewdist, edit_win_ewdist)) * 100) - 100;
-    pct_nsdiff = ((MAX(real_win_nsdist, edit_win_nsdist) /
-		   MIN(real_win_nsdist, edit_win_nsdist)) * 100) - 100;
-
-    /*
-       fprintf (stdout,"\new: %.20f%%\n", pct_ewdiff);
-       fprintf (stdout,"\nns: %.20f%%\n", pct_nsdiff);
-     */
-
-    /* set window back to the edit window */
-
-    G_set_window(&edit_window);
-
-    /*
-     * check to make sure that the current resolution matches the
-     * resolution according to that we read from the cell header by
-     * comparing the percentage difference we just calculated
-     */
-
-    if ((pct_ewdiff > 1.0) || (pct_nsdiff > 1.0)) {
-	error(1,
-	      "current window resolution does not match cell layer's resolution");
-    }
-    if (D_check_map_window(&edit_window))
-	error(1, "unable to set graphics window");
-    /* Determine conversion factors */
-    if (D_get_screen_window(&t, &b, &l, &r))
-	error(1, "Getting graphics window coordinates");
-    if (D_do_conversions(&edit_window, t, b, l, r))
-	error(1, "Error in calculating conversions");
-
-    if (G_read_cats(current_name, current_mapset, &cats) < 0) {
-	fprintf(stderr, "could not read cats for [%s]\n", current_name);
-    }
-    draw_grid();
-
-    buf = G_allocate_d_raster_buf();
-    screen_x = ((int)D_get_d_west() + (int)D_get_d_east()) / 2;
-    screen_y = ((int)D_get_d_north() + (int)D_get_d_south()) / 2;
-
-    /*
-     * info needed to draw over an edited cell with the color of the new
-     * cat
-     */
-
-    D_east = D_get_d_east();
-    D_west = D_get_d_west();
-    D_north = D_get_d_north();
-    D_south = D_get_d_south();
-
-    /* how many screen distance units for each cell */
-
-    D_ew = (D_east - D_west) / edit_window.cols;
-    D_ns = (D_south - D_north) / edit_window.rows;
-
-    /*
-     * edit mode - taking commands from mouse key presses at locations on
-     * the graphic monitor
-     */
-
-    edit_mouse_info();
-
-    c = num = 0.;
-    while (1) {
-	/* find our the screen x,y location of mouse click */
-	R_get_location_with_pointer(&screen_x, &screen_y, &button);
-	if (select_count > 12) {
-	    edit_mouse_info();
-	    select_count = 2;
-	}
-	/* right key means quit edit mode */
-	if (button == 3) {
-	    G_close_cell(fd);
-	    break;
-	}
-	/* if left or middle key, find out what's there */
-	if (button == 1 || button == 2) {
-	    /* convert display coords to UTM coords */
-	    east = D_d_to_u_col((double)screen_x);
-	    north = D_d_to_u_row((double)screen_y);
-	    /* find out what row and col for current window */
-	    row = (edit_window.north - north) / edit_window.ns_res;
-	    col = (east - edit_window.west) / edit_window.ew_res;
-
-	    /*
-	     * find out what row and col this is in the cell
-	     * layer as a whole
-	     */
-	    real_row = (real_window.north - north) / real_window.ns_res;
-	    real_col = (east - real_window.west) / real_window.ew_res;
-
-
-	    /*
-	     * check to see if we are in the current window on
-	     * the screen i.e. there is a cell actually displayed
-	     * where they clicked
-	     */
-	    if (east < edit_window.west || east > edit_window.east
-		|| north < edit_window.south || north > edit_window.north) {
-		error(0, "Selection off current screen window.\n");
-		continue;
-	    }
-	    /*
-	     * check to see if we are within the area of the
-	     * window described by the cell header (the "real
-	     * window")
-	     */
-
-	    if (east < real_window.west || east > real_window.east
-		|| north < real_window.south || north > real_window.north) {
-		error(0, "Selection off map's window.\n");
-		continue;
-	    }
-	    /* find out what value is currently in that cell */
-	    if (G_get_d_raster_row(fd, buf, row) < 0)
-		error(1, "could not get values for selected map row");
-
-	    if (G_is_d_null_value(&buf[col]))
-		sprintf(val_str, "%s", "Null");
-	    else {
-		sprintf(val_str, "%.10f", buf[col]);
-		G_trim_decimal(val_str);
-	    }
-	    fprintf(stdout, "\nCurrent value for the selected cell: %s\n",
-		    val_str);
-	    fprintf(stdout, "%s\n", G_get_d_raster_cat(&buf[col], &cats));
-	}
-	/* middle button means we want to edit that cell */
-	if (button == 2) {
-	    int tmpx, tmpy;
-
-	    edit_mouse_info2(c, buf[col]);
-	    R_get_location_with_pointer(&tmpx, &tmpy, &button);
-
-	    if (button == 3)
-		while (1) {
-		    /*
-		     * get new value from user, make sure
-		     * it is a number within the range of
-		     * the current cats
-		     */
-		    fprintf(stdout,
-			    "\n\n   Enter new cell value (N for null) -> ");
-
-		    G_gets(string);
-
-		    /* error check the user's input */
-
-		    num_ok = 1;
-		    if (strcmp(string, "N") == 0)
-			G_set_d_null_value(&num, 1);
-		    else {
-			if ((!isdigit(string[0])) && (string[0] != '-') &&
-			    !(map_type != CELL_TYPE && string[0] == '.'))
-			    num_ok = 0;
-			for (i = 1; i < strlen(string); i++) {
-			    if (!isdigit(string[i]) &&
-				!(map_type != CELL_TYPE && string[i] == '.'))
-				num_ok = 0;
-			}
-			if (!num_ok) {
-			    sprintf(line,
-				    "enter %s value between %s and %s\n",
-				    (map_type ==
-				     CELL_TYPE) ? "an integer" : "a",
-				    val_str1, val_str2);
-
-			    error(0, line);
-			    continue;
-			}
-			sscanf(string, "%lf", &num);
-			if ((num < min_value) || (num > max_value)) {
-			    sprintf(line,
-				    "enter %s value between %s and %s\n",
-				    (map_type ==
-				     CELL_TYPE) ? "an integer" : "a",
-				    val_str1, val_str2);
-			    error(0, line);
-			    continue;
-			}
-		    }
-		    break;
-		}
-	    if (button == 2 || button == 3) {
-
-		select_count = 2;
-		c = num;
-		do_edit(real_row, real_col, c);
-		change_made = 1;
-
-		/*
-		 * type mismatch calls to the color routine,
-		 * may not work on all compilers
-		 */
-
-		G_get_d_raster_color(&c, &red, &green, &blue, &colr);
-		R_RGB_color(red, green, blue);
-		D_y = (int)(0.5 + (row * D_ns + D_north));
-		D_x = (int)(0.5 + (col * D_ew + D_west));
-
-		/* draw filled box */
-		R_box_abs(D_x + 1, D_y + 1, (D_x + (int)(0.5 + D_ew)),
-			  (D_y + (int)(0.5 + D_ns)));
-
-		/* draw cleanup frame */
-		R_move_abs(D_x, D_y);
-		R_standard_color(grid_color);
-		R_cont_rel(0, (int)(0.5 + D_ns));
-		R_cont_rel((int)(0.5 + D_ew), 0);
-		R_cont_rel(0, -1 * (int)(0.5 + D_ns));
-		R_cont_rel(-1 * (int)(0.5 + D_ew), 0);
-
-		/* draw "X" */
-		R_standard_color(grid_color);
-		R_move_abs(D_x + (int)(D_ew * 0.2), D_y + (int)(D_ns * 0.2));
-		R_cont_rel((int)(D_ew * 0.6), (int)(D_ns * 0.6));
-		R_move_rel(0, (int)(D_ns * -0.6));
-		R_cont_rel((int)(D_ew * -0.6), (int)(D_ns * 0.6));
-
-		R_stabilize();
-	    }
-	    edit_mouse_info();
-	}
-    }
-
-    return 0;
-}
-
-int edit_mouse_info(void)
-{
-    G_clear_screen();
-    fprintf(stderr, "\n     +--------EDIT MODE mouse button menu--------+\n");
-    fprintf(stderr, "     |       Use mouse on graphics monitor       |\n");
-    fprintf(stderr, "     |                                           |\n");
-    fprintf(stderr, "     |left   button:     What's here?            |\n");
-    fprintf(stderr, "     |middle button:     Edit cell value         |\n");
-    fprintf(stderr, "     |right  button:     Quit edit mode          |\n");
-    fprintf(stderr, "     +-------------------------------------------+\n\n");
-
-    return 0;
-}
-
-int edit_mouse_info2(DCELL def, DCELL current)
-{
-    char cur_str[100], def_str[100];
-    DCELL tmp;
-
-    G_clear_screen();
-    tmp = current;
-    if (G_is_d_null_value(&tmp))
-	sprintf(cur_str, "Null");
-    else {
-	sprintf(cur_str, "%.10f", current);
-	G_trim_decimal(cur_str);
-    }
-    tmp = def;
-    if (G_is_d_null_value(&tmp))
-	sprintf(def_str, "Null");
-    else {
-	sprintf(def_str, "%.10f", def);
-	G_trim_decimal(def_str);
-    }
-    fprintf(stderr, "\n     +----------Select value button menu---------+\n");
-    fprintf(stderr, "     |       Use mouse on graphics monitor       |\n");
-    fprintf(stderr, "     |                                           |\n");
-    fprintf(stderr, "     |       Current value: %5s                |\n",
-	    cur_str);
-    fprintf(stderr, "     |                                           |\n");
-    fprintf(stderr, "     |left   button:     Cancel                  |\n");
-    fprintf(stderr, "     |middle button:     Use value %5s?        |\n",
-	    def_str);
-    fprintf(stderr, "     |right  button:     Select new value        |\n");
-    fprintf(stderr, "     +-------------------------------------------+\n\n");
-
-    return 0;
-}
-
-int use_mouse(void)
-{
-    G_clear_screen();
-    fprintf(stderr, "\n     +-------------------------------------------+\n");
-    fprintf(stderr, "     |       Use mouse on graphics monitor       |\n");
-    fprintf(stderr, "     |       to make selection on the menu       |\n");
-    fprintf(stderr, "     +-------------------------------------------+\n\n");
-
-    return 0;
-}

+ 0 - 92
display/d.rast.edit/edit.h

@@ -1,92 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include <grass/config.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-
-#ifndef GLOBAL
-#define GLOBAL extern
-#endif
-GLOBAL char new_name[GNAME_MAX], current_name[GNAME_MAX],
-    orig_name[GNAME_MAX];
-GLOBAL char grid_color_name[40];
-GLOBAL DCELL max_value, min_value;
-GLOBAL int cellsize;
-GLOBAL char user_mapset[GMAPSET_MAX], current_mapset[GMAPSET_MAX],
-    orig_mapset[GMAPSET_MAX];
-GLOBAL struct Cell_head real_window;
-GLOBAL char *tempfile;
-GLOBAL struct Categories cats;
-GLOBAL struct Colors colr;
-GLOBAL struct Quant quant;
-GLOBAL int grid_color;
-GLOBAL int real_nrows, real_ncols;
-GLOBAL int colr_ok, cats_ok, quant_ok;
-GLOBAL int change_made;
-GLOBAL RASTER_MAP_TYPE map_type;
-
-
-/* keeping names straight:
-
-   new_name    - new name user has input for the cell
-   layer to be created in their mapset
-   user_mapset - mapset where "new_name" will be created.
-   a.k.a. output of G_mapset command
-   orig_name   - name of the original file (being edited)
-   a.k.a. the layer displayed on the monitor
-   when the program starts
-   orig_mapset - the mapset where the "orig_name" layer
-   and it's support files are found.
-   current_name- when editing is taking place, a map is
-   displayed on the screen. The first time
-   the user is in "edit mode", current_name
-   will be same as orig_name. If edit mode
-   is exited and then entered again (while 
-   still in Dedit), we will have written the
-   changes made from the first edit to 
-   "new_name" and since we want what is on
-   the screen to match the current state of
-   edits, we set current_name to the new_name
-   and Dcell new_name.
-   current_mapset - mapset that jives with where the current_name
-   is hanging out.
- */
-
-/* cell.c */
-int Dcell(char *, char *, int);
-
-/* draw_grid.c */
-int draw_grid(void);
-
-/* edit.c */
-int edit(void);
-int edit_mouse_info(void);
-int edit_mouse_info2(DCELL, DCELL);
-int use_mouse(void);
-
-/* main.c */
-int do_edit(int, int, double);
-int error(int, char[128]);
-
-#ifdef __GNUC_MINOR__
-int ext(void) __attribute__ ((__noreturn__));
-#else
-int ext(void);
-#endif
-/* menu.c */
-int main_menu(void);
-int option_menu(void);
-int color_menu(char *);
-int map_type_menu(void);
-int arrow_options(void);
-int get_arrow_inputs(void);
-int arrow_map(void);
-
-/* mk_new_layer.c */
-int make_new_cell_layer(void);
-
-/* mk_tmp_file.c */
-int make_temporary_file(void);

+ 0 - 220
display/d.rast.edit/main.c

@@ -1,220 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       d.rast.edit
- * AUTHOR(S):    Chris Rewerts, Agricultural Engineering, Purdue University 
- *                    (original contributor)
- *               Roberto Flor <flor itc.it>, 
- *               Markus Neteler <neteler itc.it>, 
- *               Bernhard Reiter <bernhard intevation.de>, 
- *               Huidae Cho <grass4u gmail.com>, 
- *               Eric G. Miller <egm2 jps.net>, 
- *               Hamish Bowman <hamish_nospam yahoo.com>
- * PURPOSE:      interactive editing of cell values
- * COPYRIGHT:    (C) 1999-2007 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.
- *
- *****************************************************************************/
-/*
- * Pre-CVS edit comments:
- * April 1991 Update:
- * March 1992 (add vector overlay, misc touchups) Update: May 1992   (removed
- * parser routine to ask about grid color, since that can be changed easily
- * enough with the menu. added a lookup of cell value ranges, and ability to
- * edit negative cell values. also more misc touchups)
- * 
- * d.rast.edit is a graphically interactive cell editor which allows the user
- * to display a cell layer on the graphics monitor and use the mouse cursor
- * to indicate which cell values to edit by pointing to cells displayed.
- * 
- * d.rast.edit determines the name and mapset of the cell layer displayed on the
- * monitor, then makes a copy of the layer's values in a temporary file.
- * Note: current window settings and masks are ignored when making the copy,
- * so that the view on the screen can be various "zoom" views to allow the
- * user to find individual cells. After editing, a new cell layer is created.
- * 
- */
-#include <stdlib.h>
-#include <string.h>
-#define GLOBAL
-#include <grass/glocale.h>
-#include "edit.h"
-
-
-int main(int argc, char **argv)
-{
-    struct GModule *module;
-    struct Option *outmap;
-    char temp[128], line[128];
-    char *m;
-    struct FPRange fp_range;
-
-    /* Initialize the GIS calls */
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("display, raster");
-    module->description =
-	_("Interactively edit cell values in a raster map.");
-
-    outmap = G_define_standard_option(G_OPT_R_OUTPUT);
-
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-    /*
-     * note: grid color used to be an option set with the help of the
-     * parser, but it was more bother than worth. if black is not what
-     * the user wants, they can reset it with the menu
-     */
-
-    strcpy(grid_color_name, DEFAULT_FG_COLOR);
-    grid_color = D_translate_color(grid_color_name);
-
-    if (R_open_driver() != 0)
-	G_fatal_error("No graphics device selected");
-    /*
-     * if the monitor is divided into more than one window, find which is
-     * the choosen, current one being used
-     */
-
-    if (D_get_cur_wind(temp))
-	error(1, "No current graphics window");
-
-    if (D_set_cur_wind(temp))
-	error(1, "Current graphics window not available");
-
-    /*
-     * now that we have established what monitor window we are to work
-     * with, find out the name of the cell layer currently displayed
-     * there
-     */
-
-    D_get_cell_name(temp);
-    if (*temp == 0 || strcmp(temp, "full_screen") == 0)
-	error(1, "no map displayed in monitor.");
-
-    m = G_find_cell2(temp, "");
-    if (m == NULL) {
-	sprintf(line, " %s - raster map not found\n", temp);
-	error(1, line);
-    }
-    sscanf(m, "%s", orig_mapset);
-    sscanf(temp, "%s", orig_name);
-
-    fprintf(stderr, "\n\nName of original raster layer: [%s] in [%s]\n",
-	    orig_name, orig_mapset);
-
-    G_read_fp_range(orig_name, orig_mapset, &fp_range);
-    G_get_fp_range_min_max(&fp_range, &min_value, &max_value);
-
-    /* get the name for the new raster map to be created (the one we will edit) */
-    strncpy(new_name, outmap->answer, 39);
-    new_name[39] = '\0';
-
-    /* get names straight  */
-    sscanf(m, "%s", user_mapset);
-    strcpy(current_name, orig_name);
-    strcpy(current_mapset, orig_mapset);
-
-    /*
-     * we are not in the business of resampling the old file to a new
-     * raster map with a different window setting, so when we make a copy
-     * of the raster map to be edited, we will ignor the current window
-     * and find out what the cell_head window is (and call that
-     * "real_window")(the current_window could be anything, since the
-     * user will probably have to use zoom to get a detailed view of what
-     * they are editing).
-     */
-
-    G_get_cellhd(orig_name, orig_mapset, &real_window);
-
-    real_nrows = real_window.rows;
-    real_ncols = real_window.cols;
-
-    main_menu();
-
-    ext();
-}
-
-/*---------------------------------------------------------------*/
-int do_edit(
-	       /*
-	        * called by the edit() routine. given a row and col location a value for the
-	        * cell at that location, find that location in the temporary file and write
-	        * in the new value
-	        */
-	       int c_row, int c_col, double new_value)
-{
-
-    int fd;
-    long offset;
-    DCELL c;
-
-    fd = open(tempfile, 2);
-    if (c_row > real_nrows - 1)
-	error(0, "bad row number\n");
-    if (c_col > real_ncols - 1)
-	error(0, "bad col number\n");
-
-    /* how many bytes into the temporary file will this value be? */
-    offset = ((c_row * real_ncols) + c_col) * cellsize;
-
-    lseek(fd, offset, 0);
-    read(fd, &c, cellsize);
-
-    lseek(fd, offset, 0);
-    G_set_raster_value_d((void *)&c, new_value, map_type);
-    if (write(fd, &c, cellsize) != cellsize)
-	error(0, "was not able to write new value");
-
-    close(fd);
-
-    return 0;
-}
-
-/*------------------------------------------------------------------*/
-int error(
-	     /*
-	      * some sort of function to deal with errors. code 0: print warning and
-	      * continue code 1: print error message, close things down, and die
-	      */
-	     int code, char message[128]
-    )
-{
-
-    /* int cellfd; */
-
-    if (code == 0)
-	fprintf(stderr, "\n\7WARNING: %s\n", message);
-    else if (code == 1)
-	fprintf(stderr, "\n\7ERROR: %s\n", message);
-    if (code == 1) {
-	/* G_unopen_cell(cellfd); */
-	unlink(tempfile);
-	R_close_driver();
-	fprintf(stderr,
-		"\n     +-------------------------------------------+\n");
-	fprintf(stderr,
-		"     |                d.rast.edit aborts         |\n");
-	fprintf(stderr,
-		"     +-------------------------------------------+\n\n");
-	exit(-1);
-    }
-
-    return 0;
-}
-
-/*-------------------------------------------------------------*/
-
-int ext(void)
-{
-    R_close_driver();
-    fprintf(stderr, "\n     +-------------------------------------------+\n");
-    fprintf(stderr, "     |                 d.rast.edit exits         |\n");
-    fprintf(stderr, "     +-------------------------------------------+\n\n");
-    exit(0);
-}

+ 0 - 434
display/d.rast.edit/menu.c

@@ -1,434 +0,0 @@
-/*
-   menus.c - popup menus
-
-   Chris Rewerts, Agricultural Engineering, Purdue University
-   May 1991
-
-   -- alex 02/2004 - added input to zoom command to avoid other options 
-
- */
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include "edit.h"
-
-char new_color[28];
-char arrow_layer[128];
-char tmpbuf[128];
-
-int main_menu(void)
-{
-    static char *options[] = {
-	" MAIN MENU",
-	"  edit",
-	"  redraw",
-	"  zoom",
-	"  zoom options",
-	"  arrow",
-	"  number",
-	"  vector",
-	"  options",
-	"  exit",
-	NULL
-    };
-    int background_color;
-    int text_color;
-    int div_color;
-    int answer;
-
-    background_color = D_translate_color("indigo");
-    text_color = D_translate_color("white");
-    div_color = D_translate_color("blue");
-    R_font("romant");
-
-    use_mouse();
-
-    for (;;) {
-	answer = D_popup(background_color,
-			 text_color, div_color, 80, 5, 3, options);
-	switch (answer) {
-	case 1:
-	    /* edit */
-	    change_made = 0;
-	    make_temporary_file();
-	    edit();
-	    if (change_made) {
-		make_new_cell_layer();
-
-		if (strcmp(current_name, orig_name) == 0) {
-		    strcpy(current_name, new_name);
-		    strcpy(current_mapset, user_mapset);
-		}
-		Dcell(current_name, current_mapset, 0);
-	    }
-	    else
-		unlink(tempfile);
-	    use_mouse();
-	    break;
-	case 2:
-	    /* redraw */
-	    R_close_driver();
-	    if (R_open_driver() != 0)
-		G_fatal_error("No graphics device selected");
-	    Dcell(current_name, current_mapset, 0);
-	    use_mouse();
-	    break;
-	case 3:
-	    /* zoom */
-	    R_close_driver();
-	    /* G_system("d.zoom"); */
-	    memset(tmpbuf, '\0', sizeof(tmpbuf));
-	    sprintf(tmpbuf, "d.zoom -f %s@%s", current_name, current_mapset);
-	    G_system(tmpbuf);
-	    if (R_open_driver() != 0)
-		G_fatal_error("No graphics device selected");
-	    use_mouse();
-	    break;
-	case 4:
-	    /* zoom options */
-	    R_close_driver();
-	    G_system("d.zoom");
-	    if (R_open_driver() != 0)
-		G_fatal_error("No graphics device selected");
-	    use_mouse();
-	    break;
-	case 5:
-	    /* arrow */
-	    get_arrow_inputs();
-	    use_mouse();
-	    break;
-
-	case 6:
-	    /* number */
-	    R_close_driver();
-	    G_system("d.rast.num g=black");
-	    if (R_open_driver() != 0)
-		G_fatal_error("No graphics device selected");
-	    use_mouse();
-	    break;
-
-	case 7:
-	    /* vector overlay */
-	    R_close_driver();
-	    G_system("d.vect");
-	    if (R_open_driver() != 0)
-		G_fatal_error("No graphics device selected");
-	    use_mouse();
-	    break;
-
-	case 8:
-	    /* options */
-	    option_menu();
-	    use_mouse();
-	    break;
-
-	case 9:
-	    /* exit */
-	    Dcell(orig_name, orig_mapset, 0);
-	    return (0);
-	default:
-	    break;
-	}
-    }
-}
-
-/*---------------------------------------------------------------*/
-int option_menu(void)
-{
-    static char *options[] = {
-	" OPTIONS",
-	"  grid color",
-	"  exit",
-	NULL
-    };
-    int background_color;
-    int text_color;
-    int div_color;
-    int answer;
-
-    background_color = D_translate_color("indigo");
-    text_color = D_translate_color("white");
-    div_color = D_translate_color("blue");
-    R_font("romant");
-
-    for (;;) {
-	answer = D_popup(background_color,
-			 text_color, div_color, 80, 15, 3, options);
-	switch (answer) {
-	case 1:
-	    /* grid color */
-	    color_menu("SELECT GRID COLOR");
-	    grid_color = D_translate_color(new_color);
-	    break;
-	case 2:
-	    /* exit */
-
-	    return (0);
-	default:
-	    break;
-	}
-	return (0);
-    }
-}
-
-/*---------------------------------------------------------------*/
-int color_menu(char *title)
-{
-
-    /* we vary the usage of the menu a bit to allow for a changeable
-       title. We initialize with spaces then copy in the title later
-     */
-    static char *options[] = {
-	"                    ",
-	"      red",
-	"      orange",
-	"      yellow",
-	"      green",
-	"      blue",
-	"      indigo",
-	"      violet",
-	"      gray",
-	"      white",
-	"      black",
-	NULL
-    };
-    int background_color;
-    int text_color;
-    int div_color;
-    int answer;
-
-    /*
-       if(strlen(title) > 20)
-       error(1, "color_menu: title too long");
-     */
-    options[0] = (char *)G_malloc(sizeof(char) * strlen(title) + 1);
-
-    strcpy(options[0], title);
-
-    background_color = D_translate_color("indigo");
-    text_color = D_translate_color("white");
-    div_color = D_translate_color("blue");
-    R_font("romant");
-
-    for (;;) {
-	answer = D_popup(background_color,
-			 text_color, div_color, 80, 25, 3, options);
-	switch (answer) {
-	case 1:
-	    strcpy(new_color, "red");
-	    break;
-	case 2:
-	    strcpy(new_color, "orange");
-	    break;
-	case 3:
-	    strcpy(new_color, "yellow");
-	    break;
-	case 4:
-	    strcpy(new_color, "green");
-	    break;
-	case 5:
-	    strcpy(new_color, "blue");
-	    break;
-	case 6:
-	    strcpy(new_color, "indigo");
-	    break;
-	case 7:
-	    strcpy(new_color, "violet");
-	    break;
-	case 8:
-	    strcpy(new_color, "gray");
-	    break;
-	case 9:
-	    strcpy(new_color, "white");
-	    break;
-	case 10:
-	    strcpy(new_color, "black");
-	    break;
-	default:
-	    break;
-	}
-	return (0);
-    }
-}
-
-/*---------------------------------------------------------------*/
-int map_type_menu(void)
-{
-    static char *options[] = {
-	" ASPECT MAP TYPE",
-	"  grass",
-	"  agnps",
-	"  answers",
-	"  exit",
-	NULL
-    };
-    int background_color;
-    int text_color;
-    int div_color;
-    int answer;
-
-    background_color = D_translate_color("indigo");
-    text_color = D_translate_color("white");
-    div_color = D_translate_color("blue");
-    R_font("romant");
-
-    for (;;) {
-	answer = D_popup(background_color,
-			 text_color, div_color, 80, 15, 3, options);
-	switch (answer) {
-	case 1:
-	    strcpy(new_color, "grass");
-	    return (1);
-	case 2:
-	    strcpy(new_color, "agnps");
-	    return (2);
-	case 3:
-	    strcpy(new_color, "answers");
-	    return (3);
-	case 4:
-	    return (-1);
-	default:
-	    return (-1);
-	}
-    }
-}
-
-/*---------------------------------------------------------------*/
-int arrow_options(void)
-{
-    static char *options[] = {
-	"SET PROGRAM OPTIONS?",
-	"  NO:  use default options",
-	"  YES: set options now",
-	NULL
-    };
-    int background_color;
-    int text_color;
-    int div_color;
-    int answer;
-
-    background_color = D_translate_color("indigo");
-    text_color = D_translate_color("white");
-    div_color = D_translate_color("blue");
-    R_font("romant");
-
-    for (;;) {
-	answer = D_popup(background_color,
-			 text_color, div_color, 80, 15, 3, options);
-	switch (answer) {
-	case 1:
-	    return (0);
-	case 2:
-	    return (1);
-	default:
-	    return (0);;
-	}
-    }
-}
-
-/*---------------------------------------------------------------*/
-
-int get_arrow_inputs(void)
-{
-
-    char line[198];
-    char map_type[28], arrow_color[28], x_color[28], unknown_color[28];
-    int m_type;
-
-    m_type = map_type_menu();
-    if (m_type < 1)
-	return (0);
-    strcpy(map_type, new_color);
-    if (arrow_options()) {
-	arrow_map();
-	strcpy(map_type, new_color);
-	color_menu("COLOR FOR ARROWS");
-	strcpy(arrow_color, new_color);
-	color_menu("COLOR FOR X's");
-	strcpy(x_color, new_color);
-	color_menu("COLOR FOR ?'s");
-	strcpy(unknown_color, new_color);
-    }
-    else
-	/* set defaults */
-    {
-	strcpy(arrow_layer, "-");
-	switch (m_type) {
-	case 1:
-	    strcpy(arrow_color, "green");
-	    strcpy(x_color, "white");
-	    strcpy(unknown_color, "red");
-	    break;
-	case 2:
-	    strcpy(arrow_color, "black");
-	    strcpy(x_color, "white");
-	    strcpy(unknown_color, "red");
-	    break;
-	case 3:
-	    strcpy(arrow_color, "green");
-	    strcpy(x_color, "black");
-	    strcpy(unknown_color, "white");
-	    break;
-	default:
-	    strcpy(arrow_color, "green");
-	    strcpy(x_color, "white");
-	    strcpy(unknown_color, "red");
-	    break;
-	}
-    }
-    sprintf(line, "d.rast.arrow type=%s arrow=%s x=%s unk=%s",
-	    map_type, arrow_color, x_color, unknown_color);
-    fprintf(stdout, line);
-    R_close_driver();
-    G_system(line);
-    if (R_open_driver() != 0)
-	G_fatal_error("No graphics device selected");
-
-    return 0;
-}
-
-/*---------------------------------------------------------------*/
-int arrow_map(void)
-{
-    static char *options[] = {
-	"USE DISPLAYED MAP AS INPUT?",
-	"  NO:  enter other name now",
-	"  YES: use displayed map",
-	NULL
-    };
-    int background_color;
-    int text_color;
-    int div_color;
-    int answer;
-    char *mapset;
-
-    background_color = D_translate_color("indigo");
-    text_color = D_translate_color("white");
-    div_color = D_translate_color("blue");
-    R_font("romant");
-
-    for (;;) {
-	answer = D_popup(background_color,
-			 text_color, div_color, 80, 15, 3, options);
-	switch (answer) {
-	case 1:
-	    fprintf(stderr,
-		    "\n     +-------------------------------------------+\n");
-	    fprintf(stderr,
-		    "     |            Text input needed              |\n");
-	    fprintf(stderr,
-		    "     +-------------------------------------------+\n\n");
-	    if ((mapset =
-		 G_ask_cell_old("Enter name of aspect map to use for arrows",
-				arrow_layer)) == NULL) {
-		error(0, "cell layer not found");
-	    }
-	    return (0);
-	case 2:
-	    strcpy(arrow_layer, "-");
-	    return (0);
-	default:
-	    return (0);;
-	}
-    }
-}

+ 0 - 90
display/d.rast.edit/mk_new_layer.c

@@ -1,90 +0,0 @@
-/*
-
-   Chris Rewerts, Agricultural Engineering, Purdue University
-   April 1991
-
-   This function copies the edited data from the temporary
-   file to the new cell layer. Also installs colr, cats,
-   and hist support files.
-
- */
-
-#include "edit.h"
-
-int make_new_cell_layer(void)
-{
-    struct History hist;
-    void *rast;
-    int cellfd;
-
-    int tmpfd;
-    int row;
-
-    /* open the new raster map to contain the edited version of
-       the original cell layer. open our temporary file for read
-       and copy its contents to the layer */
-
-    G_set_window(&real_window);
-
-    cellfd = G_open_raster_new(new_name, map_type);
-    tmpfd = open(tempfile, 0);
-    lseek(tmpfd, 0L, 0);
-
-    rast = G_allocate_raster_buf(map_type);
-
-    fprintf(stderr, "\n     +-------------------------------------------+\n");
-    fprintf(stderr, "     |         Saving new cell layer             |\n");
-    fprintf(stderr, "     +---------------------------------------");
-
-
-    for (row = 0; row < real_nrows; row++) {
-	if (read(tmpfd, rast, real_ncols * cellsize) !=
-	    (real_ncols * cellsize))
-	    error(1, "error writing raster map during copy");
-	G_put_raster_row(cellfd, rast, map_type);
-	G_percent(row, real_nrows, 5);
-    }
-    G_percent(100, 100, 5);
-    fprintf(stderr, "\n");
-
-    close(tmpfd);
-    G_close_cell(cellfd);
-    unlink(tempfile);
-
-    /* create and write cat, colr, quant, and hist support files
-       for the newly created layer */
-
-    if (colr_ok) {
-	G_write_colors(new_name, user_mapset, &colr);
-	G_free_colors(&colr);
-	colr_ok = 0;
-    }
-    if (cats_ok) {
-	cats.num = G_number_of_cats(new_name, user_mapset);
-	G_write_cats(new_name, &cats);
-	G_free_cats(&cats);
-	cats_ok = 0;
-    }
-    if (quant_ok) {
-	G_write_quant(new_name, G_mapset(), &quant);
-	G_quant_free(&quant);
-	cats_ok = 0;
-    }
-
-    /* construct some history information */
-    sprintf(hist.mapid, "%s", G_date());
-    sprintf(hist.title, "%s", new_name);
-    sprintf(hist.mapset, "%s", user_mapset);
-    sprintf(hist.creator, "%s", G_whoami());
-    sprintf(hist.maptype, "cell");
-    sprintf(hist.edhist[0],
-	    "Generated by d.rast.edit from original raster map");
-    sprintf(hist.edhist[1], "  %s in mapset %s ", orig_name, orig_mapset);
-    hist.edlinecnt = 2;
-
-    /* write history */
-    if (G_write_history(new_name, &hist) == -1)
-	error(0, "could not write history");
-
-    return 0;
-}

+ 0 - 76
display/d.rast.edit/mk_tmp_file.c

@@ -1,76 +0,0 @@
-/*
-
-   Chris Rewerts, Agricultural Engineering, Purdue University
-   April 1991
-
-   First step to edit is to create a file with the 
-   cell layer's data that we can read and write to
-   randomly. We also get the original cell layer's 
-   other pertinent data (colr, cats) into memory
-   since we'd lose it otherwise
-
- */
-
-#include "edit.h"
-
-int make_temporary_file(void)
-{
-
-    void *rast;
-    int cellfd;
-    int tmpfd;
-    int row;
-    char line[200];
-
-    G_set_window(&real_window);
-
-    /* read cat and colr support files (if any) info into memory */
-
-    G_suppress_warnings(1);
-    colr_ok = G_read_colors(current_name, current_mapset, &colr) > 0;
-    cats_ok = G_read_cats(current_name, current_mapset, &cats) >= 0;
-    if ((map_type =
-	 G_raster_map_type(current_name, current_mapset)) != CELL_TYPE)
-	quant_ok = G_read_quant(current_name, current_mapset, &quant);
-    else
-	quant_ok = 0;
-    G_suppress_warnings(0);
-
-    rast = G_allocate_raster_buf(map_type);
-
-    /* open the original file */
-    cellfd = G_open_cell_old(current_name, current_mapset);
-    if (cellfd < 0) {
-	sprintf(line, "unable to open [%s] in [%s]\n", current_name,
-		current_mapset);
-	error(1, line);
-    }
-    /* generate a temporary file name and create it */
-    tempfile = G_tempfile();
-    tmpfd = creat(tempfile, 0666);
-    /* how many bytes per cell value */
-    cellsize = G_raster_size(map_type);
-
-    /* locate read/write pointer at beginning of temporary file */
-
-    lseek(tmpfd, 0L, 0);
-
-    fprintf(stderr, "\n     +-------------------------------------------+\n");
-    fprintf(stderr, "     |         Creating temporary edit file      |\n");
-    fprintf(stderr, "     +---------------------------------------");
-
-    for (row = 0; row < real_nrows; row++) {
-	G_get_raster_row_nomask(cellfd, rast, row, map_type);
-	if (write(tmpfd, rast, real_ncols * cellsize) !=
-	    (real_ncols * cellsize))
-	    error(1, "error writing temporary file during copy");
-	G_percent(row, real_nrows, 5);
-    }
-    G_percent(100, 100, 5);
-    fprintf(stderr, "\n");
-    G_close_cell(cellfd);
-
-    close(tmpfd);
-
-    return 0;
-}

+ 3 - 17
display/d.rast.num/number.c

@@ -53,7 +53,6 @@ int main(int argc, char **argv)
     DCELL *cell;
     char *mapset;
     char full_name[128];
-    char window_name[64];
     double D_north, D_east;
     double D_south, D_west;
     double U_east, U_north;
@@ -87,7 +86,6 @@ int main(int argc, char **argv)
 	  "displayed to the graphics monitor.");
 
     opt1 = G_define_standard_option(G_OPT_R_MAP);
-    opt1->required = NO;
 
     opt2 = G_define_option();
     opt2->key = "grid_color";
@@ -127,12 +125,7 @@ int main(int argc, char **argv)
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    if (opt1->answer)
-	strcpy(full_name, opt1->answer);
-    else {
-	if (D_get_cell_name(full_name))
-	    G_fatal_error(_("No raster map exists in current window"));
-    }
+    strcpy(full_name, opt1->answer);
 
     if (strcmp("none", opt2->answer) == 0)
 	grid_color = -1;
@@ -158,18 +151,11 @@ int main(int argc, char **argv)
 
     /* Setup driver and check important information */
 
-    if (D_get_cur_wind(window_name))
-	G_fatal_error(_("No current window"));
-
-    if (D_set_cur_wind(window_name))
-	G_fatal_error(_("Current window not available"));
-
     /* Read in the map window associated with window */
 
     G_get_window(&window);
 
-    if (D_check_map_window(&window))
-	G_fatal_error(_("Setting map window"));
+    D_check_map_window(&window);
 
     if (G_set_window(&window) == -1)
 	G_fatal_error(_("Current window not settable"));
@@ -303,7 +289,7 @@ int main(int argc, char **argv)
     }
 
     G_close_cell(layer_fd);
-    D_add_to_list(G_recreate_command());
+
     R_close_driver();
 
     exit(EXIT_SUCCESS);

+ 1 - 9
display/d.rast/display.c

@@ -12,7 +12,7 @@ static int cell_draw(char *, char *, struct Colors *, int, int,
 int display(char *name,
 	    char *mapset,
 	    int overlay,
-	    char *bg, RASTER_MAP_TYPE data_type, int invert, int nocmd)
+	    char *bg, RASTER_MAP_TYPE data_type, int invert)
 {
     struct Colors colors;
     int r, g, b;
@@ -40,14 +40,6 @@ int display(char *name,
     /* release the colors now */
     G_free_colors(&colors);
 
-    /* record the raster map */
-    if (!nocmd) {
-	D_set_cell_name(G_fully_qualified_name(name, mapset));
-	D_add_to_cell_list(G_fully_qualified_name(name, mapset));
-
-	D_add_to_list(G_recreate_command());
-    }
-
     return 0;
 }
 

+ 1 - 1
display/d.rast/local_proto.h

@@ -3,7 +3,7 @@ char *color_list(void);
 int get_rgb(char *, int *, int *, int *);
 
 /* display.c */
-int display(char *, char *, int, char *, RASTER_MAP_TYPE, int, int);
+int display(char *, char *, int, char *, RASTER_MAP_TYPE, int);
 int mask_raster_array(void *, int, int, RASTER_MAP_TYPE);
 
 /* main.c */

+ 2 - 10
display/d.rast/main.c

@@ -42,7 +42,6 @@ int main(int argc, char **argv)
     struct Option *bg;
     struct Flag *flag_o;
     struct Flag *flag_i;
-    struct Flag *flag_x;
 
     /* Initialize the GIS calls */
     G_gisinit(argv[0]);
@@ -93,11 +92,6 @@ int main(int argc, char **argv)
     flag_i->key = 'i';
     flag_i->description = _("Invert catlist");
 
-    flag_x = G_define_flag();
-    flag_x->key = 'x';
-    flag_x->description =
-	_("Don't add to list of rasters and commands in monitor");
-
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -132,11 +126,9 @@ int main(int argc, char **argv)
     /* use DCELL even if the map is FCELL */
 
     if (fp)
-	display(name, mapset, overlay, bg->answer, DCELL_TYPE, invert,
-		flag_x->answer);
+	display(name, mapset, overlay, bg->answer, DCELL_TYPE, invert);
     else
-	display(name, mapset, overlay, bg->answer, CELL_TYPE, invert,
-		flag_x->answer);
+	display(name, mapset, overlay, bg->answer, CELL_TYPE, invert);
 
     R_close_driver();
 

+ 0 - 9
display/d.rgb/main.c

@@ -45,7 +45,6 @@ int main(int argc, char **argv)
     struct Cell_head window;
     struct GModule *module;
     struct Flag *flag_o;
-    struct Flag *flag_x;
     int t, b, l, r;
     int i;
 
@@ -61,10 +60,6 @@ int main(int argc, char **argv)
     flag_o->key = 'o';
     flag_o->description = _("Overlay (non-null values only)");
 
-    flag_x = G_define_flag();
-    flag_x->key = 'x';
-    flag_x->description = _("Don't add to list of commands in monitor");
-
     for (i = 0; i < 3; i++) {
 	char buff[80];
 
@@ -138,10 +133,6 @@ int main(int argc, char **argv)
     G_percent(window.rows, window.rows, 5);
     D_cell_draw_end();
 
-    /* Close down connection to window driver */
-    if (!flag_x->answer)
-	D_add_to_list(G_recreate_command());
-
     R_close_driver();
 
     /* Close the raster maps */

+ 21 - 31
display/d.rhumbline/main.c

@@ -31,7 +31,6 @@ int main(int argc, char *argv[])
 {
     int line_color;
     int text_color = 0;
-    int use_mouse;
     double lon1, lat1, lon2, lat2;
     struct GModule *module;
     struct
@@ -51,7 +50,7 @@ int main(int argc, char *argv[])
     parm.coor->key = "coor";
     parm.coor->key_desc = "lon1,lat1,lon2,lat2";
     parm.coor->type = TYPE_STRING;
-    parm.coor->required = NO;
+    parm.coor->required = YES;
     parm.coor->description = "Starting and ending coordinates";
 
     parm.lcolor = G_define_option();
@@ -78,29 +77,25 @@ int main(int argc, char *argv[])
 	G_fatal_error("%s: database is not a %s database",
 		      argv[0], G__projection_name(PROJECTION_LL));
 
-    use_mouse = 1;
-    if (parm.coor->answer) {
-	if (parm.coor->answers[0] == NULL)
-	    G_fatal_error("No coordinates given");
-
-	if (!G_scan_easting(parm.coor->answers[0], &lon1, G_projection())) {
-	    G_usage();
-	    G_fatal_error("%s - illegal longitude", parm.coor->answers[0]);
-	}
-	if (!G_scan_northing(parm.coor->answers[1], &lat1, G_projection())) {
-	    G_usage();
-	    G_fatal_error("%s - illegal longitude", parm.coor->answers[1]);
-
-	}
-	if (!G_scan_easting(parm.coor->answers[2], &lon2, G_projection())) {
-	    G_usage();
-	    G_fatal_error("%s - illegal longitude", parm.coor->answers[2]);
-	}
-	if (!G_scan_northing(parm.coor->answers[3], &lat2, G_projection())) {
-	    G_usage();
-	    G_fatal_error("%s - illegal longitude", parm.coor->answers[3]);
-	}
-	use_mouse = 0;
+    if (parm.coor->answers[0] == NULL)
+	G_fatal_error("No coordinates given");
+
+    if (!G_scan_easting(parm.coor->answers[0], &lon1, G_projection())) {
+	G_usage();
+	G_fatal_error("%s - illegal longitude", parm.coor->answers[0]);
+    }
+    if (!G_scan_northing(parm.coor->answers[1], &lat1, G_projection())) {
+	G_usage();
+	G_fatal_error("%s - illegal longitude", parm.coor->answers[1]);
+
+    }
+    if (!G_scan_easting(parm.coor->answers[2], &lon2, G_projection())) {
+	G_usage();
+	G_fatal_error("%s - illegal longitude", parm.coor->answers[2]);
+    }
+    if (!G_scan_northing(parm.coor->answers[3], &lat2, G_projection())) {
+	G_usage();
+	G_fatal_error("%s - illegal longitude", parm.coor->answers[3]);
     }
 
     if (R_open_driver() != 0)
@@ -125,12 +120,7 @@ int main(int argc, char *argv[])
 #endif
 
     setup_plot();
-    if (use_mouse)
-	mouse(line_color, text_color);
-    else {
-	plot(lon1, lat1, lon2, lat2, line_color, text_color);
-	D_add_to_list(G_recreate_command());
-    }
+    plot(lon1, lat1, lon2, lat2, line_color, text_color);
 
     R_close_driver();
     exit(0);

+ 0 - 53
display/d.rhumbline/mouse.c

@@ -1,53 +0,0 @@
-#include <stdio.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-#include "local_proto.h"
-
-int mouse(int line_color, int text_color)
-{
-    int x1, y1, x2, y2;
-    double lat1, lon1, lat2, lon2;
-    int top, bottom, left, right;
-    int button;
-
-    right = (int)D_get_d_east();
-    left = (int)D_get_d_west();
-    top = (int)D_get_d_north();
-    bottom = (int)D_get_d_south();
-
-    x2 = x1 = (right + left) / 2;
-    y2 = y1 = (top + bottom) / 2;
-
-    fprintf(stderr, "\n");
-    fprintf(stderr, "Left:   begin\n");
-    fprintf(stderr, "Middle: draw\n");
-    fprintf(stderr, "Right:  quit\n");
-
-    while (1) {
-	R_standard_color(line_color);
-	R_get_location_with_line(x1, y1, &x2, &y2, &button);
-#ifdef DEBUG
-	fprintf(stdout, "button=%d  x1,y1=%d,%d  x2,y2=%d,%d\n", button, x1,
-		y1, x2, y2);
-#endif
-	if (button == 3)
-	    return -1;
-	if (x2 < left || x2 > right)
-	    continue;
-	if (y2 < top || y2 > bottom)
-	    continue;
-
-	if (button == 2) {
-	    lon1 = D_d_to_u_col((double)x1);
-	    lat1 = D_d_to_u_row((double)y1);
-	    lon2 = D_d_to_u_col((double)x2);
-	    lat2 = D_d_to_u_row((double)y2);
-	    plot(lon1, lat1, lon2, lat2, line_color, text_color);
-	}
-
-	x1 = x2;
-	y1 = y2;
-    }
-
-    return 0;
-}

+ 0 - 10
display/d.save/Makefile

@@ -1,10 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = d.save
-
-LIBES     = $(DISPLAYLIB) $(RASTERLIB) $(GISLIB)
-DEPENDENCIES= $(DISPLAYDEP) $(RASTERDEP) $(GISDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 49
display/d.save/description.html

@@ -1,49 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-When GRASS display (<EM>d.</EM>) commands are used to
-generate graphical images on the graphics monitor, some
-commands are noted in lists that the current graphics
-driver (see manual entry for 
-<EM><A HREF="d.mon.html">d.mon</A></EM>) maintains. This
-command, <EM>d.save</EM>, uses this information to
-create a shell script that can be used to recreate graphics
-in another frame at another time. The shell script is sent
-to standard output (the user's terminal). If you wish to
-save the shell script created by <EM>d.save</EM>, its
-output should be redirected to a file; for example:
-<DL>
-<DD> <B>d.save &gt; script.out </B> 
-</DL>
-
-The user can run the program non-interactively by
-specifying flag settings and parameter values on the
-command line. If the user types <B>d.save</B> without
-specifying these program arguments, the user will be
-prompted for inputs through the standard user interface
-described in the manual entry for 
-<EM><A HREF="parser.html">parser</A></EM>.
-
-
-<H2>NOTES</H2>
-
-Object numbers for remove= and move= options are displayed after #.
-
-<P>
-
-Display commands used interactively, and those that take
-their graphic instructions from standard input, will not be
-saved by <EM>d.save</EM>.
-
-<H2>SEE ALSO</H2>
-
-<EM><A HREF="d.frame.html">d.frame</A></EM><br>
-<EM><A HREF="d.mon.html">d.mon</A></EM><br>
-<EM><A HREF="g.region.html">g.region</A></EM><br>
-<EM><A HREF="parser.html">parser</A></EM>
-
-<H2>AUTHOR</H2>
-
-David Satnik, 
-Central Washington University
-
-<p><i>Last changed: $Date$</i>

+ 0 - 16
display/d.save/locals.h

@@ -1,16 +0,0 @@
-/* main.c */
-struct list_struct
-{
-    char *string;
-    struct list_struct *ptr;
-};
-
-int main(int, char **);
-int in_frame_list(struct Option *, char *);
-int init_globals(void);
-int which_item(char *);
-int set_item(char *, char **);
-int process_list(char *, char **, int);
-int process_items(char **, int);
-int process_pad(char ***, int *);
-int list_alloc(int, struct list_struct *, char *);

+ 0 - 565
display/d.save/main.c

@@ -1,565 +0,0 @@
-/*
- ****************************************************************************
- *
- * MODULE:       d.save
- * AUTHOR(S):    David Satnik - Central Washington University
- * PURPOSE:      Output all commands that have been used to create the 
- *               current display graphics with the help of the internal Pad 
- *               contents. 
- * COPYRIGHT:    (C) 2000 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 <string.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-#include <grass/glocale.h>
-
-#include "locals.h"
-
-/* globals !!! */
-int Sheight, Swidth;
-char Scurwin[100];
-
-int Wtop, Wbot, Wleft, Wright;
-char Wcell[100] = "", Wdig[100], Wsite[100], Wcolor[25] = "";
-
-int Mtype;
-int proj;
-struct Cell_head *Mwind;
-char Nstr[20], Sstr[20], Estr[20], Wstr[20], EWRESstr[20], NSRESstr[20];
-
-struct list_struct *List = NULL, *List_last = NULL;
-
-int in_frame_list(struct Option *, char *);
-int init_globals(void);
-int which_item(char *);
-int set_item(char *, char **);
-int process_list(char *, char **, int);
-int process_items(char **, int);
-int process_pad(char ***, int *);
-
-int main(int argc, char **argv)
-{
-    char **pads;
-    char **items;
-    char **list;
-    int npads;
-    int nitems;
-    int p;
-    int stat;
-    int i, j;
-    int redraw;
-    int total_rno, *rno;
-    int total_mno, **mno;
-    int nlists, *live;
-    int from, to, tmp;
-    struct list_struct *temp_list;
-    struct Flag *all_flag;
-    struct Flag *cur_frame;
-    struct Flag *only_object;
-    struct Option *opt1;
-    struct Option *opt2;
-    struct Option *opt3;
-    struct GModule *module;
-    char buff[1024];
-    char current_frame[64];
-    float Ftop, Fbot, Fleft, Fright;
-
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("display");
-    module->description =
-	_("Creates a list of commands for recreating screen graphics.");
-
-
-    opt1 = G_define_option();
-    opt1->key = "frame";
-    opt1->description = _("Name of frame(s) to save");
-    opt1->type = TYPE_STRING;
-    opt1->required = NO;
-    opt1->multiple = YES;
-    /* Conditionalize so "help" and "--interface-description" work */
-    R__open_quiet();		/* don't let library code make us die */
-
-    if (R_open_driver() == 0) {
-	Sheight = R_screen_bot() - R_screen_top();
-	Swidth = R_screen_rite() - R_screen_left();
-
-	Mwind = (struct Cell_head *)G_malloc(sizeof(struct Cell_head));
-	R_pad_list(&pads, &npads);
-
-	/* process the screen pad */
-	p = -1;
-	stat = R_pad_select("");
-	if (stat) {
-	    R_pad_perror("echo     ERROR", stat);
-	    fprintf(stdout, "exit -1\n\n");
-	}
-	else
-	    process_pad(&items, &nitems);
-
-
-	opt1->answer = Scurwin;
-	buff[0] = '\0';
-	for (p = npads - 1; p >= 0; p--) {
-	    strcat(buff, pads[p]);
-	    if (p != 0)
-		strcat(buff, ",");
-	}
-	opt1->options = buff;
-    }
-    else
-	stat = -1;		/* used to exit, if driver open failed */
-
-    opt2 = G_define_option();
-    opt2->key = "remove";
-    opt2->description =
-	_("List of object numbers to remove which are displayed after \"#\". "
-	  "-1 for the last object.");
-    opt2->type = TYPE_INTEGER;
-    opt2->required = NO;
-    opt2->multiple = YES;
-
-    opt3 = G_define_option();
-    opt3->key = "move";
-    opt3->description = _("List of object numbers to move "
-			  "(\"from\" to \"to\"). remove= option will be done first, if any.");
-    opt3->type = TYPE_INTEGER;
-    opt3->required = NO;
-    opt3->key_desc = "from,to";
-    opt3->multiple = YES;
-
-    cur_frame = G_define_flag();
-    cur_frame->key = 'c';
-    cur_frame->description = _("Save current frame");
-    cur_frame->answer = 0;
-
-    all_flag = G_define_flag();
-    all_flag->key = 'a';
-    all_flag->description = _("Save all the frames");
-    all_flag->answer = 0;
-
-    only_object = G_define_flag();
-    only_object->key = 'o';
-    only_object->description =
-	_("Only map objects without extra header and tailer");
-    only_object->answer = 0;
-
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-
-    if (stat)			/* Check we have monitor */
-	G_fatal_error(_("No monitor selected"));
-
-    total_rno = 0;
-    if (opt2->answers) {
-	for (total_rno = 0; opt2->answers[total_rno]; total_rno++) ;
-	if (total_rno) {
-	    rno = (int *)G_malloc(total_rno * sizeof(int));
-	    for (i = 0; i < total_rno; i++)
-		rno[i] = atoi(opt2->answers[i]);
-	}
-    }
-
-    total_mno = 0;
-    if (opt3->answers) {
-	for (total_mno = 0; opt3->answers[total_mno]; total_mno++) ;
-	total_mno /= 2;
-	if (total_mno) {
-	    mno = (int **)G_malloc(total_mno * sizeof(int *));
-	    for (i = 0, j = 0; i < total_mno; i++, j += 2) {
-		mno[i] = (int *)G_malloc(2 * sizeof(int));
-		mno[i][0] = atoi(opt3->answers[j]);
-		mno[i][1] = atoi(opt3->answers[j + 1]);
-	    }
-	}
-    }
-
-    if (cur_frame->answer) {
-	D_get_cur_wind(current_frame);
-	opt1->answer = current_frame;
-    }
-
-    if (!only_object->answer)
-	fprintf(stdout, ":\n# Shell Script created by d.save %s\n\n",
-		G_date());
-
-    G_get_window(Mwind);
-
-    redraw = 0;
-    /* now start at the end (the earliest made window) and process them */
-    for (p = npads - 1; p >= 0; p--) {
-	if (all_flag->answer || in_frame_list(opt1, pads[p])) {
-	    init_globals();
-	    if (!cur_frame->answer && !only_object->answer)
-		fprintf(stdout,
-			"\n# Here are the commands to create window: %s\n",
-			pads[p]);
-	    stat = R_pad_select(pads[p]);
-	    if (stat) {
-		R_pad_perror("echo     ERROR", stat);
-		fprintf(stdout, "exit -1\n\n");
-		continue;
-	    }
-
-	    if (total_rno || total_mno) {
-		stat = R_pad_get_item("list", &list, &nlists);
-		if (stat || !nlists) {
-		    R_pad_perror("echo     ERROR", stat);
-		    fprintf(stdout, "exit -1\n\n");
-		    continue;
-		}
-
-		R_pad_delete_item("list");
-
-		live = (int *)G_malloc(nlists * sizeof(int));
-		for (i = 0; i < nlists; i++)
-		    live[i] = i;
-
-		if (total_rno) {
-		    for (i = 0; i < total_rno; i++) {
-			if (rno[i] < -1 || rno[i] > nlists)
-			    continue;
-
-			redraw = 1;
-
-			rno[i] = (rno[i] == -1 ?
-				  nlists : (rno[i] == 0 ? 1 : rno[i]));
-
-			live[nlists - rno[i]] = -1;
-		    }
-		    G_free(rno);
-		}
-
-		if (total_mno) {
-		    for (i = 0; i < total_mno; i++) {
-			from = (mno[i][0] == -1 ?
-				nlists : (mno[i][0] == 0 ? 1 : mno[i][0]));
-			to = (mno[i][1] == -1 ?
-			      nlists : (mno[i][1] == 0 ? 1 : mno[i][1]));
-			if (from < 1 ||
-			    from > nlists ||
-			    to < 1 ||
-			    to > nlists ||
-			    from == to || live[nlists - from] < 0) {
-			    G_free(mno[i]);
-			    continue;
-			}
-
-			redraw = 1;
-
-			tmp = live[nlists - to];
-			live[nlists - to] = live[nlists - from];
-			if (from < to) {
-			    for (j = nlists - from; j >= nlists - to + 2; j--)
-				live[j] = live[j - 1];
-			    live[nlists - to + 1] = tmp;
-			}
-			else {
-			    for (j = nlists - from; j <= nlists - to - 2; j++)
-				live[j] = live[j + 1];
-			    live[nlists - to - 1] = tmp;
-			}
-			G_free(mno[i]);
-		    }
-		    G_free(mno);
-		}
-
-		for (i = 0; i < nlists; i++) {
-		    if (live[i] >= 0)
-			D_add_to_list(list[live[i]]);
-		}
-		G_free(live);
-		R_pad_freelist(list, nlists);
-	    }
-
-	    if (process_pad(&items, &nitems) != 0)
-		continue;
-
-	    Ftop = (100.0 * Wtop) / Sheight;
-	    Fbot = (100.0 * Wbot) / Sheight;
-	    Fleft = (100.0 * Wleft) / Swidth;
-	    Fright = (100.0 * Wright) / Swidth;
-	    if (Ftop < 0)
-		Ftop = 0;
-	    if (Fbot < 0)
-		Fbot = 0;
-	    if (Fleft < 0)
-		Fleft = 0;
-	    if (Fright < 0)
-		Fright = 0;
-
-	    if (!cur_frame->answer && !only_object->answer) {
-		if (all_flag->answer && p == npads - 1)
-		    fprintf(stdout,
-			    "d.frame -ec frame=%s at=%.4f,%.4f,%.4f,%.4f\n",
-			    pads[p], 100 - Fbot, 100 - Ftop, Fleft, Fright);
-		else
-		    fprintf(stdout,
-			    "d.frame -c frame=%s at=%.4f,%.4f,%.4f,%.4f\n",
-			    pads[p], 100 - Fbot, 100 - Ftop, Fleft, Fright);
-	    }
-
-	    if (!only_object->answer) {
-		if (Wcolor[0] == '\0')
-		    fprintf(stdout, "d.erase\n");
-		else
-		    fprintf(stdout, "d.erase color=%s\n", Wcolor);
-
-		if (Mtype != -1) {
-		    fprintf(stdout,
-			    "g.region n=%s s=%s e=%s w=%s nsres=%s ewres=%s\n",
-			    Nstr, Sstr, Estr, Wstr, NSRESstr, EWRESstr);
-		}
-		fprintf(stdout, "\n");
-	    }
-
-	    /* List already has commands to draw these maps.
-	       if (Wcell[0]!='\0')
-	       fprintf (stdout,"d.rast map=%s\n", Wcell);
-
-	       if (Wdig[0]!='\0')
-	       fprintf (stdout,"d.vect map=%s\n", Wdig);
-
-	       if (Wsite[0]!='\0')
-	       fprintf (stdout,"d.sites sitefile=%s\n", Wsite);
-	     */
-
-	    /* print out the list */
-	    i = 0;
-	    temp_list = List;
-	    while (temp_list != NULL) {
-		i++;
-		temp_list = temp_list->ptr;
-	    }
-
-	    while (List != NULL) {
-		fprintf(stdout, "%-70s # %d\n", List->string, i--);
-		temp_list = List;
-		List = List->ptr;
-		G_free(temp_list->string);
-		G_free(temp_list);
-	    }
-	    List_last = NULL;
-	}
-	if (!all_flag->answer && !strcmp(opt1->answer, pads[p]))
-	    break;
-    }
-    if (!only_object->answer &&
-	(all_flag->answer || in_frame_list(opt1, Scurwin)))
-	fprintf(stdout, "\nd.frame -s frame=%s\n", Scurwin);
-
-    R_close_driver();
-
-    if (redraw)
-	G_system("d.redraw");
-
-    exit(EXIT_SUCCESS);
-}
-
-/* return 1 if the padname is in the opt->answers list of frame names */
-int in_frame_list(struct Option *opt, char *padname)
-{
-    int n;
-
-    if (opt->answers)
-	for (n = 0; opt->answers[n] != NULL; n++)
-	    if (!strcmp(opt->answers[n], padname))
-		return (1);
-
-    return (0);
-}
-
-int init_globals(void)
-{
-    Wtop = Wbot = Wleft = Wright = 0;
-    Wcell[0] = '\0';
-    Wdig[0] = '\0';
-    Wsite[0] = '\0';
-    Wcolor[0] = '\0';
-
-    Mtype = Mwind->zone = -1;
-    Mwind->ew_res = Mwind->ns_res = Mwind->north = Mwind->south
-	= Mwind->east = Mwind->west = 0.0;
-
-    return 0;
-}
-
-
-
-/* this array of strings defines the possible item types */
-#define ITEM_TYPES 12
-#define ITEM_SIZE 10
-char Known_items[ITEM_TYPES][ITEM_SIZE] = {
-    "cur_w",
-    "d_win",
-    "m_win",
-    "time",
-    "list",
-    "erase",
-    "cell",
-    "dig",
-    "site",
-    "cell_list",
-    "dig_list",
-    "site_list"
-};
-
-
-/* this function returns the position in the Known_items array that
-   the given item string matches or -1 if no match. */
-int which_item(char *itemstr)
-{
-    int i;
-
-    for (i = 0; i < ITEM_TYPES; i++) {
-	if (!strcmp(itemstr, Known_items[i]))
-	    return (i);
-    }
-    return (-1);
-}
-
-/* this function sets the global variable(s) associated with an item */
-int set_item(char *item, char **list)
-{
-    char *err;
-
-    if (!strcmp(item, "list"))
-	process_list(item, list, 1);
-    else {
-	switch (which_item(item)) {
-	case 0:		/* cur_w */
-	    strcpy(Scurwin, list[0]);
-	    break;
-	case 1:		/* d_win */
-	    sscanf(list[0], " %d %d %d %d ", &Wtop, &Wbot, &Wleft, &Wright);
-	    break;
-	case 2:		/* m_win */
-	    sscanf(list[0], " %d %d %s %s %s %s %d %d ",
-		   &Mtype, &(Mwind->zone),
-		   Estr, Wstr, Nstr, Sstr, &(Mwind->rows), &(Mwind->cols));
-	    proj = G_projection();
-	    G_scan_easting(Estr, &(Mwind->east), proj);
-	    G_scan_easting(Wstr, &(Mwind->west), proj);
-	    G_scan_northing(Nstr, &(Mwind->north), proj);
-	    G_scan_northing(Sstr, &(Mwind->south), proj);
-	    if ((err = G_adjust_Cell_head(Mwind, 1, 1))) {
-		G_fatal_error(err);
-	    }
-	    G_format_resolution(Mwind->ew_res, EWRESstr, proj);
-	    G_format_resolution(Mwind->ns_res, NSRESstr, proj);
-	    break;
-	case 3:		/* time */
-	    break;
-	case 5:		/* d.erase color */
-	    sscanf(list[0], " %s ", Wcolor);
-	    break;
-	case 6:		/* cell */
-	    sscanf(list[0], " %s ", Wcell);
-	    break;
-	case 7:		/* dig */
-	    sscanf(list[0], " %s ", Wdig);
-	    break;
-	case 8:		/* site */
-	    sscanf(list[0], " %s ", Wsite);
-	    break;
-	case 9:
-	case 10:
-	case 11:
-	    break;
-	default:
-	    G_warning(_("Unknown item type in pad: %s"), item);
-	    break;
-	}
-    }
-
-    return 0;
-}
-
-/* this function processes items which have multiple lines */
-int process_list(char *item, char **list, int count)
-{
-    int n;
-    struct list_struct *new_list;
-
-    switch (which_item(item)) {
-    case 4:			/* list */
-	for (n = 0; n < count; n++) {
-	    new_list =
-		(struct list_struct *)G_malloc(sizeof(struct list_struct));
-	    new_list->ptr = NULL;
-	    new_list->string = (char *)G_malloc(strlen(list[n]) + 1);
-	    strcpy(new_list->string, list[n]);
-	    if (List == NULL)	/* nothing on the list yet */
-		List = new_list;
-	    else
-		List_last->ptr = new_list;
-
-	    List_last = new_list;
-	}
-	break;
-    case 9:
-    case 10:
-    case 11:
-	break;
-    default:			/* otherwise */
-	G_warning(_("Unknown item type in pad: %s"), item);
-	break;
-    }
-
-
-    return 0;
-}
-
-
-/* this function processes the items in a pad */
-int process_items(char **items, int nitems)
-{
-    int count;
-    char **list;
-    int i;
-    int stat;
-
-    for (i = nitems - 1; i >= 0; i--) {
-	stat = R_pad_get_item(items[i], &list, &count);
-	if (stat) {
-	    R_pad_perror("#          ERROR", stat);
-	    fprintf(stdout, "exit -1\n\n");
-	    continue;
-	}
-	if (count == 1)
-	    set_item(items[i], list);
-	else
-	    process_list(items[i], list, count);
-
-	R_pad_freelist(list, count);
-    }
-
-    return 0;
-}
-
-/* this function processes a pad */
-int process_pad(char ***items, int *nitems)
-{
-    int stat;
-
-    stat = R_pad_list_items(items, nitems);
-    if (stat) {
-	R_pad_perror("echo     ERROR", stat);
-	fprintf(stdout, "exit -1\n\n");
-	return (-1);
-    }
-
-    process_items(*items, *nitems);
-    return (0);
-}

+ 23 - 80
display/d.text.new/main.c

@@ -72,7 +72,7 @@ struct rectinfo
 
 static void set_color(char *);
 static int get_coordinates(int *, int *, double *, double *,
-			   struct rectinfo, char **, char, char, char);
+			   struct rectinfo, char **, char, char);
 static void draw_text(char *, int *, int *, int, char *, double, char);
 
 int main(int argc, char **argv)
@@ -91,6 +91,7 @@ int main(int argc, char **argv)
 	struct Option *font;
 	struct Option *path;
 	struct Option *charset;
+	struct Option *input;
     } opt;
     struct
     {
@@ -99,7 +100,6 @@ int main(int argc, char **argv)
 	struct Flag *b;
 	struct Flag *r;
 	struct Flag *s;
-	struct Flag *m;
 	struct Flag *c;
     } flag;
 
@@ -115,12 +115,10 @@ int main(int argc, char **argv)
     char bold;
 
     /* window info */
-    char win_name[64];
     struct rectinfo win;
 
     /* command file */
     FILE *cmd_fp;
-    char *cmd_file;
 
     char buf[512];
 
@@ -138,8 +136,7 @@ int main(int argc, char **argv)
     module = G_define_module();
     module->keywords = _("display");
     module->description =
-	_
-	("Draws text in the active display frame on the graphics monitor using the current font.");
+	_("Draws text in the active display frame on the graphics monitor using the current font.");
 
     opt.text = G_define_option();
     opt.text->key = "text";
@@ -225,9 +222,9 @@ int main(int argc, char **argv)
     opt.charset->description =
 	_("Text encoding (only applicable to TrueType fonts)");
 
-    flag.m = G_define_flag();
-    flag.m->key = 'm';
-    flag.m->description = _("Use mouse to interactively place text");
+    opt.input = G_define_standard_option(G_OPT_F_INPUT);
+    opt.input->required = NO;
+    opt.input->description = _("Input file");
 
     flag.p = G_define_flag();
     flag.p->key = 'p';
@@ -260,8 +257,6 @@ int main(int argc, char **argv)
     /* parse and check options and flags */
 
     if ((opt.line->answer && opt.at->answer) ||
-	(opt.line->answer && flag.m->answer) ||
-	(opt.at->answer && flag.m->answer) ||
 	(flag.p->answer && flag.g->answer))
 	G_fatal_error(_("Please choose only one placement method"));
 
@@ -296,12 +291,6 @@ int main(int argc, char **argv)
 
     D_setup(0);
 
-    if (D_get_cur_wind(win_name))
-	G_fatal_error(_("No current window"));
-
-    if (D_set_cur_wind(win_name))
-	G_fatal_error(_("Current window not available"));
-
     /* figure out where to put text */
     D_get_screen_window(&win.t, &win.b, &win.l, &win.r);
     R_set_window(win.t, win.b, win.l, win.r);
@@ -321,9 +310,9 @@ int main(int argc, char **argv)
 
     orig_x = orig_y = 0;
 
-    if (opt.at->answer || flag.m->answer) {
+    if (opt.at->answer) {
 	if (get_coordinates(&x, &y, &east, &north,
-			    win, opt.at->answers, flag.m->answer,
+			    win, opt.at->answers,
 			    flag.p->answer, flag.g->answer))
 	    G_fatal_error(_("Invalid coordinates"));
 	orig_x = x;
@@ -348,38 +337,6 @@ int main(int argc, char **argv)
 
 	if (text[0])
 	    draw_text(text, &x2, &y2, size, align, rotation, bold);
-	if (opt.at->answer || opt.line->answer)
-	    D_add_to_list(G_recreate_command());
-	else {
-	    if (flag.m->answer) {
-		if (flag.p->answer)
-		    sprintf(buf, "%s -p at=%d,%d", argv[0], x, y);
-		else if (flag.g->answer)
-		    sprintf(buf, "%s -g at=%f,%f", argv[0], east, north);
-		else
-		    sprintf(buf, "%s at=%f,%f", argv[0],
-			    (double)(x * 100.0 / (double)(win.r - win.l)),
-			    (double)((win.b - y) * 100.0 / (double)(win.b -
-								    win.t)));
-
-		sprintf(buf, "%s text=\"%s\"", buf, opt.text->answer);
-		sprintf(buf, "%s size=%s", buf, opt.size->answer);
-		sprintf(buf, "%s color=%s", buf, opt.color->answer);
-		sprintf(buf, "%s align=%s", buf, opt.align->answer);
-		sprintf(buf, "%s rotation=%s", buf, opt.rotation->answer);
-		sprintf(buf, "%s linespacing=%s", buf,
-			opt.linespacing->answer);
-		if (flag.b->answer)
-		    strcat(buf, " -b");
-		if (flag.r->answer)
-		    strcat(buf, " -r");
-		if (flag.s->answer)
-		    strcat(buf, " -s");
-	    }
-	    else
-		sprintf(buf, "%s line=1", G_recreate_command());
-	    D_add_to_list(buf);
-	}
 
 	/* reset */
 	R_text_size(5, 5);
@@ -390,25 +347,26 @@ int main(int argc, char **argv)
 	exit(EXIT_SUCCESS);
     }
 
-    if (isatty(0))
-	fprintf(stdout,
-		_
-		("\nPlease enter text instructions.  Enter EOF (ctrl-d) on last line to quit\n"));
+    if (!opt.input->answer || strcmp(opt.input->answer, "-") == 0)
+	cmd_fp = stdin;
+    else {
+	cmd_fp = fopen(opt.input->answer, "r");
+	if (!cmd_fp)
+	    G_fatal_error(_("Unable to open input file <%s>"), opt.input->answer);
+    }
 
-    cmd_file = G_tempfile();
-    if ((cmd_fp = fopen(cmd_file, "w")) == NULL)
-	G_fatal_error(_("Unable to open temporary file <%s>"), cmd_file);
+    if (isatty(fileno(cmd_fp)))
+	fprintf(stderr,
+		_("\nPlease enter text instructions.  Enter EOF (ctrl-d) on last line to quit\n"));
 
     set_x = set_y = set_l = 0;
     first_text = 1;
     linefeed = 1;
     /* do the plotting */
-    while (fgets(buf, 512, stdin)) {
+    while (fgets(buf, sizeof(buf), cmd_fp)) {
 	int buf_len;
 	char *buf_ptr, *ptr;
 
-	fprintf(cmd_fp, "%s", buf);
-
 	buf_len = strlen(buf) - 1;
 	for (; buf[buf_len] == '\r' || buf[buf_len] == '\n'; buf_len--) ;
 	buf[buf_len + 1] = 0;
@@ -559,10 +517,8 @@ int main(int argc, char **argv)
 	}
     }
 
-    fclose(cmd_fp);
-
-    sprintf(buf, "%s < %s", G_recreate_command(), cmd_file);
-    D_add_to_list(buf);
+    if (cmd_fp != stdin)
+	fclose(cmd_fp);
 
     /* reset */
     R_text_size(5, 5);
@@ -599,25 +555,12 @@ static void set_color(char *tcolor)
 
 static int
 get_coordinates(int *x, int *y, double *east, double *north,
-		struct rectinfo win, char **at, char mouse, char pixel,
+		struct rectinfo win, char **at, char pixel,
 		char geocoor)
 {
-    int i;
     double e, n;
 
-    if (mouse) {
-	fprintf(stderr, _("Click!\n"));
-	fprintf(stderr, _(" Left:    Place text here\n"));
-	fprintf(stderr, _(" Right:   Quit\n"));
-
-	R_get_location_with_pointer(x, y, &i);
-	i &= 0x0f;
-	if (i != 1)
-	    return 1;
-	e = D_d_to_u_col((double)*x);
-	n = D_d_to_u_row((double)*y);
-    }
-    else if (at) {
+    if (at) {
 	e = atof(at[0]);
 	n = atof(at[1]);
 	if (pixel) {

+ 1 - 14
display/d.thematic.area/main.c

@@ -56,7 +56,7 @@ int main(int argc, char **argv)
     struct Option *field_opt;
     struct Option *render_opt;
     struct Option *legend_file_opt;
-    struct Flag *legend_flag, *algoinfo_flag, *x_flag, *nodraw_flag;
+    struct Flag *legend_flag, *algoinfo_flag, *nodraw_flag;
 
     struct cat_list *Clist;
     int *cats, ncat, nrec, ctype;
@@ -185,12 +185,6 @@ int main(int argc, char **argv)
     nodraw_flag->key = 'n';
     nodraw_flag->description = _("Do not draw map, only output the legend");
 
-    x_flag = G_define_flag();
-    x_flag->key = 'x';
-    x_flag->description =
-	_("Don't add to list of vectors and commands in monitor "
-	  "(it won't be drawn if the monitor is refreshed)");
-
     /* Check command line */
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
@@ -467,13 +461,6 @@ int main(int argc, char **argv)
 
 	}			/* end window check if */
 
-	if (!x_flag->answer) {
-	    D_add_to_list(G_recreate_command());
-
-	    D_set_dig_name(G_fully_qualified_name(map_name, mapset));
-	    D_add_to_dig_list(G_fully_qualified_name(map_name, mapset));
-	}
-
 	R_close_driver();
 
     }				/* end of nodraw_flag condition */

+ 0 - 6
display/d.vect.chart/main.c

@@ -279,12 +279,6 @@ int main(int argc, char **argv)
 	       sizecol_opt->answer, size, scale,
 	       &ocolor, colors, y_center, max_reference);
 
-    if (ret == 0) {
-	D_add_to_list(G_recreate_command());
-	D_set_dig_name(G_fully_qualified_name(map_opt->answer, mapset));
-	D_add_to_dig_list(G_fully_qualified_name(map_opt->answer, mapset));
-    }
-
     R_close_driver();
 
     Vect_close(&Map);

+ 3 - 20
display/d.vect/main.c

@@ -103,7 +103,7 @@ int main(int argc, char **argv)
     struct Option *width_opt, *wcolumn_opt, *wscale_opt;
     struct Option *render_opt;
     struct Flag *verbose_flag;	/* please remove before GRASS 7 released */
-    struct Flag *id_flag, *table_acolors_flag, *cats_acolors_flag, *x_flag,
+    struct Flag *id_flag, *table_acolors_flag, *cats_acolors_flag,
 	*zcol_flag;
     struct cat_list *Clist;
     int *cats, ncat;
@@ -363,12 +363,6 @@ int main(int argc, char **argv)
     id_flag->guisection = _("Query");
     id_flag->description = _("Use values from 'cats' option as feature id");
 
-    x_flag = G_define_flag();
-    x_flag->key = 'x';
-    x_flag->description =
-	_("Don't add to list of vectors and commands in monitor "
-	  "(it won't be drawn if the monitor is refreshed)");
-
     zcol_flag = G_define_flag();
     zcol_flag->key = 'z';
     zcol_flag->description = _("Colorize polygons according to z height)");
@@ -413,9 +407,7 @@ int main(int argc, char **argv)
 	minreg = atof(minreg_opt->answer);
 
 	if (reg < minreg) {
-	    G_message(_
-		      ("Region size is lower than minreg, nothing displayed."));
-	    D_add_to_list(G_recreate_command());
+	    G_message(_("Region size is lower than minreg, nothing displayed."));
 	    exit(EXIT_SUCCESS);
 	}
     }
@@ -423,9 +415,7 @@ int main(int argc, char **argv)
 	maxreg = atof(maxreg_opt->answer);
 
 	if (reg > maxreg) {
-	    G_message(_
-		      ("Region size is greater than maxreg, nothing displayed."));
-	    D_add_to_list(G_recreate_command());
+	    G_message(_("Region size is greater than maxreg, nothing displayed."));
 	    exit(EXIT_SUCCESS);
 	}
     }
@@ -737,13 +727,6 @@ int main(int argc, char **argv)
 	}
     }
 
-    if (!x_flag->answer) {
-	D_add_to_list(G_recreate_command());
-
-	D_set_dig_name(G_fully_qualified_name(map_name, mapset));
-	D_add_to_dig_list(G_fully_qualified_name(map_name, mapset));
-    }
-
     R_close_driver();
 
     if (verbose)

+ 4 - 29
display/d.what.rast/main.c

@@ -30,7 +30,6 @@
 int main(int argc, char **argv)
 {
     struct Cell_head window;
-    char temp[128];
     int t, b, l, r;
     int i, j;
     int width, mwidth;
@@ -49,27 +48,13 @@ int main(int argc, char **argv)
 	  "within the current geographic region.");
 
 
-    /* Don't fail initially if driver open fails, and don't let call kill
-     * us -- set quiet mode
-     */
-    R__open_quiet();
-    if (R_open_driver() == 0) {
-	if (D_get_cell_list(&rast, &nrasts) < 0)
-	    rast = NULL;
-	else {
-	    rast = (char **)G_realloc(rast, (nrasts + 1) * sizeof(char *));
-	    rast[nrasts] = NULL;
-	}
-	R_close_driver();
-    }
+    rast = NULL;
 
     opt1 = G_define_option();
     opt1->key = "map";
     opt1->type = TYPE_STRING;
-    opt1->required = NO;
+    opt1->required = YES;
     opt1->multiple = YES;
-    if (rast)
-	opt1->answers = rast;
     opt1->gisprompt = "old,cell,raster";
     opt1->description = _("Name of existing raster map(s)");
     opt1->key_desc = "name";
@@ -96,10 +81,7 @@ int main(int argc, char **argv)
 	_
 	("Print out col/row for the entire map in grid resolution of the region");
 
-    if (!rast)
-	opt1->required = YES;
-
-    if ((argc > 1 || !rast) && G_parser(argc, argv))
+    if (argc > 1 && G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
 
@@ -109,17 +91,10 @@ int main(int argc, char **argv)
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    if (D_get_cur_wind(temp))
-	G_fatal_error(_("No current graphics window"));
-
-    if (D_set_cur_wind(temp))
-	G_fatal_error(_("Current graphics window not available"));
-
     /* Read in the map window associated with window */
     G_get_window(&window);
 
-    if (D_check_map_window(&window))
-	G_fatal_error(_("Setting graphics window"));
+    D_check_map_window(&window);
 
     if (G_set_window(&window) == -1)
 	G_fatal_error(_("Can't set current graphics window"));

+ 5 - 26
display/d.what.vect/main.c

@@ -40,7 +40,7 @@
 
 int main(int argc, char **argv)
 {
-    struct Flag *once, *terse, *txt, *topo_flag, *flash, *edit_flag;
+    struct Flag *once, *terse, *txt, *topo_flag, *edit_flag;
     struct Option *opt1;
     struct GModule *module;
     char *mapset, *openvect();
@@ -56,18 +56,7 @@ int main(int argc, char **argv)
 	_("Allows the user to interactively query a vector map layer "
 	  "at user-selected locations within the current geographic region.");
 
-    /* Conditionalize R_open_driver() so "help" works, open quiet as well */
-    R__open_quiet();
-    if (R_open_driver() == 0) {
-	if (D_get_dig_list(&vect, &nvects) < 0)
-	    vect = NULL;
-	else {
-	    vect = (char **)G_realloc(vect, (nvects + 1) * sizeof(char *));
-	    vect[nvects] = NULL;
-	}
-
-	R_close_driver();
-    }
+    vect = NULL;
 
     once = G_define_flag();
     once->key = '1';
@@ -78,9 +67,7 @@ int main(int argc, char **argv)
     opt1->type = TYPE_STRING;
     opt1->multiple = YES;
     opt1->key_desc = "name";
-    if (vect)
-	opt1->answers = vect;
-    opt1->required = NO;
+    opt1->required = YES;
     opt1->gisprompt = "old,vector,vector";
     opt1->description = _("Name of existing vector map");
 
@@ -97,18 +84,11 @@ int main(int argc, char **argv)
     topo_flag->key = 'd';
     topo_flag->description = _("Print topological information (debugging)");
 
-    flash = G_define_flag();
-    flash->key = 'f';
-    flash->description = _("Enable flashing (slower)");
-
     edit_flag = G_define_flag();
     edit_flag->key = 'e';
     edit_flag->description = _("Open form in edit mode");
 
-    if (!vect)
-	opt1->required = YES;
-
-    if ((argc > 1 || !vect) && G_parser(argc, argv))
+    if (argc > 1 && G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
     if (opt1->answers && opt1->answers[0])
@@ -160,14 +140,13 @@ int main(int argc, char **argv)
 	G_fatal_error(_("No graphics device selected"));
     D_setup(0);
 
-    what(once->answer, txt->answer, terse->answer, flash->answer,
+    what(once->answer, txt->answer, terse->answer,
 	 width, mwidth, topo_flag->answer, edit_flag->answer);
 
     for (i = 0; i < nvects; i++)
 	Vect_close(&Map[i]);
 
     R_close_driver();
-    R_pad_freelist(vect, nvects);
 
     G_message(_("Done."));
     exit(EXIT_SUCCESS);

+ 4 - 56
display/d.what.vect/what.c

@@ -15,7 +15,7 @@ static int nlines = 50;
 
 #define WDTH 5
 
-int what(int once, int txt, int terse, int flash, int width, int mwidth,
+int what(int once, int txt, int terse, int width, int mwidth,
 	 int topo, int edit)
 {
     int type, edit_mode;
@@ -32,7 +32,6 @@ int what(int once, int txt, int terse, int flash, int width, int mwidth,
     double maxdist;
     int getz = 0;
     struct field_info *Fi;
-    int flash_basecolr, flash_colr;
 
     plus_t line, area = 0, centroid;
     int i;
@@ -41,18 +40,12 @@ int what(int once, int txt, int terse, int flash, int width, int mwidth,
     char buf[1000], *str, title[500];
     dbString html;
     char *form;
-    char *panell;
 
     if (terse)
 	txt = 1;		/* force text for terse */
 
     G_get_set_window(&window);
 
-    if (flash)
-	G_setup_plot(D_get_d_north(), D_get_d_south(), D_get_d_west(),
-		     D_get_d_east(), D_move_abs, D_cont_abs);
-
-
     G_begin_polygon_area_calculations();
     nrows = window.rows;
     ncols = window.cols;
@@ -69,32 +62,15 @@ int what(int once, int txt, int terse, int flash, int width, int mwidth,
     else
 	notty = 0;
 
-    if (flash) {
-	panell = G_tempfile();
-	flash_basecolr = YELLOW;
-    }
-
     do {
-	if (flash)
-	    R_panel_save(panell, R_screen_top(), R_screen_bot(),
-			 R_screen_left(), R_screen_rite());
-
 	if (!terse)
-	    show_buttons(once, flash);
+	    show_buttons(once);
 	R_get_location_with_pointer(&screen_x, &screen_y, &button);
 	if (!once) {
 	    if (button == 3) {
-		if (flash)
-		    R_panel_delete(panell);
 		break;
 	    }
 	    if (button == 2) {
-		if (flash) {
-		    R_panel_delete(panell);
-		    flash_basecolr++;
-		    if (flash_basecolr >= G_num_standard_colors())
-			flash_basecolr = 1;
-		}
 		continue;
 	    }
 	}
@@ -123,8 +99,6 @@ int what(int once, int txt, int terse, int flash, int width, int mwidth,
 	    maxdist = y1;
 	G_debug(1, "Maximum distance in map units = %f\n", maxdist);
 
-	if (flash)
-	    flash_colr = flash_basecolr;
 	F_clear();
 	for (i = 0; i < nvects; i++) {
 	    Vect_reset_cats(Cats);
@@ -325,11 +299,6 @@ int what(int once, int txt, int terse, int flash, int width, int mwidth,
 			}
 		    }
 		}
-
-		if (flash) {
-		    flash_line(&Map[i], line, Points, BLACK);
-		    flash_line(&Map[i], line, Points, flash_colr);
-		}
 	    }
 
 	    if (area > 0) {
@@ -408,11 +377,6 @@ int what(int once, int txt, int terse, int flash, int width, int mwidth,
 		if (centroid > 0) {
 		    Vect_read_line(&Map[i], Points, Cats, centroid);
 		}
-
-		if (flash) {
-		    flash_area(&Map[i], area, Points, BLACK);
-		    flash_area(&Map[i], area, Points, flash_colr);
-		}
 	    }
 
 	    if (Cats->n_cats > 0) {
@@ -490,17 +454,6 @@ int what(int once, int txt, int terse, int flash, int width, int mwidth,
 		G_debug(3, db_get_string(&html));
 		F_open(title, db_get_string(&html));
 	    }
-
-	    if (flash) {
-		flash_colr++;
-		if (flash_colr >= G_num_standard_colors())
-		    flash_colr = 1;
-	    }
-	}
-
-	if (flash) {
-	    R_panel_restore(panell);
-	    R_panel_delete(panell);
 	}
 
     } while (!once);
@@ -510,7 +463,7 @@ int what(int once, int txt, int terse, int flash, int width, int mwidth,
 }
 
 /* TODO */
-int show_buttons(int once, int flash)
+int show_buttons(int once)
 {
     if (once) {
 	fprintf(stderr, _("\nClick mouse button on desired location\n\n"));
@@ -520,13 +473,8 @@ int show_buttons(int once, int flash)
 	fprintf(stderr, "\n");
 	fprintf(stderr, _("Buttons\n"));
 	fprintf(stderr, _(" Left:  what's here\n"));
-	if (flash) {
-	    fprintf(stderr, _(" Middle: toggle flash color\n"));
-	    nlines = 5;
-	}
-	else
-	    nlines = 4;
 	fprintf(stderr, _(" Right: quit\n"));
+	nlines = 4;
     }
 
     return 0;

+ 2 - 2
display/d.what.vect/what.h

@@ -2,8 +2,8 @@
 char *openvect(char *);
 
 /* what.c */
-int what(int, int, int, int, int, int, int, int);
-int show_buttons(int, int);
+int what(int, int, int, int, int, int, int);
+int show_buttons(int);
 
 /*flash.c */
 void flash_area(struct Map_info *, plus_t, struct line_pnts *, int);

+ 6 - 85
display/d.zoom/main.c

@@ -37,7 +37,7 @@ int main(int argc, char **argv)
 #ifdef QUIET
     struct Flag *quiet;
 #endif
-    struct Flag *just, *full, *hand, *pan, *last;
+    struct Flag *full, *hand, *pan, *last;
     struct Option *rmap, *vmap, *zoom;
     struct GModule *module;
     double magnify;
@@ -59,32 +59,13 @@ int main(int argc, char **argv)
 	_("Allows the user to change the current geographic "
 	  "region settings interactively, with a mouse.");
 
-    /* Conditionalize R_open_driver() so "help" works, open quiet as well */
-    R__open_quiet();
-    if (R_open_driver() == 0) {
-	if (D_get_cell_list(&rast, &nrasts) < 0)
-	    rast = NULL;
-	else {
-	    rast = (char **)G_realloc(rast, (nrasts + 1) * sizeof(char *));
-	    rast[nrasts] = NULL;
-	}
-
-	if (D_get_dig_list(&vect, &nvects) < 0)
-	    vect = NULL;
-	else {
-	    vect = (char **)G_realloc(vect, (nvects + 1) * sizeof(char *));
-	    vect[nvects] = NULL;
-	}
-
-	R_close_driver();
-    }
+    rast = NULL;
+    vect = NULL;
 
     rmap = G_define_option();
     rmap->key = "rast";
     rmap->type = TYPE_STRING;
     rmap->multiple = YES;
-    if (rast)
-	rmap->answers = rast;
     rmap->required = NO;
     rmap->gisprompt = "old,cell,raster";
     rmap->description = _("Name of raster map");
@@ -93,8 +74,6 @@ int main(int argc, char **argv)
     vmap->key = "vector";
     vmap->type = TYPE_STRING;
     vmap->multiple = YES;
-    if (vect)
-	vmap->answers = vect;
     vmap->required = NO;
     vmap->gisprompt = "old,dig,vector";
     vmap->description = _("Name of vector map");
@@ -125,20 +104,11 @@ int main(int argc, char **argv)
     hand->key = 'h';
     hand->description = _("Handheld mode");
 
-    just = G_define_flag();
-    just->key = 'j';
-    just->description = _("Just redraw given maps using default colors");
-
     last = G_define_flag();
     last->key = 'r';
     last->description = _("Return to previous zoom");
 
-    if (!rast && !vect) {
-	rmap->required = YES;
-	just->answer = 1;
-    }
-
-    if ((argc > 1 || (!rast && !vect)) && G_parser(argc, argv))
+    if (argc > 1 && G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
     if ((full->answer + pan->answer + hand->answer) > 1)
@@ -153,48 +123,8 @@ int main(int argc, char **argv)
 #endif
 
     cmd = NULL;
-    if (!just->answer) {
-	if (R_open_driver() != 0)
-	    G_fatal_error(_("No graphics device selected"));
-	stat = R_pad_get_item("list", &list, &nlists);
-	R_close_driver();
-	if (stat || !nlists) {
-	    G_message(_("ERROR: can not get \"list\" items"));
-	    G_message(_("-j flag forced"));
-	    just->answer = 1;
-	}
-	else {
-	    cmd = (char *)G_malloc(strlen(list[0]) + 1);
-	    strcpy(cmd, list[0]);
-	    for (i = 1; i < nlists; i++) {
-		cmd =
-		    (char *)G_realloc(cmd, strlen(cmd) + strlen(list[i]) + 2);
-		strcat(cmd, "\n");
-		strcat(cmd, list[i]);
-	    }
-	}
-    }
-
-    if (just->answer) {
-	if (rmap->answers && rmap->answers[0])
-	    rast = rmap->answers;
-	else {
-	    rast = NULL;
-	    nrasts = 0;
-	}
-	if (vmap->answers && vmap->answers[0])
-	    vect = vmap->answers;
-	else {
-	    vect = NULL;
-	    nvects = 0;
-	}
-    }
-
-
-    /* Make sure map is available */
-    if (rmap->required == YES && rmap->answers == NULL)
-	G_fatal_error(_("No map is displayed in GRASS monitor"));
-
+    rast = rmap->answers;
+    vect = vmap->answers;
 
     if (rast) {
 	struct Cell_head window;
@@ -229,9 +159,6 @@ int main(int argc, char **argv)
 	}
     }
 
-    if (vmap->required == YES && vmap->answers == NULL)
-	exit(EXIT_SUCCESS);
-
     if (vect) {
 	struct Map_info Map;
 	BOUND_BOX box;
@@ -343,12 +270,6 @@ int main(int argc, char **argv)
 
     R_close_driver();
 
-    if (rast)
-	R_pad_freelist(rast, nrasts);
-
-    if (vect)
-	R_pad_freelist(vect, nvects);
-
     G_message(_("Zooming complete."));
     exit(stat);
 }

+ 0 - 34
display/drivers/HTMLMAP/Makefile

@@ -1,34 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM=htmlmapdriver
-
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
-
-EXTRA_CFLAGS=-I../../../lib/driver
-
-OBJS =  \
-	Graph_Clse.o\
-	Graph_Set.o\
-	Polygn_abs.o\
-	Text.o\
-	main.o
-
-ARCH_OBJS := $(foreach obj,$(OBJS),OBJ.$(ARCH)/$(obj))
-
-LIBES = $(DRIVERLIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(FTLIB) $(ICONVLIB)
-DEPENDENCIES = $(DRIVERLIBDEP) $(DRIVERDEP) $(DISPLAYDEP) $(RASTERDEP) $(GISLIBDEP)
-
-default: $(DRIVERDIR)/HTMLMAP $(HTMLDIR)/$(PGM).html moncap
-
-moncap:
-	@if [ -f $(ETC)/monitorcap ] && egrep '^HTMLMAP' $(ETC)/monitorcap >/dev/null 2>&1 ; then \
-	echo HTMLMAP already defined in $(ETC)/monitorcap ; \
-	else \
-	echo adding HTMLMAP driver to $(ETC)/monitorcap ; \
-	cat moncap.entry >> $(ETC)/monitorcap ; \
-	fi
-
-$(DRIVERDIR)/HTMLMAP: $(ARCH_OBJS) $(DEPENDENCIES)
-	$(CC) $(LDFLAGS) -o $@ $(ARCH_OBJS) $(LIBES) $(MATHLIB) $(XDRLIB)

+ 0 - 3
display/drivers/HTMLMAP/moncap.entry

@@ -1,3 +0,0 @@
-HTMLMAP:driver/HTMLMAP:Create HTML Image Map: \
-     dev/fifo.15a dev/fifo.15b \
-     ::any terminal

+ 0 - 29
display/drivers/PNG/Makefile

@@ -1,29 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM=pngdriver
-
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
-
-EXTRA_CFLAGS = $(PNGINC) -I../../../lib/driver -I../../../lib/pngdriver
-
-OBJS =  main.o
-
-ARCH_OBJS := $(foreach obj,$(OBJS),OBJ.$(ARCH)/$(obj))
-
-LIBES = $(PNGDRIVERLIB) $(DRIVERLIB) $(GISLIB) $(FTLIB) $(ICONVLIB)
-DEPENDENCIES = $(PNGDRIVERDEP) $(DRIVERDEP) $(GISLIBDEP)
-
-default: $(DRIVERDIR)/PNG $(HTMLDIR)/$(PGM).html moncap
-
-moncap:
-	@if [ -f $(ETC)/monitorcap ] && egrep '^PNG' $(ETC)/monitorcap >/dev/null 2>&1 ; then \
-	echo PNG already defined in $(ETC)/monitorcap ; \
-	else \
-	echo adding PNG driver to $(ETC)/monitorcap ; \
-	cat moncap.entry >> $(ETC)/monitorcap ; \
-	fi
-
-$(DRIVERDIR)/PNG: $(ARCH_OBJS) $(DEPENDENCIES)
-	$(CC) $(LDFLAGS) -o $@ $(ARCH_OBJS) $(LIBES) $(PNGLIB) $(MATHLIB) $(XDRLIB)

+ 0 - 44
display/drivers/PNG/README

@@ -1,44 +0,0 @@
-NAME
-
-   PNGdriver - driver to create PNG images (drivers)
-   
-DESCRIPTION
-
-   The PNG driver generates PNG pictures from GRASS display commands.
-   
-USAGE
-
-  Environment variables
-  
-   Several environment variables effect the operation of the PNG driver.
-     * GRASS_WIDTH=xxx
-       the width of the image map (default is 640).
-     * GRASS_HEIGHT=yyy
-       the height of the image map (default is 480).
-     * GRASS_PNGFILE=filename
-       the filename to put the resulting image in, default is map.png.
-     * GRASS_BACKGROUNDCOLOR=RRGGBB
-       specifies the background color to use in RGB notation (hex
-       values). Default is 000000 (black).
-     * GRASS_TRANSPARENT=[TRUE|FALSE]
-       sets transparent background on (TRUE) or off (FALSE, default).
-       
-  Example
-  
-    1. Start up the driver
-         d.mon start=PNG
-         d.mon select=PNG
-    2. Display text strings (HREF's) and polygons
-         d.area map=someareamap fillcolor=green linecolor=black
-         d.vect map=somevectormap color=red
-    3. Stop the driver when all polygon have been displayed. This will
-       cause a file named 'map.png' to be created in your current
-       directory.
-         d.mon stop=PNG
-       
-AUTHOR
-
-   Per Henrik Johansen
-   phj@norgit.no
-   NORGIT AS
-

+ 0 - 29
display/drivers/PNG/main.c

@@ -1,29 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       PNG driver
- * AUTHOR(S):    Johansen Per Henrik <per.henrik.johansen norgit.no> 
- *                      (original contributor)
- *               Markus Neteler <neteler itc.it>, 
- *               Glynn Clements <glynn gclements.plus.com>, 
- *               Andreas Lange <andreas.lange rhein-main.de>,
- *               Huidae Cho <grass4u gmail.com>,
- *               Cedric Shock <cedricgrass shockfamily.net>
- *               Hamish Bowman <hamish_nospam yahoo.com>
- * PURPOSE:      driver to create PNG and PPM images
- * COPYRIGHT:    (C) 2001-2006 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 "pngdriver.h"
-
-int main(int argc, char **argv)
-{
-    LIB_init(PNG_Driver(), argc, argv);
-
-    return LIB_main(argc, argv);
-}

+ 0 - 27
display/drivers/PNG/moncap.entry

@@ -1,27 +0,0 @@
-PNG:driver/PNG:Create PNG file: \
-     dev/fifo.8a dev/fifo.8b \
-     ::any terminal
-png1:driver/PNG:Create PNG file: \
-     dev/fifo.9a dev/fifo.9b \
-     ::any terminal
-png2:driver/PNG:Create PNG file: \
-     dev/fifo.10a dev/fifo.10b \
-     ::any terminal
-png3:driver/PNG:Create PNG file: \
-     dev/fifo.11a dev/fifo.11b \
-     ::any terminal
-png4:driver/PNG:Create PNG file: \
-     dev/fifo.12a dev/fifo.12b \
-     ::any terminal
-png5:driver/PNG:Create PNG file: \
-     dev/fifo.13a dev/fifo.13b \
-     ::any terminal
-png6:driver/PNG:Create PNG file: \
-     dev/fifo.14a dev/fifo.14b \
-     ::any terminal
-png7:driver/PNG:Create PNG file: \
-     dev/fifo.15a dev/fifo.15b \
-     ::any terminal
-gism:driver/PNG:Create PNG file for gis.m: \
-     dev/fifo.16a dev/fifo.16b \
-     ::any terminal

+ 0 - 29
display/drivers/PS/Makefile

@@ -1,29 +0,0 @@
-MODULE_TOPDIR = ../../..
-
-PGM=psdriver
-
-include $(MODULE_TOPDIR)/include/Make/Platform.make
-include $(MODULE_TOPDIR)/include/Make/Grass.make
-include $(MODULE_TOPDIR)/include/Make/Rules.make
-
-EXTRA_CFLAGS = -I../../../lib/driver -I../../../lib/psdriver
-
-OBJS =  main.o
-
-ARCH_OBJS := $(foreach obj,$(OBJS),OBJ.$(ARCH)/$(obj))
-
-LIBES = $(PSDRIVERLIB) $(DRIVERLIB) $(GISLIB) $(FTLIB) $(ICONVLIB)
-DEPENDENCIES = $(PSDRIVERDEP) $(DRIVERDEP) $(GISDEP)
-
-default: $(DRIVERDIR)/PS $(HTMLDIR)/$(PGM).html moncap
-
-moncap:
-	@if [ -f $(ETC)/monitorcap ] && egrep '^PS' $(ETC)/monitorcap >/dev/null 2>&1 ; then \
-	echo PS already defined in $(ETC)/monitorcap ; \
-	else \
-	echo adding PS driver to $(ETC)/monitorcap ; \
-	cat moncap.entry >> $(ETC)/monitorcap ; \
-	fi
-
-$(DRIVERDIR)/PS: $(ARCH_OBJS) $(DEPENDENCIES)
-	$(CC) $(LDFLAGS) -o $@ $(ARCH_OBJS) $(LIBES) $(MATHLIB) $(XDRLIB)

+ 0 - 24
display/drivers/PS/main.c

@@ -1,24 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       PostScript driver
- * AUTHOR(S):    Glynn Clements <glynn gclements.plus.com>
- *                      (original contributor)
- *               Markus Neteler <neteler itc.it> 
- * PURPOSE:      driver to create PostScript files from display commands
- * COPYRIGHT:    (C) 2007 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 "psdriver.h"
-
-int main(int argc, char **argv)
-{
-    LIB_init(PS_Driver(), argc, argv);
-
-    return LIB_main(argc, argv);
-}

+ 0 - 0
display/drivers/PS/moncap.entry


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor