summaryrefslogtreecommitdiff
path: root/gui/sheet.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-24 00:00:42 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-24 01:55:49 -0300
commit6e07f89c6fd2cf86e25fa245c2688d8c2e20be95 (patch)
treef7f89de51a6e9bdbfa1ae075f22681093fa71b22 /gui/sheet.c
parent03a241809ee91fb0addd685a71d3c98c69e4c868 (diff)
downloadeeshow-6e07f89c6fd2cf86e25fa245c2688d8c2e20be95.tar.gz
eeshow-6e07f89c6fd2cf86e25fa245c2688d8c2e20be95.tar.bz2
eeshow-6e07f89c6fd2cf86e25fa245c2688d8c2e20be95.zip
gui/: experimental sheet index (WIP)
We also change the way the sheet overlays work: now clicking on the subsheet (which, in the case of the bottom-most sheet did nothing) goes back to the parent and clicking on the root opens the index.
Diffstat (limited to 'gui/sheet.c')
-rw-r--r--gui/sheet.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/gui/sheet.c b/gui/sheet.c
index 3e62485..dfd0f57 100644
--- a/gui/sheet.c
+++ b/gui/sheet.c
@@ -272,12 +272,32 @@ void do_revision_overlays(struct gui_ctx *ctx)
/* ----- Sheet selection overlays ------------------------------------------ */
+static struct gui_sheet *find_parent_sheet(struct gui_sheet *sheets,
+ const struct gui_sheet *ref)
+{
+ struct gui_sheet *parent;
+ const struct sch_obj *obj;
+
+ for (parent = sheets; parent; parent = parent->next)
+ for (obj = parent->sch->objs; obj; obj = obj->next)
+ if (obj->type == sch_obj_sheet &&
+ obj->u.sheet.sheet == ref->sch)
+ return parent;
+ return NULL;
+}
+
+
static void close_subsheet(void *user)
{
struct gui_sheet *sheet = user;
struct gui_ctx *ctx = sheet->ctx;
+ struct gui_sheet *parent;
- go_to_sheet(ctx, sheet);
+ parent = find_parent_sheet(ctx->new_hist->sheets, sheet);
+ if (parent)
+ go_to_sheet(ctx, parent);
+ else
+ show_index(ctx);
}
@@ -308,21 +328,6 @@ static bool hover_sheet(void *user, bool on, int dx, int dy)
}
-static struct gui_sheet *find_parent_sheet(struct gui_sheet *sheets,
- const struct gui_sheet *ref)
-{
- struct gui_sheet *parent;
- const struct sch_obj *obj;
-
- for (parent = sheets; parent; parent = parent->next)
- for (obj = parent->sch->objs; obj; obj = obj->next)
- if (obj->type == sch_obj_sheet &&
- obj->u.sheet.sheet == ref->sch)
- return parent;
- return NULL;
-}
-
-
static void sheet_selector_recurse(struct gui_ctx *ctx, struct gui_sheet *sheet)
{
struct gui_sheet *parent;