summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-10-15 21:36:55 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-10-15 21:36:55 (GMT)
commit56da4d4f17ebf1fcfa25bd6cb575feea16924086 (patch)
treeed4b09aaff28ce24caaba5fd3efa9e3b5d7f531c
parentdbbf05c1d3adbc5a26bdaf5ca1237f7c3cea342a (diff)
downloadeeshow-56da4d4f17ebf1fcfa25bd6cb575feea16924086.zip
eeshow-56da4d4f17ebf1fcfa25bd6cb575feea16924086.tar.gz
eeshow-56da4d4f17ebf1fcfa25bd6cb575feea16924086.tar.bz2
main/eeshow.c, gui/comp.c: -d file.doc_db load doc db; comp pop shows entries
-rw-r--r--gui/comp.c10
-rw-r--r--main/eeshow.c15
2 files changed, 23 insertions, 2 deletions
diff --git a/gui/comp.c b/gui/comp.c
index cc7d6a6..48b9421 100644
--- a/gui/comp.c
+++ b/gui/comp.c
@@ -17,6 +17,7 @@
#include <gtk/gtk.h>
#include "misc/util.h"
+#include "db/doc.h"
#include "kicad/dwg.h"
#include "gfx/misc.h"
#include "gui/aoi.h"
@@ -126,6 +127,14 @@ static void comp_click(void *user)
}
+static void add_doc(void *user, const char *tag, const char *s)
+{
+ struct gui *gui = user;
+
+ add_pop_item(gui, comp_click, (void *) s, COMP_W, 0, "%s", tag);
+}
+
+
static bool hover_comp(void *user, bool on, int dx, int dy)
{
struct comp_aoi_ctx *aoi_ctx = user;
@@ -165,6 +174,7 @@ static bool hover_comp(void *user, bool on, int dx, int dy)
add_pop_header(gui, COMP_W, ref ? ref : "???");
if (doc)
add_pop_item(gui, comp_click, (void *) doc, COMP_W, 0, "Doc");
+ doc_find(ref, add_doc, gui);
add_pop_frame(gui);
place_pop(gui, &aoi_ctx->bbox);
diff --git a/main/eeshow.c b/main/eeshow.c
index d5c9920..e3a2038 100644
--- a/main/eeshow.c
+++ b/main/eeshow.c
@@ -26,6 +26,7 @@
#include "kicad/ext.h"
#include "kicad/pl.h" // for suppress_page_layout
#include "gfx/cro.h" // for disable_overline, use_pango
+#include "db/doc.h"
#include "gui/gui.h"
#include "version.h"
#include "main/common.h"
@@ -35,7 +36,7 @@
void usage(const char *name)
{
fprintf(stderr,
-"usage: %s [gtk_flags] [-1] [-N n] kicad_file ...\n"
+"usage: %s [gtk_flags] [-1] [-d file.doc_db] [-N n] kicad_file ...\n"
" %s -V\n"
" %s gdb ...\n"
"\n"
@@ -44,6 +45,8 @@ void usage(const char *name)
" rev git revision\n"
"\n"
" -1 show only one sheet - do not recurse into sub-sheets\n"
+" -d file.doc_db\n"
+" load documentation database file\n"
" -v increase verbosity of diagnostic output\n"
" -E shell_command ...\n"
" execute the specified shell command when the GUI is ready.\n"
@@ -65,17 +68,21 @@ int main(int argc, char **argv)
int limit = 0;
char c;
struct file_names file_names;
+ const char *doc_db = NULL;
run_under_gdb(argc, argv);
gtk_init(&argc, &argv);
setlocale(LC_ALL, "C"); /* restore sanity */
- while ((c = getopt(argc, argv, "1hvE:LN:OPV")) != EOF)
+ while ((c = getopt(argc, argv, "1d:hvE:LN:OPV")) != EOF)
switch (c) {
case '1':
one_sheet = 1;
break;
+ case 'd':
+ doc_db = optarg;
+ break;
case 'v':
verbose++;
break;
@@ -107,6 +114,10 @@ int main(int argc, char **argv)
if (argc - optind < 1)
usage(*argv);
+ /* @@@ support versioning */
+ if (doc_db && !doc_load(doc_db, NULL))
+ fatal("cannot load \"%s\"", doc_db);
+
classify_files(&file_names, argv + optind, argc - optind);
if (!file_names.pro && !file_names.sch)
fatal("project or top sheet name required");