Many changes in layers and markers



Hi,

I have finally finished the major changes I wanted to get into 0.10
(see the code in our git). Sorry for the delay. In the end there were
more API changes I originally planned - because the existing programs
will have to be updated anyway, I thought it would be better to make
all the cleanups in one release rather than during several releases. I
hope that the current architecture is flexible enough that no other
major changes will be needed in future releases.

So what has been changed and what features have been added:

* Markers are now movable. You can use champlain_marker_set_movable()
to make the specified marker movable.

* ChamplainPolygon and ChamplainLayer have been merged. The reason is
that they are most of the time identical - both of them contain a list
of coordinates (ChamplainPoint vs ChamplainMarker), you may want to
have the nodes of polygon to be drawn with different shapes so it's
better to use ChamplainMarker for that, you may want to make the nodes
of the polygon movable (now possible with markers) and so on. In fact,
the only difference between the polygon and the layer is the line
plotted between the points and this can be done by a single function.

* ChamplainSelectionLayer and ChamplainLayer have been merged. From
the user point of view there's no need to distinguish between the two
- just call the corresponding function to enable/disable selection

* The license and the scale actors have been separated from
ChamplainView. The license actor is inserted into ChamplainView by
default so people don't forget to display the license when it's
mandatory. The inserted actors are now positioned using the
ClutterBinLayout manager (you can get it using
champlain_view_get_layout_manager()). Using the layout manager you can
layout the inserted actor to the beginning, center and end in both x
and y direction. Using the layout manager also means that the required
clutter version was bumped to 1.2.

* ChamplainBoundingBox is used where appropriate

* The tidy part of "libchamplain" has been replaced with its successor
"mx". This will help us to get (and possibly contribute) fixes from
the mainline.

* ChamplainMapSourceDesc is a class - its properties are
construct-only which prevents the list of map sources returned by the
factory to be illegally modified

* There have been several interface cleanups and renames


The list below summarizes the changes and shows what you should use
instead of the original classes/methods (x -> y means: use y instead
of x):

ChamplainBaseMarker -> ChamplainMarker
ChamplainMarker -> ChamplainLabel
ChamplainPoint - it is now a circular marker that can be inserted into a layer
ChamplainCustomMarker - a marker that implements ClutterContainer -
use instead of adding ClutterActors into ChamplainMarker
ChamplainPolygon -> ChamplainMarkerLayer (also the name _polygon_ was
changed to _path_ which is more descriptive in my opinion)
ChamplainLayer -> ChamplainMarkerLayer
ChamplainSelectionLayer -> ChamplainMarkerLayer

champlain_view_ensure_markers_visible() ->
champlain_marker_layer_get_bounding_box() together with
champlain_view_ensure_visible()

champlain_view_set_size() -> clutter_actor_set_size()

champlain_view_set_show_license(), champlain_view_set_license_text(),
champlain_view_set_show_scale(), champlain_view_set_scale_unit(),
champlain_view_set_max_scale_width(),
champlain_view_get_show_license(), champlain_view_get_license_text(),
champlain_view_get_show_scale(), champlain_view_get_max_scale_width(),
champlain_view_get_scale_unit() -> ChamplainLicense and ChamplainScale
and their methods (+ ClutterActor methods)

champlain_view_add_polygon() and champlain_view_remove_polygon() are
gone. Since polygons=layers now, use ChamplainMarkerLayer, insert
ChamplainMarkers where the polygon nodes should be and display the
polygon (now path) with champlain_marker_layer_show_path()

champlain_view_get_coords_at() -> champlain_view_x_to_longitude() and
champlain_view_y_to_latitude() to get the latitude and longitude from
x, y

champlain_view_get_coords_from_event() -> get the coordinates from the
event and use champlain_view_x_to_longitude() and
champlain_view_y_to_latitude()


The new inheritance hierarchy is:

ClutterActor
--ChamplainLayer (abstract)
----ChamplainMarkerLayer
--ChamplainMarker (abstract)
----ChamplainLabel
----ChamplainPoint
----ChamplainCustomMarker (implements ClutterContainer)
--ChamplainScale
--ChamplainLicense

In general, notice that everything now inherits from ClutterActor and
not ClutterGroup - before we used ClutterGroup and inserted into it
also internal actors of the class. This made them visible outside so
the internal structure wasn't correctly encapsulated. The only missing
actor that should inherit from ClutterActor is ChamplainView - I had
some problems during the implementation but I plan to make this change
soon so stop inserting actors directly into ChamplainView too (you can
use the stage for this purpose or the inner layout manager).


TODOs:
So far I have concentrated on interfaces mostly and the implementation
itself definitely deserves some more work:

* fix #638652 - this is my top priority bug now.
* since mx replaced tidy, the kinetic mode is a bit strange - I'll
adjust the physics of it to make it closer to theprevious behaviour
which I liked better
* when ChamplainCustomMarker is used, some error messages are written
into console
* I'm aware of some missing unrefs() in the code so there will be some
memory leaks now
* inherit ChamplainView from ClutterActor
* there were also some fixes of tidy in libchamplain history some of
which could be applied to mx as well
* general fixes and cleanups
* documentation improvements

I know that chaning the API of a library is a good way to be hated, on
the other hand the changes will make the architecture much more
flexible and maintainable. For instance, ChamplainView doesn't have to
care about markers and polygons which was the case previously (1200
LOC less in ChamplainView). It only knows about the inserted
Champlainlayers and its the responsibility of the layers to perform
the necessary actions. If you want to create your special layer or
marker, no problem - no change in ChamplainView is needed and you can
do whatever you wish.

This is a good time to tell me:
1. If something is missing in the new marker API so it can be added
2. Something should be renamed
3. If you think that the change of the API is totally stupid
All kinds of feedback are welcome.

What I'd like to do next:
1. Make a 0.9.0 release hopefully with #638652 fixed (this weekend or
early next week - we're behind the schedule already)
2. At the same time provide patches for programs using libchamplain
which are part of gnome - emerillon, eog plugin, empathy
3. Bump the required version for the programs from (2) in jhbuild modules

If you think some more actions are needed, please let me know.

For people who wish to test the new features and don't have GTK3
installed yet, I have prepared a patch (see the attachment) which
makes libchamplain compile under GTK2. The launcher-gtk demo now
contains movable markers connected with a polygon line so you can test
how it's updated when dragged.

Happy dragging,

Jiri
From e26cfadcb72ed096b91ecf86f127686f0d4547bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Techet?= <techet gmail com>
Date: Wed, 9 Feb 2011 00:27:36 +0100
Subject: [PATCH] patch

---
 champlain-gtk-uninstalled.pc.in |    2 +-
 champlain-gtk.pc.in             |    2 +-
 champlain-gtk/Makefile.am       |    4 ++--
 champlain-uninstalled.pc.in     |    2 +-
 champlain.pc.in                 |    2 +-
 champlain/Makefile.am           |    4 ++--
 configure.ac                    |    6 +++---
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/champlain-gtk-uninstalled.pc.in b/champlain-gtk-uninstalled.pc.in
index 23e5011..224eb54 100644
--- a/champlain-gtk-uninstalled.pc.in
+++ b/champlain-gtk-uninstalled.pc.in
@@ -8,4 +8,4 @@ Description: Gtk+ Widget wrapper for libchamplain
 Version: @VERSION@
 Libs: ${abs_top_builddir}/champlain-gtk/libchamplain-gtk-@CHAMPLAIN_API_VERSION@.la
 Cflags: -I${abs_top_srcdir} -I${abs_top_builddir}
-Requires: champlain-@CHAMPLAIN_API_VERSION@-uninstalled clutter-gtk-1.0 gtk+-3.0
+Requires: champlain-@CHAMPLAIN_API_VERSION@-uninstalled clutter-gtk-0.10 gtk+-2.0
diff --git a/champlain-gtk.pc.in b/champlain-gtk.pc.in
index c933537..6461a69 100644
--- a/champlain-gtk.pc.in
+++ b/champlain-gtk.pc.in
@@ -8,4 +8,4 @@ Description: Gtk+ Widget wrapper for libchamplain
 Version: @VERSION@
 Libs: -L${libdir} -lchamplain-gtk-@CHAMPLAIN_API_VERSION@
 Cflags: -I${includedir}/libchamplain-gtk-@CHAMPLAIN_API_VERSION@
-Requires: champlain-@CHAMPLAIN_API_VERSION@ clutter-gtk-1.0 gtk+-3.0
+Requires: champlain-@CHAMPLAIN_API_VERSION@ clutter-gtk-0.10 gtk+-2.0
diff --git a/champlain-gtk/Makefile.am b/champlain-gtk/Makefile.am
index 182b9ff..bcd8ace 100644
--- a/champlain-gtk/Makefile.am
+++ b/champlain-gtk/Makefile.am
@@ -74,9 +74,9 @@ GtkChamplain-@CHAMPLAIN_API_VERSION@.gir: libchamplain-gtk-@CHAMPLAIN_API_VERSIO
 GtkChamplain_@CHAMPLAIN_API_VERSION_NORM@_gir_NAMESPACE = GtkChamplain
 GtkChamplain_@CHAMPLAIN_API_VERSION_NORM@_gir_VERSION = @CHAMPLAIN_API_VERSION@
 GtkChamplain_@CHAMPLAIN_API_VERSION_NORM@_gir_LIBS = libchamplain-gtk-@CHAMPLAIN_API_VERSION@.la
-GtkChamplain_@CHAMPLAIN_API_VERSION_NORM@_gir_PACKAGES = gobject-2.0 gtk+-3.0
+GtkChamplain_@CHAMPLAIN_API_VERSION_NORM@_gir_PACKAGES = gobject-2.0 gtk+-2.0
 GtkChamplain_@CHAMPLAIN_API_VERSION_NORM@_gir_FILES = $(introspection_sources)
-GtkChamplain_@CHAMPLAIN_API_VERSION_NORM@_gir_INCLUDES = Clutter-1.0 Gtk-3.0 Champlain-@CHAMPLAIN_API_VERSION@
+GtkChamplain_@CHAMPLAIN_API_VERSION_NORM@_gir_INCLUDES = Clutter-1.0 Gtk-2.0 Champlain-@CHAMPLAIN_API_VERSION@
 GtkChamplain_@CHAMPLAIN_API_VERSION_NORM@_gir_CFLAGS = \
 	$(DEPS_CFLAGS) $(SOUP_CFLAGS) $(GTK_CFLAGS) \
 	-I$(top_srcdir) -I$(top_builddir)\
diff --git a/champlain-uninstalled.pc.in b/champlain-uninstalled.pc.in
index 9afc281..13e566a 100644
--- a/champlain-uninstalled.pc.in
+++ b/champlain-uninstalled.pc.in
@@ -9,4 +9,4 @@ Version: @VERSION@
 Libs: ${abs_top_builddir}/champlain/libchamplain-@CHAMPLAIN_API_VERSION@.la
 Cflags: -I${abs_top_srcdir} -I${abs_top_builddir}
 Requires: gobject-2.0 glib-2.0 clutter-1.0
-Requires.private: gdk-3.0 gio-2.0 cairo sqlite3 @SOUP_DEP@
+Requires.private: gdk-2.0 gio-2.0 cairo sqlite3 @SOUP_DEP@
diff --git a/champlain.pc.in b/champlain.pc.in
index 6d38c26..69cb23a 100644
--- a/champlain.pc.in
+++ b/champlain.pc.in
@@ -9,4 +9,4 @@ Version: @VERSION@
 Libs: -L${libdir} -lchamplain-@CHAMPLAIN_API_VERSION@
 Cflags: -I${includedir}/libchamplain-@CHAMPLAIN_API_VERSION@
 Requires: gobject-2.0 glib-2.0 clutter-1.0
-Requires.private: gdk-3.0 gio-2.0 cairo sqlite3 @SOUP_DEP@
+Requires.private: gdk-2.0 gio-2.0 cairo sqlite3 @SOUP_DEP@
diff --git a/champlain/Makefile.am b/champlain/Makefile.am
index 9c0b284..473bc4c 100644
--- a/champlain/Makefile.am
+++ b/champlain/Makefile.am
@@ -161,9 +161,9 @@ Champlain-@CHAMPLAIN_API_VERSION@.gir: libchamplain-@CHAMPLAIN_API_VERSION@.la
 Champlain_@CHAMPLAIN_API_VERSION_NORM@_gir_NAMESPACE = Champlain
 Champlain_@CHAMPLAIN_API_VERSION_NORM@_gir_VERSION = @CHAMPLAIN_API_VERSION@
 Champlain_@CHAMPLAIN_API_VERSION_NORM@_gir_LIBS = libchamplain-@CHAMPLAIN_API_VERSION@.la
-Champlain_@CHAMPLAIN_API_VERSION_NORM@_gir_PACKAGES = gobject-2.0 gtk+-3.0
+Champlain_@CHAMPLAIN_API_VERSION_NORM@_gir_PACKAGES = gobject-2.0 gtk+-2.0
 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_INCLUDES = Clutter-1.0 Gtk-2.0 $(memphis_gir_include)
 Champlain_@CHAMPLAIN_API_VERSION_NORM@_gir_CFLAGS = \
 	$(DEPS_CFLAGS) $(SOUP_CFLAGS) $(MEMPHIS_CFLAGS) \
 	-I$(top_srcdir)/mx -I$(top_srcdir) -I$(top_builddir) \
diff --git a/configure.ac b/configure.ac
index 2bf4f26..6af0406 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ AC_SUBST(LIBRARY_VERSION)
 PKG_CHECK_MODULES(DEPS,
   [   glib-2.0 >= 2.16
       gobject-2.0 >= 2.10
-      gdk-3.0 >= 2.90
+      gdk-2.0 >= 2.10
       clutter-1.0 >= 1.2
       cairo >= 1.4
       gio-2.0 >= 2.16
@@ -134,8 +134,8 @@ AC_ARG_ENABLE(gtk,
 
 if test x$enable_gtk = xyes; then
   PKG_CHECK_MODULES(GTK,
-    [   gtk+-3.0 >= 2.90
-        clutter-gtk-1.0 >= 0.90
+    [   gtk+-2.0 >= 2.12
+        clutter-gtk-0.10 >= 0.10
     ]
   )
   AC_SUBST(GTK_CFLAGS)
-- 
1.7.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]