mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 14:45:43 +01:00
Remove unused clearlooks-older
This commit is contained in:
parent
012567beb5
commit
521e4f676b
11 changed files with 0 additions and 5921 deletions
|
|
@ -1,121 +0,0 @@
|
|||
static unsigned char dot_intensity[] = {
|
||||
0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0x98,0xb9,0xc6,0xb9,0x91,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0xb9,0xbd,0xac,0x9e,0x65,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0xc6,0xac,0x9e,0x96,0x5c,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0xb9,0x9e,0x96,0x62,0x55,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0x91,0x65,0x5c,0x55,0x68,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
|
||||
};
|
||||
static unsigned char dot_alpha[] = {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x66,0xc4,0xff,0xc4,0x66,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x66,0xdf,0xff,0xff,0xff,0xdf,0x66,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0xc4,0xff,0xff,0xff,0xff,0xff,0xc4,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0xc4,0xff,0xff,0xff,0xff,0xff,0xc4,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x66,0xdf,0xff,0xff,0xff,0xdf,0x66,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x66,0xc4,0xff,0xc4,0x66,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
||||
static unsigned char circle_alpha[] = {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x23,0x62,0x92,0xb3,0xb2,0x95,0x2b,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3e,0xab,0xc9,0xeb,0xf9,0xf5,0xfd,0xff,0x57,0x00,0x00,
|
||||
0x00,0x1f,0xb5,0xd8,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0x00,
|
||||
0x00,0x67,0xb9,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9c,0x00,
|
||||
0x00,0x9a,0xe2,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0x00,
|
||||
0x00,0xba,0xeb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xc0,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0x00,
|
||||
0x00,0x9b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9c,0x00,
|
||||
0x00,0x2b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0x00,
|
||||
0x00,0x00,0x57,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x00,0x00,
|
||||
0x00,0x00,0x00,0x2b,0x9c,0xe5,0xff,0xe5,0x9c,0x2b,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
static unsigned char outline_alpha[] = {
|
||||
0x00,0x00,0x00,0x4a,0xac,0xe9,0xff,0xe9,0xac,0x4a,0x00,0x00,0x00,
|
||||
0x00,0x00,0x98,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x98,0x00,0x00,
|
||||
0x00,0x98,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x98,0x00,
|
||||
0x4a,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4a,
|
||||
0xac,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xac,
|
||||
0xe9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe9,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0xe9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe9,
|
||||
0xac,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xac,
|
||||
0x4a,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4a,
|
||||
0x00,0x98,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x98,0x00,
|
||||
0x00,0x00,0x98,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x98,0x00,0x00,
|
||||
0x00,0x00,0x00,0x4a,0xac,0xe9,0xff,0xe9,0xac,0x4a,0x00,0x00,0x00,
|
||||
};
|
||||
static unsigned char inconsistent_alpha[] = {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
static unsigned char check_base_alpha[] = {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
static unsigned char check_alpha[] = {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, 137, 151,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, 183, 172, 7,0x00,0x00,
|
||||
0x00,0x00, 12, 18,0x00,0x00, 3, 161, 233, 27,0x00,0x00,0x00,
|
||||
0x00,0x00, 199, 239, 101,0x00, 85, 253, 108,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00, 83, 245, 250, 75, 206, 230, 8,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00, 104, 252, 243, 253, 124,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00, 2, 162, 255, 241, 28,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00, 18, 228, 163,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00, 78, 62,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
static unsigned char check_inconsistent_alpha[] = {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
|
||||
0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
|
||||
0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,159 +0,0 @@
|
|||
#ifndef CLEARLOOKS_DRAW_H
|
||||
#define CLEARLOOKS_DRAW_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkColor *from;
|
||||
GdkColor *to;
|
||||
} CLGradient;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CL_GRADIENT_NONE,
|
||||
CL_GRADIENT_HORIZONTAL,
|
||||
CL_GRADIENT_VERTICAL
|
||||
} CLGradientType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CLGradient fill_gradient;
|
||||
CLGradient border_gradient;
|
||||
|
||||
CLGradientType gradient_type;
|
||||
|
||||
GdkGC *bordergc;
|
||||
GdkGC *fillgc;
|
||||
|
||||
guint8 corners[4];
|
||||
|
||||
GdkGC *topleft; /* top + left shadow */
|
||||
GdkGC *bottomright; /* bottom + right shadow */
|
||||
|
||||
GdkColor tmp_color; /* used for gradient */
|
||||
} CLRectangle;
|
||||
|
||||
typedef enum /* DON'T CHANGE THE ORDER! */
|
||||
{
|
||||
CL_CORNER_TOPRIGHT,
|
||||
CL_CORNER_BOTTOMRIGHT,
|
||||
CL_CORNER_BOTTOMLEFT,
|
||||
CL_CORNER_TOPLEFT
|
||||
} CLCornerSide;
|
||||
|
||||
typedef enum /* DON'T CHANGE THE ORDER! */
|
||||
{
|
||||
CL_BORDER_TOP,
|
||||
CL_BORDER_RIGHT,
|
||||
CL_BORDER_BOTTOM,
|
||||
CL_BORDER_LEFT
|
||||
} CLBorderType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CL_CORNER_NONE = 0,
|
||||
CL_CORNER_NARROW = 1,
|
||||
CL_CORNER_ROUND = 2
|
||||
} CLCornerSharpness;
|
||||
|
||||
|
||||
|
||||
CLRectangle *cl_rectangle_new(GdkGC *fillgc, GdkGC *bordergc,
|
||||
int tl, int tr, int bl, int br);
|
||||
|
||||
void cl_draw_rectangle (GdkWindow *window, GtkWidget *widget, GtkStyle *style,
|
||||
int x, int y, int width, int height, CLRectangle *r);
|
||||
|
||||
void cl_rectangle_set_color (CLGradient *g, GdkColor *color);
|
||||
void cl_rectangle_set_gradient (CLGradient *g, GdkColor *from, GdkColor *to);
|
||||
|
||||
void cl_rectangle_set_button (CLRectangle *r, GtkStyle *style,
|
||||
GtkStateType state_type, gboolean hasdefault, gboolean has_focus,
|
||||
CLBorderType tl, CLBorderType tr,
|
||||
CLBorderType bl, CLBorderType br);
|
||||
|
||||
void cl_rectangle_set_entry (CLRectangle *r, GtkStyle *style,
|
||||
GtkStateType state_type,
|
||||
CLBorderType tl, CLBorderType tr,
|
||||
CLBorderType bl, CLBorderType br,
|
||||
gboolean has_focus);
|
||||
|
||||
void cl_draw_shadow(GdkWindow *window, GtkWidget *widget, GtkStyle *style,
|
||||
int x, int y, int width, int height, CLRectangle *r);
|
||||
|
||||
void cl_rectangle_set_clip_rectangle (CLRectangle *r, GdkRectangle *area);
|
||||
void cl_rectangle_reset_clip_rectangle (CLRectangle *r);
|
||||
|
||||
void cl_set_corner_sharpness (const gchar *detail, GtkWidget *widget, CLRectangle *r);
|
||||
|
||||
|
||||
void cl_rectangle_set_corners (CLRectangle *r, int tl, int tr, int bl, int br);
|
||||
|
||||
void cl_rectangle_init (CLRectangle *r, GdkGC *fillgc, GdkGC *bordergc,
|
||||
int tl, int tr, int bl, int br);
|
||||
|
||||
void cl_rectangle_reset (CLRectangle *r, GtkStyle *style);
|
||||
|
||||
|
||||
GdkPixmap* cl_progressbar_tile_new (GdkDrawable *drawable, GtkWidget *widget,
|
||||
GtkStyle *style, gint height, gint offset);
|
||||
|
||||
void cl_progressbar_fill (GdkDrawable *drawable, GtkWidget *widget,
|
||||
GtkStyle *style, GdkGC *gc,
|
||||
gint x, gint y, gint width, gint height,
|
||||
guint8 offset, GdkRectangle *area);
|
||||
|
||||
GdkColor cl_gc_set_fg_color_shade (GdkGC *gc, GdkColormap *colormap,
|
||||
GdkColor *from, gfloat s);
|
||||
|
||||
void cl_draw_spinbutton(GtkStyle *style, GdkWindow *window,
|
||||
GtkStateType state_type, GtkShadowType shadow_type,
|
||||
GdkRectangle *area,
|
||||
GtkWidget *widget, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height);
|
||||
|
||||
void cl_draw_button(GtkStyle *style, GdkWindow *window,
|
||||
GtkStateType state_type, GtkShadowType shadow_type,
|
||||
GdkRectangle *area,
|
||||
GtkWidget *widget, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height);
|
||||
|
||||
void cl_draw_entry (GtkStyle *style, GdkWindow *window,
|
||||
GtkStateType state_type, GtkShadowType shadow_type,
|
||||
GdkRectangle *area,
|
||||
GtkWidget *widget, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height);
|
||||
|
||||
void cl_draw_combobox_entry (GtkStyle *style, GdkWindow *window,
|
||||
GtkStateType state_type, GtkShadowType shadow_type,
|
||||
GdkRectangle *area,
|
||||
GtkWidget *widget, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height);
|
||||
|
||||
void cl_draw_combobox_button (GtkStyle *style, GdkWindow *window,
|
||||
GtkStateType state_type, GtkShadowType shadow_type,
|
||||
GdkRectangle *area,
|
||||
GtkWidget *widget, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height);
|
||||
|
||||
void cl_draw_menuitem_button (GdkDrawable *window, GtkWidget *widget, GtkStyle *style,
|
||||
GdkRectangle *area, GtkStateType state_type,
|
||||
int x, int y, int wiidth, int height, CLRectangle *r);
|
||||
|
||||
void cl_draw_menuitem_flat (GdkDrawable *window, GtkWidget *widget, GtkStyle *style,
|
||||
GdkRectangle *area, GtkStateType state_type,
|
||||
int x, int y, int wiidth, int height, CLRectangle *r);
|
||||
|
||||
void cl_draw_menuitem_gradient (GdkDrawable *window, GtkWidget *widget, GtkStyle *style,
|
||||
GdkRectangle *area, GtkStateType state_type,
|
||||
int x, int y, int wiidth, int height, CLRectangle *r);
|
||||
|
||||
void cl_draw_treeview_header (GtkStyle *style, GdkWindow *window,
|
||||
GtkStateType state_type, GtkShadowType shadow_type,
|
||||
GdkRectangle *area,
|
||||
GtkWidget *widget, const gchar *detail,
|
||||
gint x, gint y, gint width, gint height);
|
||||
|
||||
#endif /* CLEARLOOKS_DRAW_H */
|
||||
|
|
@ -1,392 +0,0 @@
|
|||
/* Clearlooks theme engine
|
||||
* Copyright (C) 2005 Richard Stellingwerff.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Written by Owen Taylor <otaylor@redhat.com>
|
||||
* and by Alexander Larsson <alexl@redhat.com>
|
||||
* Modified by Richard Stellingwerff <remenic@gmail.com>
|
||||
*/
|
||||
|
||||
#include "clearlooks_style.h"
|
||||
#include "clearlooks_rc_style.h"
|
||||
|
||||
static void clearlooks_rc_style_init (ClearlooksRcStyle *style);
|
||||
static void clearlooks_rc_style_class_init (ClearlooksRcStyleClass *klass);
|
||||
static GtkStyle *clearlooks_rc_style_create_style (GtkRcStyle *rc_style);
|
||||
static guint clearlooks_rc_style_parse (GtkRcStyle *rc_style,
|
||||
GtkSettings *settings,
|
||||
GScanner *scanner);
|
||||
static void clearlooks_rc_style_merge (GtkRcStyle *dest,
|
||||
GtkRcStyle *src);
|
||||
|
||||
|
||||
static GtkRcStyleClass *parent_class;
|
||||
|
||||
GType clearlooks_type_rc_style = 0;
|
||||
|
||||
enum
|
||||
{
|
||||
TOKEN_SPOTCOLOR = G_TOKEN_LAST + 1,
|
||||
TOKEN_CONTRAST,
|
||||
TOKEN_SUNKENMENU,
|
||||
TOKEN_PROGRESSBARSTYLE,
|
||||
TOKEN_MENUBARSTYLE,
|
||||
TOKEN_MENUITEMSTYLE,
|
||||
TOKEN_LISTVIEWITEMSTYLE
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
const gchar *name;
|
||||
guint token;
|
||||
}
|
||||
theme_symbols[] =
|
||||
{
|
||||
{ "spotcolor", TOKEN_SPOTCOLOR },
|
||||
{ "contrast", TOKEN_CONTRAST },
|
||||
{ "sunkenmenubar", TOKEN_SUNKENMENU },
|
||||
{ "progressbarstyle", TOKEN_PROGRESSBARSTYLE },
|
||||
{ "menubarstyle", TOKEN_MENUBARSTYLE },
|
||||
{ "menuitemstyle", TOKEN_MENUITEMSTYLE },
|
||||
{ "listviewitemstyle", TOKEN_LISTVIEWITEMSTYLE }
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
clearlooks_rc_style_register_type (GTypeModule *module)
|
||||
{
|
||||
static const GTypeInfo object_info =
|
||||
{
|
||||
sizeof (ClearlooksRcStyleClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) clearlooks_rc_style_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (ClearlooksRcStyle),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) clearlooks_rc_style_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
clearlooks_type_rc_style = g_type_module_register_type (module,
|
||||
GTK_TYPE_RC_STYLE,
|
||||
"ClearlooksRcStyle",
|
||||
&object_info, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
clearlooks_rc_style_init (ClearlooksRcStyle *clearlooks_rc)
|
||||
{
|
||||
clearlooks_rc->has_spot_color = FALSE;
|
||||
clearlooks_rc->contrast = 1.0;
|
||||
clearlooks_rc->sunkenmenubar = 1;
|
||||
clearlooks_rc->progressbarstyle = 0;
|
||||
clearlooks_rc->menubarstyle = 0;
|
||||
clearlooks_rc->menuitemstyle = 1;
|
||||
clearlooks_rc->listviewitemstyle = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
clearlooks_rc_style_class_init (ClearlooksRcStyleClass *klass)
|
||||
{
|
||||
GtkRcStyleClass *rc_style_class = GTK_RC_STYLE_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
rc_style_class->parse = clearlooks_rc_style_parse;
|
||||
rc_style_class->create_style = clearlooks_rc_style_create_style;
|
||||
rc_style_class->merge = clearlooks_rc_style_merge;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_color(GtkSettings *settings,
|
||||
GScanner *scanner,
|
||||
GdkColor *color)
|
||||
{
|
||||
guint token;
|
||||
|
||||
/* Skip 'blah_color' */
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
return gtk_rc_parse_color (scanner, color);
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_contrast(GtkSettings *settings,
|
||||
GScanner *scanner,
|
||||
double *contrast)
|
||||
{
|
||||
guint token;
|
||||
|
||||
/* Skip 'contrast' */
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_FLOAT)
|
||||
return G_TOKEN_FLOAT;
|
||||
|
||||
*contrast = scanner->value.v_float;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_sunkenmenubar(GtkSettings *settings,
|
||||
GScanner *scanner,
|
||||
guint8 *sunken)
|
||||
{
|
||||
guint token;
|
||||
|
||||
/* Skip 'sunkenmenubar' */
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_INT)
|
||||
return G_TOKEN_INT;
|
||||
|
||||
*sunken = scanner->value.v_int;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_progressbarstyle(GtkSettings *settings,
|
||||
GScanner *scanner,
|
||||
guint8 *progressbarstyle)
|
||||
{
|
||||
guint token;
|
||||
|
||||
/* Skip 'sunkenmenubar' */
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_INT)
|
||||
return G_TOKEN_INT;
|
||||
|
||||
*progressbarstyle = scanner->value.v_int;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_menubarstyle(GtkSettings *settings,
|
||||
GScanner *scanner,
|
||||
guint8 *menubarstyle)
|
||||
{
|
||||
guint token;
|
||||
|
||||
/* Skip 'menubarstyle' */
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_INT)
|
||||
return G_TOKEN_INT;
|
||||
|
||||
*menubarstyle = scanner->value.v_int;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_menuitemstyle(GtkSettings *settings,
|
||||
GScanner *scanner,
|
||||
guint8 *menuitemstyle)
|
||||
{
|
||||
guint token;
|
||||
|
||||
/* Skip 'sunkenmenubar' */
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_INT)
|
||||
return G_TOKEN_INT;
|
||||
|
||||
*menuitemstyle = scanner->value.v_int;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_listviewitemstyle(GtkSettings *settings,
|
||||
GScanner *scanner,
|
||||
guint8 *listviewitemstyle)
|
||||
{
|
||||
guint token;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_INT)
|
||||
return G_TOKEN_INT;
|
||||
|
||||
*listviewitemstyle = scanner->value.v_int;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
clearlooks_rc_style_parse (GtkRcStyle *rc_style,
|
||||
GtkSettings *settings,
|
||||
GScanner *scanner)
|
||||
|
||||
{
|
||||
static GQuark scope_id = 0;
|
||||
ClearlooksRcStyle *clearlooks_style = CLEARLOOKS_RC_STYLE (rc_style);
|
||||
|
||||
guint old_scope;
|
||||
guint token;
|
||||
guint i;
|
||||
|
||||
/* Set up a new scope in this scanner. */
|
||||
|
||||
if (!scope_id)
|
||||
scope_id = g_quark_from_string("clearlooks_theme_engine");
|
||||
|
||||
/* If we bail out due to errors, we *don't* reset the scope, so the
|
||||
* error messaging code can make sense of our tokens.
|
||||
*/
|
||||
old_scope = g_scanner_set_scope(scanner, scope_id);
|
||||
|
||||
/* Now check if we already added our symbols to this scope
|
||||
* (in some previous call to clearlooks_rc_style_parse for the
|
||||
* same scanner.
|
||||
*/
|
||||
|
||||
if (!g_scanner_lookup_symbol(scanner, theme_symbols[0].name))
|
||||
{
|
||||
g_scanner_freeze_symbol_table(scanner);
|
||||
for (i = 0; i < G_N_ELEMENTS (theme_symbols); i++)
|
||||
g_scanner_scope_add_symbol(scanner, scope_id,
|
||||
theme_symbols[i].name,
|
||||
GINT_TO_POINTER(theme_symbols[i].token));
|
||||
g_scanner_thaw_symbol_table(scanner);
|
||||
}
|
||||
|
||||
/* We're ready to go, now parse the top level */
|
||||
|
||||
token = g_scanner_peek_next_token(scanner);
|
||||
while (token != G_TOKEN_RIGHT_CURLY)
|
||||
{
|
||||
switch (token)
|
||||
{
|
||||
case TOKEN_SPOTCOLOR:
|
||||
token = theme_parse_color(settings, scanner, &clearlooks_style->spot_color);
|
||||
clearlooks_style->has_spot_color = TRUE;
|
||||
break;
|
||||
case TOKEN_CONTRAST:
|
||||
token = theme_parse_contrast(settings, scanner, &clearlooks_style->contrast);
|
||||
break;
|
||||
case TOKEN_SUNKENMENU:
|
||||
token = theme_parse_sunkenmenubar(settings, scanner, &clearlooks_style->sunkenmenubar);
|
||||
break;
|
||||
case TOKEN_PROGRESSBARSTYLE:
|
||||
token = theme_parse_progressbarstyle(settings, scanner, &clearlooks_style->progressbarstyle);
|
||||
break;
|
||||
case TOKEN_MENUBARSTYLE:
|
||||
token = theme_parse_menubarstyle(settings, scanner, &clearlooks_style->menubarstyle);
|
||||
break;
|
||||
case TOKEN_MENUITEMSTYLE:
|
||||
token = theme_parse_menuitemstyle(settings, scanner, &clearlooks_style->menuitemstyle);
|
||||
break;
|
||||
case TOKEN_LISTVIEWITEMSTYLE:
|
||||
token = theme_parse_listviewitemstyle(settings, scanner, &clearlooks_style->listviewitemstyle);
|
||||
break;
|
||||
default:
|
||||
g_scanner_get_next_token(scanner);
|
||||
token = G_TOKEN_RIGHT_CURLY;
|
||||
break;
|
||||
}
|
||||
|
||||
if (token != G_TOKEN_NONE)
|
||||
return token;
|
||||
|
||||
token = g_scanner_peek_next_token(scanner);
|
||||
}
|
||||
|
||||
g_scanner_get_next_token(scanner);
|
||||
|
||||
g_scanner_set_scope(scanner, old_scope);
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
clearlooks_rc_style_merge (GtkRcStyle *dest,
|
||||
GtkRcStyle *src)
|
||||
{
|
||||
ClearlooksRcStyle *dest_w, *src_w;
|
||||
|
||||
parent_class->merge (dest, src);
|
||||
|
||||
if (!CLEARLOOKS_IS_RC_STYLE (src))
|
||||
return;
|
||||
|
||||
src_w = CLEARLOOKS_RC_STYLE (src);
|
||||
dest_w = CLEARLOOKS_RC_STYLE (dest);
|
||||
|
||||
dest_w->contrast = src_w->contrast;
|
||||
dest_w->sunkenmenubar = src_w->sunkenmenubar;
|
||||
dest_w->progressbarstyle = src_w->progressbarstyle;
|
||||
dest_w->menubarstyle = src_w->menubarstyle;
|
||||
dest_w->menuitemstyle = src_w->menuitemstyle;
|
||||
dest_w->listviewitemstyle = src_w->listviewitemstyle;
|
||||
|
||||
if (src_w->has_spot_color)
|
||||
{
|
||||
dest_w->has_spot_color = TRUE;
|
||||
dest_w->spot_color = src_w->spot_color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Create an empty style suitable to this RC style
|
||||
*/
|
||||
static GtkStyle *
|
||||
clearlooks_rc_style_create_style (GtkRcStyle *rc_style)
|
||||
{
|
||||
return GTK_STYLE (g_object_new (CLEARLOOKS_TYPE_STYLE, NULL));
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/* Clearlooks Theme Engine
|
||||
* Copyright (C) 2005 Richard Stellingwerff.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Written by Owen Taylor <otaylor@redhat.com>
|
||||
* and by Alexander Larsson <alexl@redhat.com>
|
||||
* Modified by Richard Stellingwerff <remenic@gmail.com>
|
||||
*/
|
||||
|
||||
#include <gtk/gtkrc.h>
|
||||
|
||||
typedef struct _ClearlooksRcStyle ClearlooksRcStyle;
|
||||
typedef struct _ClearlooksRcStyleClass ClearlooksRcStyleClass;
|
||||
|
||||
extern GType clearlooks_type_rc_style;
|
||||
|
||||
#define CLEARLOOKS_TYPE_RC_STYLE clearlooks_type_rc_style
|
||||
#define CLEARLOOKS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), CLEARLOOKS_TYPE_RC_STYLE, ClearlooksRcStyle))
|
||||
#define CLEARLOOKS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLEARLOOKS_TYPE_RC_STYLE, ClearlooksRcStyleClass))
|
||||
#define CLEARLOOKS_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), CLEARLOOKS_TYPE_RC_STYLE))
|
||||
#define CLEARLOOKS_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLEARLOOKS_TYPE_RC_STYLE))
|
||||
#define CLEARLOOKS_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLEARLOOKS_TYPE_RC_STYLE, ClearlooksRcStyleClass))
|
||||
|
||||
struct _ClearlooksRcStyle
|
||||
{
|
||||
GtkRcStyle parent_instance;
|
||||
|
||||
GdkColor spot_color;
|
||||
gboolean has_spot_color;
|
||||
double contrast;
|
||||
guint8 sunkenmenubar;
|
||||
guint8 progressbarstyle;
|
||||
guint8 menubarstyle;
|
||||
guint8 menuitemstyle;
|
||||
guint8 listviewitemstyle;
|
||||
};
|
||||
|
||||
struct _ClearlooksRcStyleClass
|
||||
{
|
||||
GtkRcStyleClass parent_class;
|
||||
};
|
||||
|
||||
void clearlooks_rc_style_register_type (GTypeModule *module);
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,108 +0,0 @@
|
|||
/* Clearlooks Engine
|
||||
* Copyright (C) 2005 Richard Stellingwerff.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Written by Owen Taylor <otaylor@redhat.com>
|
||||
* and by Alexander Larsson <alexl@redhat.com>
|
||||
* Modified by Richard Stellingwerff <remenic@gmail.com>
|
||||
*/
|
||||
#include <gtk/gtkstyle.h>
|
||||
|
||||
#include "clearlooks_draw.h"
|
||||
|
||||
typedef struct _ClearlooksStyle ClearlooksStyle;
|
||||
typedef struct _ClearlooksStyleClass ClearlooksStyleClass;
|
||||
|
||||
extern GType clearlooks_type_style;
|
||||
|
||||
#define CLEARLOOKS_TYPE_STYLE clearlooks_type_style
|
||||
#define CLEARLOOKS_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), CLEARLOOKS_TYPE_STYLE, ClearlooksStyle))
|
||||
#define CLEARLOOKS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLEARLOOKS_TYPE_STYLE, ClearlooksStyleClass))
|
||||
#define CLEARLOOKS_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), CLEARLOOKS_TYPE_STYLE))
|
||||
#define CLEARLOOKS_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLEARLOOKS_TYPE_STYLE))
|
||||
#define CLEARLOOKS_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLEARLOOKS_TYPE_STYLE, ClearlooksStyleClass))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CL_BORDER_UPPER = 0,
|
||||
CL_BORDER_LOWER,
|
||||
CL_BORDER_UPPER_ACTIVE,
|
||||
CL_BORDER_LOWER_ACTIVE,
|
||||
CL_BORDER_COUNT
|
||||
} ClBorderColorType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CL_SCROLLBUTTON_BEGIN = 0,
|
||||
CL_SCROLLBUTTON_END,
|
||||
CL_SCROLLBUTTON_OTHER
|
||||
} ClScrollButtonType;
|
||||
|
||||
struct _ClearlooksStyle
|
||||
{
|
||||
GtkStyle parent_instance;
|
||||
|
||||
GdkColor shade[9];
|
||||
|
||||
GdkColor spot_color;
|
||||
GdkColor spot1;
|
||||
GdkColor spot2;
|
||||
GdkColor spot3;
|
||||
|
||||
GdkColor border[CL_BORDER_COUNT];
|
||||
|
||||
/* from light to dark */
|
||||
GdkGC *shade_gc[9];
|
||||
GdkGC *border_gc[CL_BORDER_COUNT];
|
||||
|
||||
GdkGC *spot1_gc;
|
||||
GdkGC *spot2_gc;
|
||||
GdkGC *spot3_gc;
|
||||
|
||||
GdkColor inset_light[5];
|
||||
GdkColor inset_dark[5];
|
||||
|
||||
GdkColor button_g1[5];
|
||||
GdkColor button_g2[5];
|
||||
GdkColor button_g3[5];
|
||||
GdkColor button_g4[5];
|
||||
|
||||
GdkColor listview_bg[5];
|
||||
|
||||
GdkPixmap *radio_pixmap_nonactive[5];
|
||||
GdkPixmap *radio_pixmap_active[5];
|
||||
GdkPixmap *radio_pixmap_inconsistent[5];
|
||||
GdkBitmap *radio_pixmap_mask; /* All masks are the same */
|
||||
|
||||
GdkPixmap *check_pixmap_nonactive[5];
|
||||
GdkPixmap *check_pixmap_active[5];
|
||||
GdkPixmap *check_pixmap_inconsistent[5];
|
||||
|
||||
gboolean sunkenmenubar:1;
|
||||
|
||||
guint8 progressbarstyle;
|
||||
guint8 menubarstyle;
|
||||
guint8 menuitemstyle;
|
||||
guint8 listviewitemstyle;
|
||||
};
|
||||
|
||||
struct _ClearlooksStyleClass
|
||||
{
|
||||
GtkStyleClass parent_class;
|
||||
};
|
||||
|
||||
void clearlooks_style_register_type (GTypeModule *module);
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
#include <gmodule.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "clearlooks_style.h"
|
||||
#include "clearlooks_rc_style.h"
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
theme_init (GTypeModule *module)
|
||||
{
|
||||
clearlooks_rc_style_register_type (module);
|
||||
clearlooks_style_register_type (module);
|
||||
printf("theme_init() called from internal clearlooks engine\n");
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
theme_exit (void)
|
||||
{
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT GtkRcStyle *
|
||||
theme_create_rc_style (void)
|
||||
{
|
||||
return GTK_RC_STYLE (g_object_new (CLEARLOOKS_TYPE_RC_STYLE, NULL));
|
||||
}
|
||||
|
||||
/* The following function will be called by GTK+ when the module
|
||||
* is loaded and checks to see if we are compatible with the
|
||||
* version of GTK+ that loads us.
|
||||
*/
|
||||
G_MODULE_EXPORT const gchar* g_module_check_init (GModule *module);
|
||||
const gchar*
|
||||
g_module_check_init (GModule *module)
|
||||
{
|
||||
return gtk_check_version (GTK_MAJOR_VERSION,
|
||||
GTK_MINOR_VERSION,
|
||||
GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
mkdir engines
|
||||
cp libclearlooks.so engines
|
||||
|
|
@ -1,981 +0,0 @@
|
|||
#include "support.h"
|
||||
|
||||
/* #define ALWAYS_DITHER_GRADIENTS */
|
||||
|
||||
GtkTextDirection
|
||||
get_direction (GtkWidget *widget)
|
||||
{
|
||||
GtkTextDirection dir;
|
||||
|
||||
if (widget)
|
||||
dir = gtk_widget_get_direction (widget);
|
||||
else
|
||||
dir = GTK_TEXT_DIR_LTR;
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
generate_bit (unsigned char alpha[], GdkColor *color, double mult)
|
||||
{
|
||||
guint r, g, b;
|
||||
GdkPixbuf *pixbuf;
|
||||
unsigned char *pixels;
|
||||
int w, h, rs;
|
||||
int x, y;
|
||||
|
||||
r = (color->red >> 8) * mult;
|
||||
r = MIN(r, 255);
|
||||
g = (color->green >> 8) * mult;
|
||||
g = MIN(g, 255);
|
||||
b = (color->blue >> 8) * mult;
|
||||
b = MIN(b, 255);
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, RADIO_SIZE, RADIO_SIZE);
|
||||
|
||||
w = gdk_pixbuf_get_width (pixbuf);
|
||||
h = gdk_pixbuf_get_height (pixbuf);
|
||||
rs = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
|
||||
|
||||
for (y=0; y < h; y++)
|
||||
{
|
||||
for (x=0; x < w; x++)
|
||||
{
|
||||
pixels[y*rs + x*4 + 0] = r;
|
||||
pixels[y*rs + x*4 + 1] = g;
|
||||
pixels[y*rs + x*4 + 2] = b;
|
||||
if (alpha)
|
||||
pixels[y*rs + x*4 + 3] = alpha[y*w + x];
|
||||
else
|
||||
pixels[y*rs + x*4 + 3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
#define CLAMP_UCHAR(v) ((guchar) (CLAMP (((int)v), (int)0, (int)255)))
|
||||
|
||||
GdkPixbuf *
|
||||
colorize_bit (unsigned char *bit,
|
||||
unsigned char *alpha,
|
||||
GdkColor *new_color)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
double intensity;
|
||||
int x, y;
|
||||
const guchar *src, *asrc;
|
||||
guchar *dest;
|
||||
int dest_rowstride;
|
||||
int width, height;
|
||||
guchar *dest_pixels;
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, RADIO_SIZE, RADIO_SIZE);
|
||||
|
||||
if (pixbuf == NULL)
|
||||
return NULL;
|
||||
|
||||
dest_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
dest_pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
|
||||
for (y = 0; y < RADIO_SIZE; y++)
|
||||
{
|
||||
src = bit + y * RADIO_SIZE;
|
||||
asrc = alpha + y * RADIO_SIZE;
|
||||
dest = dest_pixels + y * dest_rowstride;
|
||||
|
||||
for (x = 0; x < RADIO_SIZE; x++)
|
||||
{
|
||||
double dr, dg, db;
|
||||
|
||||
intensity = (src[x] + 0 )/ 255.0;
|
||||
|
||||
if (intensity <= 0.5)
|
||||
{
|
||||
/* Go from black at intensity = 0.0 to new_color at intensity = 0.5 */
|
||||
dr = (new_color->red * intensity * 2.0) / 65535.0;
|
||||
dg = (new_color->green * intensity * 2.0) / 65535.0;
|
||||
db = (new_color->blue * intensity * 2.0) / 65535.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Go from new_color at intensity = 0.5 to white at intensity = 1.0 */
|
||||
dr = (new_color->red + (65535 - new_color->red) * (intensity - 0.5) * 2.0) / 65535.0;
|
||||
dg = (new_color->green + (65535 - new_color->green) * (intensity - 0.5) * 2.0) / 65535.0;
|
||||
db = (new_color->blue + (65535 - new_color->blue) * (intensity - 0.5) * 2.0) / 65535.0;
|
||||
}
|
||||
|
||||
dest[0] = CLAMP_UCHAR (255 * dr);
|
||||
dest[1] = CLAMP_UCHAR (255 * dg);
|
||||
dest[2] = CLAMP_UCHAR (255 * db);
|
||||
|
||||
dest[3] = asrc[x];
|
||||
dest += 4;
|
||||
}
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixmap *
|
||||
pixbuf_to_pixmap (GtkStyle *style,
|
||||
GdkPixbuf *pixbuf,
|
||||
GdkScreen *screen)
|
||||
{
|
||||
GdkGC *tmp_gc;
|
||||
GdkPixmap *pixmap;
|
||||
|
||||
pixmap = gdk_pixmap_new (gdk_screen_get_root_window (screen),
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
style->depth);
|
||||
|
||||
gdk_drawable_set_colormap (pixmap, style->colormap);
|
||||
|
||||
tmp_gc = gdk_gc_new (pixmap);
|
||||
|
||||
gdk_pixbuf_render_to_drawable (pixbuf, pixmap, tmp_gc, 0, 0, 0, 0,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
GDK_RGB_DITHER_NORMAL, 0, 0);
|
||||
|
||||
gdk_gc_unref (tmp_gc);
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rgb_to_hls (gdouble *r,
|
||||
gdouble *g,
|
||||
gdouble *b)
|
||||
{
|
||||
gdouble min;
|
||||
gdouble max;
|
||||
gdouble red;
|
||||
gdouble green;
|
||||
gdouble blue;
|
||||
gdouble h, l, s;
|
||||
gdouble delta;
|
||||
|
||||
red = *r;
|
||||
green = *g;
|
||||
blue = *b;
|
||||
|
||||
if (red > green)
|
||||
{
|
||||
if (red > blue)
|
||||
max = red;
|
||||
else
|
||||
max = blue;
|
||||
|
||||
if (green < blue)
|
||||
min = green;
|
||||
else
|
||||
min = blue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (green > blue)
|
||||
max = green;
|
||||
else
|
||||
max = blue;
|
||||
|
||||
if (red < blue)
|
||||
min = red;
|
||||
else
|
||||
min = blue;
|
||||
}
|
||||
|
||||
l = (max + min) / 2;
|
||||
s = 0;
|
||||
h = 0;
|
||||
|
||||
if (max != min)
|
||||
{
|
||||
if (l <= 0.5)
|
||||
s = (max - min) / (max + min);
|
||||
else
|
||||
s = (max - min) / (2 - max - min);
|
||||
|
||||
delta = max -min;
|
||||
if (red == max)
|
||||
h = (green - blue) / delta;
|
||||
else if (green == max)
|
||||
h = 2 + (blue - red) / delta;
|
||||
else if (blue == max)
|
||||
h = 4 + (red - green) / delta;
|
||||
|
||||
h *= 60;
|
||||
if (h < 0.0)
|
||||
h += 360;
|
||||
}
|
||||
|
||||
*r = h;
|
||||
*g = l;
|
||||
*b = s;
|
||||
}
|
||||
|
||||
void
|
||||
hls_to_rgb (gdouble *h,
|
||||
gdouble *l,
|
||||
gdouble *s)
|
||||
{
|
||||
gdouble hue;
|
||||
gdouble lightness;
|
||||
gdouble saturation;
|
||||
gdouble m1, m2;
|
||||
gdouble r, g, b;
|
||||
|
||||
lightness = *l;
|
||||
saturation = *s;
|
||||
|
||||
if (lightness <= 0.5)
|
||||
m2 = lightness * (1 + saturation);
|
||||
else
|
||||
m2 = lightness + saturation - lightness * saturation;
|
||||
|
||||
m1 = 2 * lightness - m2;
|
||||
|
||||
if (saturation == 0)
|
||||
{
|
||||
*h = lightness;
|
||||
*l = lightness;
|
||||
*s = lightness;
|
||||
}
|
||||
else
|
||||
{
|
||||
hue = *h + 120;
|
||||
while (hue > 360)
|
||||
hue -= 360;
|
||||
while (hue < 0)
|
||||
hue += 360;
|
||||
|
||||
if (hue < 60)
|
||||
r = m1 + (m2 - m1) * hue / 60;
|
||||
else if (hue < 180)
|
||||
r = m2;
|
||||
else if (hue < 240)
|
||||
r = m1 + (m2 - m1) * (240 - hue) / 60;
|
||||
else
|
||||
r = m1;
|
||||
|
||||
hue = *h;
|
||||
while (hue > 360)
|
||||
hue -= 360;
|
||||
while (hue < 0)
|
||||
hue += 360;
|
||||
|
||||
if (hue < 60)
|
||||
g = m1 + (m2 - m1) * hue / 60;
|
||||
else if (hue < 180)
|
||||
g = m2;
|
||||
else if (hue < 240)
|
||||
g = m1 + (m2 - m1) * (240 - hue) / 60;
|
||||
else
|
||||
g = m1;
|
||||
|
||||
hue = *h - 120;
|
||||
while (hue > 360)
|
||||
hue -= 360;
|
||||
while (hue < 0)
|
||||
hue += 360;
|
||||
|
||||
if (hue < 60)
|
||||
b = m1 + (m2 - m1) * hue / 60;
|
||||
else if (hue < 180)
|
||||
b = m2;
|
||||
else if (hue < 240)
|
||||
b = m1 + (m2 - m1) * (240 - hue) / 60;
|
||||
else
|
||||
b = m1;
|
||||
|
||||
*h = r;
|
||||
*l = g;
|
||||
*s = b;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
shade (GdkColor * a, GdkColor * b, float k)
|
||||
{
|
||||
gdouble red;
|
||||
gdouble green;
|
||||
gdouble blue;
|
||||
|
||||
red = (gdouble) a->red / 65535.0;
|
||||
green = (gdouble) a->green / 65535.0;
|
||||
blue = (gdouble) a->blue / 65535.0;
|
||||
|
||||
rgb_to_hls (&red, &green, &blue);
|
||||
|
||||
green *= k;
|
||||
if (green > 1.0)
|
||||
green = 1.0;
|
||||
else if (green < 0.0)
|
||||
green = 0.0;
|
||||
|
||||
blue *= k;
|
||||
if (blue > 1.0)
|
||||
blue = 1.0;
|
||||
else if (blue < 0.0)
|
||||
blue = 0.0;
|
||||
|
||||
hls_to_rgb (&red, &green, &blue);
|
||||
|
||||
b->red = red * 65535.0;
|
||||
b->green = green * 65535.0;
|
||||
b->blue = blue * 65535.0;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
void
|
||||
arrow_draw_hline (GdkWindow *window,
|
||||
GdkGC *gc,
|
||||
int x1,
|
||||
int x2,
|
||||
int y,
|
||||
gboolean last)
|
||||
{
|
||||
if (x2 - x1 < 7 && !last) /* 7 to get garretts pixels, otherwise 6 */
|
||||
{
|
||||
gdk_draw_line (window, gc, x1, y, x2, y);
|
||||
}
|
||||
else if (last)
|
||||
{
|
||||
/* we don't draw "spikes" for very small arrows */
|
||||
if (x2 - x1 <= 9)
|
||||
{
|
||||
/*gdk_draw_line (window, gc, x1+1, y, x1+1, y);
|
||||
gdk_draw_line (window, gc, x2-1, y, x2-1, y);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_draw_line (window, gc, x1+2, y, x1+2, y);
|
||||
gdk_draw_line (window, gc, x2-2, y, x2-2, y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_draw_line (window, gc, x1, y, x1+2, y);
|
||||
gdk_draw_line (window, gc, x2-2, y, x2, y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
arrow_draw_vline (GdkWindow *window,
|
||||
GdkGC *gc,
|
||||
int y1,
|
||||
int y2,
|
||||
int x,
|
||||
gboolean last)
|
||||
{
|
||||
if (y2 - y1 < 7 && !last) /* 7 to get garretts pixels */
|
||||
gdk_draw_line (window, gc, x, y1, x, y2);
|
||||
else if (last)
|
||||
{
|
||||
/* we don't draw "spikes" for very small arrows */
|
||||
if (y2 - y1 > 9) {
|
||||
gdk_draw_line (window, gc, x, y1+2, x, y1+2);
|
||||
gdk_draw_line (window, gc, x, y2-2, x, y2-2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_draw_line (window, gc, x, y1, x, y1+2);
|
||||
gdk_draw_line (window, gc, x, y2-2, x, y2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
draw_arrow (GdkWindow *window,
|
||||
GdkGC *gc,
|
||||
GdkRectangle *area,
|
||||
GtkArrowType arrow_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
if (area)
|
||||
gdk_gc_set_clip_rectangle (gc, area);
|
||||
|
||||
if (arrow_type == GTK_ARROW_DOWN)
|
||||
{
|
||||
for (i = 0, j = -1; i < height; i++, j++)
|
||||
arrow_draw_hline (window, gc, x + j, x + width - j - 1, y + i, i == 0);
|
||||
|
||||
}
|
||||
else if (arrow_type == GTK_ARROW_UP)
|
||||
{
|
||||
for (i = height - 1, j = -1; i >= 0; i--, j++)
|
||||
arrow_draw_hline (window, gc, x + j, x + width - j - 1, y + i, i == height - 1);
|
||||
}
|
||||
else if (arrow_type == GTK_ARROW_LEFT)
|
||||
{
|
||||
for (i = width - 1, j = -1; i >= 0; i--, j++)
|
||||
arrow_draw_vline (window, gc, y + j, y + height - j - 1, x + i, i == width - 1);
|
||||
}
|
||||
else if (arrow_type == GTK_ARROW_RIGHT)
|
||||
{
|
||||
for (i = 0, j = -1; i < width; i++, j++)
|
||||
arrow_draw_vline (window, gc, y + j, y + height - j - 1, x + i, i == 0);
|
||||
}
|
||||
|
||||
if (area)
|
||||
gdk_gc_set_clip_rectangle (gc, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
calculate_arrow_geometry (GtkArrowType arrow_type,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
gint w = *width;
|
||||
gint h = *height;
|
||||
|
||||
switch (arrow_type)
|
||||
{
|
||||
case GTK_ARROW_UP:
|
||||
case GTK_ARROW_DOWN:
|
||||
w += (w % 2) - 1;
|
||||
h = (w / 2 + 1) + 1;
|
||||
|
||||
if (h > *height)
|
||||
{
|
||||
h = *height;
|
||||
w = 2 * (h - 1) - 1;
|
||||
}
|
||||
|
||||
if (arrow_type == GTK_ARROW_DOWN)
|
||||
{
|
||||
if (*height % 2 == 1 || h % 2 == 0)
|
||||
*height += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*height % 2 == 0 || h % 2 == 0)
|
||||
*height -= 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case GTK_ARROW_RIGHT:
|
||||
case GTK_ARROW_LEFT:
|
||||
h += (h % 2) - 1;
|
||||
w = (h / 2 + 1) + 1;
|
||||
|
||||
if (w > *width)
|
||||
{
|
||||
w = *width;
|
||||
h = 2 * (w - 1) - 1;
|
||||
}
|
||||
|
||||
if (arrow_type == GTK_ARROW_RIGHT)
|
||||
{
|
||||
if (*width % 2 == 1 || w % 2 == 0)
|
||||
*width += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*width % 2 == 0 || w % 2 == 0)
|
||||
*width -= 1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* should not be reached */
|
||||
break;
|
||||
}
|
||||
|
||||
*x += (*width - w) / 2;
|
||||
*y += (*height - h) / 2;
|
||||
*height = h;
|
||||
*width = w;
|
||||
}
|
||||
|
||||
|
||||
void gtk_treeview_get_header_index (GtkTreeView *tv, GtkWidget *header,
|
||||
gint *column_index, gint *columns,
|
||||
gboolean *resizable)
|
||||
{
|
||||
GList *list;
|
||||
*column_index = *columns = 0;
|
||||
list = gtk_tree_view_get_columns (tv);
|
||||
|
||||
do
|
||||
{
|
||||
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(list->data);
|
||||
if ( column->button == header )
|
||||
{
|
||||
*column_index = *columns;
|
||||
*resizable = column->resizable;
|
||||
}
|
||||
if ( column->visible )
|
||||
(*columns)++;
|
||||
} while ((list = g_list_next(list)));
|
||||
}
|
||||
|
||||
void gtk_clist_get_header_index (GtkCList *clist, GtkWidget *button,
|
||||
gint *column_index, gint *columns)
|
||||
{
|
||||
*columns = clist->columns;
|
||||
int i;
|
||||
|
||||
for (i=0; i<*columns; i++)
|
||||
{
|
||||
if (clist->column[i].button == button)
|
||||
{
|
||||
*column_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
sanitize_size (GdkWindow *window,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
gboolean set_bg = FALSE;
|
||||
|
||||
if ((*width == -1) && (*height == -1))
|
||||
{
|
||||
set_bg = GDK_IS_WINDOW (window);
|
||||
gdk_window_get_size (window, width, height);
|
||||
}
|
||||
else if (*width == -1)
|
||||
gdk_window_get_size (window, width, NULL);
|
||||
else if (*height == -1)
|
||||
gdk_window_get_size (window, NULL, height);
|
||||
|
||||
return set_bg;
|
||||
}
|
||||
|
||||
static GtkRequisition default_option_indicator_size = { 7, 13 };
|
||||
static GtkBorder default_option_indicator_spacing = { 7, 5, 2, 2 };
|
||||
|
||||
void
|
||||
option_menu_get_props (GtkWidget *widget,
|
||||
GtkRequisition *indicator_size,
|
||||
GtkBorder *indicator_spacing)
|
||||
{
|
||||
GtkRequisition *tmp_size = NULL;
|
||||
GtkBorder *tmp_spacing = NULL;
|
||||
|
||||
if (widget)
|
||||
gtk_widget_style_get (widget, "indicator_size", &tmp_size,
|
||||
"indicator_spacing", &tmp_spacing, NULL);
|
||||
|
||||
if (tmp_size)
|
||||
{
|
||||
*indicator_size = *tmp_size;
|
||||
g_free (tmp_size);
|
||||
}
|
||||
else
|
||||
*indicator_size = default_option_indicator_size;
|
||||
|
||||
if (tmp_spacing)
|
||||
{
|
||||
*indicator_spacing = *tmp_spacing;
|
||||
g_free (tmp_spacing);
|
||||
}
|
||||
else
|
||||
*indicator_spacing = default_option_indicator_spacing;
|
||||
}
|
||||
|
||||
GtkWidget *special_get_ancestor(GtkWidget * widget,
|
||||
GType widget_type)
|
||||
{
|
||||
g_return_val_if_fail(GTK_IS_WIDGET(widget), NULL);
|
||||
|
||||
while (widget && widget->parent
|
||||
&& !g_type_is_a(GTK_WIDGET_TYPE(widget->parent),
|
||||
widget_type))
|
||||
widget = widget->parent;
|
||||
|
||||
if (!
|
||||
(widget && widget->parent
|
||||
&& g_type_is_a(GTK_WIDGET_TYPE(widget->parent), widget_type)))
|
||||
return NULL;
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
/* Dithered Gradient Buffers */
|
||||
static void
|
||||
internel_image_buffer_free_pixels (guchar *pixels, gpointer data)
|
||||
{
|
||||
g_free (pixels);
|
||||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
internal_image_buffer_new (gint width, gint height)
|
||||
{
|
||||
guchar *buf;
|
||||
int rowstride;
|
||||
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
|
||||
rowstride = width * 3;
|
||||
|
||||
buf = g_try_malloc (height * rowstride);
|
||||
|
||||
if (!buf)
|
||||
return NULL;
|
||||
|
||||
return gdk_pixbuf_new_from_data(buf, GDK_COLORSPACE_RGB,
|
||||
FALSE, 8,
|
||||
width, height, rowstride,
|
||||
internel_image_buffer_free_pixels, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
internal_color_get_as_uchars(GdkColor *color,
|
||||
guchar *red,
|
||||
guchar *green,
|
||||
guchar *blue)
|
||||
{
|
||||
*red = (guchar) (color->red / 256.0);
|
||||
*green = (guchar) (color->green / 256.0);
|
||||
*blue = (guchar) (color->blue / 256.0);
|
||||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
internal_create_horizontal_gradient_image_buffer (gint width, gint height,
|
||||
GdkColor *from,
|
||||
GdkColor *to)
|
||||
{
|
||||
int i;
|
||||
long r, g, b, dr, dg, db;
|
||||
GdkPixbuf* buffer;
|
||||
guchar *ptr;
|
||||
guchar *pixels;
|
||||
guchar r0, g0, b0;
|
||||
guchar rf, gf, bf;
|
||||
int rowstride;
|
||||
|
||||
buffer = internal_image_buffer_new (width, height);
|
||||
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
|
||||
pixels = gdk_pixbuf_get_pixels (buffer);
|
||||
ptr = pixels;
|
||||
rowstride = gdk_pixbuf_get_rowstride (buffer);
|
||||
|
||||
internal_color_get_as_uchars(from, &r0, &g0, &b0);
|
||||
internal_color_get_as_uchars(to, &rf, &gf, &bf);
|
||||
|
||||
r = r0 << 16;
|
||||
g = g0 << 16;
|
||||
b = b0 << 16;
|
||||
|
||||
dr = ((rf-r0)<<16)/width;
|
||||
dg = ((gf-g0)<<16)/width;
|
||||
db = ((bf-b0)<<16)/width;
|
||||
|
||||
/* render the first line */
|
||||
for (i=0; i<width; i++)
|
||||
{
|
||||
*(ptr++) = (guchar)(r>>16);
|
||||
*(ptr++) = (guchar)(g>>16);
|
||||
*(ptr++) = (guchar)(b>>16);
|
||||
|
||||
r += dr;
|
||||
g += dg;
|
||||
b += db;
|
||||
}
|
||||
|
||||
/* copy the first line to the other lines */
|
||||
for (i=1; i<height; i++)
|
||||
{
|
||||
memcpy (&(pixels[i*rowstride]), pixels, rowstride);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
internal_create_vertical_gradient_image_buffer (gint width, gint height,
|
||||
GdkColor *from,
|
||||
GdkColor *to)
|
||||
{
|
||||
gint i, j, max_block, last_block;
|
||||
long r, g, b, dr, dg, db;
|
||||
GdkPixbuf *buffer;
|
||||
|
||||
guchar *ptr;
|
||||
guchar point[4];
|
||||
|
||||
guchar r0, g0, b0;
|
||||
guchar rf, gf, bf;
|
||||
|
||||
gint rowstride;
|
||||
guchar *pixels;
|
||||
|
||||
buffer = internal_image_buffer_new (width, height);
|
||||
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
|
||||
pixels = gdk_pixbuf_get_pixels (buffer);
|
||||
rowstride = gdk_pixbuf_get_rowstride (buffer);
|
||||
|
||||
internal_color_get_as_uchars(from, &r0, &g0, &b0);
|
||||
internal_color_get_as_uchars(to, &rf, &gf, &bf);
|
||||
|
||||
r = r0<<16;
|
||||
g = g0<<16;
|
||||
b = b0<<16;
|
||||
|
||||
dr = ((rf-r0)<<16)/height;
|
||||
dg = ((gf-g0)<<16)/height;
|
||||
db = ((bf-b0)<<16)/height;
|
||||
|
||||
max_block = width/2;
|
||||
|
||||
for (i=0; i < height; i++)
|
||||
{
|
||||
ptr = pixels + i * rowstride;
|
||||
|
||||
ptr[0] = r>>16;
|
||||
ptr[1] = g>>16;
|
||||
ptr[2] = b>>16;
|
||||
|
||||
if (width > 1)
|
||||
{
|
||||
last_block = 0;
|
||||
|
||||
for (j=1; j <= max_block; j *= 2)
|
||||
{
|
||||
memcpy (&(ptr[j*3]), ptr, j*3);
|
||||
|
||||
if ((j*2) >= max_block)
|
||||
{
|
||||
last_block = j*2;
|
||||
}
|
||||
}
|
||||
|
||||
if ((last_block < width) && (last_block > 0))
|
||||
{
|
||||
memcpy (&(ptr[last_block*3]), ptr, (width - last_block)*3);
|
||||
}
|
||||
}
|
||||
|
||||
r += dr;
|
||||
g += dg;
|
||||
b += db;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void
|
||||
draw_vgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style,
|
||||
int x, int y, int width, int height,
|
||||
GdkColor *left_color, GdkColor *right_color)
|
||||
{
|
||||
#ifndef ALWAYS_DITHER_GRADIENTS
|
||||
gboolean dither = ((style->depth > 0) && (style->depth <= 16));
|
||||
#endif
|
||||
|
||||
if ((width <= 0) || (height <= 0))
|
||||
return;
|
||||
|
||||
if ( left_color == NULL || right_color == NULL )
|
||||
{
|
||||
gdk_draw_rectangle (drawable, gc, TRUE, x, y, width, height);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef ALWAYS_DITHER_GRADIENTS
|
||||
if (dither)
|
||||
#endif
|
||||
{
|
||||
GdkPixbuf *image_buffer = NULL;
|
||||
|
||||
image_buffer = internal_create_horizontal_gradient_image_buffer (width, height, left_color, right_color);
|
||||
|
||||
if (image_buffer)
|
||||
{
|
||||
gdk_draw_pixbuf(drawable, gc, image_buffer, 0, 0, x, y, width, height, GDK_RGB_DITHER_MAX, 0, 0);
|
||||
|
||||
g_object_unref(image_buffer);
|
||||
}
|
||||
}
|
||||
#ifndef ALWAYS_DITHER_GRADIENTS
|
||||
else
|
||||
{
|
||||
int i;
|
||||
GdkColor col;
|
||||
int dr, dg, db;
|
||||
GdkGCValues old_values;
|
||||
|
||||
gdk_gc_get_values (gc, &old_values);
|
||||
|
||||
if (left_color == right_color )
|
||||
{
|
||||
col = *left_color;
|
||||
gdk_rgb_find_color (style->colormap, &col);
|
||||
gdk_gc_set_foreground (gc, &col);
|
||||
gdk_draw_rectangle (drawable, gc, TRUE, x, y, width, height);
|
||||
gdk_gc_set_foreground (gc, &old_values.foreground);
|
||||
return;
|
||||
}
|
||||
|
||||
col = *left_color;
|
||||
dr = (right_color->red - left_color->red) / width;
|
||||
dg = (right_color->green - left_color->green) / width;
|
||||
db = (right_color->blue - left_color->blue) / width;
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
gdk_rgb_find_color (style->colormap, &col);
|
||||
|
||||
gdk_gc_set_foreground (gc, &col);
|
||||
gdk_draw_line (drawable, gc, x + i, y, x + i, y + height - 1);
|
||||
|
||||
col.red += dr;
|
||||
col.green += dg;
|
||||
col.blue += db;
|
||||
}
|
||||
|
||||
gdk_gc_set_foreground (gc, &old_values.foreground);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
draw_hgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style,
|
||||
int x, int y, int width, int height,
|
||||
GdkColor *top_color, GdkColor *bottom_color)
|
||||
{
|
||||
#ifndef ALWAYS_DITHER_GRADIENTS
|
||||
gboolean dither = ((style->depth > 0) && (style->depth <= 16));
|
||||
#endif
|
||||
|
||||
if ((width <= 0) || (height <= 0))
|
||||
return;
|
||||
|
||||
#ifndef ALWAYS_DITHER_GRADIENTS
|
||||
if (dither)
|
||||
#endif
|
||||
{
|
||||
GdkPixbuf *image_buffer = NULL;
|
||||
|
||||
image_buffer = internal_create_vertical_gradient_image_buffer (width, height, top_color, bottom_color);
|
||||
|
||||
if (image_buffer)
|
||||
{
|
||||
gdk_draw_pixbuf(drawable, gc, image_buffer, 0, 0, x, y, width, height, GDK_RGB_DITHER_MAX, 0, 0);
|
||||
|
||||
g_object_unref(image_buffer);
|
||||
}
|
||||
}
|
||||
#ifndef ALWAYS_DITHER_GRADIENTS
|
||||
else
|
||||
{
|
||||
int i;
|
||||
GdkColor col;
|
||||
int dr, dg, db;
|
||||
GdkGCValues old_values;
|
||||
|
||||
gdk_gc_get_values (gc, &old_values);
|
||||
|
||||
if (top_color == bottom_color )
|
||||
{
|
||||
col = *top_color;
|
||||
gdk_rgb_find_color (style->colormap, &col);
|
||||
gdk_gc_set_foreground (gc, &col);
|
||||
gdk_draw_rectangle (drawable, gc, TRUE, x, y, width, height);
|
||||
gdk_gc_set_foreground (gc, &old_values.foreground);
|
||||
return;
|
||||
}
|
||||
|
||||
col = *top_color;
|
||||
dr = (bottom_color->red - top_color->red) / height;
|
||||
dg = (bottom_color->green - top_color->green) / height;
|
||||
db = (bottom_color->blue - top_color->blue) / height;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
gdk_rgb_find_color (style->colormap, &col);
|
||||
|
||||
gdk_gc_set_foreground (gc, &col);
|
||||
gdk_draw_line (drawable, gc, x, y + i, x + width - 1, y + i);
|
||||
|
||||
col.red += dr;
|
||||
col.green += dg;
|
||||
col.blue += db;
|
||||
}
|
||||
|
||||
gdk_gc_set_foreground (gc, &old_values.foreground);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void blend (GdkColormap *colormap,
|
||||
GdkColor *a, GdkColor *b, GdkColor *c, int alpha)
|
||||
{
|
||||
int inAlpha = 100-alpha;
|
||||
c->red = (a->red * alpha + b->red * inAlpha) / 100;
|
||||
c->green = (a->green * alpha + b->green * inAlpha) / 100;
|
||||
c->blue = (a->blue * alpha + b->blue * inAlpha) / 100;
|
||||
|
||||
gdk_rgb_find_color (colormap, c);
|
||||
}
|
||||
|
||||
GtkWidget *get_parent_window (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *parent = widget->parent;
|
||||
|
||||
while (parent && GTK_WIDGET_NO_WINDOW (parent))
|
||||
parent = parent->parent;
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
GdkColor *get_parent_bgcolor (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *parent = get_parent_window (widget);
|
||||
|
||||
if (parent && parent->style)
|
||||
return &parent->style->bg[GTK_STATE_NORMAL];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
find_combo_box_widget (GtkWidget * widget)
|
||||
{
|
||||
GtkWidget *result = NULL;
|
||||
|
||||
if (widget && !GTK_IS_COMBO_BOX_ENTRY (widget))
|
||||
{
|
||||
if (GTK_IS_COMBO_BOX (widget))
|
||||
result = widget;
|
||||
else
|
||||
result = find_combo_box_widget(widget->parent);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
is_combo_box (GtkWidget * widget)
|
||||
{
|
||||
return (find_combo_box_widget(widget) != NULL);
|
||||
}
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
/* GTK 2.2 compatibility */
|
||||
#ifndef GTK_IS_COMBO_BOX_ENTRY
|
||||
#define GTK_IS_COMBO_BOX_ENTRY(x) 0
|
||||
#endif
|
||||
#ifndef GTK_IS_COMBO_BOX
|
||||
#define GTK_IS_COMBO_BOX(x) 0
|
||||
#endif
|
||||
|
||||
#define RADIO_SIZE 13
|
||||
#define CHECK_SIZE 13
|
||||
|
||||
GtkTextDirection
|
||||
get_direction (GtkWidget *widget);
|
||||
|
||||
GdkPixbuf *
|
||||
generate_bit (unsigned char alpha[],
|
||||
GdkColor *color,
|
||||
double mult);
|
||||
|
||||
GdkPixbuf *
|
||||
colorize_bit (unsigned char *bit,
|
||||
unsigned char *alpha,
|
||||
GdkColor *new_color);
|
||||
|
||||
GdkPixmap *
|
||||
pixbuf_to_pixmap (GtkStyle *style,
|
||||
GdkPixbuf *pixbuf,
|
||||
GdkScreen *screen);
|
||||
|
||||
gboolean
|
||||
sanitize_size (GdkWindow *window,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
void
|
||||
rgb_to_hls (gdouble *r,
|
||||
gdouble *g,
|
||||
gdouble *b);
|
||||
|
||||
void
|
||||
hls_to_rgb (gdouble *h,
|
||||
gdouble *l,
|
||||
gdouble *s);
|
||||
|
||||
void
|
||||
shade (GdkColor * a, GdkColor * b, float k);
|
||||
|
||||
void
|
||||
draw_hgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style,
|
||||
int x, int y, int width, int height,
|
||||
GdkColor *top_color, GdkColor *bottom_color);
|
||||
|
||||
void
|
||||
draw_vgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style,
|
||||
int x, int y, int width, int height,
|
||||
GdkColor *left_color, GdkColor *right_color);
|
||||
|
||||
void
|
||||
arrow_draw_hline (GdkWindow *window,
|
||||
GdkGC *gc,
|
||||
int x1,
|
||||
int x2,
|
||||
int y,
|
||||
gboolean last);
|
||||
|
||||
void
|
||||
arrow_draw_vline (GdkWindow *window,
|
||||
GdkGC *gc,
|
||||
int y1,
|
||||
int y2,
|
||||
int x,
|
||||
gboolean last);
|
||||
|
||||
void
|
||||
draw_arrow (GdkWindow *window,
|
||||
GdkGC *gc,
|
||||
GdkRectangle *area,
|
||||
GtkArrowType arrow_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void
|
||||
calculate_arrow_geometry (GtkArrowType arrow_type,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
GtkWidget *special_get_ancestor(GtkWidget * widget,
|
||||
GType widget_type);
|
||||
|
||||
void blend (GdkColormap *colormap,
|
||||
GdkColor *a, GdkColor *b, GdkColor *c, int alpha);
|
||||
|
||||
GtkWidget *get_parent_window (GtkWidget *widget);
|
||||
|
||||
GdkColor *get_parent_bgcolor (GtkWidget *widget);
|
||||
|
||||
gboolean is_combo_box (GtkWidget * widget);
|
||||
|
||||
GtkWidget *find_combo_box_widget (GtkWidget * widget);
|
||||
|
||||
void gtk_clist_get_header_index (GtkCList *clist, GtkWidget *button,
|
||||
gint *column_index, gint *columns);
|
||||
Loading…
Add table
Add a link
Reference in a new issue