gint width,
gint height,
gboolean visible,
+ gboolean load_image,
gint scale,
gint opacity,
void (*pfunc_change)(Actor*),
- void (*pfunc_probability)(Actor*)
+ void (*pfunc_probability)(Actor*),
+ GPtrArray *child
)
{
Actor *actor = NULL;
actor->name = g_strdup(name);
actor->func_change = (gpointer)pfunc_change;
actor->func_probability = (gpointer)pfunc_probability;
- if (visible)
+ actor->child = child;
+ if (load_image)
create_hildon_actor(actor, desktop_plugin);
else
actor->widget = NULL;
void
change_signal(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
+ gint now = time(NULL);
+ Actor *a;
+#if 0
gchar *newfile;
gint now = time(NULL);
newfile = g_strdup_printf("%s%d.png", actor->name, scene.daytime);
actor->filename = newfile;
change_hildon_actor(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30) + 10;
+#endif
+ a = g_ptr_array_index(actor->child, 0);
+ //fprintf(stderr, "actor name= %p \n", child->widget);
+ if (a->visible)
+ a->visible = FALSE;
+ else
+ a->visible = TRUE;
+ hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(a->widget), a->visible);
+
+ a = g_ptr_array_index(actor->child, 1);
+ //fprintf(stderr, "actor name= %s \n", child->name);
+ if (a->visible)
+ a->visible = FALSE;
+ else
+ a->visible = TRUE;
+ hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(a->widget), a->visible);
+
+ actor->time_start_animation = now + fast_rnd(30) + 10;
}
void
GtkWidget *image = NULL;
gchar *str = NULL;
- /* fprintf(stderr, "create_hildon_actor %s\n", actor->name);*/
ha = hildon_animation_actor_new();
str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
desktop_plugin->priv->theme, actor->filename);
actor->width,
actor->height,
NULL);
+ /*fprintf(stderr, "create_hildon_actor %s %s\n", actor->name, str);*/
if (str)
g_free(str);
if (pixbuf){
gtk_container_add (GTK_CONTAINER (ha), image);
}
actor_set_position_full(ha, actor->x, actor->y, actor->z);
- hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(ha), actor->visible);
hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(ha), (double)actor->scale/100, (double)actor->scale/100);
realize(ha);
gtk_widget_show_all(ha);
+ hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(ha), actor->visible);
/* TO DO check it */
/* gdk_flush (); */
}
void
+change_layer(Actor * actor, AWallpaperPlugin *desktop_plugin)
+{
+ gint y;
+ Actor *a;
+
+ a = g_ptr_array_index(actor->child, 0);
+ y = a->y + 10;
+ if (y > 480) y = -480;
+ //fprintf(stderr, "!! %s - %d\n", actor->name, y);
+ actor_set_position_full(a->widget, a->x, y, a->z);
+ a->y = y;
+
+ a = g_ptr_array_index(actor->child, 1);
+ y = a->y + 10;
+ if (y > 480) y = -480;
+ //fprintf(stderr, "!! %s - %d\n", actor->name, y);
+ actor_set_position_full(a->widget, a->x, y, a->z);
+ a->y = y;
+
+ a = g_ptr_array_index(actor->child, 2);
+ y = a->y + 20;
+ if (y > 480) y = -480;
+ //fprintf(stderr, "!! %s - %d\n", actor->name, y);
+ actor_set_position_full(a->widget, a->x, y, a->z);
+ a->y = y;
+
+ a = g_ptr_array_index(actor->child, 3);
+ y = a->y + 20;
+ if (y > 480) y = -480;
+ //fprintf(stderr, "!! %s - %d\n", actor->name, y);
+ actor_set_position_full(a->widget, a->x, y, a->z);
+ a->y = y;
+
+}
+
+void
change_layer1(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
gint y;
init_scene2(AWallpaperPlugin *desktop_plugin)
{
Actor *actor;
+ GPtrArray *child;
gint now = time(NULL);
fprintf(stderr, "init scene2 \n");
actor = init_object(desktop_plugin, "background", "bg.png",
0, 0, 5, 800, 480,
- TRUE, 100, 255, NULL, NULL);
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "symbols", "symbols.png",
0, 0, 10, 800, 480,
- TRUE, 100, 255, NULL, NULL);
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
scene.actors = g_slist_append(scene.actors, actor);
+ child = g_ptr_array_sized_new(4);
actor = init_object(desktop_plugin, "layer1", "layer1_2.png",
0, -480, 6, 800, 960,
- TRUE, 100, 255, (gpointer)&change_layer1, NULL);
- actor->time_start_animation = now;
- actor->duration_animation = G_MAXINT;
- scene.actors = g_slist_append(scene.actors, actor);
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ //actor->time_start_animation = now;
+ //actor->duration_animation = G_MAXINT;
+ //scene.actors = g_slist_append(scene.actors, actor);
+ g_ptr_array_add(child, actor);
actor = init_object(desktop_plugin, "layer1", "layer1_1.png",
0, (-480 - 480), 7, 800, 960,
- TRUE, 100, 255, (gpointer)&change_layer1, NULL);
- actor->time_start_animation = now;
- actor->duration_animation = G_MAXINT;
- scene.actors = g_slist_append(scene.actors, actor);
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ //actor->time_start_animation = now;
+ //actor->duration_animation = G_MAXINT;
+ //scene.actors = g_slist_append(scene.actors, actor);
+ g_ptr_array_add(child, actor);
actor = init_object(desktop_plugin, "layer2", "layer2_2.png",
0, -480, 8, 800, 960,
- TRUE, 100, 255, (gpointer)&change_layer2, NULL);
- actor->time_start_animation = now;
- actor->duration_animation = G_MAXINT;
- scene.actors = g_slist_append(scene.actors, actor);
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ //actor->time_start_animation = now;
+ //actor->duration_animation = G_MAXINT;
+ //scene.actors = g_slist_append(scene.actors, actor);
+ g_ptr_array_add(child, actor);
actor = init_object(desktop_plugin, "layer2", "layer2_1.png",
0, (-480 - 480), 9, 800, 960,
- TRUE, 100, 255, (gpointer)&change_layer2, NULL);
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ //actor->time_start_animation = now;
+ //actor->duration_animation = G_MAXINT;
+ //scene.actors = g_slist_append(scene.actors, actor);
+ g_ptr_array_add(child, actor);
+
+ actor = init_object(desktop_plugin, "layers", "",
+ 0, (-480 - 480), 9, 800, 960,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_layer, NULL, child);
actor->time_start_animation = now;
actor->duration_animation = G_MAXINT;
scene.actors = g_slist_append(scene.actors, actor);
run_long_timeout(desktop_plugin);
+
}
/* Init Modern Scene */
static void
/* init value for random */
scene.seed = time(NULL);
-
+
- actor = init_object(desktop_plugin, "sky", "sky0.png", 0, 0, 5, 800, 480,
- TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
+ actor = init_object(desktop_plugin, "sky", "sky0.png",
+ 0, 0, 5, 800, 480,
+ TRUE, TRUE, 100, 255,
+ (gpointer)&change_static_actor, NULL, NULL);
change_static_actor(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88,
- TRUE, 100, 255, (gpointer)&change_sun, &probability_sun);
+ actor = init_object(desktop_plugin, "sun", "sun.png",
+ 0, 0, 6, 88, 88,
+ TRUE, TRUE, 100, 255,
+ (gpointer)&change_sun, &probability_sun, NULL);
actor->time_start_animation = now;
actor->duration_animation = G_MAXINT;
change_sun(actor, desktop_plugin);
// TRUE, 100, 255, NULL, NULL);
//scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
- FALSE, 100, 255, (gpointer)&change_cloud, NULL);
+ actor = init_object(desktop_plugin, "cloud1", "cloud1.png",
+ 0, fast_rnd(300)-97, 7, 150, 97,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(180);
actor->duration_animation = 3*60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
- FALSE, 100, 255, (gpointer)&change_cloud, NULL);
+ actor = init_object(desktop_plugin, "cloud2", "cloud2.png",
+ 0, fast_rnd(300)-75, 7, 188, 75,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(180);
actor->duration_animation = 3*60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
- FALSE, 100, 255, (gpointer)&change_cloud, NULL);
+ actor = init_object(desktop_plugin, "cloud4", "cloud4.png",
+ 0, fast_rnd(300)-75, 7, 150, 75,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(180);
actor->duration_animation = 5*60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "town", "town0.png", 0, 0, 8, 800, 480,
- TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
+ actor = init_object(desktop_plugin, "town", "town0.png",
+ 0, 0, 8, 800, 480,
+ TRUE, TRUE, 100, 255,
+ (gpointer)&change_static_actor, NULL, NULL);
change_static_actor(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "tram", "tram.png", -300, 225, 9, 350, 210,
- FALSE, 100, 255, (gpointer)&change_tram, NULL);
+ actor = init_object(desktop_plugin, "tram", "tram.png",
+ -300, 225, 9, 350, 210,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_tram, NULL, NULL);
actor->time_start_animation = time(NULL) + fast_rnd(10);
actor->duration_animation = 60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "border", "border0.png", 0, 480-79, 10, 800, 79,
- TRUE, 100, 255, (gpointer)&change_static_actor_with_corner, NULL);
+ actor = init_object(desktop_plugin, "border", "border0.png",
+ 0, 480-79, 10, 800, 79,
+ TRUE, TRUE, 100, 255,
+ (gpointer)&change_static_actor_with_corner, NULL, NULL);
change_static_actor_with_corner(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 20, 6, 60, 60,
- FALSE, 100, 255, (gpointer)&change_moon, NULL);
+ actor = init_object(desktop_plugin, "moon", "moon1.png",
+ 400, 20, 6, 60, 60,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_moon, NULL, NULL);
change_moon(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
- FALSE, 100, 255, (gpointer)&change_wind, NULL);
+ actor = init_object(desktop_plugin, "wind", "",
+ 0, 0, 5, 0, 0,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_wind, NULL, NULL);
change_wind(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
for (i=0; i<13; i++){
actor = init_object(desktop_plugin, "window1", "window1.png",
winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, 100, 255, (gpointer)&change_window1, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
scene.actors = g_slist_append(scene.actors, actor);
for (i=0; i<8; i++){
actor = init_object(desktop_plugin, "window2", "window2.png",
winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, 100, 255, (gpointer)&change_window1, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
scene.actors = g_slist_append(scene.actors, actor);
for (i=0; i<10; i++){
actor = init_object(desktop_plugin, "window3", "window3.png",
winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, 100, 255, (gpointer)&change_window1, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
scene.actors = g_slist_append(scene.actors, actor);
for (i=0; i<7; i++){
actor = init_object(desktop_plugin, "window4", "window4.png",
winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, 100, 255, (gpointer)&change_window1, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
scene.actors = g_slist_append(scene.actors, actor);
for (i=0; i<6; i++){
actor = init_object(desktop_plugin, "window5", "window5.png",
winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, 100, 255, (gpointer)&change_window1, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
scene.actors = g_slist_append(scene.actors, actor);
}
run_long_timeout(desktop_plugin);
+
#if 0
anim = g_new0(Animation, 1);
anim->count = 1;
static void
init_scene1(AWallpaperPlugin *desktop_plugin)
{
- Actor *actor;
+ Actor *actor, *actor1, *actor2;
gint now = time(NULL);
gint i;
gint winds[13][2];
+ GPtrArray *child = NULL;
scene.daytime = get_daytime();
scene.actors = NULL;
actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480,
- TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
+ TRUE, TRUE, 100, 255,
+ (gpointer)&change_static_actor, NULL, NULL);
change_static_actor(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88,
- TRUE, 100, 255, (gpointer)&change_sun, &probability_sun);
+ TRUE, TRUE, 100, 255,
+ (gpointer)&change_sun, &probability_sun, NULL);
actor->time_start_animation = time(NULL);
actor->duration_animation = G_MAXINT;
change_sun(actor, desktop_plugin);
#endif
actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60,
- FALSE, 100, 255, (gpointer)&change_moon, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_moon, NULL, NULL);
change_moon(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
- FALSE, 100, 255, (gpointer)&change_cloud, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(180);
actor->duration_animation = 3*60;
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
- FALSE, 100, 255, (gpointer)&change_cloud, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(180);
actor->duration_animation = 3*60;
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
- FALSE, 100, 255, (gpointer)&change_cloud, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(180);
actor->duration_animation = 5*60;
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50,
- FALSE, 100, 255, (gpointer)&change_plane2, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_plane2, NULL, NULL);
actor->time_start_animation = now + probability_plane();
actor->duration_animation = 60;
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116,
- FALSE, 100, 255, (gpointer)&change_plane1, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_plane1, NULL, NULL);
actor->time_start_animation = now + probability_plane();
actor->duration_animation = 30;
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480,
- TRUE, 100, 255, (gpointer)&change_static_actor_with_corner, NULL);
+ TRUE, TRUE, 100, 255,
+ (gpointer)&change_static_actor_with_corner, NULL, NULL);
change_static_actor_with_corner(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
- FALSE, 100, 255, (gpointer)&change_wind, NULL);
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_wind, NULL, NULL);
change_wind(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "signal", "red.png", 486, 425, 10, 18, 38,
- TRUE, 100, 255, (gpointer)&change_signal, NULL);
- actor->time_start_animation = now + fast_rnd(30) + 10;
- scene.actors = g_slist_append(scene.actors, actor);winds[0][0] = 717;
+ actor1 = init_object(desktop_plugin, "signal_red", "red.png",
+ 486, 425, 10, 18, 38,
+ FALSE, TRUE, 100, 255, NULL, NULL, NULL);
+ //actor->time_start_animation = now + fast_rnd(30) + 10;
+ //scene.actors = g_slist_append(scene.actors, actor);
+
+ actor2 = init_object(desktop_plugin, "signal_green", "green.png",
+ 486, 425, 10, 18, 38,
+ TRUE, TRUE, 100, 255, NULL, NULL, NULL);
+ //actor->time_start_animation = now + fast_rnd(30) + 10;
+ //scene.actors = g_slist_append(scene.actors, actor1);
+ child = g_ptr_array_sized_new(2);
+ g_ptr_array_add(child, actor1);
+ g_ptr_array_add(child, actor2);
+ actor = init_object(desktop_plugin, "signal", "",
+ 486, 425, 10, 18, 38,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_signal, NULL, child);
+ actor->time_start_animation = now + fast_rnd(30) + 10;
+ scene.actors = g_slist_append(scene.actors, actor);
winds[0][0] = 389;
winds[0][1] = 305;
for (i=0; i<13; i++){
actor = init_object(desktop_plugin, "window", "window.png",
winds[i][0], winds[i][1], 10, 8, 9,
- FALSE, 100, 255, (gpointer)&change_window1, NULL);
+ FALSE, TRUE, 100, 255,
+ (gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
scene.actors = g_slist_append(scene.actors, actor);
priv->desktop_plugin = desktop_plugin;
priv->visible = TRUE;
priv->short_timer = 0;
- priv->theme = g_strdup("Berlin");
+ priv->theme = g_strdup("Modern");
desktop_plugin->priv->main_widget = gtk_fixed_new();
gtk_widget_set_size_request(desktop_plugin->priv->main_widget, 100, 32);