[GRASS-SVN] r46069 - grass/branches/releasebranch_6_4/display/d.barscale

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 21 16:46:36 EDT 2011


Author: neteler
Date: 2011-04-21 13:46:36 -0700 (Thu, 21 Apr 2011)
New Revision: 46069

Modified:
   grass/branches/releasebranch_6_4/display/d.barscale/draw_scale.c
   grass/branches/releasebranch_6_4/display/d.barscale/main.c
   grass/branches/releasebranch_6_4/display/d.barscale/mouse.c
   grass/branches/releasebranch_6_4/display/d.barscale/options.h
Log:
fontsize support backported

Modified: grass/branches/releasebranch_6_4/display/d.barscale/draw_scale.c
===================================================================
--- grass/branches/releasebranch_6_4/display/d.barscale/draw_scale.c	2011-04-21 20:43:43 UTC (rev 46068)
+++ grass/branches/releasebranch_6_4/display/d.barscale/draw_scale.c	2011-04-21 20:46:36 UTC (rev 46069)
@@ -59,7 +59,7 @@
     "5000 miles", 8046720.000, 20000000., 5},}
 };
 
-int draw_scale(char *save, int toptext)
+int draw_scale(char *save, int toptext, int size)
 {
     double meters;
     double line_len;
@@ -68,7 +68,6 @@
     int t, b, l, r;
     int pt, pb, pl, pr;
     int i;
-    int size;
     int xarr[5], yarr[5];
     double seg_len;
     const struct scale *scales = all_scales[use_feet];
@@ -76,7 +75,6 @@
     /* Establish text size */
     D_get_screen_window(&t, &b, &l, &r);
     R_set_window(t, b, l, r);
-    size = 14;
     R_text_size(size, size);
 
     x_pos = (int)(east * (r - l) / 100.);

Modified: grass/branches/releasebranch_6_4/display/d.barscale/main.c
===================================================================
--- grass/branches/releasebranch_6_4/display/d.barscale/main.c	2011-04-21 20:43:43 UTC (rev 46068)
+++ grass/branches/releasebranch_6_4/display/d.barscale/main.c	2011-04-21 20:46:36 UTC (rev 46069)
@@ -12,7 +12,7 @@
  *               Hamish Bowman <hamish_nospam yahoo.com>, 
  *               Jan-Oliver Wagner <jan intevation.de>
  * PURPOSE:      displays a barscale on graphics monitor
- * COPYRIGHT:    (C) 1999-2007 by the GRASS Development Team
+ * COPYRIGHT:    (C) 1999-2011 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
@@ -43,9 +43,9 @@
 {
     char window_name[64];
     struct Cell_head window;
-    int t, b, l, r;
+    int t, b, l, r, fontsize;
     struct GModule *module;
-    struct Option *opt1, *opt2, *opt3;
+    struct Option *opt1, *opt2, *opt3, *fsize;
     struct Flag *mouse, *feet, *top, *linescale, *northarrow, *scalebar;
     struct Cell_head W;
 
@@ -97,6 +97,14 @@
     opt3->description =
 	_("The screen coordinates for top-left corner of label ([0,0] is top-left of frame)");
 
+    fsize = G_define_option();
+    fsize->key = "fontsize";
+    fsize->type = TYPE_INTEGER;
+    fsize->required = NO;
+    fsize->answer = "14";
+    fsize->options = "1-72";
+    fsize->description = _("Font size for gridline coordinate labels");
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -120,8 +128,8 @@
 
     sscanf(opt3->answers[0], "%lf", &east);
     sscanf(opt3->answers[1], "%lf", &north);
+    fontsize = atoi(fsize->answer);
 
-
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
@@ -158,12 +166,12 @@
 
     if (!mouse->answer) {
 	/* Draw the scale */
-	draw_scale(NULL, top->answer);
+	draw_scale(NULL, top->answer, fontsize);
 
 	/* Add this command to list */
 	D_add_to_list(G_recreate_command());
     }
-    else if (mouse_query(top->answer)) {
+    else if (mouse_query(top->answer, fontsize)) {
 	char cmdbuf[255];
 
 	sprintf(cmdbuf, "%s at=%f,%f", argv[0], east, north);

Modified: grass/branches/releasebranch_6_4/display/d.barscale/mouse.c
===================================================================
--- grass/branches/releasebranch_6_4/display/d.barscale/mouse.c	2011-04-21 20:43:43 UTC (rev 46068)
+++ grass/branches/releasebranch_6_4/display/d.barscale/mouse.c	2011-04-21 20:46:36 UTC (rev 46069)
@@ -4,7 +4,7 @@
 #include <grass/display.h>
 #include "options.h"
 
-int mouse_query(int toptext)
+int mouse_query(int toptext, int fontsize)
 {
     int t, b, l, r;
     char *panel = G_tempfile();
@@ -23,7 +23,7 @@
 	east = (x_pos * 100.0) / (r - l);
 	north = (y_pos * 100.0) / (b - t);
 
-	draw_scale(panel, toptext);
+	draw_scale(panel, toptext, fontsize);
 
 	fprintf(stderr,
 		"\n"

Modified: grass/branches/releasebranch_6_4/display/d.barscale/options.h
===================================================================
--- grass/branches/releasebranch_6_4/display/d.barscale/options.h	2011-04-21 20:43:43 UTC (rev 46068)
+++ grass/branches/releasebranch_6_4/display/d.barscale/options.h	2011-04-21 20:46:36 UTC (rev 46069)
@@ -9,7 +9,7 @@
 extern int draw;
 
 /* draw_scale.c */
-int draw_scale(char *save, int toptext);
+int draw_scale(char *save, int toptext, int fontsize);
 
 /* mouse.c */
-int mouse_query(int toptext);
+int mouse_query(int toptext, int fontsize);



More information about the grass-commit mailing list