1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 05:55:20 +02:00

eeshow/gui-over.c: more structured approach to composing styles

This commit is contained in:
Werner Almesberger 2016-08-07 06:24:10 -03:00
parent cb7902fcb2
commit 15deee6955

View File

@ -56,39 +56,58 @@ struct overlay {
}; };
#define BG_DEFAULT { 0.8, 0.9, 1.0, 0.8 } #define NORMAL_FONT "Helvetica 10"
#define FRAME_DEFAULT { 0.5, 0.5, 1.0, 0.7 } #define BOLD_FONT "Helvetica Bold 10"
#define NORMAL_PAD 8
#define NORMAL_RADIUS 6
#define NORMAL_SKIP 8
#define NORMAL_WIDTH 2
#define DENSE_PAD 4
#define DENSE_RADIUS 3
#define DENSE_SKIP 5
#define DENSE_WIDTH 1
#define BG_STANDARD { 0.8, 0.9, 1.0, 0.8 }
#define FG_STANDARD { 0.0, 0.0, 0.0, 1.0 }
#define FRAME_STANDARD { 0.5, 0.5, 1.0, 0.7 }
#define BG_SELECTED BG_STANDARD
#define FG_SELECTED FG_STANDARD
#define FRAME_SELECTED { 0.0, 0.0, 1.0, 0.8 } #define FRAME_SELECTED { 0.0, 0.0, 1.0, 0.8 }
#define FG_DEFAULT { 0.0, 0.0, 0.0, 1.0 }
#define BOX_ATTRS(style) \
.pad = style##_PAD, \
.radius = style##_RADIUS, \
.skip = style##_SKIP, \
.width = style##_WIDTH
#define NORMAL BOX_ATTRS(NORMAL)
#define DENSE BOX_ATTRS(DENSE)
#define COLOR_ATTRS(style) \
.bg = BG_##style, \
.fg = FG_##style, \
.frame = FRAME_##style
#define STANDARD COLOR_ATTRS(STANDARD)
#define SELECTED COLOR_ATTRS(SELECTED)
struct overlay_style overlay_style_default = { struct overlay_style overlay_style_default = {
.font = "Helvetica 10", .font = "Helvetica 10",
.radius = 6, NORMAL,
.pad = 8, STANDARD,
.skip = 8,
.bg = BG_DEFAULT,
.frame = FRAME_DEFAULT,
.fg = FG_DEFAULT,
.width = 2,
}, overlay_style_dense = { }, overlay_style_dense = {
.font = "Helvetiva 10", .font = "Helvetiva 10",
.radius = 3, DENSE,
.pad = 4, STANDARD,
.skip = 5,
.bg = BG_DEFAULT,
.frame = FRAME_DEFAULT,
.fg = FG_DEFAULT,
.width = 1,
}, overlay_style_dense_selected = { }, overlay_style_dense_selected = {
.font = "Helvetica Bold 10", .font = "Helvetica Bold 10",
.radius = 3, DENSE,
.pad = 4, SELECTED,
.skip = 5,
.bg = BG_DEFAULT,
.frame = FRAME_SELECTED,
.fg = FG_DEFAULT,
.width = 1,
}; };