Ben NanoNote 3D scans
Sign in or create your account | Project List | Help
Ben NanoNote 3D scans Git Source Tree
Root/
Source at commit a7105addcbd924297e077d7203b94139f37224d7 created 13 years 6 months ago. By Werner Almesberger, Like rotations, shifts can now be accelerated by changing the mouse position. | |
---|---|
1 | /* |
2 | * style.c - GUI style parameters and items |
3 | * |
4 | * Written 2010 by Werner Almesberger |
5 | * Copyright 2010 by Werner Almesberger |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | */ |
12 | |
13 | |
14 | #include <stdlib.h> |
15 | #include <gtk/gtk.h> |
16 | |
17 | #include "style.h" |
18 | |
19 | |
20 | GdkGC *gc_osd; |
21 | |
22 | |
23 | static GdkColor get_color(GdkDrawable *da, const char *spec) |
24 | { |
25 | GdkColormap *cmap; |
26 | GdkColor color; |
27 | |
28 | cmap = gdk_drawable_get_colormap(da); |
29 | if (!gdk_color_parse(spec, &color)) |
30 | abort(); |
31 | if (!gdk_colormap_alloc_color(cmap, &color, FALSE, TRUE)) |
32 | abort(); |
33 | return color; |
34 | } |
35 | |
36 | |
37 | static GdkGC *gc(GdkDrawable *da, const char *spec, int width) |
38 | { |
39 | GdkGCValues gc_values = { |
40 | .background = get_color(da, "black"), |
41 | .foreground = get_color(da, spec), |
42 | .line_width = width, |
43 | }; |
44 | |
45 | return gdk_gc_new_with_values(da, &gc_values, |
46 | GDK_GC_FOREGROUND | GDK_GC_BACKGROUND | GDK_GC_LINE_WIDTH); |
47 | } |
48 | |
49 | |
50 | void init_style(GdkDrawable *da) |
51 | { |
52 | gc_osd = gc(da, "#ffff00", 4); |
53 | } |
54 |
Branches:
master