]>
Commit | Line | Data |
---|---|---|
29dddd64 | 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 | |
3 | @@ -359,6 +359,108 @@ | |
4 | } | |
5 | } | |
6 | ||
7 | +#if GTK_MAJOR_VERSION==1 | |
8 | +void gdk_rgb_find_color(GdkColormap *colormap, GdkColor *color) | |
9 | +{ | |
10 | + color->pixel = gdk_rgb_xpixel_from_rgb(((color->red >> 8) << 16) | ((color->green >> 8) << 8) | (color->blue >> 8)); | |
11 | +} | |
12 | +#endif | |
13 | + | |
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) | |
16 | +{ | |
17 | + if(width>0 && height>0) | |
18 | + { | |
19 | + GdkColor col=*begin_color; | |
20 | + int i, | |
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; | |
25 | + GdkRectangle clip; | |
26 | + GdkGCValues old_values; | |
27 | + | |
28 | + clip.x = x; | |
29 | + clip.y = y; | |
30 | + clip.width = width; | |
31 | + clip.height = height; | |
32 | + | |
33 | + gdk_gc_get_values(gc, &old_values); | |
34 | + | |
35 | + if(area) | |
36 | + { | |
37 | + GdkRectangle clip2; | |
38 | + | |
39 | + if(gdk_rectangle_intersect(area, &clip, &clip2)) | |
40 | + gdk_gc_set_clip_rectangle(gc, gdk_rectangle_intersect(area, &clip, &clip2) ? &clip2 : &clip); | |
41 | + } | |
42 | + else if(region) | |
43 | + gdk_gc_set_clip_region(gc, region); | |
44 | + | |
45 | + if(increase) | |
46 | + for(i = 0; i < last; i++) | |
47 | + { | |
48 | + gdk_rgb_find_color(colormap, &col); | |
49 | + gdk_gc_set_foreground(gc, &col); | |
50 | + if(horiz) | |
51 | + gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i); | |
52 | + else | |
53 | + gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1); | |
54 | + col.red += dr; | |
55 | + col.green += dg; | |
56 | + col.blue += db; | |
57 | + } | |
58 | + else | |
59 | + for(i=last-1; i>=0; i--) | |
60 | + { | |
61 | + gdk_rgb_find_color(colormap, &col); | |
62 | + gdk_gc_set_foreground(gc, &col); | |
63 | + if(horiz) | |
64 | + gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i); | |
65 | + else | |
66 | + gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1); | |
67 | + col.red += dr; | |
68 | + col.green += dg; | |
69 | + col.blue += db; | |
70 | + } | |
71 | + | |
72 | + gdk_gc_set_foreground(gc, &old_values.foreground); | |
73 | + if(area) | |
74 | + gdk_gc_set_clip_rectangle(gc, NULL); | |
75 | + else if(region) | |
76 | + gdk_gc_set_clip_region(gc, NULL); | |
77 | + } | |
78 | +} | |
79 | + | |
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) | |
82 | +{ | |
83 | +/*CPD TODO: Store last settings to make faster! */ | |
84 | + GdkColor top, | |
85 | + bot, | |
86 | + *t, | |
87 | + *b; | |
88 | + | |
89 | + top.pixel=bot.pixel=0; | |
90 | + | |
91 | + if(equal(1.0, shade_top)) | |
92 | + t=base; | |
93 | + else | |
94 | + { | |
95 | + shade(base, &top, shade_top); | |
96 | + t=⊤ | |
97 | + } | |
98 | + if(equal(1.0, shade_bot)) | |
99 | + b=base; | |
100 | + else | |
101 | + { | |
102 | + shade(base, &bot, shade_bot); | |
103 | + b=⊥ | |
104 | + } | |
105 | + | |
106 | + draw_gradient(window, gc, colormap, area, region, x, y, width, height, t, b, horiz, increase); | |
107 | +} | |
108 | + | |
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) | |
111 | { | |
112 | @@ -891,113 +993,11 @@ | |
113 | b->blue = blue * 65535.0; | |
114 | } | |
115 | ||
116 | -#if GTK_MAJOR_VERSION==1 | |
117 | -void gdk_rgb_find_color(GdkColormap *colormap, GdkColor *color) | |
118 | -{ | |
119 | - color->pixel = gdk_rgb_xpixel_from_rgb(((color->red >> 8) << 16) | ((color->green >> 8) << 8) | (color->blue >> 8)); | |
120 | -} | |
121 | -#endif | |
122 | - | |
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) | |
125 | -{ | |
126 | - if(width>0 && height>0) | |
127 | - { | |
128 | - GdkColor col=*begin_color; | |
129 | - int i, | |
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; | |
134 | - GdkRectangle clip; | |
135 | - GdkGCValues old_values; | |
136 | - | |
137 | - clip.x = x; | |
138 | - clip.y = y; | |
139 | - clip.width = width; | |
140 | - clip.height = height; | |
141 | - | |
142 | - gdk_gc_get_values(gc, &old_values); | |
143 | - | |
144 | - if(area) | |
145 | - { | |
146 | - GdkRectangle clip2; | |
147 | - | |
148 | - if(gdk_rectangle_intersect(area, &clip, &clip2)) | |
149 | - gdk_gc_set_clip_rectangle(gc, gdk_rectangle_intersect(area, &clip, &clip2) ? &clip2 : &clip); | |
150 | - } | |
151 | - else if(region) | |
152 | - gdk_gc_set_clip_region(gc, region); | |
153 | - | |
154 | - if(increase) | |
155 | - for(i = 0; i < last; i++) | |
156 | - { | |
157 | - gdk_rgb_find_color(colormap, &col); | |
158 | - gdk_gc_set_foreground(gc, &col); | |
159 | - if(horiz) | |
160 | - gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i); | |
161 | - else | |
162 | - gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1); | |
163 | - col.red += dr; | |
164 | - col.green += dg; | |
165 | - col.blue += db; | |
166 | - } | |
167 | - else | |
168 | - for(i=last-1; i>=0; i--) | |
169 | - { | |
170 | - gdk_rgb_find_color(colormap, &col); | |
171 | - gdk_gc_set_foreground(gc, &col); | |
172 | - if(horiz) | |
173 | - gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i); | |
174 | - else | |
175 | - gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1); | |
176 | - col.red += dr; | |
177 | - col.green += dg; | |
178 | - col.blue += db; | |
179 | - } | |
180 | - | |
181 | - gdk_gc_set_foreground(gc, &old_values.foreground); | |
182 | - if(area) | |
183 | - gdk_gc_set_clip_rectangle(gc, NULL); | |
184 | - else if(region) | |
185 | - gdk_gc_set_clip_region(gc, NULL); | |
186 | - } | |
187 | -} | |
188 | - | |
189 | static int equal(double d1, double d2) | |
190 | { | |
191 | return (fabs(d1 - d2) < 0.0001); | |
192 | } | |
193 | ||
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) | |
196 | -{ | |
197 | -/*CPD TODO: Store last settings to make faster! */ | |
198 | - GdkColor top, | |
199 | - bot, | |
200 | - *t, | |
201 | - *b; | |
202 | - | |
203 | - top.pixel=bot.pixel=0; | |
204 | - | |
205 | - if(equal(1.0, shade_top)) | |
206 | - t=base; | |
207 | - else | |
208 | - { | |
209 | - shade(base, &top, shade_top); | |
210 | - t=⊤ | |
211 | - } | |
212 | - if(equal(1.0, shade_bot)) | |
213 | - b=base; | |
214 | - else | |
215 | - { | |
216 | - shade(base, &bot, shade_bot); | |
217 | - b=⊥ | |
218 | - } | |
219 | - | |
220 | - draw_gradient(window, gc, colormap, area, region, x, y, width, height, t, b, horiz, increase); | |
221 | -} | |
222 | - | |
223 | static void arrow_draw_hline(GdkWindow *window, GdkGC *gc, int x1, int x2, int y, gboolean last) | |
224 | { | |
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 @@ | |
229 | } | |
230 | } | |
231 | ||
232 | +#if GTK_MAJOR_VERSION==1 | |
233 | +void gdk_rgb_find_color(GdkColormap *colormap, GdkColor *color) | |
234 | +{ | |
235 | + color->pixel = gdk_rgb_xpixel_from_rgb(((color->red >> 8) << 16) | ((color->green >> 8) << 8) | (color->blue >> 8)); | |
236 | +} | |
237 | +#endif | |
238 | + | |
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) | |
241 | +{ | |
242 | + if(width>0 && height>0) | |
243 | + { | |
244 | + GdkColor col=*begin_color; | |
245 | + int i, | |
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; | |
250 | + GdkRectangle clip; | |
251 | + GdkGCValues old_values; | |
252 | + | |
253 | + clip.x = x; | |
254 | + clip.y = y; | |
255 | + clip.width = width; | |
256 | + clip.height = height; | |
257 | + | |
258 | + gdk_gc_get_values(gc, &old_values); | |
259 | + | |
260 | + if(area) | |
261 | + { | |
262 | + GdkRectangle clip2; | |
263 | + | |
264 | + if(gdk_rectangle_intersect(area, &clip, &clip2)) | |
265 | + gdk_gc_set_clip_rectangle(gc, gdk_rectangle_intersect(area, &clip, &clip2) ? &clip2 : &clip); | |
266 | + } | |
267 | + else if(region) | |
268 | + gdk_gc_set_clip_region(gc, region); | |
269 | + | |
270 | + if(increase) | |
271 | + for(i = 0; i < last; i++) | |
272 | + { | |
273 | + gdk_rgb_find_color(colormap, &col); | |
274 | + gdk_gc_set_foreground(gc, &col); | |
275 | + if(horiz) | |
276 | + gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i); | |
277 | + else | |
278 | + gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1); | |
279 | + col.red += dr; | |
280 | + col.green += dg; | |
281 | + col.blue += db; | |
282 | + } | |
283 | + else | |
284 | + for(i=last-1; i>=0; i--) | |
285 | + { | |
286 | + gdk_rgb_find_color(colormap, &col); | |
287 | + gdk_gc_set_foreground(gc, &col); | |
288 | + if(horiz) | |
289 | + gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i); | |
290 | + else | |
291 | + gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1); | |
292 | + col.red += dr; | |
293 | + col.green += dg; | |
294 | + col.blue += db; | |
295 | + } | |
296 | + | |
297 | + gdk_gc_set_foreground(gc, &old_values.foreground); | |
298 | + if(area) | |
299 | + gdk_gc_set_clip_rectangle(gc, NULL); | |
300 | + else if(region) | |
301 | + gdk_gc_set_clip_region(gc, NULL); | |
302 | + } | |
303 | +} | |
304 | + | |
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) | |
307 | +{ | |
308 | +/*CPD TODO: Store last settings to make faster! */ | |
309 | + GdkColor top, | |
310 | + bot, | |
311 | + *t, | |
312 | + *b; | |
313 | + | |
314 | + top.pixel=bot.pixel=0; | |
315 | + | |
316 | + if(equal(1.0, shade_top)) | |
317 | + t=base; | |
318 | + else | |
319 | + { | |
320 | + shade(base, &top, shade_top); | |
321 | + t=⊤ | |
322 | + } | |
323 | + if(equal(1.0, shade_bot)) | |
324 | + b=base; | |
325 | + else | |
326 | + { | |
327 | + shade(base, &bot, shade_bot); | |
328 | + b=⊥ | |
329 | + } | |
330 | + | |
331 | + draw_gradient(window, gc, colormap, area, region, x, y, width, height, t, b, horiz, increase); | |
332 | +} | |
333 | + | |
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) | |
336 | { | |
337 | @@ -891,113 +993,11 @@ | |
338 | b->blue = blue * 65535.0; | |
339 | } | |
340 | ||
341 | -#if GTK_MAJOR_VERSION==1 | |
342 | -void gdk_rgb_find_color(GdkColormap *colormap, GdkColor *color) | |
343 | -{ | |
344 | - color->pixel = gdk_rgb_xpixel_from_rgb(((color->red >> 8) << 16) | ((color->green >> 8) << 8) | (color->blue >> 8)); | |
345 | -} | |
346 | -#endif | |
347 | - | |
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) | |
350 | -{ | |
351 | - if(width>0 && height>0) | |
352 | - { | |
353 | - GdkColor col=*begin_color; | |
354 | - int i, | |
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; | |
359 | - GdkRectangle clip; | |
360 | - GdkGCValues old_values; | |
361 | - | |
362 | - clip.x = x; | |
363 | - clip.y = y; | |
364 | - clip.width = width; | |
365 | - clip.height = height; | |
366 | - | |
367 | - gdk_gc_get_values(gc, &old_values); | |
368 | - | |
369 | - if(area) | |
370 | - { | |
371 | - GdkRectangle clip2; | |
372 | - | |
373 | - if(gdk_rectangle_intersect(area, &clip, &clip2)) | |
374 | - gdk_gc_set_clip_rectangle(gc, gdk_rectangle_intersect(area, &clip, &clip2) ? &clip2 : &clip); | |
375 | - } | |
376 | - else if(region) | |
377 | - gdk_gc_set_clip_region(gc, region); | |
378 | - | |
379 | - if(increase) | |
380 | - for(i = 0; i < last; i++) | |
381 | - { | |
382 | - gdk_rgb_find_color(colormap, &col); | |
383 | - gdk_gc_set_foreground(gc, &col); | |
384 | - if(horiz) | |
385 | - gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i); | |
386 | - else | |
387 | - gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1); | |
388 | - col.red += dr; | |
389 | - col.green += dg; | |
390 | - col.blue += db; | |
391 | - } | |
392 | - else | |
393 | - for(i=last-1; i>=0; i--) | |
394 | - { | |
395 | - gdk_rgb_find_color(colormap, &col); | |
396 | - gdk_gc_set_foreground(gc, &col); | |
397 | - if(horiz) | |
398 | - gdk_draw_line(window, gc, x, y + i, x + width - 1, y + i); | |
399 | - else | |
400 | - gdk_draw_line(window, gc, x + i, y, x + i, y + height - 1); | |
401 | - col.red += dr; | |
402 | - col.green += dg; | |
403 | - col.blue += db; | |
404 | - } | |
405 | - | |
406 | - gdk_gc_set_foreground(gc, &old_values.foreground); | |
407 | - if(area) | |
408 | - gdk_gc_set_clip_rectangle(gc, NULL); | |
409 | - else if(region) | |
410 | - gdk_gc_set_clip_region(gc, NULL); | |
411 | - } | |
412 | -} | |
413 | - | |
414 | static int equal(double d1, double d2) | |
415 | { | |
416 | return (fabs(d1 - d2) < 0.0001); | |
417 | } | |
418 | ||
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) | |
421 | -{ | |
422 | -/*CPD TODO: Store last settings to make faster! */ | |
423 | - GdkColor top, | |
424 | - bot, | |
425 | - *t, | |
426 | - *b; | |
427 | - | |
428 | - top.pixel=bot.pixel=0; | |
429 | - | |
430 | - if(equal(1.0, shade_top)) | |
431 | - t=base; | |
432 | - else | |
433 | - { | |
434 | - shade(base, &top, shade_top); | |
435 | - t=⊤ | |
436 | - } | |
437 | - if(equal(1.0, shade_bot)) | |
438 | - b=base; | |
439 | - else | |
440 | - { | |
441 | - shade(base, &bot, shade_bot); | |
442 | - b=⊥ | |
443 | - } | |
444 | - | |
445 | - draw_gradient(window, gc, colormap, area, region, x, y, width, height, t, b, horiz, increase); | |
446 | -} | |
447 | - | |
448 | static void arrow_draw_hline(GdkWindow *window, GdkGC *gc, int x1, int x2, int y, gboolean last) | |
449 | { | |
450 | if(x2 - x1 < 7 && !last) /* 7 to get garretts pixels, otherwise 6 */ |