summaryrefslogtreecommitdiff
path: root/gui/glabel.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-18 17:13:36 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-18 17:13:36 -0300
commit4613b51540166c563817688683ab7cb976945a00 (patch)
treeb57735b44c01a9cb5987f294128d7a414af3cc4b /gui/glabel.c
parent9ce1707dff36162fc91a030befdcf8a3c2b6852d (diff)
downloadeeshow-4613b51540166c563817688683ab7cb976945a00.tar.gz
eeshow-4613b51540166c563817688683ab7cb976945a00.tar.bz2
eeshow-4613b51540166c563817688683ab7cb976945a00.zip
eeshow/gui/: use underlay to draw a nice box for glabels
Diffstat (limited to 'gui/glabel.c')
-rw-r--r--gui/glabel.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/gui/glabel.c b/gui/glabel.c
index 13f520b..dde7776 100644
--- a/gui/glabel.c
+++ b/gui/glabel.c
@@ -64,6 +64,7 @@ static void glabel_dest_click(void *user)
void dehover_glabel(struct gui_ctx *ctx)
{
overlay_remove_all(&ctx->pop_overlays);
+ overlay_remove_all(&ctx->pop_underlays);
redraw(ctx);
}
@@ -76,10 +77,10 @@ static void add_dest_overlay(struct gui_ctx *ctx, const char *label,
.wmin = 100,
.wmax = 100,
.radius = 0,
- .pad = 4,
- .skip = -4,
+ .pad = 0,
+ .skip = 4,
.fg = { 0.0, 0.0, 0.0, 1.0 },
- .bg = { 1.0, 0.8, 0.4, 0.8 },
+ .bg = { 0.0, 0.0, 0.0, 0.0 },
.frame = { 1.0, 1.0, 1.0, 1.0 }, /* debugging */
.width = 0,
};
@@ -97,11 +98,38 @@ static void add_dest_overlay(struct gui_ctx *ctx, const char *label,
&ctx->aois, NULL, glabel_dest_click, sheet);
overlay_text(over, "%d %s", n, sheet->sch->title);
overlay_style(over, &style);
- return;
+ break;
}
}
+static void add_dest_frame(struct gui_ctx *ctx)
+{
+ int w, h;
+
+ overlay_size_all(ctx->pop_overlays,
+ gtk_widget_get_pango_context(ctx->da), 0, 1, &w, &h);
+
+ struct overlay_style style = {
+ .font = BOLD_FONT,
+ .wmin = w,
+ .hmin = h,
+ .radius = 0,
+ .pad = GLABEL_STACK_PADDING,
+ .skip = 0,
+ .fg = { 0.0, 0.0, 0.0, 1.0 },
+ .bg = { 0.9, 0.9, 0.3, 0.8 },
+ .frame = { 0.0, 0.0, 0.0, 1.0 }, /* debugging */
+ .width = 1,
+ };
+ struct overlay *over;
+
+ over = overlay_add(&ctx->pop_underlays, NULL, NULL, NULL, NULL);
+ overlay_text_raw(over, "");
+ overlay_style(over, &style);
+}
+
+
static bool hover_glabel(void *user, bool on)
{
struct glabel_aoi_ctx *aoi_ctx = user;
@@ -121,8 +149,10 @@ static bool hover_glabel(void *user, bool on)
aoi_dehover();
overlay_remove_all(&ctx->pop_overlays);
+ overlay_remove_all(&ctx->pop_underlays);
for (sheet = ctx->new_hist->sheets; sheet; sheet = sheet->next)
add_dest_overlay(ctx, aoi_ctx->obj->u.text.s, sheet, ++n);
+ add_dest_frame(ctx);
eeschema_coord(ctx,
bbox->x - curr_sheet->xmin, bbox->y - curr_sheet->ymin,