AM_CPPFLAGS = $(DEPS_CFLAGS) $(WARN_CFLAGS)
AM_LDFLAGS = $(DEPS_LIBS)
-launcher_SOURCES = launcher.c
+launcher_SOURCES = launcher.c markers.c
launcher_LDADD = $(DEPS_LIBS) ../champlain/libchamplain-0.3.la
animated_marker_SOURCES = animated-marker.c
if ENABLE_GTK
noinst_PROGRAMS += launcher-gtk
-launcher_gtk_SOURCES = launcher-gtk.c
+launcher_gtk_SOURCES = launcher-gtk.c markers.c
launcher_gtk_CPPFLAGS = $(GTK_DEPS_CFLAGS)
launcher_gtk_LDADD = $(GTK_DEPS_LIBS) $(DEPS_LIBS) \
../champlain-gtk/libchamplain-gtk-0.3.la \
*/
#include <champlain/champlain.h>
+#include "markers.h"
#define PADDING 10
-ChamplainBaseMarker *markers [4];
static gboolean
map_view_button_release_cb (ClutterActor *actor,
- ClutterButtonEvent *event,
- ChamplainView * view)
+ ClutterButtonEvent *event,
+ ChamplainView * view)
{
gdouble lat, lon;
g_print("Map was clicked at ");
if (champlain_view_get_coords_from_event (view, (ClutterEvent*)event, &lat,
&lon))
- g_print("%f, %f \n", lat, lon);
-
- return TRUE;
-}
-
-static gboolean
-marker_button_release_cb (ClutterActor *actor,
- ClutterButtonEvent *event,
- ChamplainView * view)
-{
- if (event->button != 1 || event->click_count > 1)
- return FALSE;
-
- g_print("Montreal was clicked\n");
+ g_print("Map clicked at %f, %f \n", lat, lon);
return TRUE;
}
static gboolean
zoom_in (ClutterActor *actor,
- ClutterButtonEvent *event,
- ChamplainView * view)
+ ClutterButtonEvent *event,
+ ChamplainView * view)
{
champlain_view_zoom_in (view);
return TRUE;
static gboolean
zoom_out (ClutterActor *actor,
- ClutterButtonEvent *event,
- ChamplainView * view)
+ ClutterButtonEvent *event,
+ ChamplainView * view)
{
champlain_view_zoom_out (view);
return TRUE;
}
-static gboolean
-center (ClutterActor *actor,
- ClutterButtonEvent *event,
- ChamplainView * view)
-{
- champlain_view_ensure_markers_visible (view, markers, TRUE);
- return TRUE;
-}
-
-static ChamplainLayer *
-create_marker_layer (ChamplainView *view)
-{
- ClutterActor *marker;
- ChamplainLayer *layer;
- //ClutterColor orange = { 0xf3, 0x94, 0x07, 0xbb };
- //ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
-
- layer = champlain_layer_new ();
-
- marker = champlain_marker_new_with_text ("Montréal\n<span size=\"xx-small\">Québec</span>",
- "Airmole 14", NULL, NULL);
- champlain_marker_set_use_markup (CHAMPLAIN_MARKER (marker), TRUE);
-
- markers[0] = CHAMPLAIN_BASE_MARKER (marker);
- champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker),
- 45.528178, -73.563788);
- clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
- clutter_actor_set_reactive (marker, TRUE);
- g_signal_connect_after (marker, "button-release-event",
- G_CALLBACK (marker_button_release_cb), view);
-
- marker = champlain_marker_new_full ("New York", "/usr/share/icons/Tango/32x32/apps/system-users.png", NULL);
- markers[1] = CHAMPLAIN_BASE_MARKER (marker);
- champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 40.77, -73.98);
- clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
-
- marker = champlain_marker_new_with_image ("/usr/share/icons/Tango/32x32/apps/system-users.png", NULL);
- markers[2] = CHAMPLAIN_BASE_MARKER (marker);
- champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 47.130885,
- -70.764141);
- clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
-
- markers[3] = NULL;
-
- clutter_actor_show (CLUTTER_ACTOR (layer));
- return layer;
-}
-
static ClutterActor *
make_button (char *text)
{
int
main (int argc,
- char *argv[])
+ char *argv[])
{
ClutterActor* actor, *stage, *buttons, *button;
ChamplainLayer *layer;
G_CALLBACK (zoom_out),
actor);
- button = make_button ("Center on markers");
- clutter_container_add_actor (CLUTTER_CONTAINER (buttons), button);
- clutter_actor_set_reactive (button, TRUE);
- clutter_actor_set_position (button, total_width, 0);
- clutter_actor_get_size (button, &width, NULL);
- total_width += width + PADDING;
- g_signal_connect (button, "button-release-event",
- G_CALLBACK (center),
- actor);
-
clutter_container_add_actor (CLUTTER_CONTAINER (stage), buttons);
/* Create the markers and marker layer */
--- /dev/null
+/*
+ * Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <champlain/champlain.h>
+#include <markers.h>
+
+static gboolean
+marker_button_release_cb (ClutterActor *actor,
+ ClutterButtonEvent *event,
+ ChamplainView * view)
+{
+ if (event->button != 1 || event->click_count > 1)
+ return FALSE;
+
+ g_print("Montreal was clicked\n");
+
+ return TRUE;
+}
+
+ChamplainLayer *
+create_marker_layer (ChamplainView *view)
+{
+ ClutterActor *marker;
+ ChamplainLayer *layer;
+
+ layer = champlain_layer_new ();
+
+ marker = champlain_marker_new_with_text ("Montréal\n<span size=\"xx-small\">Québec</span>",
+ "Airmole 14", NULL, NULL);
+ champlain_marker_set_use_markup (CHAMPLAIN_MARKER (marker), TRUE);
+
+ champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker),
+ 45.528178, -73.563788);
+ clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
+ clutter_actor_set_reactive (marker, TRUE);
+ g_signal_connect_after (marker, "button-release-event",
+ G_CALLBACK (marker_button_release_cb), view);
+
+ marker = champlain_marker_new_full ("New York", "/usr/share/icons/gnome/32x32/emblems/emblem-generic.png", NULL);
+ champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 40.77, -73.98);
+ clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
+
+ marker = champlain_marker_new_with_image ("/usr/share/icons/Tango/32x32/emblems/emblem-important.png", NULL);
+ champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 47.130885,
+ -70.764141);
+ clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
+
+ marker = champlain_marker_new_with_image ("/usr/share/icons/Tango/32x32/emblems/emblem-urgent.png", NULL);
+ champlain_marker_set_draw_background (CHAMPLAIN_MARKER (marker), FALSE);
+ champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 47,
+ -80);
+ clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
+
+ clutter_actor_show (CLUTTER_ACTOR (layer));
+ return layer;
+}
--- /dev/null
+/*
+ * Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <champlain/champlain.h>
+
+#ifndef MARKERS_H
+#define MARKERS_H
+
+ChamplainLayer * create_marker_layer (ChamplainView *view);
+
+#endif