AM_CONDITIONAL(GUI_SDL, [test "x$sdl" = "xyes" -a "x$cegui" = "xyes" -a "x$opengl" = "xyes" -a "x$glc" = "xyes" -a "x$xmu" = "xyes" ])
AM_CONDITIONAL(GRAPHICS_OPENGL, [test "x$opengl" = "xyes" -a "x$glc" = "xyes" ])
+AC_ARG_ENABLE(gui-clutter, [ --disable-gui-clutter don't create gui clutter ], MODULE_GUI_CLUTTER=$enableval, MODULE_GUI_CLUTTER=yes)
+if test "x$MODULE_GUI_CLUTTER" = "xyes"; then
+ PKG_CHECK_MODULES(CLUTTER, [clutter-0.8], [clutter_pkgconfig=yes], [clutter_pkgconfig=no])
+ if test "x$clutter_pkgconfig" = "xyes"; then
+ AC_DEFINE(HAVE_CLUTTER, 1, [Define to 1 if you have clutter])
+ fi
+fi
+
+AC_SUBST(CLUTTER_CFLAGS)
+AC_SUBST(CLUTTER_LIBS)
+AM_CONDITIONAL(GUI_CLUTTER, [test "x$clutter_pkgconfig" = "xyes" -a "x$glc" = "xyes" ])
+
+
if test x"${USE_GYPSY}" = xyes
then
PKG_CHECK_MODULES(GYPSY, gypsy, use_gypsy=yes, use_gypsy=no)
navit/fib-1.1/Makefile
navit/graphics/Makefile
navit/graphics/gtk_drawing_area/Makefile
+navit/graphics/cogl/Makefile
navit/graphics/opengl/Makefile
navit/graphics/null/Makefile
navit/graphics/sdl/Makefile
navit/gui/Makefile
navit/gui/gtk/Makefile
navit/gui/internal/Makefile
+navit/gui/clutter/Makefile
navit/gui/cegui/Makefile
navit/gui/cegui/datafiles/Makefile
navit/osd/Makefile
else
echo "OpenGL gui : DISABLED : you are missing $sdl_failures"
fi
+if test x"$clutter_pkgconfig" = xyes
+ then
+ echo "Clutter gui : ENABLED"
+ else
+ echo "Clutter gui : DISABLED"
+fi
if test x"$enable_hildon" = xyes
- then
+ then
echo "Maemo/Hildon: ENABLED"
else
echo "Maemo/Hildon: DISABLED"
SUBDIRS+=gtk_drawing_area
endif
if GRAPHICS_OPENGL
- SUBDIRS+=opengl
+ SUBDIRS+=opengl cogl
endif
if USE_GRAPHICS_QT_QPAINTER
SUBDIRS+=qt_qpainter
--- /dev/null
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @CLUTTER_CFLAGS@ @GLC_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_cogl
+modulegraphics_LTLIBRARIES = libgraphics_cogl.la
+libgraphics_cogl_la_SOURCES = graphics_cogl.c navit_actor.c navit_actor.h
+libgraphics_cogl_la_LIBADD = @CLUTTER_LIBS@ @GLC_LIBS@
--- /dev/null
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <math.h>
+#include <glib.h>
+#include "config.h"
+#include <GL/glc.h>
+#include "point.h"
+#include "graphics.h"
+#include "color.h"
+#include "plugin.h"
+
+#include "debug.h"
+#include "navit_actor.h"
+
+struct graphics_priv {
+ int button_timeout;
+ struct point p;
+ int width;
+ int height;
+ int library_init;
+ int visible;
+ struct graphics_priv *parent;
+ struct graphics_priv *overlays;
+ struct graphics_priv *next;
+ struct graphics_gc_priv *background_gc;
+ enum draw_mode_num mode;
+ void (*resize_callback)(void *data, int w, int h);
+ void *resize_callback_data;
+ void (*motion_callback)(void *data, struct point *p);
+ void *motion_callback_data;
+ void (*button_callback)(void *data, int press, int button, struct point *p);
+ void *button_callback_data;
+ ClutterActor *testActor;
+};
+
+struct graphics_font_priv {
+#if 0
+ FT_Face face;
+#endif
+};
+
+struct graphics_gc_priv {
+ struct graphics_priv *gr;
+ float fr,fg,fb,fa;
+ float br,bg,bb,ba;
+ int linewidth;
+};
+
+struct graphics_image_priv {
+ int w;
+ int h;
+};
+
+static void
+graphics_destroy(struct graphics_priv *gr)
+{
+}
+
+
+static void font_destroy(struct graphics_font_priv *font)
+{
+ g_free(font);
+ /* TODO: free font->face */
+}
+
+static struct graphics_font_methods font_methods = {
+ font_destroy
+};
+
+static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size)
+{
+ return NULL;
+}
+
+static void
+gc_destroy(struct graphics_gc_priv *gc)
+{
+ g_free(gc);
+}
+
+static void
+gc_set_linewidth(struct graphics_gc_priv *gc, int w)
+{
+ gc->linewidth=w;
+}
+
+static void
+gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char *dash_list, int n)
+{
+
+}
+
+
+static void
+gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc->fr=c->r/65535.0;
+ gc->fg=c->g/65535.0;
+ gc->fb=c->b/65535.0;
+ gc->fa=c->a/65535.0;
+// printf("new alpha : %i\n",c->a);
+}
+
+static void
+gc_set_background(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc->br=c->r/65535.0;
+ gc->bg=c->g/65535.0;
+ gc->bb=c->b/65535.0;
+ gc->ba=c->a/65535.0;
+}
+
+static struct graphics_gc_methods gc_methods = {
+ gc_destroy,
+ gc_set_linewidth,
+ gc_set_dashes,
+ gc_set_foreground,
+ gc_set_background
+};
+
+static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
+{
+ struct graphics_gc_priv *gc=g_new(struct graphics_gc_priv, 1);
+
+ *meth=gc_methods;
+ gc->gr=gr;
+ gc->linewidth=1;
+ return gc;
+}
+
+
+static struct graphics_image_priv *
+image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h)
+{
+ return NULL;
+}
+
+static void
+draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ int i;
+
+ for (i = 0 ; i < count-1 ; i++) {
+ dbg(0," Line : [%s,%s] -> [%s,%s]\n",p[i].x,p[i].y,p[i+1].x,p[i+1].y);
+ }
+}
+
+static void
+draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+
+}
+
+static void
+draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
+{
+
+}
+
+static void
+draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
+{
+
+}
+
+static void
+draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
+{
+ dbg(0,"Text : %s [%i,%i] %f\n",text,dx,dy,(180*atan2(dx,dy)/3.14));
+}
+
+static void
+draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
+{
+
+}
+
+
+static void
+overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, int window)
+{
+
+}
+
+static void
+draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
+{
+}
+
+static void
+background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
+{
+ gr->background_gc=gc;
+}
+
+static void
+draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
+{
+/*
+ if (gr->DLid) {
+ if (mode == draw_mode_begin)
+ glNewList(gr->DLid,GL_COMPILE);
+ if (mode == draw_mode_end)
+ glEndList();
+ }
+*/
+}
+
+
+static struct graphics_priv *
+overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h)
+{
+ return NULL;
+}
+
+/**
+ * Links the graphics driver to the gui. The gui calls it by
+ * specifying what kind of graphic driver is expected.
+ *
+ * @param this The graphics instance
+ * @param type A string identifying what kind of driver is expected
+ * @returns a pointer to the component used to draw in the graphics
+ */
+static void *
+get_data(struct graphics_priv *this, char *type)
+{
+ if (strcmp(type,"navit_clutter_actor"))
+ return NULL;
+ return &this->testActor;
+}
+
+static void
+register_resize_callback(struct graphics_priv *this, void (*callback)(void *data, int w, int h), void *data)
+{
+ this->resize_callback=callback;
+ this->resize_callback_data=data;
+}
+
+static void
+register_motion_callback(struct graphics_priv *this, void (*callback)(void *data, struct point *p), void *data)
+{
+ this->motion_callback=callback;
+ this->motion_callback_data=data;
+}
+
+static void
+register_button_callback(struct graphics_priv *this, void (*callback)(void *data, int press, int button, struct point *p), void *data)
+{
+ this->button_callback=callback;
+ this->button_callback_data=data;
+}
+
+static struct graphics_methods graphics_methods = {
+ graphics_destroy,
+ draw_mode,
+ draw_lines,
+ draw_polygon,
+ draw_rectangle,
+ draw_circle,
+ draw_text,
+ draw_image,
+#ifdef HAVE_IMLIB2
+ draw_image_warp,
+#else
+ NULL,
+#endif
+ draw_restore,
+ font_new,
+ gc_new,
+ background_gc,
+ overlay_new,
+ image_new,
+ get_data,
+ register_resize_callback,
+ register_button_callback,
+ register_motion_callback,
+ NULL, // image_free
+};
+
+static struct graphics_priv *
+graphics_cogl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs)
+{
+ struct graphics_priv *this=g_new0(struct graphics_priv,1);
+ *meth=graphics_methods;
+
+ // Initialize the fonts
+
+ return this;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_graphics_type("cogl", graphics_cogl_new);
+}
--- /dev/null
+
+// ---------------------------------------------------------
+#include "navit_actor.h"
+#include "debug.h"
+
+
+G_DEFINE_TYPE (FooActor, foo_actor, CLUTTER_TYPE_ACTOR);
+
+
+static void
+test_coglbox_paint(ClutterActor *self)
+{
+ dbg(0,"low level drawing\n");
+ ClutterColor cfill;
+ ClutterColor cstroke;
+
+ cfill.red = 0;
+ cfill.green = 160;
+ cfill.blue = 0;
+ cfill.alpha = 255;
+
+ cstroke.red = 200;
+ cstroke.green = 0;
+ cstroke.blue = 0;
+ cstroke.alpha = 255;
+
+ cogl_push_matrix ();
+
+ cogl_path_round_rectangle (CLUTTER_INT_TO_FIXED (-50),
+ CLUTTER_INT_TO_FIXED (-25),
+ CLUTTER_INT_TO_FIXED (100),
+ CLUTTER_INT_TO_FIXED (50),
+ CLUTTER_INT_TO_FIXED (10),
+ 5);
+
+ cogl_translate (100,100,0);
+ cogl_color (&cstroke);
+ cogl_path_stroke ();
+
+ cogl_translate (150,0,0);
+ cogl_color (&cfill);
+ cogl_path_fill ();
+
+ cogl_pop_matrix();
+}
+
+static void
+foo_actor_class_init (FooActorClass *klass)
+{
+ ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
+ actor_class->paint = test_coglbox_paint;
+}
+
+static void
+foo_actor_init (FooActor *actor)
+{
+
+}
+
+ClutterActor*
+foo_actor_new (void)
+{
+ dbg(0,"New canvas for cogl created\n");
+ return g_object_new (FOO_TYPE_ACTOR, NULL);
+}
+
+// ---------------------------------------------------------
\ No newline at end of file
--- /dev/null
+#include <clutter/clutter.h>
+#include <stdlib.h>
+
+
+#define FOO_TYPE_ACTOR (foo_actor_get_type ())
+#define FOO_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOO_TYPE_ACTOR, FooActor))
+#define FOO_IS_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOO_TYPE_ACTOR))
+#define FOO_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOO_TYPE_ACTOR, FooActorClass))
+#define FOO_IS_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOO_TYPE_ACTOR))
+#define FOO_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOO_TYPE_ACTOR, FooActorClass))
+
+typedef struct _FooActor
+{
+ ClutterActor parent_instance;
+} FooActor;
+
+typedef struct _FooActorClass
+{
+ ClutterActorClass parent_class;
+} FooActorClass;
+
+ClutterActor* foo_actor_new (void);
\ No newline at end of file
if GUI_SDL
SUBDIRS += cegui
endif
+if GUI_CLUTTER
+ SUBDIRS += clutter
+endif
--- /dev/null
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = -I$(top_srcdir)/navit @NAVIT_CFLAGS@ @GLC_CFLAGS@ @CLUTTER_CFLAGS@ -DMODULE=gui_clutter
+modulegui_LTLIBRARIES = libgui_clutter.la
+libgui_clutter_la_SOURCES = gui_clutter_main.c gui_clutter_animators.c gui_clutter_animators.h gui_clutter_menuhack.c gui_clutter_menuhack.h navit_actor.h navit_actor.c
+libgui_clutter_la_LIBADD = @CLUTTER_LIBS@
--- /dev/null
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <clutter/clutter.h>
+
+extern ClutterTimeline *timeline;
+
--- /dev/null
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "glib.h"
+#include "debug.h"
+#include <clutter/clutter.h>
+#include "gui_clutter.h"
+#include "navit_actor.h"
+
+gboolean on_rect_button_release (ClutterActor *actor, ClutterEvent *event, gpointer data);
+gboolean init_clutter_gui(void);
+
+/**
+ * Makes the button 'bumps' when clicked
+ *
+ * @param actor The actor which was clicked
+ * @param event The event leading to the callback. Here we only handle button_release
+ * @param data Extra informations about the event.
+ * @returns a pointer to the gui instance
+ */
+gboolean on_rect_button_release (ClutterActor *actor, ClutterEvent *event, gpointer data)
+{
+ ClutterAlpha *alpha;
+ ClutterBehaviour *behave;
+
+ gint x = 0;
+ gint y = 0;
+ clutter_event_get_coords (event, &x, &y);
+
+ timeline = clutter_timeline_new_for_duration (200);
+
+ alpha = clutter_alpha_new_full (timeline,
+ CLUTTER_ALPHA_SINE,
+ NULL, NULL);
+
+ behave = clutter_behaviour_scale_new (alpha,
+ 1.0, 1.0, /* scale start */
+ 1.5, 1.5); /* scale end */
+
+ clutter_actor_move_anchor_point_from_gravity (actor, CLUTTER_GRAVITY_CENTER);
+ clutter_behaviour_apply (behave, actor );
+ clutter_timeline_start (timeline);
+
+ return TRUE; /* Stop further handling of this event. */
+}
+
+/**
+ * Initialize the clutter GUI.
+ * Currently, all widgets are hardcoded, but later we can change this using JSON
+ *
+ * @returns TRUE on success
+ */
+
+gboolean init_clutter_gui(void){
+
+ ClutterActor *rect = NULL;
+
+ ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
+ ClutterColor rect_color = { 0xff, 0xff, 0xff, 0x99 };
+
+ clutter_init (NULL,NULL); //&argc, &argv);
+
+ /* Get the stage and set its size and color: */
+ ClutterActor *stage = clutter_stage_get_default ();
+ clutter_actor_set_size (stage, 800, 600);
+ clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
+
+
+
+ /* Add a button to the stage: */
+ rect = clutter_rectangle_new_with_color (&rect_color);
+ clutter_actor_set_size (rect, 70, 30);
+ clutter_actor_set_position (rect, 700, 100);
+ clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
+
+ /* Allow the actor to emit events.
+ * By default only the stage does this. */
+ clutter_actor_set_reactive (rect, TRUE);
+ g_signal_connect (rect, "button-release-event", G_CALLBACK (on_rect_button_release), NULL);
+
+ clutter_actor_show (rect);
+
+
+ /* Add another button to the stage: */
+ rect = clutter_rectangle_new_with_color (&rect_color);
+ clutter_actor_set_size (rect, 70, 30);
+ clutter_actor_set_position (rect, 700, 150);
+ clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
+
+ clutter_actor_set_reactive (rect, TRUE);
+ g_signal_connect (rect, "button-release-event", G_CALLBACK (on_rect_button_release), NULL);
+
+ clutter_actor_show (rect);
+
+ /* The map drawing area */
+ ClutterActor *testActor=NULL;
+ testActor = foo_actor_new ();
+ clutter_container_add_actor (CLUTTER_CONTAINER (stage), testActor);
+
+ clutter_actor_set_rotation (testActor, CLUTTER_Y_AXIS, -30, 200, 0, 0);
+ clutter_actor_set_position (testActor, 0, 100);
+ /* End of the map drawing area */
+
+
+ /* Show the stage: */
+ clutter_actor_show (stage);
+ dbg(0,"Clutter init OK\n");
+ return TRUE;
+}
--- /dev/null
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+gboolean init_clutter_gui(void);
+gboolean on_rect_button_release (ClutterActor *rect, ClutterEvent *event, gpointer data);
--- /dev/null
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "glib.h"
+#include <stdio.h>
+#include <libintl.h>
+
+#include "navit.h"
+#include "config.h"
+#include "plugin.h"
+#include "gui.h"
+#include "debug.h"
+
+#include "projection.h"
+
+#include "item.h"
+#include "navit.h"
+#include "vehicle.h"
+#include "profile.h"
+#include "transform.h"
+#include "coord.h"
+#include "callback.h"
+#include "point.h"
+#include "graphics.h"
+#include "navigation.h"
+#include "attr.h"
+#include "track.h"
+#include "menu.h"
+#include "map.h"
+
+// Specific to this gui :
+#include "gui_clutter.h"
+ClutterTimeline *timeline = NULL;
+
+#include "gui_clutter_animators.h"
+#include "gui_clutter_menuhack.h"
+
+ClutterActor *testActor;
+
+struct gui_priv {
+ struct navit *nav;
+ int dyn_counter;
+};
+
+int gui_clutter_set_graphics(struct gui_priv *this_, struct graphics *gra);
+struct gui_priv * gui_clutter_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs);
+
+
+int gui_clutter_main_loop(struct gui *this_)
+{
+ GSource *timeout;
+ dbg(0,"Entering main loop\n");
+}
+
+
+struct gui_methods gui_clutter_methods = {
+ gui_clutter_menubar_new,
+ NULL, //gui_gtk_popup_new,
+ gui_clutter_set_graphics, // Needed
+ gui_clutter_main_loop, //gui_main_loop,
+ NULL, //gui_gtk_datawindow_new,
+ NULL, //gui_gtk_add_bookmark,
+};
+
+
+int
+gui_clutter_set_graphics(struct gui_priv *this_, struct graphics *gra)
+{
+ dbg(0,"setting up the graphics\n");
+
+ testActor=(ClutterActor *)graphics_get_data(gra, "navit_clutter_actor");
+ if (!testActor)
+ return 1;
+ return 0;
+}
+
+
+static void
+gui_gtk_init(struct gui_priv *this, struct navit *nav)
+{
+
+ dbg(0,"More init\n");
+ /*
+ gui_gtk_toggle_init(this);
+ gui_gtk_layouts_init(this);
+ gui_gtk_projections_init(this);
+ gui_gtk_vehicles_init(this);
+ gui_gtk_maps_init(this);
+ gui_gtk_destinations_init(this);
+ gui_gtk_bookmarks_init(this);
+ */
+}
+
+static gboolean
+gui_clutter_delete(ClutterActor *actor, ClutterEvent *event, struct navit *nav)
+{
+ dbg(0,"Exiting clutter gui\n");
+ /* FIXME remove attr_navit callback */
+ navit_destroy(nav);
+ g_object_unref (timeline);
+ dbg(0,"Done exiting clutter gui\n");
+ return TRUE;
+}
+
+/**
+ * Register a vehicule callback. It can be used to get infos like
+ * satellites in view, used, or any other information provided via
+ * nmea / gpsd.
+ *
+ * @param navit The navit instance
+ * @param vehicle pointer to the active vehicule
+ * @returns nothing
+ */
+static void vehicle_callback_handler( struct navit *nav, struct vehicle *v){
+ char buffer [50];
+ struct attr attr;
+ int sats=0, sats_used=0;
+ dbg(0,"Entering vehicle_callback_handler\n");
+
+ if (vehicle_get_attr(v, attr_position_speed, &attr))
+ sprintf (buffer, "%02.02f km/h", *attr.u.numd);
+ else
+ strcpy (buffer, "N/A");
+ dbg(0,"speed : %i ",buffer);
+
+ if (vehicle_get_attr(v, attr_position_height, &attr))
+ sprintf (buffer, "%.f m", *attr.u.numd);
+ else
+ strcpy (buffer, "N/A");
+ dbg(0,"alt : %i ",buffer);
+
+ if (vehicle_get_attr(v, attr_position_sats, &attr))
+ sats=attr.u.num;
+ if (vehicle_get_attr(v, attr_position_sats_used, &attr))
+ sats_used=attr.u.num;
+ dbg(0," sats : %i, used %i: \n",sats,sats_used);
+
+}
+
+/**
+ * Perform the gui initialization
+ *
+ * @param navit The navit instance
+ * @param meth an array of the methods used by the gui
+ * @param attrs pointer to the config attributes
+ * @returns a pointer to the gui instance
+ */
+struct gui_priv * gui_clutter_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs) {
+
+ struct gui_priv *this;
+
+ this=g_new0(struct gui_priv, 1);
+ this->nav=nav;
+
+
+ *meth=gui_clutter_methods;
+
+ init_clutter_gui();
+
+ // g_signal_connect(NULL, "delete-event", G_CALLBACK(gui_clutter_delete), nav);
+
+// Extra init
+// navit_add_callback(nav, callback_new_attr_1(callback_cast(gui_gtk_init), attr_navit, this));
+
+ struct callback *cb=callback_new_attr_0(callback_cast(vehicle_callback_handler), attr_position_coord_geo);
+ navit_add_callback(nav,cb);
+ dbg(0,"Vehicule callback registered\n");
+
+ return this;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_gui_type("clutter", gui_clutter_new);
+}
--- /dev/null
+#include "gui_clutter_menuhack.h"
+
+static struct menu_priv *
+add_menu(struct menu_priv *menu, struct menu_methods *meth, char *name, enum menu_type type, struct callback *cb)
+{
+ *meth=menu_methods;
+ dbg(0,"callback : %s\n",name);
+
+ if(menu==(struct menu_priv *)(MENU_BOOKMARK)){
+ dbg(0,"Item %s is a bookmark\n",name);
+
+ struct bookmark *newB = g_new0(struct bookmark, 1);
+ newB->name=g_strdup(name);
+ newB->cb=cb;
+ if (newB) {
+ newB->next = bookmarks;
+ bookmarks = newB;
+ }
+
+ }
+
+ if(menu==(struct menu_priv *)(MENU_FORMER_DEST)){
+ dbg(0,"Item %s is a former destination\n",name);
+
+ struct former_dest *newB = g_new0(struct former_dest, 1);
+ newB->name=g_strdup(name);
+ newB->cb=cb;
+ if (newB) {
+ newB->next = former_dests;
+ former_dests = newB;
+ }
+
+ }
+
+ if(!strcmp(name,"Bookmarks")){
+ dbg(0,"Menu is the bookmark menu!\n");
+ return (struct menu_priv *)MENU_BOOKMARK;
+ } else if(!strcmp(name,"Former Destinations")){
+ dbg(0,"Menu is the Former Destinations menu!\n");
+ return (struct menu_priv *)MENU_FORMER_DEST;
+ } else {
+ return (struct menu_priv *)1;
+ }
+}
+
+struct menu_priv *
+gui_clutter_menubar_new(struct gui_priv *this_, struct menu_methods *meth)
+{
+ dbg(0,"Creating the menus\n");
+ *meth=menu_methods;
+ return (struct menu_priv *) 1; //gui_gtk_ui_new(this_, meth, "/ui/MenuBar", nav, 0);
+}
--- /dev/null
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "glib.h"
+#include <stdio.h>
+#include <libintl.h>
+
+#include "navit.h"
+#include "config.h"
+#include "gui.h"
+#include "debug.h"
+#include "GL/glc.h"
+
+
+#include "projection.h"
+
+#include "item.h"
+#include "navit.h"
+#include "vehicle.h"
+#include "profile.h"
+#include "transform.h"
+#include "coord.h"
+#include "callback.h"
+#include "point.h"
+#include "graphics.h"
+#include "navigation.h"
+#include "attr.h"
+#include "track.h"
+#include "menu.h"
+#include "map.h"
+
+
+#define MENU_BOOKMARK 2
+#define MENU_FORMER_DEST 3
+
+struct bookmark{
+ char * name;
+ struct callback *cb;
+ struct bookmark *next;
+} *bookmarks;
+
+struct former_dest{
+ char * name;
+ struct callback *cb;
+ struct former_dest *next;
+} *former_dests;
+
+
+static struct menu_priv *
+ add_menu(struct menu_priv *menu, struct menu_methods *meth, char *name, enum menu_type type, struct callback *cb);
+
+static struct menu_methods menu_methods = {
+ add_menu,
+};
+
+struct menu_priv {
+ char *path;
+// GtkAction *action;
+ struct gui_priv *gui;
+ enum menu_type type;
+ struct callback *cb;
+ struct menu_priv *child;
+ struct menu_priv *sibling;
+ gulong handler_id;
+ guint merge_id;
+};
+
+struct menu_priv *
+gui_clutter_menubar_new(struct gui_priv *this_, struct menu_methods *meth);
--- /dev/null
+../../graphics/cogl/navit_actor.c
\ No newline at end of file
--- /dev/null
+../../graphics/cogl/navit_actor.h
\ No newline at end of file