summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2017-05-07 00:12:57 (GMT)
committerWerner Almesberger <werner@almesberger.net>2017-05-07 00:12:57 (GMT)
commitf405999fbaf5615f55f68adc3396566a66b562d7 (patch)
tree29533c0eabd5ab6da83f6f2c193162ad123a1b07
parent076f5639036b136fe237856390c66b7fed18ebaf (diff)
downloadeeshow-f405999fbaf5615f55f68adc3396566a66b562d7.zip
eeshow-f405999fbaf5615f55f68adc3396566a66b562d7.tar.gz
eeshow-f405999fbaf5615f55f68adc3396566a66b562d7.tar.bz2
new undocumented option "-C width" to set component pop-up width (0: fit content)
-rw-r--r--gui/comp.c6
-rw-r--r--gui/gui.h11
-rw-r--r--main/eeshow.c13
3 files changed, 22 insertions, 8 deletions
diff --git a/gui/comp.c b/gui/comp.c
index 45a1de0..3a9cb25 100644
--- a/gui/comp.c
+++ b/gui/comp.c
@@ -48,6 +48,8 @@ struct comp_aoi_ctx {
#define COMP_W 100
+unsigned comp_pop_width = COMP_W;
+
/* ----- Bounding box ------------------------------------------------------ */
@@ -166,9 +168,9 @@ static bool hover_comp(void *user, bool on, int dx, int dy)
overlay_remove_all(&gui->pop_overlays);
overlay_remove_all(&gui->pop_underlays);
- add_pop_header(gui, COMP_W, ctx->ref);
+ add_pop_header(gui, comp_pop_width, ctx->ref);
for (item = ctx->items; item; item = item->next)
- add_pop_item(gui, comp_click, (void *) item, COMP_W, 0,
+ add_pop_item(gui, comp_click, (void *) item, comp_pop_width, 0,
"%s", item->tag);
add_pop_frame(gui);
diff --git a/gui/gui.h b/gui/gui.h
index d3f0fab..0698b33 100644
--- a/gui/gui.h
+++ b/gui/gui.h
@@ -1,8 +1,8 @@
/*
* gui/gui.h - GUI for eeshow
*
- * Written 2016 by Werner Almesberger
- * Copyright 2016 by Werner Almesberger
+ * Written 2016-2017 by Werner Almesberger
+ * Copyright 2016-2017 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,6 +18,13 @@
#include "kicad/ext.h"
+/*
+ * @@@ ought to pass this to run_gui, then share via common.h, but let's be
+ * pragmatic :-)
+ */
+
+extern unsigned comp_pop_width;
+
int run_gui(const struct file_names *fn, bool recurse, int limit,
const char **commands, unsigned n_commands);
diff --git a/main/eeshow.c b/main/eeshow.c
index ec072b6..8a4313e 100644
--- a/main/eeshow.c
+++ b/main/eeshow.c
@@ -1,8 +1,8 @@
/*
* main/eeshow.c - Visualize Eeschema schematics
*
- * Written 2016 by Werner Almesberger
- * Copyright 2016 by Werner Almesberger
+ * Written 2016-2017 by Werner Almesberger
+ * Copyright 2016-2017 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -48,6 +48,8 @@ void usage(const char *name)
" -d file.doc_db\n"
" load documentation database file (experimental)\n"
" -v increase verbosity of diagnostic output\n"
+" -C width\n"
+" set width of component pop-up (0: fit content; default is %u)\n"
" -E shell_command ...\n"
" execute the specified shell command when the GUI is ready.\n"
" Sets EESHOW_WINDOW_ID to the X11 window ID.\n"
@@ -55,7 +57,7 @@ void usage(const char *name)
" -P use Pango to render text (experimental, slow)\n"
" -V print revision (version) number and exit\n"
" gdb run eeshow under gdb\n"
- , name, name, name);
+ , name, name, name, comp_pop_width);
exit(1);
}
@@ -75,7 +77,7 @@ int main(int argc, char **argv)
gtk_init(&argc, &argv);
setlocale(LC_ALL, "C"); /* restore sanity */
- while ((c = getopt(argc, argv, "1d:hvE:LN:OPV")) != EOF)
+ while ((c = getopt(argc, argv, "1d:hvC:E:LN:OPV")) != EOF)
switch (c) {
case '1':
one_sheet = 1;
@@ -86,6 +88,9 @@ int main(int argc, char **argv)
case 'v':
verbose++;
break;
+ case 'C':
+ comp_pop_width = atoi(optarg);
+ break;
case 'E':
commands = realloc_type_n(commands, const char *,
n_commands + 1);