[GRASS-SVN] r63535 - grass/trunk/display/d.mon
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Dec 14 04:52:10 PST 2014
Author: martinl
Date: 2014-12-14 04:52:10 -0800 (Sun, 14 Dec 2014)
New Revision: 63535
Modified:
grass/trunk/display/d.mon/main.c
grass/trunk/display/d.mon/proto.h
grass/trunk/display/d.mon/start.c
Log:
d.mon: add -x flag to start wx monitors without toolbars and statusbar
Modified: grass/trunk/display/d.mon/main.c
===================================================================
--- grass/trunk/display/d.mon/main.c 2014-12-14 12:49:28 UTC (rev 63534)
+++ grass/trunk/display/d.mon/main.c 2014-12-14 12:52:10 UTC (rev 63535)
@@ -27,7 +27,7 @@
struct Option *start_opt, *select_opt, *stop_opt, *output_opt,
*width_opt, *height_opt, *bgcolor_opt, *res_opt;
struct Flag *list_flag, *selected_flag, *select_flag, *release_flag,
- *cmd_flag, *truecolor_flag, *update_flag;
+ *cmd_flag, *truecolor_flag, *update_flag, *x_flag;
int nopts, ret;
const char *mon;
@@ -130,9 +130,19 @@
update_flag->description = _("Requires --overwrite flag. If not given the output file is overwritten.");
update_flag->guisection = _("Settings");
+ x_flag = G_define_flag();
+ x_flag->key = 'x';
+ x_flag->label = _("Launch light-weight wx monitor without toolbars and statusbar");
+ x_flag->description = _("Requires 'start=wx0-7'");
+ x_flag->guisection = _("Settings");
+
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
-
+
+ if (x_flag->answer && start_opt->answer && strncmp(start_opt->answer, "wx", 2) != 0)
+ G_warning(_("Flag -%c has effect only for wx monitors (%s=wx0-7)"),
+ x_flag->key, start_opt->key);
+
if (selected_flag->answer || release_flag->answer || cmd_flag->answer) {
if (list_flag->answer)
G_warning(_("Flag -%c ignored"), list_flag->key);
@@ -194,7 +204,7 @@
ret = start_mon(start_opt->answer, output_opt->answer, !select_flag->answer,
width, height, bgcolor_opt->answer,
- !truecolor_flag->answer);
+ !truecolor_flag->answer, x_flag->answer);
if (output_opt->answer && !update_flag->answer) {
if (D_open_driver() != 0)
G_fatal_error(_("No graphics device selected. "
Modified: grass/trunk/display/d.mon/proto.h
===================================================================
--- grass/trunk/display/d.mon/proto.h 2014-12-14 12:49:28 UTC (rev 63534)
+++ grass/trunk/display/d.mon/proto.h 2014-12-14 12:52:10 UTC (rev 63535)
@@ -1,6 +1,6 @@
/* start */
int start_mon(const char *, const char *, int, int, int,
- const char *, int);
+ const char *, int, int);
/* select.c */
int select_mon(const char *);
Modified: grass/trunk/display/d.mon/start.c
===================================================================
--- grass/trunk/display/d.mon/start.c 2014-12-14 12:49:28 UTC (rev 63534)
+++ grass/trunk/display/d.mon/start.c 2014-12-14 12:52:10 UTC (rev 63535)
@@ -9,7 +9,7 @@
static void start(const char *, const char *);
static void start_wx(const char *, const char *, const char *,
- const char *, int, int);
+ const char *, int, int, int);
static void error_handler(void *);
/* start file-based monitor */
@@ -71,10 +71,10 @@
/* start wxGUI display monitor */
void start_wx(const char *name, const char *tempfile,
const char *env_value, const char *cmd_value,
- int width, int height)
+ int width, int height, int x_only)
{
char progname[GPATH_MAX];
- char *env_name, *map_value, str_width[1024], str_height[1024];
+ char *env_name, *map_value, str_width[1024], str_height[1024], *str_x_only;
env_name = NULL;
G_asprintf(&env_name, "MONITOR_%s_MAPFILE", G_store_upper(name));
@@ -94,14 +94,19 @@
else
str_height[0] = '\0';
+ if (x_only)
+ str_x_only = "1";
+ else
+ str_x_only = "0";
+
G_spawn_ex(getenv("GRASS_PYTHON"), progname, progname,
name, map_value, cmd_value, env_value,
- str_width, str_height, SF_BACKGROUND, NULL);
+ str_width, str_height, str_x_only, SF_BACKGROUND, NULL);
}
int start_mon(const char *name, const char *output, int select,
int width, int height, const char *bgcolor,
- int truecolor)
+ int truecolor, int x_only)
{
char *u_name;
char *env_name, *env_value, *cmd_value;
@@ -179,7 +184,7 @@
if (strncmp(name, "wx", 2) == 0)
start_wx(name, tempfile, env_value, cmd_value,
- width, height);
+ width, height, x_only);
else
start(name, output);
More information about the grass-commit
mailing list