/*
- * Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
+ * Copyright (C) 2008, 2009 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
ClutterScrollEvent *event,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ClutterActor *group, *new_group;
gdouble lon, lat;
marker_reposition_cb (ChamplainMarker *marker,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ChamplainMarkerPrivate *marker_priv = CHAMPLAIN_MARKER_GET_PRIVATE (marker);
gint x, y;
marker_reposition (gpointer data)
{
ChamplainView *view = CHAMPLAIN_VIEW (data);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
clutter_container_foreach (CLUTTER_CONTAINER (priv->user_layers),
CLUTTER_CALLBACK (layer_reposition_cb), view);
return FALSE;
static void
create_initial_map (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ClutterActor *group;
priv->map = map_new ();
static void
license_set_position (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
guint width, height;
if (!priv->license_actor)
gboolean center = FALSE;
TidyAdjustment *hadjust, *vadjust;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (!priv->map)
{
GParamSpec *pspec)
{
ChamplainView *view = CHAMPLAIN_VIEW (object);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
switch (prop_id)
{
GParamSpec *pspec)
{
ChamplainView *view = CHAMPLAIN_VIEW (object);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
switch (prop_id)
{
{
/*
ChamplainView *view = CHAMPLAIN_VIEW (object);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
*/
G_OBJECT_CLASS (champlain_view_parent_class)->finalize (object);
champlain_debug_set_flags (g_getenv ("CHAMPLAIN_DEBUG"));
+ view->priv = priv;
+
priv->map_source = champlain_map_source_new_osm_mapnik ();
priv->zoom_level = 0;
priv->min_zoom_level = champlain_map_source_get_min_zoom_level (priv->map_source);
GParamSpec *arg1,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ChamplainPoint rect;
ChamplainPoint old_anchor;
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
priv->viewport_size.width = width;
priv->viewport_size.height = height;
static void
update_license (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->license_actor)
clutter_container_remove_actor (CLUTTER_CONTAINER (priv->stage),
ClutterButtonEvent *event,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->zoom_on_double_click && event->button == 1 && event->click_count == 2)
{
static void
view_update_anchor (ChamplainView *view, gint x, gint y)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gboolean need_anchor = FALSE;
gboolean need_update = FALSE;
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
gint x, y;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
priv->longitude = longitude;
priv->latitude = latitude;
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->goto_context == NULL)
return;
gint duration;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
GoToContext *ctx = g_new0 (GoToContext, 1);
ctx->from_latitude = priv->latitude;
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
champlain_view_set_zoom_level (view, priv->zoom_level + 1);
}
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
champlain_view_set_zoom_level (view, priv->zoom_level - 1);
}
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->map == NULL)
return;
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->min_zoom_level == min_zoom_level ||
min_zoom_level > priv->max_zoom_level ||
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->max_zoom_level == max_zoom_level ||
max_zoom_level < priv->min_zoom_level ||
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
g_return_if_fail (CLUTTER_IS_ACTOR (layer));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
clutter_container_add (CLUTTER_CONTAINER (priv->user_layers),
CLUTTER_ACTOR (layer), NULL);
clutter_actor_raise_top (CLUTTER_ACTOR (layer));
/* Apparently there isn a more precise test */
g_return_val_if_fail (event, FALSE);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
guint x, y;
gint actor_x, actor_y;
gint rel_x, rel_y;
static void
view_load_visible_tiles (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ChamplainRectangle viewport = priv->viewport_size;
viewport.x += priv->anchor.x;
static void
view_position_tile (ChamplainView* view, ChamplainTile* tile)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ClutterActor *actor;
gint x;
static void
view_tiles_reposition (ChamplainView* view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gint i;
for (i = 0; i < champlain_zoom_level_tile_count (priv->map->current_level); i++)
static void
view_update_state (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ChamplainState new_state = CHAMPLAIN_STATE_DONE;
gint i;
ClutterActor *group;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->map_source == source)
return;
rate > 2.0 &&
rate < 0);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
g_object_set (priv->finger_scroll, "decel-rate", rate, NULL);
}
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
priv->scroll_mode = mode;
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
priv->keep_center_on_resize = value;
}
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
priv->show_license = value;
update_license (view);
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
priv->zoom_on_double_click = value;
}
gdouble lon2,
gboolean animate)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gint zoom_level = priv->zoom_level;
gdouble width, height;
gdouble min_lat,min_lon,max_lat,max_lon;