1
0
mirror of git://projects.qi-hardware.com/ben-scans.git synced 2024-11-22 09:16:15 +02:00
ben-scans/solidify/style.c
Werner Almesberger edb12b6e95 When leveling, the center circle is now shown when the pointer approaches it.
- solidify/Makefile: added util.o
- solidify/util.h, solidify/util.c (draw_circle): wrapper for gdk_draw_arc
- solidify/Makefile: added style.o
- solidify/style.h, solidify/style.c, solidify/solidify.c (main): GUI style
  parameters and items
- solidify/level.c (scroll_z. scroll_xy, scroll_event, level),
  solidify/overlap.c (scroll_event, overlap): renamed "da" to "darea", to
  avoid confusion with "da" for GdkDrawable in style.c
- solidify/level.c (r_center, scroll_event): moved center radius
  calculation to separate function
- solidify/level.c (draw_image): renamed to draw_map
- solidify/level.c (draw_image): draw an on-screen display (OSD)
- solidify/level.c (scroll_z, scroll_xy, expose_event, level): propagate
  OSD on/off switch
- solidify/level.c (scroll_event, motion_notify_event, level): enable OSD
  when approaching the center circle
2010-09-24 02:04:04 -03:00

54 lines
1.1 KiB
C

/*
* style.c - GUI style parameters and items
*
* Written 2010 by Werner Almesberger
* Copyright 2010 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <stdlib.h>
#include <gtk/gtk.h>
#include "style.h"
GdkGC *gc_osd;
static GdkColor get_color(GdkDrawable *da, const char *spec)
{
GdkColormap *cmap;
GdkColor color;
cmap = gdk_drawable_get_colormap(da);
if (!gdk_color_parse(spec, &color))
abort();
if (!gdk_colormap_alloc_color(cmap, &color, FALSE, TRUE))
abort();
return color;
}
static GdkGC *gc(GdkDrawable *da, const char *spec, int width)
{
GdkGCValues gc_values = {
.background = get_color(da, "black"),
.foreground = get_color(da, spec),
.line_width = width,
};
return gdk_gc_new_with_values(da, &gc_values,
GDK_GC_FOREGROUND | GDK_GC_BACKGROUND | GDK_GC_LINE_WIDTH);
}
void init_style(GdkDrawable *da)
{
gc_osd = gc(da, "#ffff00", 4);
}