1 --- QtCurve-0.19/gtk/qtcurve.c.orig 2004-04-15 13:00:52.000000000 +0200
2 +++ QtCurve-0.19/gtk/qtcurve.c 2004-04-27 01:42:53.898063928 +0200
7 +#if GTK_MAJOR_VERSION==1
8 +void gdk_rgb_find_color(GdkColormap *colormap, GdkColor *color)
10 + color->pixel = gdk_rgb_xpixel_from_rgb(((color->red >> 8) << 16) | ((color->green >> 8) << 8) | (color->blue >> 8));
14 +static void draw_gradient(GdkWindow *window, GdkGC *gc, GdkColormap *colormap, GdkRectangle *area, GdkRegion *region, int x, int y, int width, int height,
15 + GdkColor *begin_color, GdkColor *end_color, gboolean horiz, gboolean increase)
17 + if(width>0 && height>0)
19 + GdkColor col=*begin_color;
21 + last=horiz ? height : width,
22 + dr=(end_color->red - begin_color->red) / last,
23 + dg=(end_color->green - begin_color->green) / last,
24 + db=(end_color->blue - begin_color->blue) / last;
26 + GdkGCValues old_values;
31 + clip.height = height;
33 + gdk_gc_get_values(gc, &old_values);
39 + if(gdk_rectangle_intersect(area, &clip, &clip2))
40 + gdk_gc_set_clip_rectangle(gc, gdk_rectangle_intersect(area, &clip, &clip2) ? &clip2 : &clip);
43 + gdk_gc_set_clip_region(gc, region);
46 + for(i = 0; i < last; i++)
48 + gdk_rgb_find_color(colormap, &col);
49 + gdk_gc_set_foreground(gc, &col);
51 + gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i);
53 + gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1);
59 + for(i=last-1; i>=0; i--)
61 + gdk_rgb_find_color(colormap, &col);
62 + gdk_gc_set_foreground(gc, &col);
64 + gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i);
66 + gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1);
72 + gdk_gc_set_foreground(gc, &old_values.foreground);
74 + gdk_gc_set_clip_rectangle(gc, NULL);
76 + gdk_gc_set_clip_region(gc, NULL);
80 +static void draw_bevel_gradient(GdkWindow *window, GdkGC *gc, GdkColormap *colormap, GdkRectangle *area, GdkRegion *region, int x, int y, int width,
81 + int height, GdkColor *base, double shade_top, double shade_bot, gboolean horiz, gboolean increase)
83 +/*CPD TODO: Store last settings to make faster! */
89 + top.pixel=bot.pixel=0;
91 + if(equal(1.0, shade_top))
95 + shade(base, &top, shade_top);
98 + if(equal(1.0, shade_bot))
102 + shade(base, &bot, shade_bot);
106 + draw_gradient(window, gc, colormap, area, region, x, y, width, height, t, b, horiz, increase);
109 static void draw_check(GtkStyle *style, GdkWindow *window, GtkStateType state_type, GtkShadowType shadow_type, GdkRectangle *area,
110 GtkWidget *widget, PCONST gchar *detail, gint x, gint y, gint width, gint height)
112 @@ -891,113 +993,11 @@
113 b->blue = blue * 65535.0;
116 -#if GTK_MAJOR_VERSION==1
117 -void gdk_rgb_find_color(GdkColormap *colormap, GdkColor *color)
119 - color->pixel = gdk_rgb_xpixel_from_rgb(((color->red >> 8) << 16) | ((color->green >> 8) << 8) | (color->blue >> 8));
123 -static void draw_gradient(GdkWindow *window, GdkGC *gc, GdkColormap *colormap, GdkRectangle *area, GdkRegion *region, int x, int y, int width, int height,
124 - GdkColor *begin_color, GdkColor *end_color, gboolean horiz, gboolean increase)
126 - if(width>0 && height>0)
128 - GdkColor col=*begin_color;
130 - last=horiz ? height : width,
131 - dr=(end_color->red - begin_color->red) / last,
132 - dg=(end_color->green - begin_color->green) / last,
133 - db=(end_color->blue - begin_color->blue) / last;
135 - GdkGCValues old_values;
139 - clip.width = width;
140 - clip.height = height;
142 - gdk_gc_get_values(gc, &old_values);
146 - GdkRectangle clip2;
148 - if(gdk_rectangle_intersect(area, &clip, &clip2))
149 - gdk_gc_set_clip_rectangle(gc, gdk_rectangle_intersect(area, &clip, &clip2) ? &clip2 : &clip);
152 - gdk_gc_set_clip_region(gc, region);
155 - for(i = 0; i < last; i++)
157 - gdk_rgb_find_color(colormap, &col);
158 - gdk_gc_set_foreground(gc, &col);
160 - gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i);
162 - gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1);
168 - for(i=last-1; i>=0; i--)
170 - gdk_rgb_find_color(colormap, &col);
171 - gdk_gc_set_foreground(gc, &col);
173 - gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i);
175 - gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1);
181 - gdk_gc_set_foreground(gc, &old_values.foreground);
183 - gdk_gc_set_clip_rectangle(gc, NULL);
185 - gdk_gc_set_clip_region(gc, NULL);
189 static int equal(double d1, double d2)
191 return (fabs(d1 - d2) < 0.0001);
194 -static void draw_bevel_gradient(GdkWindow *window, GdkGC *gc, GdkColormap *colormap, GdkRectangle *area, GdkRegion *region, int x, int y, int width,
195 - int height, GdkColor *base, double shade_top, double shade_bot, gboolean horiz, gboolean increase)
197 -/*CPD TODO: Store last settings to make faster! */
203 - top.pixel=bot.pixel=0;
205 - if(equal(1.0, shade_top))
209 - shade(base, &top, shade_top);
212 - if(equal(1.0, shade_bot))
216 - shade(base, &bot, shade_bot);
220 - draw_gradient(window, gc, colormap, area, region, x, y, width, height, t, b, horiz, increase);
223 static void arrow_draw_hline(GdkWindow *window, GdkGC *gc, int x1, int x2, int y, gboolean last)
225 if(x2 - x1 < 7 && !last) /* 7 to get garretts pixels, otherwise 6 */
226 --- QtCurve-0.19/gtk2/qtcurve.c.orig 2004-04-15 13:00:52.000000000 +0200
227 +++ QtCurve-0.19/gtk2/qtcurve.c 2004-04-27 01:49:33.512313328 +0200
228 @@ -359,6 +359,108 @@
232 +#if GTK_MAJOR_VERSION==1
233 +void gdk_rgb_find_color(GdkColormap *colormap, GdkColor *color)
235 + color->pixel = gdk_rgb_xpixel_from_rgb(((color->red >> 8) << 16) | ((color->green >> 8) << 8) | (color->blue >> 8));
239 +static void draw_gradient(GdkWindow *window, GdkGC *gc, GdkColormap *colormap, GdkRectangle *area, GdkRegion *region, int x, int y, int width, int height,
240 + GdkColor *begin_color, GdkColor *end_color, gboolean horiz, gboolean increase)
242 + if(width>0 && height>0)
244 + GdkColor col=*begin_color;
246 + last=horiz ? height : width,
247 + dr=(end_color->red - begin_color->red) / last,
248 + dg=(end_color->green - begin_color->green) / last,
249 + db=(end_color->blue - begin_color->blue) / last;
251 + GdkGCValues old_values;
255 + clip.width = width;
256 + clip.height = height;
258 + gdk_gc_get_values(gc, &old_values);
262 + GdkRectangle clip2;
264 + if(gdk_rectangle_intersect(area, &clip, &clip2))
265 + gdk_gc_set_clip_rectangle(gc, gdk_rectangle_intersect(area, &clip, &clip2) ? &clip2 : &clip);
268 + gdk_gc_set_clip_region(gc, region);
271 + for(i = 0; i < last; i++)
273 + gdk_rgb_find_color(colormap, &col);
274 + gdk_gc_set_foreground(gc, &col);
276 + gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i);
278 + gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1);
284 + for(i=last-1; i>=0; i--)
286 + gdk_rgb_find_color(colormap, &col);
287 + gdk_gc_set_foreground(gc, &col);
289 + gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i);
291 + gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1);
297 + gdk_gc_set_foreground(gc, &old_values.foreground);
299 + gdk_gc_set_clip_rectangle(gc, NULL);
301 + gdk_gc_set_clip_region(gc, NULL);
305 +static void draw_bevel_gradient(GdkWindow *window, GdkGC *gc, GdkColormap *colormap, GdkRectangle *area, GdkRegion *region, int x, int y, int width,
306 + int height, GdkColor *base, double shade_top, double shade_bot, gboolean horiz, gboolean increase)
308 +/*CPD TODO: Store last settings to make faster! */
314 + top.pixel=bot.pixel=0;
316 + if(equal(1.0, shade_top))
320 + shade(base, &top, shade_top);
323 + if(equal(1.0, shade_bot))
327 + shade(base, &bot, shade_bot);
331 + draw_gradient(window, gc, colormap, area, region, x, y, width, height, t, b, horiz, increase);
334 static void draw_check(GtkStyle *style, GdkWindow *window, GtkStateType state_type, GtkShadowType shadow_type, GdkRectangle *area,
335 GtkWidget *widget, PCONST gchar *detail, gint x, gint y, gint width, gint height)
337 @@ -891,113 +993,11 @@
338 b->blue = blue * 65535.0;
341 -#if GTK_MAJOR_VERSION==1
342 -void gdk_rgb_find_color(GdkColormap *colormap, GdkColor *color)
344 - color->pixel = gdk_rgb_xpixel_from_rgb(((color->red >> 8) << 16) | ((color->green >> 8) << 8) | (color->blue >> 8));
348 -static void draw_gradient(GdkWindow *window, GdkGC *gc, GdkColormap *colormap, GdkRectangle *area, GdkRegion *region, int x, int y, int width, int height,
349 - GdkColor *begin_color, GdkColor *end_color, gboolean horiz, gboolean increase)
351 - if(width>0 && height>0)
353 - GdkColor col=*begin_color;
355 - last=horiz ? height : width,
356 - dr=(end_color->red - begin_color->red) / last,
357 - dg=(end_color->green - begin_color->green) / last,
358 - db=(end_color->blue - begin_color->blue) / last;
360 - GdkGCValues old_values;
364 - clip.width = width;
365 - clip.height = height;
367 - gdk_gc_get_values(gc, &old_values);
371 - GdkRectangle clip2;
373 - if(gdk_rectangle_intersect(area, &clip, &clip2))
374 - gdk_gc_set_clip_rectangle(gc, gdk_rectangle_intersect(area, &clip, &clip2) ? &clip2 : &clip);
377 - gdk_gc_set_clip_region(gc, region);
380 - for(i = 0; i < last; i++)
382 - gdk_rgb_find_color(colormap, &col);
383 - gdk_gc_set_foreground(gc, &col);
385 - gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i);
387 - gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1);
393 - for(i=last-1; i>=0; i--)
395 - gdk_rgb_find_color(colormap, &col);
396 - gdk_gc_set_foreground(gc, &col);
398 - gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i);
400 - gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1);
406 - gdk_gc_set_foreground(gc, &old_values.foreground);
408 - gdk_gc_set_clip_rectangle(gc, NULL);
410 - gdk_gc_set_clip_region(gc, NULL);
414 static int equal(double d1, double d2)
416 return (fabs(d1 - d2) < 0.0001);
419 -static void draw_bevel_gradient(GdkWindow *window, GdkGC *gc, GdkColormap *colormap, GdkRectangle *area, GdkRegion *region, int x, int y, int width,
420 - int height, GdkColor *base, double shade_top, double shade_bot, gboolean horiz, gboolean increase)
422 -/*CPD TODO: Store last settings to make faster! */
428 - top.pixel=bot.pixel=0;
430 - if(equal(1.0, shade_top))
434 - shade(base, &top, shade_top);
437 - if(equal(1.0, shade_bot))
441 - shade(base, &bot, shade_bot);
445 - draw_gradient(window, gc, colormap, area, region, x, y, width, height, t, b, horiz, increase);
448 static void arrow_draw_hline(GdkWindow *window, GdkGC *gc, int x1, int x2, int y, gboolean last)
450 if(x2 - x1 < 7 && !last) /* 7 to get garretts pixels, otherwise 6 */