]> err.no Git - libchamplain/commitdiff
Port Champlain to Clutter 0.9
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sat, 16 May 2009 19:11:31 +0000 (15:11 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 3 Aug 2009 22:16:08 +0000 (18:16 -0400)
champlain-gtk/gtk-champlain-embed.c
champlain/champlain-base-marker.c
champlain/champlain-marker.c
champlain/champlain-network-map-source.c
champlain/champlain-tile.c
champlain/champlain-view.c
demos/animated-marker.c
demos/launcher-gtk.c
demos/launcher.c

index a3d483956e63479f7661d0e16c7a869e8c433e49..b16c4c981c464661d256ac1e6ce7aaef06a0a936 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <gtk/gtk.h>
 #include <clutter/clutter.h>
-#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 #include "gtk-champlain-embed.h"
 
index b97d8409fa001148cd4eac27af563fa60136cfe6..a1dc6702892fd986429c4e560ec5815a84f98248 100644 (file)
@@ -46,7 +46,6 @@
 #include "champlain-zoom-level.h"
 
 #include <clutter/clutter.h>
-#include <clutter-cairo/clutter-cairo.h>
 #include <glib.h>
 #include <glib-object.h>
 #include <cairo.h>
index 0f4f683b2508db828dbdb834ae28cc8b77496ae2..712b67168bab23f9b404b19b5c417e8dc6455324 100644 (file)
@@ -46,7 +46,6 @@
 #include "champlain-zoom-level.h"
 
 #include <clutter/clutter.h>
-#include <clutter-cairo/clutter-cairo.h>
 #include <glib.h>
 #include <glib-object.h>
 #include <cairo.h>
@@ -468,8 +467,8 @@ draw_shadow (ChamplainMarker *marker,
   else
     x = -58 * slope;
 
-  shadow = clutter_cairo_new (width + x, (height + point));
-  cr = clutter_cairo_create (CLUTTER_CAIRO (shadow));
+  shadow = clutter_cairo_texture_new (width + x, (height + point));
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (shadow));
 
   cairo_matrix_init (&matrix,
       1, 0,
@@ -512,8 +511,8 @@ draw_background (ChamplainMarker *marker,
   ClutterColor darker_color;
   cairo_t *cr;
 
-  bg = clutter_cairo_new (width, height + point);
-  cr = clutter_cairo_create (CLUTTER_CAIRO (bg));
+  bg = clutter_cairo_texture_new (width, height + point);
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
 
   /* If selected, add the selection color to the marker's color */
   if (base_priv->highlighted)
@@ -572,22 +571,22 @@ draw_marker (ChamplainMarker *marker)
 
   if (priv->text != NULL && strlen (priv->text) > 0)
     {
-      ClutterLabel *label;
+      ClutterText *label;
       if (priv->text_actor == NULL)
       {
-        priv->text_actor = clutter_label_new_with_text (priv->font_name, priv->text);
+        priv->text_actor = clutter_text_new_with_text (priv->font_name, priv->text);
         g_object_ref (priv->text_actor);
       }
 
-      label = CLUTTER_LABEL (priv->text_actor);
-      clutter_label_set_use_markup (label, priv->use_markup);
-      clutter_label_set_font_name (label, priv->font_name);
-      clutter_label_set_text (label, priv->text);
-      clutter_label_set_alignment (label, priv->alignment);
-      clutter_label_set_line_wrap (label, priv->wrap);
-      clutter_label_set_line_wrap_mode (label, priv->wrap_mode);
-      clutter_label_set_ellipsize (label, priv->ellipsize);
-      clutter_label_set_attributes (label, priv->attributes);
+      label = CLUTTER_TEXT (priv->text_actor);
+      clutter_text_set_use_markup (label, priv->use_markup);
+      clutter_text_set_font_name (label, priv->font_name);
+      clutter_text_set_text (label, priv->text);
+      clutter_text_set_line_alignment (label, priv->alignment);
+      clutter_text_set_line_wrap (label, priv->wrap);
+      clutter_text_set_line_wrap_mode (label, priv->wrap_mode);
+      clutter_text_set_ellipsize (label, priv->ellipsize);
+      clutter_text_set_attributes (label, priv->attributes);
 
       height = clutter_actor_get_height (priv->text_actor);
       if (priv->image != NULL)
@@ -605,7 +604,7 @@ draw_marker (ChamplainMarker *marker)
       if (height > total_height)
         total_height = height;
 
-      clutter_label_set_color (CLUTTER_LABEL (priv->text_actor), priv->text_color);
+      clutter_text_set_color (CLUTTER_TEXT (priv->text_actor), priv->text_color);
       if (clutter_actor_get_parent (priv->text_actor) == NULL)
         clutter_container_add_actor (CLUTTER_CONTAINER (marker), priv->text_actor);
     }
index 99a90b20c5fa1546e823573c8f741e66a5146ead..596fcbfcf82b0b708d9cd1092c6f65563d4cbd68 100644 (file)
@@ -60,7 +60,6 @@
 #include <math.h>
 #include <sys/stat.h>
 #include <string.h>
-#include <clutter-cairo.h>
 
 enum
 {
@@ -387,8 +386,8 @@ create_error_tile (ChamplainTile* tile)
   guint size;
 
   size = champlain_tile_get_size (tile);
-  actor = clutter_cairo_new (size, size);
-  cr = clutter_cairo_create (CLUTTER_CAIRO(actor));
+  actor = clutter_cairo_texture_new (size, size);
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE(actor));
 
   /* draw a linear gray to white pattern */
   pat = cairo_pattern_create_linear (size / 2.0, 0.0,  size, size / 2.0);
index 318be9da425f9d760fc78ecdc4c7ed8c98f3e183..1497c102e0af4d25acff1f1052fb101a619a554a 100644 (file)
@@ -826,11 +826,11 @@ champlain_tile_set_etag (ChamplainTile *self,
 
 typedef struct {
   ChamplainTile *tile;
-  ClutterEffectTemplate *etemplate;
+  //ClutterEffectTemplate *etemplate;
   ClutterTimeline *timeline;
   ClutterActor *old_actor;
 } AnimationContext;
-
+/*
 static void
 fade_in_completed (ClutterTimeline *timeline,
     gpointer data)
@@ -846,10 +846,11 @@ fade_in_completed (ClutterTimeline *timeline,
 
   g_object_unref (ctx->tile);
   g_object_unref (ctx->timeline);
-  g_object_unref (ctx->etemplate);
+  //g_object_unref (ctx->etemplate);
   g_free (ctx);
 
 }
+*/
 
 /**
  * champlain_tile_set_content:
@@ -883,7 +884,7 @@ champlain_tile_set_content (ChamplainTile *self,
 
   clutter_container_add (CLUTTER_CONTAINER (priv->actor), actor, NULL);
 
-  /* fixme: etemplate are leaked here */
+  /* fixme: etemplate are leaked here 
   if (fade_in == TRUE)
     {
       AnimationContext *ctx = g_new0 (AnimationContext, 1);
@@ -897,6 +898,7 @@ champlain_tile_set_content (ChamplainTile *self,
       clutter_actor_set_opacity (actor, 0);
       clutter_effect_fade (ctx->etemplate, actor, 255, NULL, NULL);
     }
+  */
 
   priv->content_actor = g_object_ref (actor);
   g_object_notify (G_OBJECT (self), "content");
index 75fcda3ecb20fa1d5a1a99558b2b07caa341ebce..82f9d6dff9fc927ec7ed15229f97263b9dcf3709 100644 (file)
@@ -1137,7 +1137,7 @@ update_license (ChamplainView *view)
 
   if (priv->show_license)
     {
-      priv->license_actor = g_object_ref (clutter_label_new_with_text ("sans 8",
+      priv->license_actor = g_object_ref (clutter_text_new_with_text ("sans 8",
           champlain_map_source_get_license (priv->map_source)));
       clutter_actor_set_opacity (priv->license_actor, 128);
       clutter_actor_show (priv->license_actor);
@@ -1283,7 +1283,7 @@ timeline_new_frame (ClutterTimeline *timeline,
   gdouble lat;
   gdouble lon;
 
-  alpha = (double) clutter_alpha_get_alpha (ctx->alpha) / CLUTTER_ALPHA_MAX_ALPHA;
+  alpha = clutter_alpha_get_alpha (ctx->alpha);
   lat = ctx->to_latitude - ctx->from_latitude;
   lon = ctx->to_longitude - ctx->from_longitude;
 
@@ -1374,8 +1374,7 @@ champlain_view_go_to (ChamplainView *view,
    */
   duration = 500 * priv->zoom_level / 2.0;
   ctx->timeline = clutter_timeline_new_for_duration (duration);
-  ctx->alpha = clutter_alpha_new_full (ctx->timeline, CLUTTER_ALPHA_SINE_INC, NULL,
-      NULL);
+  ctx->alpha = clutter_alpha_new_full (ctx->timeline, CLUTTER_EASE_OUT_SINE);
 
   g_signal_connect (ctx->timeline, "new-frame", G_CALLBACK (timeline_new_frame),
       ctx);
index b6cb40b6b52840faad832ac78875b2ccb7259648..abe5f4b9dac1dab9f501d80b3330acfc2107a4d4 100644 (file)
@@ -17,7 +17,6 @@
  */
 
 #include <champlain/champlain.h>
-#include <clutter-cairo/clutter-cairo.h>
 #include <math.h>
 
 #define MARKER_SIZE 10
@@ -39,8 +38,8 @@ create_marker ()
   marker = champlain_base_marker_new ();
 
   /* Static filled circle ----------------------------------------------- */
-  bg = clutter_cairo_new (MARKER_SIZE, MARKER_SIZE);
-  cr = clutter_cairo_create (CLUTTER_CAIRO (bg));
+  bg = clutter_cairo_texture_new (MARKER_SIZE, MARKER_SIZE);
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
 
   /* Draw the circle */
   cairo_set_source_rgb (cr, 0, 0, 0);
@@ -59,8 +58,8 @@ create_marker ()
   clutter_actor_set_position (bg, 0, 0);
 
   /* Echo circle -------------------------------------------------------- */
-  bg = clutter_cairo_new (2 * MARKER_SIZE, 2 * MARKER_SIZE);
-  cr = clutter_cairo_create (CLUTTER_CAIRO (bg));
+  bg = clutter_cairo_texture_new (2 * MARKER_SIZE, 2 * MARKER_SIZE);
+  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
 
   /* Draw the circle */
   cairo_set_source_rgb (cr, 0, 0, 0);
@@ -83,7 +82,7 @@ create_marker ()
   /* Animate the echo circle */
   timeline = clutter_timeline_new_for_duration (1000);
   clutter_timeline_set_loop (timeline, TRUE);
-  alpha = clutter_alpha_new_full (timeline, CLUTTER_ALPHA_SINE_INC, NULL, g_object_unref);
+  alpha = clutter_alpha_new_full (timeline, CLUTTER_EASE_OUT_SINE);
 
   behaviour = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 2.0, 2.0);
   clutter_behaviour_apply (behaviour, bg);
index d31816ba9feec4e0cd2ac1be244ffd3ff63023e2..bcbbd07af8f78b0d86d9c23096ef6ca46aa82fab 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <champlain/champlain.h>
 #include <champlain-gtk/champlain-gtk.h>
-#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/clutter-gtk.h>
 
 #include <markers.h>
 
index 5e6d87c04af392706d24e3073dba94d68682e647..a221eca789db02e2be7f9019b5f5c5056e50588a 100644 (file)
@@ -70,7 +70,7 @@ make_button (char *text)
   clutter_container_add_actor (CLUTTER_CONTAINER (button), button_bg);
   clutter_actor_set_opacity (button_bg, 0xcc);
 
-  button_text = clutter_label_new_full ("Sans 10", text, &black);
+  button_text = clutter_text_new_full ("Sans 10", text, &black);
   clutter_container_add_actor (CLUTTER_CONTAINER (button), button_text);
   clutter_actor_get_size (button_text, &width, &height);