Only in clearlooks: Makefile diff -ur clearlooks.org/src/clearlooks_draw.c clearlooks/src/clearlooks_draw.c --- clearlooks.org/src/clearlooks_draw.c 2005-11-13 19:51:39.000000000 +0100 +++ clearlooks/src/clearlooks_draw.c 2005-11-13 20:07:03.000000000 +0100 @@ -8,6 +8,8 @@ #define M_PI 3.14159265358979323846 +#define HAVE_ANIMATION 1 + void clearlooks_rounded_rectectangle (cairo_t *cr, double x, double y, double w, double h, @@ -681,11 +683,15 @@ const ClearlooksColors *colors, const WidgetParameters *params, const ProgressBarParameters *progressbar, - int x, int y, int width, int height) + int x, int y, int width, int height, + gint offset) { boolean is_horizontal = progressbar->orientation < 2; double tile_pos = 0; double stroke_width; +#ifdef HAVE_ANIMATION + int x_step; +#endif cairo_pattern_t *pattern; CairoColor shade1; @@ -713,7 +719,9 @@ } stroke_width = height*2; - +#ifdef HAVE_ANIMATION + x_step = (((float)stroke_width/10)*offset); +#endif cairo_set_line_width (cr, 1.0); cairo_save (cr); @@ -736,6 +744,18 @@ cairo_pattern_destroy (pattern); /* Draw strokes */ +#ifdef HAVE_ANIMATION + while (tile_pos <= width+x_step) + { + cairo_move_to (cr, stroke_width/2-x_step, 0); + cairo_line_to (cr, stroke_width-x_step, 0); + cairo_line_to (cr, stroke_width/2-x_step, height); + cairo_line_to (cr, -x_step, height); + + cairo_translate (cr, stroke_width, 0); + tile_pos += stroke_width; + } +#else while (tile_pos <= width) { cairo_move_to (cr, stroke_width/2, 0); @@ -746,7 +766,7 @@ cairo_translate (cr, stroke_width, 0); tile_pos += stroke_width; } - +#endif cairo_set_source_rgba (cr, colors->spot[2].r, colors->spot[2].g, colors->spot[2].b, diff -ur clearlooks.org/src/clearlooks_draw.h clearlooks/src/clearlooks_draw.h --- clearlooks.org/src/clearlooks_draw.h 2005-09-12 19:31:09.000000000 +0200 +++ clearlooks/src/clearlooks_draw.h 2005-11-13 20:07:29.000000000 +0100 @@ -29,7 +29,7 @@ const ClearlooksColors *colors, const WidgetParameters *widget, const ProgressBarParameters *progressbar, - int x, int y, int width, int height); + int x, int y, int width, int height, gint offset); void clearlooks_draw_slider_button (cairo_t *cr, const ClearlooksColors *colors, diff -ur clearlooks.org/src/clearlooks_style.c clearlooks/src/clearlooks_style.c --- clearlooks.org/src/clearlooks_style.c 2005-11-13 19:51:40.000000000 +0100 +++ clearlooks/src/clearlooks_style.c 2005-11-13 20:08:34.000000000 +0100 @@ -32,6 +32,13 @@ gint width, \ gint height +#ifdef HAVE_ANIMATION +static GList *progressbars = NULL; +static int timer_id = 0; +#endif + +static gint8 pboffset = 0; + static GtkStyleClass *parent_class; static cairo_t * @@ -50,6 +57,65 @@ return cr; } +#ifdef HAVE_ANIMATION +static void cl_progressbar_remove (gpointer data) +{ + if (g_list_find (progressbars, data) == NULL) + return; + + progressbars = g_list_remove (progressbars, data); + g_object_unref (data); + + if (g_list_first(progressbars) == NULL) { + g_source_remove(timer_id); + timer_id = 0; + } +} + +static void update_progressbar (gpointer data, gpointer user_data) +{ + gfloat fraction; + + if (data == NULL) + return; + + fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (data)); + + /* update only if not filled */ + if (fraction < 1.0) + gtk_widget_queue_resize ((GtkWidget*)data); + + if (fraction >= 1.0 || GTK_PROGRESS (data)->activity_mode) + cl_progressbar_remove (data); +} + +static gboolean timer_func (gpointer data) +{ + g_list_foreach (progressbars, update_progressbar, NULL); + if (--pboffset < 0) pboffset = 9; + return (g_list_first(progressbars) != NULL); +} + +static gboolean cl_progressbar_known(gconstpointer data) +{ + return (g_list_find (progressbars, data) != NULL); +} + +static void cl_progressbar_add (gpointer data) +{ + if (!GTK_IS_PROGRESS_BAR (data)) + return; + + progressbars = g_list_append (progressbars, data); + + g_object_ref (data); + g_signal_connect ((GObject*)data, "unrealize", G_CALLBACK (cl_progressbar_remove), data); + + if (timer_id == 0) + timer_id = g_timeout_add (100, timer_func, NULL); +} +#endif + static void clearlooks_set_widget_parameters (const GtkWidget *widget, const GtkStyle *style, @@ -572,6 +638,23 @@ { WidgetParameters params; ProgressBarParameters progressbar; + +#ifdef HAVE_ANIMATION + if(clearlooks_style->animation) + { + gboolean activity_mode = GTK_PROGRESS (widget)->activity_mode; + if (!activity_mode && gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget)) != 1.0 && + !cl_progressbar_known((gconstpointer)widget)) + { + cl_progressbar_add ((gpointer)widget); + } + } + else + if(cl_progressbar_known((gconstpointer)widget)) + { + cl_progressbar_remove ((gpointer)widget); + } +#endif clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); @@ -581,9 +664,9 @@ progressbar.orientation = CL_ORIENTATION_LEFT_TO_RIGHT; cairo_reset_clip (cr); - + clearlooks_draw_progressbar_fill (cr, colors, ¶ms, &progressbar, - x, y, width, height); + x, y, width, height,pboffset); } else if (DETAIL ("hscale") || DETAIL ("vscale")) @@ -1055,12 +1138,12 @@ contrast = CLEARLOOKS_RC_STYLE (rc_style)->contrast; - clearlooks_style->animation = CLEARLOOKS_RC_STYLE (rc_style)->animation; clearlooks_style->progressbarstyle = CLEARLOOKS_RC_STYLE (rc_style)->progressbarstyle; clearlooks_style->menubarstyle = CLEARLOOKS_RC_STYLE (rc_style)->menubarstyle; clearlooks_style->menuitemstyle = CLEARLOOKS_RC_STYLE (rc_style)->menuitemstyle; clearlooks_style->listviewitemstyle = CLEARLOOKS_RC_STYLE (rc_style)->listviewitemstyle; clearlooks_style->has_scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->has_scrollbar_color; + clearlooks_style->animation = CLEARLOOKS_RC_STYLE (rc_style)->animation; if (clearlooks_style->has_scrollbar_color) clearlooks_style->scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->scrollbar_color; @@ -1092,15 +1175,9 @@ &clearlooks_style->colors.base[i].g, &clearlooks_style->colors.base[i].b); } -<<<<<<< clearlooks_style.c if (CLEARLOOKS_RC_STYLE (rc_style)->animation) printf("animation is enabled!\n"); -======= - - if (clearlooks_style->animation) - printf("animation is enabled!\n"); ->>>>>>> 1.28 } static void