[libchamplain] Rename tidy to champlain and move to the champlain directory
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Rename tidy to champlain and move to the champlain directory
- Date: Sat, 26 Feb 2011 12:58:34 +0000 (UTC)
commit f4420f2e36ff6e90baf0aee8471c68d2c806261b
Author: JiÅ?Ã Techet <techet gmail com>
Date: Thu Feb 24 22:54:14 2011 +0100
Rename tidy to champlain and move to the champlain directory
Now as we have only three classes from tidy, it reduces quite some makefile
and boilerplate code when we move them directly to the champlain directory.
Makefile.am | 2 +-
champlain/Makefile.am | 11 +-
.../champlain-adjustment.c | 176 +++++++-------
.../champlain-adjustment.h | 64 +++---
.../champlain-finger-scroll.c | 244 ++++++++++----------
champlain/champlain-finger-scroll.h | 64 +++++
champlain/champlain-marshal.list | 2 +
champlain/champlain-view.c | 28 ++--
.../champlain-viewport.c | 186 ++++++++--------
champlain/champlain-viewport.h | 79 +++++++
configure.ac | 1 -
tidy/Makefile.am | 58 -----
tidy/tidy-enum-types.c.in | 30 ---
tidy/tidy-enum-types.h.in | 25 --
tidy/tidy-finger-scroll.h | 64 -----
tidy/tidy-marshal.list | 6 -
tidy/tidy-private.h | 40 ----
tidy/tidy-viewport.h | 79 -------
18 files changed, 503 insertions(+), 656 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6b9c72f..b5746f9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = build tidy champlain
+SUBDIRS = build champlain
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
diff --git a/champlain/Makefile.am b/champlain/Makefile.am
index 8934354..2f8cfdd 100644
--- a/champlain/Makefile.am
+++ b/champlain/Makefile.am
@@ -42,6 +42,9 @@ libchamplain_headers_public = \
$(srcdir)/champlain-file-tile-source.h \
$(srcdir)/champlain-null-tile-source.h \
$(srcdir)/champlain-network-bbox-tile-source.h \
+ $(srcdir)/champlain-adjustment.h \
+ $(srcdir)/champlain-finger-scroll.h \
+ $(srcdir)/champlain-viewport.h \
$(srcdir)/champlain-bounding-box.h
libchamplain_headers_private = \
@@ -87,6 +90,9 @@ libchamplain_sources = \
$(srcdir)/champlain-null-tile-source.c \
$(srcdir)/champlain-network-bbox-tile-source.c \
$(srcdir)/champlain-group.c \
+ $(srcdir)/champlain-adjustment.c \
+ $(srcdir)/champlain-finger-scroll.c \
+ $(srcdir)/champlain-viewport.c \
$(srcdir)/champlain-bounding-box.c
champlain-features.h: $(top_builddir)/config.status
@@ -125,7 +131,7 @@ nodist_libchamplain_ CHAMPLAIN_API_VERSION@_la_SOURCES = \
$(libchamplain_headers_built) \
$(libchamplain_sources_built)
-libchamplain_ CHAMPLAIN_API_VERSION@_la_LIBADD = $(DEPS_LIBS) $(SOUP_LIBS) $(MEMPHIS_LIBS) $(top_builddir)/tidy/libtidy-1.0.la
+libchamplain_ CHAMPLAIN_API_VERSION@_la_LIBADD = $(DEPS_LIBS) $(SOUP_LIBS) $(MEMPHIS_LIBS)
libchamplain_ CHAMPLAIN_API_VERSION@_la_LDFLAGS = \
-version-info $(LIBRARY_VERSION)\
@@ -137,7 +143,6 @@ AM_CPPFLAGS = \
$(SOUP_CFLAGS) \
$(MEMPHIS_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
- -I$(top_srcdir)/tidy \
-I$(top_srcdir) \
-DCHAMPLAIN_COMPILATION \
$(WARN_CFLAGS)
@@ -174,7 +179,7 @@ Champlain_ CHAMPLAIN_API_VERSION_NORM@_gir_FILES = $(introspection_sources)
Champlain_ CHAMPLAIN_API_VERSION_NORM@_gir_INCLUDES = Clutter-1.0 Gtk-3.0 $(memphis_gir_include)
Champlain_ CHAMPLAIN_API_VERSION_NORM@_gir_CFLAGS = \
$(DEPS_CFLAGS) $(SOUP_CFLAGS) $(MEMPHIS_CFLAGS) \
- -I$(top_srcdir)/tidy -I$(top_srcdir) -I$(top_builddir) \
+ -I$(top_srcdir) -I$(top_builddir) \
-DCHAMPLAIN_COMPILATION
INTROSPECTION_GIRS += Champlain- CHAMPLAIN_API_VERSION@.gir
diff --git a/tidy/tidy-adjustment.c b/champlain/champlain-adjustment.c
similarity index 72%
rename from tidy/tidy-adjustment.c
rename to champlain/champlain-adjustment.c
index 6976ebb..766f5c1 100644
--- a/tidy/tidy-adjustment.c
+++ b/champlain/champlain-adjustment.c
@@ -1,4 +1,4 @@
-/* tidy-adjustment.c: Adjustment object
+/* champlain-adjustment.c: Adjustment object
*
* Copyright (C) 2008 OpenedHand
*
@@ -27,15 +27,15 @@
#include <glib-object.h>
#include <clutter/clutter.h>
-#include "tidy-adjustment.h"
-#include "tidy-marshal.h"
-#include "tidy-private.h"
+#include "champlain-adjustment.h"
+#include "champlain-marshal.h"
+#include "champlain-private.h"
-G_DEFINE_TYPE (TidyAdjustment, tidy_adjustment, G_TYPE_OBJECT)
+G_DEFINE_TYPE (ChamplainAdjustment, champlain_adjustment, G_TYPE_OBJECT)
-#define ADJUSTMENT_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TIDY_TYPE_ADJUSTMENT, TidyAdjustmentPrivate))
+#define ADJUSTMENT_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_ADJUSTMENT, ChamplainAdjustmentPrivate))
-struct _TidyAdjustmentPrivate
+struct _ChamplainAdjustmentPrivate
{
gdouble lower;
gdouble upper;
@@ -78,24 +78,24 @@ enum
static guint signals[LAST_SIGNAL] = { 0, };
-static void tidy_adjustment_set_lower (TidyAdjustment *adjustment,
+static void champlain_adjustment_set_lower (ChamplainAdjustment *adjustment,
gdouble lower);
-static void tidy_adjustment_set_upper (TidyAdjustment *adjustment,
+static void champlain_adjustment_set_upper (ChamplainAdjustment *adjustment,
gdouble upper);
-static void tidy_adjustment_set_step_increment (TidyAdjustment *adjustment,
+static void champlain_adjustment_set_step_increment (ChamplainAdjustment *adjustment,
gdouble step);
-static void tidy_adjustment_set_page_increment (TidyAdjustment *adjustment,
+static void champlain_adjustment_set_page_increment (ChamplainAdjustment *adjustment,
gdouble page);
-static void tidy_adjustment_set_page_size (TidyAdjustment *adjustment,
+static void champlain_adjustment_set_page_size (ChamplainAdjustment *adjustment,
gdouble size);
static void
-tidy_adjustment_get_property (GObject *object,
+champlain_adjustment_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- TidyAdjustmentPrivate *priv = TIDY_ADJUSTMENT (object)->priv;
+ ChamplainAdjustmentPrivate *priv = CHAMPLAIN_ADJUSTMENT (object)->priv;
switch (prop_id)
{
@@ -134,41 +134,41 @@ tidy_adjustment_get_property (GObject *object,
}
static void
-tidy_adjustment_set_property (GObject *object,
+champlain_adjustment_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- TidyAdjustment *adj = TIDY_ADJUSTMENT (object);
+ ChamplainAdjustment *adj = CHAMPLAIN_ADJUSTMENT (object);
switch (prop_id)
{
case PROP_LOWER:
- tidy_adjustment_set_lower (adj, g_value_get_double (value));
+ champlain_adjustment_set_lower (adj, g_value_get_double (value));
break;
case PROP_UPPER:
- tidy_adjustment_set_upper (adj, g_value_get_double (value));
+ champlain_adjustment_set_upper (adj, g_value_get_double (value));
break;
case PROP_VALUE:
- tidy_adjustment_set_value (adj, g_value_get_double (value));
+ champlain_adjustment_set_value (adj, g_value_get_double (value));
break;
case PROP_STEP_INC:
- tidy_adjustment_set_step_increment (adj, g_value_get_double (value));
+ champlain_adjustment_set_step_increment (adj, g_value_get_double (value));
break;
case PROP_PAGE_INC:
- tidy_adjustment_set_page_increment (adj, g_value_get_double (value));
+ champlain_adjustment_set_page_increment (adj, g_value_get_double (value));
break;
case PROP_PAGE_SIZE:
- tidy_adjustment_set_page_size (adj, g_value_get_double (value));
+ champlain_adjustment_set_page_size (adj, g_value_get_double (value));
break;
case PROP_ELASTIC:
- tidy_adjustment_set_elastic (adj, g_value_get_boolean (value));
+ champlain_adjustment_set_elastic (adj, g_value_get_boolean (value));
break;
default:
@@ -178,9 +178,9 @@ tidy_adjustment_set_property (GObject *object,
}
static void
-stop_interpolation (TidyAdjustment *adjustment)
+stop_interpolation (ChamplainAdjustment *adjustment)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
if (priv->interpolation)
{
clutter_timeline_stop (priv->interpolation);
@@ -196,29 +196,29 @@ stop_interpolation (TidyAdjustment *adjustment)
}
void
-tidy_adjustment_interpolate_stop (TidyAdjustment *adjustment)
+champlain_adjustment_interpolate_stop (ChamplainAdjustment *adjustment)
{
stop_interpolation (adjustment);
}
static void
-tidy_adjustment_dispose (GObject *object)
+champlain_adjustment_dispose (GObject *object)
{
- stop_interpolation (TIDY_ADJUSTMENT (object));
+ stop_interpolation (CHAMPLAIN_ADJUSTMENT (object));
- G_OBJECT_CLASS (tidy_adjustment_parent_class)->dispose (object);
+ G_OBJECT_CLASS (champlain_adjustment_parent_class)->dispose (object);
}
static void
-tidy_adjustment_class_init (TidyAdjustmentClass *klass)
+champlain_adjustment_class_init (ChamplainAdjustmentClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (TidyAdjustmentPrivate));
+ g_type_class_add_private (klass, sizeof (ChamplainAdjustmentPrivate));
- object_class->get_property = tidy_adjustment_get_property;
- object_class->set_property = tidy_adjustment_set_property;
- object_class->dispose = tidy_adjustment_dispose;
+ object_class->get_property = champlain_adjustment_get_property;
+ object_class->set_property = champlain_adjustment_set_property;
+ object_class->dispose = champlain_adjustment_dispose;
g_object_class_install_property (object_class,
PROP_LOWER,
@@ -228,7 +228,7 @@ tidy_adjustment_class_init (TidyAdjustmentClass *klass)
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
- TIDY_PARAM_READWRITE));
+ CHAMPLAIN_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_UPPER,
g_param_spec_double ("upper",
@@ -237,7 +237,7 @@ tidy_adjustment_class_init (TidyAdjustmentClass *klass)
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
- TIDY_PARAM_READWRITE));
+ CHAMPLAIN_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_VALUE,
g_param_spec_double ("value",
@@ -246,7 +246,7 @@ tidy_adjustment_class_init (TidyAdjustmentClass *klass)
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
- TIDY_PARAM_READWRITE));
+ CHAMPLAIN_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_STEP_INC,
g_param_spec_double ("step-increment",
@@ -255,7 +255,7 @@ tidy_adjustment_class_init (TidyAdjustmentClass *klass)
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
- TIDY_PARAM_READWRITE));
+ CHAMPLAIN_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_PAGE_INC,
g_param_spec_double ("page-increment",
@@ -264,7 +264,7 @@ tidy_adjustment_class_init (TidyAdjustmentClass *klass)
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
- TIDY_PARAM_READWRITE));
+ CHAMPLAIN_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_PAGE_SIZE,
g_param_spec_double ("page-size",
@@ -273,7 +273,7 @@ tidy_adjustment_class_init (TidyAdjustmentClass *klass)
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
- TIDY_PARAM_READWRITE));
+ CHAMPLAIN_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_ELASTIC,
g_param_spec_boolean ("elastic",
@@ -283,33 +283,33 @@ tidy_adjustment_class_init (TidyAdjustmentClass *klass)
"'elastic' way and "
"stop clamping value.",
FALSE,
- TIDY_PARAM_READWRITE));
+ CHAMPLAIN_PARAM_READWRITE));
signals[CHANGED] =
g_signal_new ("changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (TidyAdjustmentClass, changed),
+ G_STRUCT_OFFSET (ChamplainAdjustmentClass, changed),
NULL, NULL,
- _tidy_marshal_VOID__VOID,
+ g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
-tidy_adjustment_init (TidyAdjustment *self)
+champlain_adjustment_init (ChamplainAdjustment *self)
{
self->priv = ADJUSTMENT_PRIVATE (self);
}
-TidyAdjustment *
-tidy_adjustment_new (gdouble value,
+ChamplainAdjustment *
+champlain_adjustment_new (gdouble value,
gdouble lower,
gdouble upper,
gdouble step_increment,
gdouble page_increment,
gdouble page_size)
{
- return g_object_new (TIDY_TYPE_ADJUSTMENT,
+ return g_object_new (CHAMPLAIN_TYPE_ADJUSTMENT,
"value", value,
"lower", lower,
"upper", upper,
@@ -320,20 +320,20 @@ tidy_adjustment_new (gdouble value,
}
gdouble
-tidy_adjustment_get_value (TidyAdjustment *adjustment)
+champlain_adjustment_get_value (ChamplainAdjustment *adjustment)
{
- g_return_val_if_fail (TIDY_IS_ADJUSTMENT (adjustment), 0.0);
+ g_return_val_if_fail (CHAMPLAIN_IS_ADJUSTMENT (adjustment), 0.0);
return adjustment->priv->value;
}
void
-tidy_adjustment_set_value (TidyAdjustment *adjustment,
+champlain_adjustment_set_value (ChamplainAdjustment *adjustment,
double value)
{
- TidyAdjustmentPrivate *priv;
+ ChamplainAdjustmentPrivate *priv;
- g_return_if_fail (TIDY_IS_ADJUSTMENT (adjustment));
+ g_return_if_fail (CHAMPLAIN_IS_ADJUSTMENT (adjustment));
priv = adjustment->priv;
@@ -351,14 +351,14 @@ tidy_adjustment_set_value (TidyAdjustment *adjustment,
}
static void
-tidy_adjustment_clamp_page (TidyAdjustment *adjustment,
+champlain_adjustment_clamp_page (ChamplainAdjustment *adjustment,
double lower,
double upper)
{
gboolean changed;
- TidyAdjustmentPrivate *priv;
+ ChamplainAdjustmentPrivate *priv;
- g_return_if_fail (TIDY_IS_ADJUSTMENT (adjustment));
+ g_return_if_fail (CHAMPLAIN_IS_ADJUSTMENT (adjustment));
priv = adjustment->priv;
@@ -386,10 +386,10 @@ tidy_adjustment_clamp_page (TidyAdjustment *adjustment,
}
static void
-tidy_adjustment_set_lower (TidyAdjustment *adjustment,
+champlain_adjustment_set_lower (ChamplainAdjustment *adjustment,
gdouble lower)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
if (priv->lower != lower)
{
@@ -399,15 +399,15 @@ tidy_adjustment_set_lower (TidyAdjustment *adjustment,
g_object_notify (G_OBJECT (adjustment), "lower");
- tidy_adjustment_clamp_page (adjustment, priv->lower, priv->upper);
+ champlain_adjustment_clamp_page (adjustment, priv->lower, priv->upper);
}
}
static void
-tidy_adjustment_set_upper (TidyAdjustment *adjustment,
+champlain_adjustment_set_upper (ChamplainAdjustment *adjustment,
gdouble upper)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
if (priv->upper != upper)
{
@@ -417,15 +417,15 @@ tidy_adjustment_set_upper (TidyAdjustment *adjustment,
g_object_notify (G_OBJECT (adjustment), "upper");
- tidy_adjustment_clamp_page (adjustment, priv->lower, priv->upper);
+ champlain_adjustment_clamp_page (adjustment, priv->lower, priv->upper);
}
}
static void
-tidy_adjustment_set_step_increment (TidyAdjustment *adjustment,
+champlain_adjustment_set_step_increment (ChamplainAdjustment *adjustment,
gdouble step)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
if (priv->step_increment != step)
{
@@ -438,10 +438,10 @@ tidy_adjustment_set_step_increment (TidyAdjustment *adjustment,
}
static void
-tidy_adjustment_set_page_increment (TidyAdjustment *adjustment,
+champlain_adjustment_set_page_increment (ChamplainAdjustment *adjustment,
gdouble page)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
if (priv->page_increment != page)
{
@@ -454,10 +454,10 @@ tidy_adjustment_set_page_increment (TidyAdjustment *adjustment,
}
static void
-tidy_adjustment_set_page_size (TidyAdjustment *adjustment,
+champlain_adjustment_set_page_size (ChamplainAdjustment *adjustment,
gdouble size)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
if (priv->page_size != size)
{
@@ -467,12 +467,12 @@ tidy_adjustment_set_page_size (TidyAdjustment *adjustment,
g_object_notify (G_OBJECT (adjustment), "page_size");
- tidy_adjustment_clamp_page (adjustment, priv->lower, priv->upper);
+ champlain_adjustment_clamp_page (adjustment, priv->lower, priv->upper);
}
}
void
-tidy_adjustment_get_values (TidyAdjustment *adjustment,
+champlain_adjustment_get_values (ChamplainAdjustment *adjustment,
gdouble *value,
gdouble *lower,
gdouble *upper,
@@ -480,9 +480,9 @@ tidy_adjustment_get_values (TidyAdjustment *adjustment,
gdouble *page_increment,
gdouble *page_size)
{
- TidyAdjustmentPrivate *priv;
+ ChamplainAdjustmentPrivate *priv;
- g_return_if_fail (TIDY_IS_ADJUSTMENT (adjustment));
+ g_return_if_fail (CHAMPLAIN_IS_ADJUSTMENT (adjustment));
priv = adjustment->priv;
@@ -493,7 +493,7 @@ tidy_adjustment_get_values (TidyAdjustment *adjustment,
*upper = priv->upper;
if (value)
- *value = tidy_adjustment_get_value (adjustment);
+ *value = champlain_adjustment_get_value (adjustment);
if (step_increment)
*step_increment = priv->step_increment;
@@ -508,9 +508,9 @@ tidy_adjustment_get_values (TidyAdjustment *adjustment,
static void
interpolation_new_frame_cb (ClutterTimeline *timeline,
gint frame_num,
- TidyAdjustment *adjustment)
+ ChamplainAdjustment *adjustment)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
priv->interpolation = NULL;
if (priv->elastic && priv->bounce_alpha)
@@ -519,10 +519,10 @@ interpolation_new_frame_cb (ClutterTimeline *timeline,
gdouble dx = priv->old_position +
(priv->new_position - priv->old_position) *
progress;
- tidy_adjustment_set_value (adjustment, dx);
+ champlain_adjustment_set_value (adjustment, dx);
}
else
- tidy_adjustment_set_value (adjustment,
+ champlain_adjustment_set_value (adjustment,
priv->old_position +
frame_num * priv->dx);
priv->interpolation = timeline;
@@ -530,12 +530,12 @@ interpolation_new_frame_cb (ClutterTimeline *timeline,
static void
interpolation_completed_cb (ClutterTimeline *timeline,
- TidyAdjustment *adjustment)
+ ChamplainAdjustment *adjustment)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
stop_interpolation (adjustment);
- tidy_adjustment_set_value (adjustment,
+ champlain_adjustment_set_value (adjustment,
priv->new_position);
}
@@ -562,18 +562,18 @@ bounce_alpha_func (ClutterAlpha *alpha,
*/
void
-tidy_adjustment_interpolate (TidyAdjustment *adjustment,
+champlain_adjustment_interpolate (ChamplainAdjustment *adjustment,
gdouble value,
guint n_frames,
guint fps)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
stop_interpolation (adjustment);
if (n_frames <= 1)
{
- tidy_adjustment_set_value (adjustment, value);
+ champlain_adjustment_set_value (adjustment, value);
return;
}
@@ -600,25 +600,25 @@ tidy_adjustment_interpolate (TidyAdjustment *adjustment,
}
gboolean
-tidy_adjustment_get_elastic (TidyAdjustment *adjustment)
+champlain_adjustment_get_elastic (ChamplainAdjustment *adjustment)
{
return adjustment->priv->elastic;
}
void
-tidy_adjustment_set_elastic (TidyAdjustment *adjustment,
+champlain_adjustment_set_elastic (ChamplainAdjustment *adjustment,
gboolean elastic)
{
adjustment->priv->elastic = elastic;
}
gboolean
-tidy_adjustment_clamp (TidyAdjustment *adjustment,
+champlain_adjustment_clamp (ChamplainAdjustment *adjustment,
gboolean interpolate,
guint n_frames,
guint fps)
{
- TidyAdjustmentPrivate *priv = adjustment->priv;
+ ChamplainAdjustmentPrivate *priv = adjustment->priv;
gdouble dest = priv->value;
if (priv->value < priv->lower)
@@ -629,12 +629,12 @@ tidy_adjustment_clamp (TidyAdjustment *adjustment,
if (dest != priv->value)
{
if (interpolate)
- tidy_adjustment_interpolate (adjustment,
+ champlain_adjustment_interpolate (adjustment,
dest,
n_frames,
fps);
else
- tidy_adjustment_set_value (adjustment, dest);
+ champlain_adjustment_set_value (adjustment, dest);
return TRUE;
}
diff --git a/tidy/tidy-adjustment.h b/champlain/champlain-adjustment.h
similarity index 57%
rename from tidy/tidy-adjustment.h
rename to champlain/champlain-adjustment.h
index ac34f19..50a7e2f 100644
--- a/tidy/tidy-adjustment.h
+++ b/champlain/champlain-adjustment.h
@@ -1,4 +1,4 @@
-/* tidy-adjustment.h: Adjustment object
+/* champlain-adjustment.h: Adjustment object
*
* Copyright (C) 2008 OpenedHand
*
@@ -20,74 +20,74 @@
* Written by: Chris Lord <chris openedhand com>, inspired by GtkAdjustment
*/
-#ifndef __TIDY_ADJUSTMENT_H__
-#define __TIDY_ADJUSTMENT_H__
+#ifndef __CHAMPLAIN_ADJUSTMENT_H__
+#define __CHAMPLAIN_ADJUSTMENT_H__
#include <glib-object.h>
#include <clutter/clutter.h>
G_BEGIN_DECLS
-#define TIDY_TYPE_ADJUSTMENT (tidy_adjustment_get_type())
-#define TIDY_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TIDY_TYPE_ADJUSTMENT, TidyAdjustment))
-#define TIDY_IS_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TIDY_TYPE_ADJUSTMENT))
-#define TIDY_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TIDY_TYPE_ADJUSTMENT, TidyAdjustmentClass))
-#define TIDY_IS_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TIDY_TYPE_ADJUSTMENT))
-#define TIDY_ADJUSTMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TIDY_TYPE_ADJUSTMENT, TidyAdjustmentClass))
+#define CHAMPLAIN_TYPE_ADJUSTMENT (champlain_adjustment_get_type())
+#define CHAMPLAIN_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_ADJUSTMENT, ChamplainAdjustment))
+#define CHAMPLAIN_IS_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_ADJUSTMENT))
+#define CHAMPLAIN_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_ADJUSTMENT, ChamplainAdjustmentClass))
+#define CHAMPLAIN_IS_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_ADJUSTMENT))
+#define CHAMPLAIN_ADJUSTMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_ADJUSTMENT, ChamplainAdjustmentClass))
-typedef struct _TidyAdjustment TidyAdjustment;
-typedef struct _TidyAdjustmentPrivate TidyAdjustmentPrivate;
-typedef struct _TidyAdjustmentClass TidyAdjustmentClass;
+typedef struct _ChamplainAdjustment ChamplainAdjustment;
+typedef struct _ChamplainAdjustmentPrivate ChamplainAdjustmentPrivate;
+typedef struct _ChamplainAdjustmentClass ChamplainAdjustmentClass;
/**
- * TidyAdjustment:
+ * ChamplainAdjustment:
*
* Class for handling an interval between to values. The contents of
- * the #TidyAdjustment are private and should be accessed using the
+ * the #ChamplainAdjustment are private and should be accessed using the
* public API.
*/
-struct _TidyAdjustment
+struct _ChamplainAdjustment
{
/*< private >*/
GObject parent_instance;
- TidyAdjustmentPrivate *priv;
+ ChamplainAdjustmentPrivate *priv;
};
/**
- * TidyAdjustmentClass
+ * ChamplainAdjustmentClass
* @changed: Class handler for the ::changed signal.
*
- * Base class for #TidyAdjustment.
+ * Base class for #ChamplainAdjustment.
*/
-struct _TidyAdjustmentClass
+struct _ChamplainAdjustmentClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
- void (* changed) (TidyAdjustment *adjustment);
+ void (* changed) (ChamplainAdjustment *adjustment);
};
-GType tidy_adjustment_get_type (void) G_GNUC_CONST;
+GType champlain_adjustment_get_type (void) G_GNUC_CONST;
-TidyAdjustment *tidy_adjustment_new (gdouble value,
+ChamplainAdjustment *champlain_adjustment_new (gdouble value,
gdouble lower,
gdouble upper,
gdouble step_increment,
gdouble page_increment,
gdouble page_size);
-gdouble tidy_adjustment_get_value (TidyAdjustment *adjustment);
-void tidy_adjustment_set_value (TidyAdjustment *adjustment,
+gdouble champlain_adjustment_get_value (ChamplainAdjustment *adjustment);
+void champlain_adjustment_set_value (ChamplainAdjustment *adjustment,
gdouble value);
-void tidy_adjustment_set_values (TidyAdjustment *adjustment,
+void champlain_adjustment_set_values (ChamplainAdjustment *adjustment,
gdouble value,
gdouble lower,
gdouble upper,
gdouble step_increment,
gdouble page_increment,
gdouble page_size);
-void tidy_adjustment_get_values (TidyAdjustment *adjustment,
+void champlain_adjustment_get_values (ChamplainAdjustment *adjustment,
gdouble *value,
gdouble *lower,
gdouble *upper,
@@ -95,22 +95,22 @@ void tidy_adjustment_get_values (TidyAdjustment *adjustment,
gdouble *page_increment,
gdouble *page_size);
-void tidy_adjustment_interpolate (TidyAdjustment *adjustment,
+void champlain_adjustment_interpolate (ChamplainAdjustment *adjustment,
gdouble value,
guint n_frames,
guint fps);
-gboolean tidy_adjustment_get_elastic (TidyAdjustment *adjustment);
-void tidy_adjustment_set_elastic (TidyAdjustment *adjustment,
+gboolean champlain_adjustment_get_elastic (ChamplainAdjustment *adjustment);
+void champlain_adjustment_set_elastic (ChamplainAdjustment *adjustment,
gboolean elastic);
-gboolean tidy_adjustment_clamp (TidyAdjustment *adjustment,
+gboolean champlain_adjustment_clamp (ChamplainAdjustment *adjustment,
gboolean interpolate,
guint n_frames,
guint fps);
-void tidy_adjustment_interpolate_stop (TidyAdjustment *adjustment);
+void champlain_adjustment_interpolate_stop (ChamplainAdjustment *adjustment);
G_END_DECLS
-#endif /* __TIDY_ADJUSTMENT_H__ */
+#endif /* __CHAMPLAIN_ADJUSTMENT_H__ */
diff --git a/tidy/tidy-finger-scroll.c b/champlain/champlain-finger-scroll.c
similarity index 74%
rename from tidy/tidy-finger-scroll.c
rename to champlain/champlain-finger-scroll.c
index 7152e4f..3dc3870 100644
--- a/tidy/tidy-finger-scroll.c
+++ b/champlain/champlain-finger-scroll.c
@@ -1,4 +1,4 @@
-/* tidy-finger-scroll.c: Finger scrolling container actor
+/* champlain-finger-scroll.c: Finger scrolling container actor
*
* Copyright (C) 2008 OpenedHand
*
@@ -20,33 +20,33 @@
* Written by: Chris Lord <chris openedhand com>
*/
-#include "tidy-finger-scroll.h"
-#include "tidy-enum-types.h"
-#include "tidy-marshal.h"
-#include "tidy-adjustment.h"
-#include "tidy-viewport.h"
+#include "champlain-finger-scroll.h"
+#include "champlain-enum-types.h"
+#include "champlain-marshal.h"
+#include "champlain-adjustment.h"
+#include "champlain-viewport.h"
#include <clutter/clutter.h>
#include <math.h>
static void clutter_container_iface_init (ClutterContainerIface *iface);
-G_DEFINE_TYPE_WITH_CODE (TidyFingerScroll, tidy_finger_scroll, CLUTTER_TYPE_ACTOR,
+G_DEFINE_TYPE_WITH_CODE (ChamplainFingerScroll, champlain_finger_scroll, CLUTTER_TYPE_ACTOR,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
clutter_container_iface_init))
#define FINGER_SCROLL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
- TIDY_TYPE_FINGER_SCROLL, \
- TidyFingerScrollPrivate))
+ CHAMPLAIN_TYPE_FINGER_SCROLL, \
+ ChamplainFingerScrollPrivate))
typedef struct {
/* Units to store the origin of a click when scrolling */
gfloat x;
gfloat y;
GTimeVal time;
-} TidyFingerScrollMotion;
+} ChamplainFingerScrollMotion;
-struct _TidyFingerScrollPrivate
+struct _ChamplainFingerScrollPrivate
{
/* Scroll mode */
gboolean kinetic;
@@ -79,10 +79,10 @@ enum
static guint signals[LAST_SIGNAL] = { 0, };
static void
-tidy_finger_scroll_get_property (GObject *object, guint property_id,
+champlain_finger_scroll_get_property (GObject *object, guint property_id,
GValue *value, GParamSpec *pspec)
{
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (object)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (object)->priv;
switch (property_id)
{
@@ -101,10 +101,10 @@ tidy_finger_scroll_get_property (GObject *object, guint property_id,
}
static void
-tidy_finger_scroll_set_property (GObject *object, guint property_id,
+champlain_finger_scroll_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
{
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (object)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (object)->priv;
switch (property_id)
{
@@ -126,9 +126,9 @@ tidy_finger_scroll_set_property (GObject *object, guint property_id,
}
static void
-tidy_finger_scroll_dispose (GObject *object)
+champlain_finger_scroll_dispose (GObject *object)
{
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (object)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (object)->priv;
if (priv->child)
clutter_container_remove_actor (CLUTTER_CONTAINER (object), priv->child);
@@ -140,24 +140,24 @@ tidy_finger_scroll_dispose (GObject *object)
priv->deceleration_timeline = NULL;
}
- G_OBJECT_CLASS (tidy_finger_scroll_parent_class)->dispose (object);
+ G_OBJECT_CLASS (champlain_finger_scroll_parent_class)->dispose (object);
}
static void
-tidy_finger_scroll_finalize (GObject *object)
+champlain_finger_scroll_finalize (GObject *object)
{
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (object)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (object)->priv;
g_array_free (priv->motion_buffer, TRUE);
- G_OBJECT_CLASS (tidy_finger_scroll_parent_class)->finalize (object);
+ G_OBJECT_CLASS (champlain_finger_scroll_parent_class)->finalize (object);
}
static void
-tidy_finger_scroll_paint (ClutterActor *actor)
+champlain_finger_scroll_paint (ClutterActor *actor)
{
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (actor)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (actor)->priv;
if (priv->child)
clutter_actor_paint (priv->child);
@@ -165,24 +165,24 @@ tidy_finger_scroll_paint (ClutterActor *actor)
static void
-tidy_finger_scroll_pick (ClutterActor *actor, const ClutterColor *color)
+champlain_finger_scroll_pick (ClutterActor *actor, const ClutterColor *color)
{
/* Chain up so we get a bounding box pained (if we are reactive) */
- CLUTTER_ACTOR_CLASS (tidy_finger_scroll_parent_class)->pick (actor, color);
+ CLUTTER_ACTOR_CLASS (champlain_finger_scroll_parent_class)->pick (actor, color);
/* Trigger pick on children */
- tidy_finger_scroll_paint (actor);
+ champlain_finger_scroll_paint (actor);
}
static void
-tidy_finger_scroll_get_preferred_width (ClutterActor *actor,
+champlain_finger_scroll_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
{
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (actor)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (actor)->priv;
if (!priv->child)
return;
@@ -197,13 +197,13 @@ tidy_finger_scroll_get_preferred_width (ClutterActor *actor,
}
static void
-tidy_finger_scroll_get_preferred_height (ClutterActor *actor,
+champlain_finger_scroll_get_preferred_height (ClutterActor *actor,
gfloat for_width,
gfloat *min_height_p,
gfloat *natural_height_p)
{
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (actor)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (actor)->priv;
if (!priv->child)
return;
@@ -217,16 +217,16 @@ tidy_finger_scroll_get_preferred_height (ClutterActor *actor,
}
static void
-tidy_finger_scroll_allocate (ClutterActor *actor,
+champlain_finger_scroll_allocate (ClutterActor *actor,
const ClutterActorBox *box,
ClutterAllocationFlags flags)
{
ClutterActorBox child_box;
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (actor)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (actor)->priv;
/* Chain up */
- CLUTTER_ACTOR_CLASS (tidy_finger_scroll_parent_class)->
+ CLUTTER_ACTOR_CLASS (champlain_finger_scroll_parent_class)->
allocate (actor, box, flags);
/* Child */
@@ -248,28 +248,28 @@ tidy_finger_scroll_allocate (ClutterActor *actor,
}
static void
-tidy_finger_scroll_class_init (TidyFingerScrollClass *klass)
+champlain_finger_scroll_class_init (ChamplainFingerScrollClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
- g_type_class_add_private (klass, sizeof (TidyFingerScrollPrivate));
+ g_type_class_add_private (klass, sizeof (ChamplainFingerScrollPrivate));
- object_class->get_property = tidy_finger_scroll_get_property;
- object_class->set_property = tidy_finger_scroll_set_property;
- object_class->dispose = tidy_finger_scroll_dispose;
- object_class->finalize = tidy_finger_scroll_finalize;
+ object_class->get_property = champlain_finger_scroll_get_property;
+ object_class->set_property = champlain_finger_scroll_set_property;
+ object_class->dispose = champlain_finger_scroll_dispose;
+ object_class->finalize = champlain_finger_scroll_finalize;
- actor_class->paint = tidy_finger_scroll_paint;
- actor_class->pick = tidy_finger_scroll_pick;
- actor_class->get_preferred_width = tidy_finger_scroll_get_preferred_width;
- actor_class->get_preferred_height = tidy_finger_scroll_get_preferred_height;
- actor_class->allocate = tidy_finger_scroll_allocate;
+ actor_class->paint = champlain_finger_scroll_paint;
+ actor_class->pick = champlain_finger_scroll_pick;
+ actor_class->get_preferred_width = champlain_finger_scroll_get_preferred_width;
+ actor_class->get_preferred_height = champlain_finger_scroll_get_preferred_height;
+ actor_class->allocate = champlain_finger_scroll_allocate;
g_object_class_install_property (object_class,
PROP_MODE,
g_param_spec_boolean ("mode",
- "TidyFingerScrollMode",
+ "ChamplainFingerScrollMode",
"Scrolling mode",
FALSE,
G_PARAM_READWRITE));
@@ -303,23 +303,23 @@ tidy_finger_scroll_class_init (TidyFingerScrollClass *klass)
static void
-tidy_finger_scroll_add_actor (ClutterContainer *container,
+champlain_finger_scroll_add_actor (ClutterContainer *container,
ClutterActor *actor)
{
- TidyFingerScroll *self = TIDY_FINGER_SCROLL (container);
- TidyFingerScrollPrivate *priv = self->priv;
+ ChamplainFingerScroll *self = CHAMPLAIN_FINGER_SCROLL (container);
+ ChamplainFingerScrollPrivate *priv = self->priv;
if (priv->child)
{
g_warning ("Attempting to add an actor of type %s to "
- "a TidyFingerScroll that already contains "
+ "a ChamplainFingerScroll that already contains "
"an actor of type %s.",
g_type_name (G_OBJECT_TYPE (actor)),
g_type_name (G_OBJECT_TYPE (priv->child)));
}
else
{
- if (TIDY_IS_VIEWPORT(actor))
+ if (CHAMPLAIN_IS_VIEWPORT(actor))
{
priv->child = actor;
clutter_actor_set_parent (actor, CLUTTER_ACTOR (container));
@@ -332,17 +332,17 @@ tidy_finger_scroll_add_actor (ClutterContainer *container,
else
{
g_warning ("Attempting to add an actor to "
- "a TidyFingerScroll, but the actor does "
- "not implement TidyViewport.");
+ "a ChamplainFingerScroll, but the actor does "
+ "not implement ChamplainViewport.");
}
}
}
static void
-tidy_finger_scroll_remove_actor (ClutterContainer *container,
+champlain_finger_scroll_remove_actor (ClutterContainer *container,
ClutterActor *actor)
{
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (container)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (container)->priv;
if (actor == priv->child)
{
@@ -362,18 +362,18 @@ tidy_finger_scroll_remove_actor (ClutterContainer *container,
}
static void
-tidy_finger_scroll_foreach (ClutterContainer *container,
+champlain_finger_scroll_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer callback_data)
{
- TidyFingerScrollPrivate *priv = TIDY_FINGER_SCROLL (container)->priv;
+ ChamplainFingerScrollPrivate *priv = CHAMPLAIN_FINGER_SCROLL (container)->priv;
if (priv->child)
callback (priv->child, callback_data);
}
static void
-tidy_finger_scroll_lower (ClutterContainer *container,
+champlain_finger_scroll_lower (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
@@ -381,7 +381,7 @@ tidy_finger_scroll_lower (ClutterContainer *container,
}
static void
-tidy_finger_scroll_raise (ClutterContainer *container,
+champlain_finger_scroll_raise (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
@@ -389,7 +389,7 @@ tidy_finger_scroll_raise (ClutterContainer *container,
}
static void
-tidy_finger_scroll_sort_depth_order (ClutterContainer *container)
+champlain_finger_scroll_sort_depth_order (ClutterContainer *container)
{
/* single child */
}
@@ -397,12 +397,12 @@ tidy_finger_scroll_sort_depth_order (ClutterContainer *container)
static void
clutter_container_iface_init (ClutterContainerIface *iface)
{
- iface->add = tidy_finger_scroll_add_actor;
- iface->remove = tidy_finger_scroll_remove_actor;
- iface->foreach = tidy_finger_scroll_foreach;
- iface->lower = tidy_finger_scroll_lower;
- iface->raise = tidy_finger_scroll_raise;
- iface->sort_depth_order = tidy_finger_scroll_sort_depth_order;
+ iface->add = champlain_finger_scroll_add_actor;
+ iface->remove = champlain_finger_scroll_remove_actor;
+ iface->foreach = champlain_finger_scroll_foreach;
+ iface->lower = champlain_finger_scroll_lower;
+ iface->raise = champlain_finger_scroll_raise;
+ iface->sort_depth_order = champlain_finger_scroll_sort_depth_order;
}
@@ -410,37 +410,37 @@ clutter_container_iface_init (ClutterContainerIface *iface)
static gboolean
motion_event_cb (ClutterActor *actor,
ClutterMotionEvent *event,
- TidyFingerScroll *scroll)
+ ChamplainFingerScroll *scroll)
{
gfloat x, y;
- TidyFingerScrollPrivate *priv = scroll->priv;
+ ChamplainFingerScrollPrivate *priv = scroll->priv;
if (clutter_actor_transform_stage_point (actor,
event->x,
event->y,
&x, &y))
{
- TidyFingerScrollMotion *motion;
+ ChamplainFingerScrollMotion *motion;
if (priv->child)
{
gdouble dx, dy;
- TidyAdjustment *hadjust, *vadjust;
+ ChamplainAdjustment *hadjust, *vadjust;
- tidy_viewport_get_adjustments (TIDY_VIEWPORT (priv->child),
+ champlain_viewport_get_adjustments (CHAMPLAIN_VIEWPORT (priv->child),
&hadjust,
&vadjust);
motion = &g_array_index (priv->motion_buffer,
- TidyFingerScrollMotion, priv->last_motion);
+ ChamplainFingerScrollMotion, priv->last_motion);
dx = (motion->x - x) +
- tidy_adjustment_get_value (hadjust);
+ champlain_adjustment_get_value (hadjust);
dy = (motion->y - y) +
- tidy_adjustment_get_value (vadjust);
+ champlain_adjustment_get_value (vadjust);
- tidy_adjustment_set_value (hadjust, dx);
- tidy_adjustment_set_value (vadjust, dy);
+ champlain_adjustment_set_value (hadjust, dx);
+ champlain_adjustment_set_value (vadjust, dy);
}
priv->last_motion ++;
@@ -452,7 +452,7 @@ motion_event_cb (ClutterActor *actor,
}
motion = &g_array_index (priv->motion_buffer,
- TidyFingerScrollMotion, priv->last_motion);
+ ChamplainFingerScrollMotion, priv->last_motion);
motion->x = x;
motion->y = y;
g_get_current_time (&motion->time);
@@ -462,17 +462,17 @@ motion_event_cb (ClutterActor *actor,
}
static void
-clamp_adjustments (TidyFingerScroll *scroll)
+clamp_adjustments (ChamplainFingerScroll *scroll)
{
- TidyFingerScrollPrivate *priv = scroll->priv;
+ ChamplainFingerScrollPrivate *priv = scroll->priv;
if (priv->child)
{
guint fps, n_frames;
- TidyAdjustment *hadj, *vadj;
+ ChamplainAdjustment *hadj, *vadj;
gboolean snap;
- tidy_viewport_get_adjustments (TIDY_VIEWPORT (priv->child),
+ champlain_viewport_get_adjustments (CHAMPLAIN_VIEWPORT (priv->child),
&hadj, &vadj);
/* FIXME: Hard-coded value here */
@@ -480,42 +480,42 @@ clamp_adjustments (TidyFingerScroll *scroll)
n_frames = fps / 6;
snap = TRUE;
- if (tidy_adjustment_get_elastic (hadj))
- snap = !tidy_adjustment_clamp (hadj, TRUE, n_frames, fps);
+ if (champlain_adjustment_get_elastic (hadj))
+ snap = !champlain_adjustment_clamp (hadj, TRUE, n_frames, fps);
/* Snap to the nearest step increment on hadjustment */
if (snap)
{
gdouble d, value, lower, step_increment;
- tidy_adjustment_get_values (hadj, &value, &lower, NULL,
+ champlain_adjustment_get_values (hadj, &value, &lower, NULL,
&step_increment, NULL, NULL);
d = (rint ((value - lower) / step_increment) *
step_increment) + lower;
- tidy_adjustment_set_value (hadj, d);
+ champlain_adjustment_set_value (hadj, d);
}
snap = TRUE;
- if (tidy_adjustment_get_elastic (vadj))
- snap = !tidy_adjustment_clamp (vadj, TRUE, n_frames, fps);
+ if (champlain_adjustment_get_elastic (vadj))
+ snap = !champlain_adjustment_clamp (vadj, TRUE, n_frames, fps);
/* Snap to the nearest step increment on vadjustment */
if (snap)
{
gdouble d, value, lower, step_increment;
- tidy_adjustment_get_values (vadj, &value, &lower, NULL,
+ champlain_adjustment_get_values (vadj, &value, &lower, NULL,
&step_increment, NULL, NULL);
d = (rint ((value - lower) / step_increment) *
step_increment) + lower;
- tidy_adjustment_set_value (vadj, d);
+ champlain_adjustment_set_value (vadj, d);
}
}
}
static void
deceleration_completed_cb (ClutterTimeline *timeline,
- TidyFingerScroll *scroll)
+ ChamplainFingerScroll *scroll)
{
clamp_adjustments (scroll);
g_object_unref (timeline);
@@ -527,35 +527,35 @@ deceleration_completed_cb (ClutterTimeline *timeline,
static void
deceleration_new_frame_cb (ClutterTimeline *timeline,
gint frame_num,
- TidyFingerScroll *scroll)
+ ChamplainFingerScroll *scroll)
{
- TidyFingerScrollPrivate *priv = scroll->priv;
+ ChamplainFingerScrollPrivate *priv = scroll->priv;
if (priv->child)
{
gdouble value, lower, upper, page_size;
- TidyAdjustment *hadjust, *vadjust;
+ ChamplainAdjustment *hadjust, *vadjust;
gint i;
gboolean stop = TRUE;
- tidy_viewport_get_adjustments (TIDY_VIEWPORT (priv->child),
+ champlain_viewport_get_adjustments (CHAMPLAIN_VIEWPORT (priv->child),
&hadjust,
&vadjust);
for (i = 0; i < clutter_timeline_get_delta (timeline) / 15; i++)
{
- tidy_adjustment_set_value (hadjust,
+ champlain_adjustment_set_value (hadjust,
priv->dx +
- tidy_adjustment_get_value (hadjust));
- tidy_adjustment_set_value (vadjust,
+ champlain_adjustment_get_value (hadjust));
+ champlain_adjustment_set_value (vadjust,
priv->dy +
- tidy_adjustment_get_value (vadjust));
+ champlain_adjustment_get_value (vadjust));
priv->dx = (priv->dx / priv->decel_rate);
priv->dy = (priv->dy / priv->decel_rate);
}
/* Check if we've hit the upper or lower bounds and stop the timeline */
- tidy_adjustment_get_values (hadjust, &value, &lower, &upper,
+ champlain_adjustment_get_values (hadjust, &value, &lower, &upper,
NULL, NULL, &page_size);
if (((priv->dx > 0) && (value < upper - page_size)) ||
((priv->dx < 0) && (value > lower)))
@@ -563,7 +563,7 @@ deceleration_new_frame_cb (ClutterTimeline *timeline,
if (stop)
{
- tidy_adjustment_get_values (vadjust, &value, &lower, &upper,
+ champlain_adjustment_get_values (vadjust, &value, &lower, &upper,
NULL, NULL, &page_size);
if (((priv->dy > 0) && (value < upper - page_size)) ||
((priv->dy < 0) && (value > lower)))
@@ -581,9 +581,9 @@ deceleration_new_frame_cb (ClutterTimeline *timeline,
static gboolean
button_release_event_cb (ClutterActor *actor,
ClutterButtonEvent *event,
- TidyFingerScroll *scroll)
+ ChamplainFingerScroll *scroll)
{
- TidyFingerScrollPrivate *priv = scroll->priv;
+ ChamplainFingerScrollPrivate *priv = scroll->priv;
gboolean decelerating = FALSE;
gboolean moved = TRUE;
@@ -610,7 +610,7 @@ button_release_event_cb (ClutterActor *actor,
{
double frac, x_origin, y_origin;
GTimeVal release_time, motion_time;
- TidyAdjustment *hadjust, *vadjust;
+ ChamplainAdjustment *hadjust, *vadjust;
glong time_diff;
gint i;
@@ -623,8 +623,8 @@ button_release_event_cb (ClutterActor *actor,
motion_time = (GTimeVal){ 0, 0 };
for (i = 0; i < priv->last_motion; i++)
{
- TidyFingerScrollMotion *motion =
- &g_array_index (priv->motion_buffer, TidyFingerScrollMotion, i);
+ ChamplainFingerScrollMotion *motion =
+ &g_array_index (priv->motion_buffer, ChamplainFingerScrollMotion, i);
/* FIXME: This doesn't guard against overflows - Should
* either fix that, or calculate the correct maximum
@@ -661,7 +661,7 @@ button_release_event_cb (ClutterActor *actor,
priv->dy = (y_origin - y) / frac;
/* Get adjustments to do step-increment snapping */
- tidy_viewport_get_adjustments (TIDY_VIEWPORT (priv->child),
+ champlain_viewport_get_adjustments (CHAMPLAIN_VIEWPORT (priv->child),
&hadjust,
&vadjust);
@@ -712,7 +712,7 @@ button_release_event_cb (ClutterActor *actor,
/* Solving for dx */
d = a * priv->dx;
- tidy_adjustment_get_values (hadjust, &value, &lower, NULL,
+ champlain_adjustment_get_values (hadjust, &value, &lower, NULL,
&step_increment, NULL, NULL);
d = ((rint (((value + d) - lower) / step_increment) *
step_increment) + lower) - value;
@@ -720,7 +720,7 @@ button_release_event_cb (ClutterActor *actor,
/* Solving for dy */
d = a * (priv->dy);
- tidy_adjustment_get_values (vadjust, &value, &lower, NULL,
+ champlain_adjustment_get_values (vadjust, &value, &lower, NULL,
&step_increment, NULL, NULL);
d = ((rint (((value + d) - lower) / step_increment) *
step_increment) + lower) - value;
@@ -738,13 +738,13 @@ button_release_event_cb (ClutterActor *actor,
y = priv->decel_rate;
a = (1.0 - 1.0 / pow (y, 4 + 1)) / (1.0 - 1.0 / y);
- tidy_adjustment_get_values (hadjust, &value, &lower, NULL,
+ champlain_adjustment_get_values (hadjust, &value, &lower, NULL,
&step_increment, NULL, NULL);
d = ((rint ((value - lower) / step_increment) *
step_increment) + lower) - value;
priv->dx = (d / a);
- tidy_adjustment_get_values (vadjust, &value, &lower, NULL,
+ champlain_adjustment_get_values (vadjust, &value, &lower, NULL,
&step_increment, NULL, NULL);
d = ((rint ((value - lower) / step_increment) *
step_increment) + lower) - value;
@@ -784,7 +784,7 @@ button_release_event_cb (ClutterActor *actor,
}
static gboolean
-after_event_cb (TidyFingerScroll *scroll)
+after_event_cb (ChamplainFingerScroll *scroll)
{
/* Check the pointer grab - if something else has grabbed it - for example,
* a scroll-bar or some such, don't do our funky stuff.
@@ -805,13 +805,13 @@ after_event_cb (TidyFingerScroll *scroll)
static gboolean
captured_event_cb (ClutterActor *actor,
ClutterEvent *event,
- TidyFingerScroll *scroll)
+ ChamplainFingerScroll *scroll)
{
- TidyFingerScrollPrivate *priv = scroll->priv;
+ ChamplainFingerScrollPrivate *priv = scroll->priv;
if (event->type == CLUTTER_BUTTON_PRESS)
{
- TidyFingerScrollMotion *motion;
+ ChamplainFingerScrollMotion *motion;
ClutterButtonEvent *bevent = (ClutterButtonEvent *)event;
if (bevent->source != actor)
@@ -819,7 +819,7 @@ captured_event_cb (ClutterActor *actor,
/* Reset motion buffer */
priv->last_motion = 0;
- motion = &g_array_index (priv->motion_buffer, TidyFingerScrollMotion, 0);
+ motion = &g_array_index (priv->motion_buffer, ChamplainFingerScrollMotion, 0);
if ((bevent->button == 1) &&
(clutter_actor_transform_stage_point (actor,
@@ -861,13 +861,13 @@ captured_event_cb (ClutterActor *actor,
}
static void
-tidy_finger_scroll_init (TidyFingerScroll *self)
+champlain_finger_scroll_init (ChamplainFingerScroll *self)
{
ClutterActor *scrollbar;
- TidyFingerScrollPrivate *priv = self->priv = FINGER_SCROLL_PRIVATE (self);
+ ChamplainFingerScrollPrivate *priv = self->priv = FINGER_SCROLL_PRIVATE (self);
priv->motion_buffer = g_array_sized_new (FALSE, TRUE,
- sizeof (TidyFingerScrollMotion), 3);
+ sizeof (ChamplainFingerScrollMotion), 3);
g_array_set_size (priv->motion_buffer, 3);
priv->decel_rate = 1.1f;
priv->child = NULL;
@@ -882,18 +882,18 @@ tidy_finger_scroll_init (TidyFingerScroll *self)
}
ClutterActor *
-tidy_finger_scroll_new (gboolean kinetic)
+champlain_finger_scroll_new (gboolean kinetic)
{
- return CLUTTER_ACTOR (g_object_new (TIDY_TYPE_FINGER_SCROLL,
+ return CLUTTER_ACTOR (g_object_new (CHAMPLAIN_TYPE_FINGER_SCROLL,
"mode", kinetic, NULL));
}
void
-tidy_finger_scroll_stop (TidyFingerScroll *scroll)
+champlain_finger_scroll_stop (ChamplainFingerScroll *scroll)
{
- TidyFingerScrollPrivate *priv;
+ ChamplainFingerScrollPrivate *priv;
- g_return_if_fail (TIDY_IS_FINGER_SCROLL (scroll));
+ g_return_if_fail (CHAMPLAIN_IS_FINGER_SCROLL (scroll));
priv = scroll->priv;
diff --git a/champlain/champlain-finger-scroll.h b/champlain/champlain-finger-scroll.h
new file mode 100644
index 0000000..a40ef9d
--- /dev/null
+++ b/champlain/champlain-finger-scroll.h
@@ -0,0 +1,64 @@
+/* champlain-finger-scroll.h: Finger scrolling container actor
+ *
+ * Copyright (C) 2008 OpenedHand
+ *
+ * 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Written by: Chris Lord <chris openedhand com>
+ */
+
+#ifndef __CHAMPLAIN_FINGER_SCROLL_H__
+#define __CHAMPLAIN_FINGER_SCROLL_H__
+
+#include <glib-object.h>
+#include <clutter/clutter.h>
+
+G_BEGIN_DECLS
+
+#define CHAMPLAIN_TYPE_FINGER_SCROLL (champlain_finger_scroll_get_type())
+#define CHAMPLAIN_FINGER_SCROLL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_FINGER_SCROLL, ChamplainFingerScroll))
+#define CHAMPLAIN_IS_FINGER_SCROLL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_FINGER_SCROLL))
+#define CHAMPLAIN_FINGER_SCROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_FINGER_SCROLL, ChamplainFingerScrollClass))
+#define CHAMPLAIN_IS_FINGER_SCROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_FINGER_SCROLL))
+#define CHAMPLAIN_FINGER_SCROLL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_FINGER_SCROLL, ChamplainFingerScrollClass))
+
+
+typedef struct _ChamplainFingerScroll ChamplainFingerScroll;
+typedef struct _ChamplainFingerScrollPrivate ChamplainFingerScrollPrivate;
+typedef struct _ChamplainFingerScrollClass ChamplainFingerScrollClass;
+
+struct _ChamplainFingerScroll
+{
+ /*< private >*/
+ ClutterActor parent_instance;
+
+ ChamplainFingerScrollPrivate *priv;
+};
+
+struct _ChamplainFingerScrollClass
+{
+ ClutterActorClass parent_class;
+};
+
+GType champlain_finger_scroll_get_type (void) G_GNUC_CONST;
+
+ClutterActor *champlain_finger_scroll_new (gboolean kinetic);
+
+void champlain_finger_scroll_stop (ChamplainFingerScroll *scroll);
+
+G_END_DECLS
+
+#endif /* __CHAMPLAIN_FINGER_SCROLL_H__ */
diff --git a/champlain/champlain-marshal.list b/champlain/champlain-marshal.list
index 6c8b051..e0ad580 100644
--- a/champlain/champlain-marshal.list
+++ b/champlain/champlain-marshal.list
@@ -1,2 +1,4 @@
VOID:DOUBLE,DOUBLE,BOXED
VOID:POINTER,UINT,BOOLEAN
+VOID:UINT,UINT
+VOID:OBJECT,OBJECT
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 73687cb..a8b2c8b 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -67,9 +67,9 @@
#include <glib.h>
#include <glib-object.h>
#include <math.h>
-#include <tidy-finger-scroll.h>
-#include <tidy-viewport.h>
-#include <tidy-adjustment.h>
+#include <champlain-finger-scroll.h>
+#include <champlain-viewport.h>
+#include <champlain-adjustment.h>
//#define VIEW_LOG
#ifdef VIEW_LOG
@@ -264,7 +264,7 @@ update_viewport (ChamplainView *view,
if (relocate || force_relocate)
{
g_signal_handlers_block_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
- tidy_viewport_set_origin (TIDY_VIEWPORT (priv->viewport),
+ champlain_viewport_set_origin (CHAMPLAIN_VIEWPORT (priv->viewport),
priv->viewport_x,
priv->viewport_y);
g_signal_handlers_unblock_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
@@ -283,7 +283,7 @@ update_viewport (ChamplainView *view,
static void
-panning_completed (G_GNUC_UNUSED TidyFingerScroll *scroll,
+panning_completed (G_GNUC_UNUSED ChamplainFingerScroll *scroll,
ChamplainView *view)
{
DEBUG_LOG ()
@@ -292,7 +292,7 @@ panning_completed (G_GNUC_UNUSED TidyFingerScroll *scroll,
gfloat absolute_x, absolute_y;
gfloat x, y;
- tidy_viewport_get_origin (TIDY_VIEWPORT (priv->viewport), &x, &y);
+ champlain_viewport_get_origin (CHAMPLAIN_VIEWPORT (priv->viewport), &x, &y);
absolute_x = x + priv->anchor_x + priv->viewport_width / 2.0;
absolute_y = y + priv->anchor_y + priv->viewport_height / 2.0;
@@ -330,11 +330,11 @@ resize_viewport (ChamplainView *view)
gdouble lower_y = 0;
gdouble upper_x = G_MAXINT16;
gdouble upper_y = G_MAXINT16;
- TidyAdjustment *hadjust, *vadjust;
+ ChamplainAdjustment *hadjust, *vadjust;
ChamplainViewPrivate *priv = view->priv;
- tidy_viewport_get_adjustments (TIDY_VIEWPORT (priv->viewport), &hadjust,
+ champlain_viewport_get_adjustments (CHAMPLAIN_VIEWPORT (priv->viewport), &hadjust,
&vadjust);
if (priv->zoom_level < 8)
@@ -351,7 +351,7 @@ resize_viewport (ChamplainView *view)
/*
* block emmision of signal by priv->viewport with viewport_pos_changed_cb()
- * callback - the signal can be emitted by updating TidyAdjustment, but
+ * callback - the signal can be emitted by updating ChamplainAdjustment, but
* calling the callback now would be a disaster since we don't have updated
* anchor yet
*/
@@ -525,14 +525,14 @@ champlain_view_dispose (GObject *object)
if (priv->kinetic_scroll != NULL)
{
- tidy_finger_scroll_stop (TIDY_FINGER_SCROLL (priv->kinetic_scroll));
+ champlain_finger_scroll_stop (CHAMPLAIN_FINGER_SCROLL (priv->kinetic_scroll));
g_object_unref (priv->kinetic_scroll);
priv->kinetic_scroll = NULL;
}
if (priv->viewport != NULL)
{
- tidy_viewport_stop (TIDY_VIEWPORT (priv->viewport));
+ champlain_viewport_stop (CHAMPLAIN_VIEWPORT (priv->viewport));
g_object_unref (priv->viewport);
priv->viewport = NULL;
}
@@ -1018,7 +1018,7 @@ champlain_view_init (ChamplainView *view)
clutter_actor_show (priv->viewport_container);
/* Setup viewport */
- priv->viewport = g_object_ref (tidy_viewport_new ());
+ priv->viewport = g_object_ref (champlain_viewport_new ());
clutter_container_add_actor (CLUTTER_CONTAINER (priv->viewport), priv->viewport_container);
g_object_set (G_OBJECT (priv->viewport), "sync-adjustments", FALSE, NULL);
@@ -1031,7 +1031,7 @@ champlain_view_init (ChamplainView *view)
clutter_actor_raise (priv->user_layers, priv->map_layer);
/* Setup kinetic scroll */
- priv->kinetic_scroll = g_object_ref (tidy_finger_scroll_new (FALSE));
+ priv->kinetic_scroll = g_object_ref (champlain_finger_scroll_new (FALSE));
g_signal_connect (priv->kinetic_scroll, "scroll-event",
G_CALLBACK (scroll_event), view);
@@ -1084,7 +1084,7 @@ viewport_pos_changed_cb (G_GNUC_UNUSED GObject *gobject,
ChamplainViewPrivate *priv = view->priv;
gfloat x, y;
- tidy_viewport_get_origin (TIDY_VIEWPORT (priv->viewport), &x, &y);
+ champlain_viewport_get_origin (CHAMPLAIN_VIEWPORT (priv->viewport), &x, &y);
if (fabs (x - priv->viewport_x) > 100 ||
fabs (y - priv->viewport_y) > 100 ||
diff --git a/tidy/tidy-viewport.c b/champlain/champlain-viewport.c
similarity index 68%
rename from tidy/tidy-viewport.c
rename to champlain/champlain-viewport.c
index fd94d8b..ee0c10f 100644
--- a/tidy/tidy-viewport.c
+++ b/champlain/champlain-viewport.c
@@ -1,4 +1,4 @@
-/* tidy-viewport.c: Viewport actor
+/* champlain-viewport.c: Viewport actor
*
* Copyright (C) 2008 OpenedHand
*
@@ -26,23 +26,23 @@
#include <clutter/clutter.h>
-#include "tidy-viewport.h"
-#include "tidy-private.h"
+#include "champlain-viewport.h"
+#include "champlain-private.h"
-G_DEFINE_TYPE (TidyViewport, tidy_viewport, CLUTTER_TYPE_GROUP)
+G_DEFINE_TYPE (ChamplainViewport, champlain_viewport, CLUTTER_TYPE_GROUP)
#define VIEWPORT_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), TIDY_TYPE_VIEWPORT, \
- TidyViewportPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_VIEWPORT, \
+ ChamplainViewportPrivate))
-struct _TidyViewportPrivate
+struct _ChamplainViewportPrivate
{
gfloat x;
gfloat y;
- TidyAdjustment *hadjustment;
- TidyAdjustment *vadjustment;
+ ChamplainAdjustment *hadjustment;
+ ChamplainAdjustment *vadjustment;
gboolean sync_adjustments;
};
@@ -59,14 +59,14 @@ enum
};
static void
-tidy_viewport_get_property (GObject *object,
+champlain_viewport_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- TidyAdjustment *adjustment;
+ ChamplainAdjustment *adjustment;
- TidyViewportPrivate *priv = TIDY_VIEWPORT (object)->priv;
+ ChamplainViewportPrivate *priv = CHAMPLAIN_VIEWPORT (object)->priv;
switch (prop_id)
{
@@ -79,12 +79,12 @@ tidy_viewport_get_property (GObject *object,
break;
case PROP_HADJUST :
- tidy_viewport_get_adjustments (TIDY_VIEWPORT (object), &adjustment, NULL);
+ champlain_viewport_get_adjustments (CHAMPLAIN_VIEWPORT (object), &adjustment, NULL);
g_value_set_object (value, adjustment);
break;
case PROP_VADJUST :
- tidy_viewport_get_adjustments (TIDY_VIEWPORT (object), NULL, &adjustment);
+ champlain_viewport_get_adjustments (CHAMPLAIN_VIEWPORT (object), NULL, &adjustment);
g_value_set_object (value, adjustment);
break;
@@ -99,36 +99,36 @@ tidy_viewport_get_property (GObject *object,
}
static void
-tidy_viewport_set_property (GObject *object,
+champlain_viewport_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- TidyViewport *viewport = TIDY_VIEWPORT (object);
- TidyViewportPrivate *priv = viewport->priv;
+ ChamplainViewport *viewport = CHAMPLAIN_VIEWPORT (object);
+ ChamplainViewportPrivate *priv = viewport->priv;
switch (prop_id)
{
case PROP_X_ORIGIN:
- tidy_viewport_set_origin (viewport,
+ champlain_viewport_set_origin (viewport,
g_value_get_int (value),
priv->y);
break;
case PROP_Y_ORIGIN:
- tidy_viewport_set_origin (viewport,
+ champlain_viewport_set_origin (viewport,
priv->x,
g_value_get_int (value));
break;
case PROP_HADJUST :
- tidy_viewport_set_adjustments (TIDY_VIEWPORT (object),
+ champlain_viewport_set_adjustments (CHAMPLAIN_VIEWPORT (object),
g_value_get_object (value),
priv->vadjustment);
break;
case PROP_VADJUST :
- tidy_viewport_set_adjustments (TIDY_VIEWPORT (object),
+ champlain_viewport_set_adjustments (CHAMPLAIN_VIEWPORT (object),
priv->hadjustment,
g_value_get_object (value));
break;
@@ -144,40 +144,40 @@ tidy_viewport_set_property (GObject *object,
}
void
-tidy_viewport_stop (TidyViewport *viewport)
+champlain_viewport_stop (ChamplainViewport *viewport)
{
- TidyViewportPrivate *priv = TIDY_VIEWPORT (viewport)->priv;
+ ChamplainViewportPrivate *priv = CHAMPLAIN_VIEWPORT (viewport)->priv;
- tidy_adjustment_interpolate_stop (priv->hadjustment);
- tidy_adjustment_interpolate_stop (priv->vadjustment);
+ champlain_adjustment_interpolate_stop (priv->hadjustment);
+ champlain_adjustment_interpolate_stop (priv->vadjustment);
}
static void
-tidy_viewport_dispose (GObject *gobject)
+champlain_viewport_dispose (GObject *gobject)
{
- TidyViewportPrivate *priv = TIDY_VIEWPORT (gobject)->priv;
+ ChamplainViewportPrivate *priv = CHAMPLAIN_VIEWPORT (gobject)->priv;
if (priv->hadjustment)
{
- tidy_adjustment_interpolate_stop (priv->hadjustment);
+ champlain_adjustment_interpolate_stop (priv->hadjustment);
g_object_unref (priv->hadjustment);
priv->hadjustment = NULL;
}
if (priv->vadjustment)
{
- tidy_adjustment_interpolate_stop (priv->vadjustment);
+ champlain_adjustment_interpolate_stop (priv->vadjustment);
g_object_unref (priv->vadjustment);
priv->vadjustment = NULL;
}
- G_OBJECT_CLASS (tidy_viewport_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (champlain_viewport_parent_class)->dispose (gobject);
}
static void
-tidy_viewport_paint (ClutterActor *self)
+champlain_viewport_paint (ClutterActor *self)
{
- TidyViewportPrivate *priv = TIDY_VIEWPORT (self)->priv;
+ ChamplainViewportPrivate *priv = CHAMPLAIN_VIEWPORT (self)->priv;
cogl_push_matrix ();
@@ -185,29 +185,29 @@ tidy_viewport_paint (ClutterActor *self)
(priv->y) * -1.0,
0.0);
- CLUTTER_ACTOR_CLASS (tidy_viewport_parent_class)->paint (self);
+ CLUTTER_ACTOR_CLASS (champlain_viewport_parent_class)->paint (self);
cogl_pop_matrix ();
}
static void
-tidy_viewport_pick (ClutterActor *self,
+champlain_viewport_pick (ClutterActor *self,
const ClutterColor *color)
{
- tidy_viewport_paint (self);
+ champlain_viewport_paint (self);
}
static void
-tidy_viewport_allocate (ClutterActor *self,
+champlain_viewport_allocate (ClutterActor *self,
const ClutterActorBox *box,
ClutterAllocationFlags flags)
{
CoglFixed prev_value;
- TidyViewportPrivate *priv = TIDY_VIEWPORT (self)->priv;
+ ChamplainViewportPrivate *priv = CHAMPLAIN_VIEWPORT (self)->priv;
/* Chain up */
- CLUTTER_ACTOR_CLASS (tidy_viewport_parent_class)->
+ CLUTTER_ACTOR_CLASS (champlain_viewport_parent_class)->
allocate (self, box, flags);
/* Refresh adjustments */
@@ -221,8 +221,8 @@ tidy_viewport_allocate (ClutterActor *self,
NULL);
/* Make sure value is clamped */
- prev_value = tidy_adjustment_get_value (priv->hadjustment);
- tidy_adjustment_set_value (priv->hadjustment, prev_value);
+ prev_value = champlain_adjustment_get_value (priv->hadjustment);
+ champlain_adjustment_set_value (priv->hadjustment, prev_value);
}
if (priv->vadjustment)
@@ -232,27 +232,27 @@ tidy_viewport_allocate (ClutterActor *self,
"upper", (box->y2 - box->y1),
NULL);
- prev_value = tidy_adjustment_get_value (priv->vadjustment);
- tidy_adjustment_set_value (priv->vadjustment, prev_value);
+ prev_value = champlain_adjustment_get_value (priv->vadjustment);
+ champlain_adjustment_set_value (priv->vadjustment, prev_value);
}
}
}
static void
-tidy_viewport_class_init (TidyViewportClass *klass)
+champlain_viewport_class_init (ChamplainViewportClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
- g_type_class_add_private (klass, sizeof (TidyViewportPrivate));
+ g_type_class_add_private (klass, sizeof (ChamplainViewportPrivate));
- gobject_class->get_property = tidy_viewport_get_property;
- gobject_class->set_property = tidy_viewport_set_property;
- gobject_class->dispose = tidy_viewport_dispose;
+ gobject_class->get_property = champlain_viewport_get_property;
+ gobject_class->set_property = champlain_viewport_set_property;
+ gobject_class->dispose = champlain_viewport_dispose;
- actor_class->paint = tidy_viewport_paint;
- actor_class->pick = tidy_viewport_pick;
- actor_class->allocate = tidy_viewport_allocate;
+ actor_class->paint = champlain_viewport_paint;
+ actor_class->pick = champlain_viewport_pick;
+ actor_class->allocate = champlain_viewport_allocate;
g_object_class_install_property (gobject_class,
PROP_X_ORIGIN,
@@ -287,56 +287,56 @@ tidy_viewport_class_init (TidyViewportClass *klass)
g_object_class_install_property (gobject_class,
PROP_HADJUST,
g_param_spec_object ("hadjustment",
- "TidyAdjustment",
+ "ChamplainAdjustment",
"Horizontal adjustment",
- TIDY_TYPE_ADJUSTMENT,
+ CHAMPLAIN_TYPE_ADJUSTMENT,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_VADJUST,
g_param_spec_object ("vadjustment",
- "TidyAdjustment",
+ "ChamplainAdjustment",
"Vertical adjustment",
- TIDY_TYPE_ADJUSTMENT,
+ CHAMPLAIN_TYPE_ADJUSTMENT,
G_PARAM_READWRITE));
}
static void
-hadjustment_value_notify_cb (TidyAdjustment *adjustment,
+hadjustment_value_notify_cb (ChamplainAdjustment *adjustment,
GParamSpec *pspec,
- TidyViewport *viewport)
+ ChamplainViewport *viewport)
{
- TidyViewportPrivate *priv = viewport->priv;
+ ChamplainViewportPrivate *priv = viewport->priv;
gdouble value;
- value = tidy_adjustment_get_value (adjustment);
+ value = champlain_adjustment_get_value (adjustment);
- tidy_viewport_set_origin (viewport,
+ champlain_viewport_set_origin (viewport,
value,
priv->y);
}
static void
-vadjustment_value_notify_cb (TidyAdjustment *adjustment, GParamSpec *arg1,
- TidyViewport *viewport)
+vadjustment_value_notify_cb (ChamplainAdjustment *adjustment, GParamSpec *arg1,
+ ChamplainViewport *viewport)
{
- TidyViewportPrivate *priv = viewport->priv;
+ ChamplainViewportPrivate *priv = viewport->priv;
gdouble value;
- value = tidy_adjustment_get_value (adjustment);
+ value = champlain_adjustment_get_value (adjustment);
- tidy_viewport_set_origin (viewport,
+ champlain_viewport_set_origin (viewport,
priv->x,
value);
}
void
-tidy_viewport_set_adjustments (TidyViewport *viewport,
- TidyAdjustment *hadjustment,
- TidyAdjustment *vadjustment)
+champlain_viewport_set_adjustments (ChamplainViewport *viewport,
+ ChamplainAdjustment *hadjustment,
+ ChamplainAdjustment *vadjustment)
{
- TidyViewportPrivate *priv = TIDY_VIEWPORT (viewport)->priv;
+ ChamplainViewportPrivate *priv = CHAMPLAIN_VIEWPORT (viewport)->priv;
if (hadjustment != priv->hadjustment)
{
@@ -382,15 +382,15 @@ tidy_viewport_set_adjustments (TidyViewport *viewport,
}
void
-tidy_viewport_get_adjustments (TidyViewport *viewport,
- TidyAdjustment **hadjustment,
- TidyAdjustment **vadjustment)
+champlain_viewport_get_adjustments (ChamplainViewport *viewport,
+ ChamplainAdjustment **hadjustment,
+ ChamplainAdjustment **vadjustment)
{
- TidyViewportPrivate *priv;
+ ChamplainViewportPrivate *priv;
- g_return_if_fail (TIDY_IS_VIEWPORT (viewport));
+ g_return_if_fail (CHAMPLAIN_IS_VIEWPORT (viewport));
- priv = ((TidyViewport *)viewport)->priv;
+ priv = ((ChamplainViewport *)viewport)->priv;
if (hadjustment)
{
@@ -398,20 +398,20 @@ tidy_viewport_get_adjustments (TidyViewport *viewport,
*hadjustment = priv->hadjustment;
else
{
- TidyAdjustment *adjustment;
+ ChamplainAdjustment *adjustment;
guint width, stage_width, increment;
width = clutter_actor_get_width (CLUTTER_ACTOR(viewport));
stage_width = clutter_actor_get_width (clutter_stage_get_default ());
increment = MAX (1, MIN(stage_width, width));
- adjustment = tidy_adjustment_new (priv->x,
+ adjustment = champlain_adjustment_new (priv->x,
0,
width,
1,
increment,
increment);
- tidy_viewport_set_adjustments (viewport,
+ champlain_viewport_set_adjustments (viewport,
adjustment,
priv->vadjustment);
*hadjustment = adjustment;
@@ -424,20 +424,20 @@ tidy_viewport_get_adjustments (TidyViewport *viewport,
*vadjustment = priv->vadjustment;
else
{
- TidyAdjustment *adjustment;
+ ChamplainAdjustment *adjustment;
guint height, stage_height, increment;
height = clutter_actor_get_height (CLUTTER_ACTOR(viewport));
stage_height = clutter_actor_get_height (clutter_stage_get_default ());
increment = MAX (1, MIN(stage_height, height));
- adjustment = tidy_adjustment_new (priv->y,
+ adjustment = champlain_adjustment_new (priv->y,
0,
height,
1,
increment,
increment);
- tidy_viewport_set_adjustments (viewport,
+ champlain_viewport_set_adjustments (viewport,
priv->hadjustment,
adjustment);
*vadjustment = adjustment;
@@ -449,10 +449,10 @@ tidy_viewport_get_adjustments (TidyViewport *viewport,
static void
clip_notify_cb (ClutterActor *actor,
GParamSpec *pspec,
- TidyViewport *self)
+ ChamplainViewport *self)
{
gfloat width, height;
- TidyViewportPrivate *priv = self->priv;
+ ChamplainViewportPrivate *priv = self->priv;
if (!priv->sync_adjustments)
return;
@@ -476,7 +476,7 @@ clip_notify_cb (ClutterActor *actor,
}
static void
-tidy_viewport_init (TidyViewport *self)
+champlain_viewport_init (ChamplainViewport *self)
{
self->priv = VIEWPORT_PRIVATE (self);
@@ -487,19 +487,19 @@ tidy_viewport_init (TidyViewport *self)
}
ClutterActor *
-tidy_viewport_new (void)
+champlain_viewport_new (void)
{
- return g_object_new (TIDY_TYPE_VIEWPORT, NULL);
+ return g_object_new (CHAMPLAIN_TYPE_VIEWPORT, NULL);
}
void
-tidy_viewport_set_origin (TidyViewport *viewport,
+champlain_viewport_set_origin (ChamplainViewport *viewport,
float x,
float y)
{
- TidyViewportPrivate *priv;
+ ChamplainViewportPrivate *priv;
- g_return_if_fail (TIDY_IS_VIEWPORT (viewport));
+ g_return_if_fail (CHAMPLAIN_IS_VIEWPORT (viewport));
priv = viewport->priv;
@@ -511,7 +511,7 @@ tidy_viewport_set_origin (TidyViewport *viewport,
g_object_notify (G_OBJECT (viewport), "x-origin");
if (priv->hadjustment)
- tidy_adjustment_set_value (priv->hadjustment,
+ champlain_adjustment_set_value (priv->hadjustment,
x);
}
@@ -521,7 +521,7 @@ tidy_viewport_set_origin (TidyViewport *viewport,
g_object_notify (G_OBJECT (viewport), "y-origin");
if (priv->vadjustment)
- tidy_adjustment_set_value (priv->vadjustment,
+ champlain_adjustment_set_value (priv->vadjustment,
y);
}
@@ -531,13 +531,13 @@ tidy_viewport_set_origin (TidyViewport *viewport,
}
void
-tidy_viewport_get_origin (TidyViewport *viewport,
+champlain_viewport_get_origin (ChamplainViewport *viewport,
float *x,
float *y)
{
- TidyViewportPrivate *priv;
+ ChamplainViewportPrivate *priv;
- g_return_if_fail (TIDY_IS_VIEWPORT (viewport));
+ g_return_if_fail (CHAMPLAIN_IS_VIEWPORT (viewport));
priv = viewport->priv;
diff --git a/champlain/champlain-viewport.h b/champlain/champlain-viewport.h
new file mode 100644
index 0000000..fa728bb
--- /dev/null
+++ b/champlain/champlain-viewport.h
@@ -0,0 +1,79 @@
+/* champlain-viewport.h: Viewport actor
+ *
+ * Copyright (C) 2008 OpenedHand
+ *
+ * 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Written by: Chris Lord <chris openedhand com>
+ */
+
+#ifndef __CHAMPLAIN_VIEWPORT_H__
+#define __CHAMPLAIN_VIEWPORT_H__
+
+#include <glib-object.h>
+#include <clutter/clutter.h>
+#include "champlain-adjustment.h"
+
+G_BEGIN_DECLS
+
+#define CHAMPLAIN_TYPE_VIEWPORT (champlain_viewport_get_type())
+#define CHAMPLAIN_VIEWPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_VIEWPORT, ChamplainViewport))
+#define CHAMPLAIN_IS_VIEWPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_VIEWPORT))
+#define CHAMPLAIN_VIEWPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_VIEWPORT, ChamplainViewportClass))
+#define CHAMPLAIN_IS_VIEWPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_VIEWPORT))
+#define CHAMPLAIN_VIEWPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_VIEWPORT, ChamplainViewportClass))
+
+typedef struct _ChamplainViewport ChamplainViewport;
+typedef struct _ChamplainViewportPrivate ChamplainViewportPrivate;
+typedef struct _ChamplainViewportClass ChamplainViewportClass;
+
+struct _ChamplainViewport
+{
+ ClutterGroup parent;
+
+ ChamplainViewportPrivate *priv;
+};
+
+struct _ChamplainViewportClass
+{
+ ClutterGroupClass parent_class;
+};
+
+GType champlain_viewport_get_type (void) G_GNUC_CONST;
+
+ClutterActor * champlain_viewport_new (void);
+
+void champlain_viewport_set_origin (ChamplainViewport *viewport,
+ float x,
+ float y);
+
+void champlain_viewport_get_origin (ChamplainViewport *viewport,
+ gfloat *x,
+ gfloat *y);
+void champlain_viewport_stop (ChamplainViewport *viewport);
+
+void champlain_viewport_get_adjustments (ChamplainViewport *viewport,
+ ChamplainAdjustment **hadjustment,
+ ChamplainAdjustment **vadjustment);
+
+void champlain_viewport_set_adjustments (ChamplainViewport *viewport,
+ ChamplainAdjustment *hadjustment,
+ ChamplainAdjustment *vadjustment);
+
+G_END_DECLS
+
+#endif /* __CHAMPLAIN_VIEWPORT_H__ */
+
diff --git a/configure.ac b/configure.ac
index d8a9c84..f50ffa6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -214,7 +214,6 @@ AC_CONFIG_FILES([build/Makefile
champlain/Makefile
champlain/champlain-version.h
demos/Makefile
- tidy/Makefile
docs/Makefile
docs/reference/Makefile
docs/reference/version.xml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]