summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-30 01:14:48 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-30 01:22:03 (GMT)
commitafc999c766661b50d9f3070864a3d9c3c2c9c500 (patch)
tree29e432f640b967773d3a69e3b34c61e63bf6c77c
parent9fa6e29c6bbd1cb2f1c3b988267c12522baae08a (diff)
downloadeeshow-afc999c766661b50d9f3070864a3d9c3c2c9c500.zip
eeshow-afc999c766661b50d9f3070864a3d9c3c2c9c500.tar.gz
eeshow-afc999c766661b50d9f3070864a3d9c3c2c9c500.tar.bz2
gui/common.h (show_extra): change from bool to enum gfx_extra (mask)
-rw-r--r--gui/common.h2
-rw-r--r--gui/render.c18
-rw-r--r--gui/sheet.c3
3 files changed, 12 insertions, 11 deletions
diff --git a/gui/common.h b/gui/common.h
index 18f0ab2..8727707 100644
--- a/gui/common.h
+++ b/gui/common.h
@@ -149,7 +149,7 @@ void progress_update(struct gui *gui);
/* render.c */
extern bool use_delta;
-extern bool show_extra;
+extern enum gfx_extra show_extra;
void redraw(const struct gui *gui);
diff --git a/gui/render.c b/gui/render.c
index a6289a4..a70fbf6 100644
--- a/gui/render.c
+++ b/gui/render.c
@@ -40,7 +40,7 @@
bool use_delta = 0;
-bool show_extra = 0;
+enum gfx_extra show_extra = 0;
/* ----- Helper functions -------------------------------------------------- */
@@ -159,8 +159,7 @@ static void hack(const struct gui *gui, cairo_t *cr,
areas = changed_sheets(gui, xo, yo, f);
diff_to_canvas(cr, gui->x, gui->y, gui->scale,
- gfx_user(old->gfx), gfx_user(new->gfx),
- show_extra ? gfx_pin_type : 0, areas);
+ gfx_user(old->gfx), gfx_user(new->gfx), show_extra, areas);
free_areas(&areas);
}
@@ -173,7 +172,6 @@ static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr,
GtkAllocation alloc;
float f = gui->scale;
int x, y;
- enum gfx_extra extra = show_extra ? gfx_pin_type : 0;
gtk_widget_get_allocation(gui->da, &alloc);
x = -(sheet->xmin + gui->x) * f + alloc.width / 2;
@@ -182,12 +180,12 @@ static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr,
cro_canvas_prepare(cr);
if (!gui->old_hist || gui->diff_mode == diff_new) {
highlight_glabel(gui, sheet, cr, x, y, f);
- cro_canvas_draw(gfx_user(sheet->gfx), cr, x, y, f, extra);
+ cro_canvas_draw(gfx_user(sheet->gfx), cr, x, y, f, show_extra);
} else if (gui->diff_mode == diff_old) {
sheet = find_corresponding_sheet(gui->old_hist->sheets,
gui->new_hist->sheets, gui->curr_sheet);
highlight_glabel(gui, sheet, cr, x, y, f);
- cro_canvas_draw(gfx_user(sheet->gfx), cr, x, y, f, extra);
+ cro_canvas_draw(gfx_user(sheet->gfx), cr, x, y, f, show_extra);
} else if (use_delta) {
struct area *areas = changed_sheets(gui, x, y, f);
const struct area *area;
@@ -202,9 +200,11 @@ static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr,
/* @@@ fix geometry later */
cro_canvas_draw(gfx_user(gui->delta_ab.gfx), cr, x, y, f,
- extra);
- cro_canvas_draw(gfx_user(gui->delta_a.gfx), cr, x, y, f, extra);
- cro_canvas_draw(gfx_user(gui->delta_b.gfx), cr, x, y, f, extra);
+ show_extra);
+ cro_canvas_draw(gfx_user(gui->delta_a.gfx), cr, x, y, f,
+ show_extra);
+ cro_canvas_draw(gfx_user(gui->delta_b.gfx), cr, x, y, f,
+ show_extra);
} else {
hack(gui, cr, x, y, f);
}
diff --git a/gui/sheet.c b/gui/sheet.c
index a09efec..96b911d 100644
--- a/gui/sheet.c
+++ b/gui/sheet.c
@@ -16,6 +16,7 @@
#include <gtk/gtk.h>
+#include "gfx/gfx.h"
#include "file/git-hist.h"
#include "kicad/sch.h"
#include "kicad/delta.h"
@@ -558,7 +559,7 @@ static void sheet_key(void *user, int x, int y, int keyval)
break;
case GDK_KEY_e:
- show_extra = !show_extra;
+ show_extra ^= gfx_pin_type;
redraw(gui);
break;