summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-19 14:17:00 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-19 14:34:25 -0300
commitd65e236083da05aea35e5912d26423bdb9f2177e (patch)
treef75349bd72e1239b81fa0a2e10388b7c2db897f6
parent3c75e21c2b972d26f9dd4a2817302012d91b286a (diff)
downloadeeshow-d65e236083da05aea35e5912d26423bdb9f2177e.tar.gz
eeshow-d65e236083da05aea35e5912d26423bdb9f2177e.tar.bz2
eeshow-d65e236083da05aea35e5912d26423bdb9f2177e.zip
eeshow/: add online help with h or ? (WIP)
-rw-r--r--Makefile15
-rw-r--r--README3
-rw-r--r--gui/help.c57
-rw-r--r--gui/help.h18
-rw-r--r--gui/sheet.c6
-rw-r--r--help.html48
6 files changed, 144 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index d2132ec..4971c05 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,7 @@ OBJS = main.o \
kicad/lib-render.o kicad/dwg.o kicad/delta.o \
gui/gui.o gui/over.o gui/style.o gui/aoi.o gui/fmt-pango.o gui/input.o \
gui/progress.o gui/glabel.o gui/sheet.o gui/history.o gui/render.o \
+ gui/help.o \
file/file.o file/git-util.o file/git-file.o file/git-hist.o \
gfx/style.o gfx/fig.o gfx/record.o gfx/cro.o gfx/diff.o gfx/gfx.o \
gfx/text.o gfx/misc.o \
@@ -26,11 +27,13 @@ CFLAGS = -g -Wall -Wextra -Wno-unused-parameter -Wshadow \
-I. \
`pkg-config --cflags cairo` \
`pkg-config --cflags libgit2` \
- `pkg-config --cflags gtk+-3.0`
+ `pkg-config --cflags gtk+-3.0` \
+ `pkg-config --cflags webkit2gtk-3.0`
LDLIBS = -lm \
`pkg-config --libs cairo` \
`pkg-config --libs libgit2` \
- `pkg-config --libs gtk+-3.0`
+ `pkg-config --libs gtk+-3.0` \
+ `pkg-config --libs webkit2gtk-3.0`
include ../common/Makefile.c-common
@@ -41,6 +44,14 @@ all:: $(NAME)
$(NAME): $(OBJS)
$(CC) -o $(NAME) $(OBJS) $(LDLIBS)
+help.inc: help.html
+ $(BUILD) sed 's/.*/"&"/' $< >$@ || { rm -f $@; exit 1; }
+
+gui/help.c: help.inc
+
+clean::
+ rm -f help.inc
+
#----- Test sheet -------------------------------------------------------------
sch:
diff --git a/README b/README
index b87503c..08d2056 100644
--- a/README
+++ b/README
@@ -25,6 +25,7 @@ Prerequisites
libcairo2-dev
libgit2-dev
libgtk-3-dev
+ibwebkit2gtk-3.0-dev
Development status
@@ -45,7 +46,6 @@ many limitations, especially in the following areas:
More details on pending items can be found in the file TODO.
-
Non-interactive rendering
=========================
@@ -175,6 +175,7 @@ PgUp go to the previous sheet in sequence
PgDn go to the next sheet in sequence
Up or Down invoke the revision history (WIP)
Tab toggle between old and new revision
+? or H show/hide help window
D when comparing revisions, show difference (default)
N show newer sheet
O show older sheet
diff --git a/gui/help.c b/gui/help.c
new file mode 100644
index 0000000..e23e612
--- /dev/null
+++ b/gui/help.c
@@ -0,0 +1,57 @@
+/*
+ * gui/help.c - Online help
+ *
+ * Written 2016 by Werner Almesberger
+ * Copyright 2016 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <stdbool.h>
+
+#include <gtk/gtk.h>
+#include <webkit2/webkit2.h>
+
+#include "gui/help.h"
+
+
+static GtkWidget *window = NULL;
+static bool visible;
+
+
+static void new_help_window(void)
+{
+ GtkWidget *view;
+
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ view = webkit_web_view_new();
+ gtk_container_add(GTK_CONTAINER(window), view);
+ gtk_widget_show_all(window);
+
+ webkit_web_view_load_html(WEBKIT_WEB_VIEW(view),
+#include "../help.inc"
+ , NULL);
+
+ g_signal_connect(window, "destroy",
+ G_CALLBACK(gtk_main_quit), NULL);
+
+ gtk_widget_show_all(window);
+}
+
+
+void help(void)
+{
+ if (!window) {
+ new_help_window();
+ visible = 1;
+ } else {
+ visible = !visible;
+ if (visible)
+ gtk_widget_show(window);
+ else
+ gtk_widget_hide(window);
+ }
+}
diff --git a/gui/help.h b/gui/help.h
new file mode 100644
index 0000000..937ba1d
--- /dev/null
+++ b/gui/help.h
@@ -0,0 +1,18 @@
+/*
+ * gui/help.h - Online help
+ *
+ * Written 2016 by Werner Almesberger
+ * Copyright 2016 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef GUI_HELP_H
+#define GUI_HELP_H
+
+void help(void);
+
+#endif /* !GUI_HELP_H */
diff --git a/gui/sheet.c b/gui/sheet.c
index ae62b3a..111756b 100644
--- a/gui/sheet.c
+++ b/gui/sheet.c
@@ -24,6 +24,7 @@
#include "gui/aoi.h"
#include "gui/over.h"
#include "gui/input.h"
+#include "gui/help.h"
#include "gui/common.h"
@@ -515,6 +516,11 @@ static void sheet_key(void *user, int x, int y, int keyval)
redraw(ctx);
break;
+ case GDK_KEY_h:
+ case GDK_KEY_question:
+ help();
+ break;
+
case GDK_KEY_q:
gtk_main_quit();
}
diff --git a/help.html b/help.html
new file mode 100644
index 0000000..461f83e
--- /dev/null
+++ b/help.html
@@ -0,0 +1,48 @@
+<HTML>
+<HEAD><TITLE>Eeshow help</TITLE></HEAD>
+
+<H1>Key functions in GUI mode</H1>
+
+<TABLE>
+ <TR>
+ <TD>+ or =
+ <TD>zoom in
+ <TR>
+ <TD>-
+ <TD>zoom out
+ <TR>
+ <TD>*
+ <TD>zoom to extents
+ <TR>
+ <TD>Home
+ <TD>go to the top sheet
+ <TR>
+ <TD>Delete or Backspace
+ <TD>go to the next higher sheet in hierarchy
+ <TR>
+ <TD>PgUp
+ <TD>go to the previous sheet in sequence
+ <TR>
+ <TD>PgDn
+ <TD>go to the next sheet in sequence
+ <TR>
+ <TD>Tab
+ <TD>toggle between old and new revision
+ <TR>
+ <TD>? or H
+ <TD>open/close help window
+ <TR>
+ <TD>D
+ <TD>when comparing revisions, show difference
+ <TR>
+ <TD>N
+ <TD>show newer sheet
+ <TR>
+ <TD>O
+ <TD>show older sheet
+ <TR>
+ <TD>Q
+ <TD>quit the vieweer
+</TABLE>
+</BODY>
+</HTML>