[libchamplainmm] View: Cleanup and update



commit 8c2bb50cb350323d7c1453c87c577fdf42cdd810
Author: Juan R. García Blanco <juanrgar gmail com>
Date:   Sun Jun 8 20:46:00 2014 +0200

    View: Cleanup and update
    
    Add new convert_clutter.m4 to deal with specific clutter conversions,
    since cluttermm's own convert_clutter.m4 is under codegen/m4.

 champlain/src/layer.hg      |    2 +
 champlain/src/view.ccg      |   23 +++++++
 champlain/src/view.hg       |  154 ++++++++++++++++++++++--------------------
 tools/m4/convert.m4         |    1 +
 tools/m4/convert_clutter.m4 |    3 +
 5 files changed, 110 insertions(+), 73 deletions(-)
---
diff --git a/champlain/src/layer.hg b/champlain/src/layer.hg
index 91d95c4..67be836 100644
--- a/champlain/src/layer.hg
+++ b/champlain/src/layer.hg
@@ -26,6 +26,8 @@ _PINCLUDE(cluttermm/private/actor_p.h)
 namespace Champlain
 {
 
+class View;
+
 /** Base class of libchamplain layers.
  *
  * Every layer (overlay that moves together with the map) has to inherit this
diff --git a/champlain/src/view.ccg b/champlain/src/view.ccg
index e69de29..98e7f82 100644
--- a/champlain/src/view.ccg
+++ b/champlain/src/view.ccg
@@ -0,0 +1,23 @@
+/* Copyright (c) 2014  Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm 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.
+ *
+ * libchamplainmm 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 program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <champlain/champlain.h>
+
+namespace Champlain
+{
+} // namespace Champlain
diff --git a/champlain/src/view.hg b/champlain/src/view.hg
index e83e87c..bd13f2c 100644
--- a/champlain/src/view.hg
+++ b/champlain/src/view.hg
@@ -16,27 +16,29 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <cluttermm.h>
-#include <champlainmm/tile.h>
+#include <cluttermm/actor.h>
+#include <cluttermm/content.h>
+#include <cluttermm/types.h>
+#include <champlainmm/bounding-box.h>
+#include <champlainmm/map-source.h>
+#include <champlainmm/layer.h>
+#include <champlainmm/license.h>
 
 _DEFS(champlainmm,champlain)
-
-_CC_INCLUDE(champlain/champlain.h)
-_CC_INCLUDE(champlainmm/layer.h)
-_CC_INCLUDE(champlainmm/map-source.h)
-_PINCLUDE(cluttermm/private/group_p.h)
+_PINCLUDE(cluttermm/private/actor_p.h)
 
 namespace Champlain
 {
 
 class Layer;
-class MapSource;
 
-class View :
-    public Clutter::Group
+class View : public Clutter::Actor
 {
-  _CLASS_GOBJECT(View, ChamplainView, CHAMPLAIN_VIEW,
-                 Clutter::Group, ClutterGroup)
+  /** 
+   *
+   * @newin{0,1}
+   */
+  _CLASS_GOBJECT(View, ChamplainView, CHAMPLAIN_VIEW, Clutter::Actor, ClutterActor)
 
 protected:
   _CTOR_DEFAULT()
@@ -44,67 +46,68 @@ protected:
 public:
   _WRAP_CREATE()
 
-  _WRAP_METHOD(void center_on(double latitude, double longitude),
-               champlain_view_center_on)
-
-  _WRAP_METHOD(Glib::RefPtr<const MapSource> get_map_source() const,
-               champlain_view_get_map_source)
-  _WRAP_METHOD(Glib::RefPtr<MapSource> get_map_source(),
-               champlain_view_get_map_source)
-  _WRAP_METHOD(double get_decel_rate() const,
-               champlain_view_get_decel_rate)
-  _WRAP_METHOD(bool get_keep_center_on_resize() const,
-               champlain_view_get_keep_center_on_resize)
-  _WRAP_METHOD(guint get_max_zoom_level() const,
-               champlain_view_get_max_zoom_level)
-  _WRAP_METHOD(guint get_min_zoom_level() const,
-               champlain_view_get_min_zoom_level)
-  _WRAP_METHOD(bool get_show_license(),
-               champlain_view_get_show_license)
-  _WRAP_METHOD(guint get_max_level() const,
-               champlain_view_get_zoom_level)
-  _WRAP_METHOD(bool get_zoom_on_double_click(),
-               champlain_view_get_zoom_on_double_click)
-
-  _WRAP_METHOD(void go_to(double latitude, double longitude),
-               champlain_view_go_to)
+  _WRAP_METHOD(void center_on(double latitude, double longitude), champlain_view_center_on)
+  _WRAP_METHOD(void go_to(double latitude, double longitude), champlain_view_go_to)
   _WRAP_METHOD(void stop_go_to(), champlain_view_stop_go_to)
+  _WRAP_METHOD(double get_center_latitude() const, champlain_view_get_center_latitude)
+  _WRAP_METHOD(double get_center_longitude() const, champlain_view_get_center_longitude)
 
   _WRAP_METHOD(void zoom_in(), champlain_view_zoom_in)
   _WRAP_METHOD(void zoom_out(), champlain_view_zoom_out)
-  _WRAP_METHOD(void set_zoom_level(guint zoom_level),
-               champlain_view_set_zoom_level)
-  _WRAP_METHOD(void set_max_zoom_level(guint zoom_level),
-               champlain_view_set_max_zoom_level)
-  _WRAP_METHOD(void set_min_zoom_level(guint zoom_level),
-               champlain_view_set_min_zoom_level)
-
-  _WRAP_METHOD(void set_map_source(const Glib::RefPtr<MapSource> & map_source),
-               champlain_view_set_map_source)
-  _WRAP_METHOD(void set_size(guint width, guint height),
-               champlain_view_set_size)
-  _WRAP_METHOD(void set_decel_rate(double rate),
-               champlain_view_set_decel_rate)
-  _WRAP_METHOD(void set_keep_center_on_resize(bool value),
-               champlain_view_set_keep_center_on_resize)
-  _WRAP_METHOD(void set_show_license(bool value),
-               champlain_view_set_show_license)
-  _WRAP_METHOD(void set_zoom_on_double_click(bool value),
-               champlain_view_set_zoom_on_double_click)
-
-  _WRAP_METHOD(void add_layer(const Glib::RefPtr<Layer> & layer),
-               champlain_view_add_layer)
-  _WRAP_METHOD(void remove_layer(const Glib::RefPtr<Layer> & layer),
-               champlain_view_remove_layer)
-
-  _WRAP_METHOD(void get_coords_at(guint x, guint y,
-                                  double & latitude,
-                                  double & longitude),
-               champlain_view_get_coords_at)
-  _WRAP_METHOD(void get_coords_from_event(Clutter::Event & event,
-                                          double & latitude,
-                                          double & longitude),
-               champlain_view_get_coords_from_event)
+  _WRAP_METHOD(void set_zoom_level(guint zoom_level), champlain_view_set_zoom_level)
+  _WRAP_METHOD(void set_min_zoom_level(guint zoom_level), champlain_view_set_min_zoom_level)
+  _WRAP_METHOD(void set_max_zoom_level(guint zoom_level), champlain_view_set_max_zoom_level)
+
+  _WRAP_METHOD(void ensure_visible(BoundingBox& bbox, bool animate), champlain_view_ensure_visible)
+  _WRAP_METHOD(void ensure_layers_visible(bool animate), champlain_view_ensure_layers_visible)
+
+  _WRAP_METHOD(void set_map_source(const Glib::RefPtr<MapSource>& map_source), champlain_view_set_map_source)
+  _WRAP_METHOD(void add_overlay_source(const Glib::RefPtr<MapSource>& map_source, guint8 opacity), 
champlain_view_add_overlay_source)
+  _WRAP_METHOD(void remove_overlay_source(const Glib::RefPtr<MapSource>& map_source), 
champlain_view_remove_overlay_source)
+  // TODO get_overlay_sources
+
+  _WRAP_METHOD(void set_deceleration(double rate), champlain_view_set_deceleration)
+  _WRAP_METHOD(void set_kinetic_mode(bool kinetic = true), champlain_view_set_kinetic_mode)
+  _WRAP_METHOD(void set_keep_center_on_resize(bool value = true), champlain_view_set_keep_center_on_resize)
+  _WRAP_METHOD(void set_zoom_on_double_click(bool value = true), champlain_view_set_zoom_on_double_click)
+  _WRAP_METHOD(void set_animate_zoom(bool value = true), champlain_view_set_animate_zoom)
+  _WRAP_METHOD(void set_background_pattern(const Glib::RefPtr<Clutter::Content>& background), 
champlain_view_set_background_pattern)
+
+  _WRAP_METHOD(void add_layer(const Glib::RefPtr<Layer>& layer), champlain_view_add_layer)
+  _WRAP_METHOD(void remove_layer(const Glib::RefPtr<Layer>& layer), champlain_view_remove_layer)
+
+  _WRAP_METHOD(guint get_zoom_level() const, champlain_view_get_zoom_level)
+  _WRAP_METHOD(guint get_min_zoom_level() const, champlain_view_get_min_zoom_level)
+  _WRAP_METHOD(guint get_max_zoom_level() const, champlain_view_get_max_zoom_level)
+  _WRAP_METHOD(Glib::RefPtr<MapSource> get_map_source(), champlain_view_get_map_source)
+  _WRAP_METHOD(Glib::RefPtr<const MapSource> get_map_source() const, champlain_view_get_map_source, 
constversion)
+  _WRAP_METHOD(double get_deceleration() const, champlain_view_get_deceleration)
+  _WRAP_METHOD(bool get_kinetic_mode() const, champlain_view_get_kinetic_mode)
+  _WRAP_METHOD(bool get_keep_center_on_resize() const, champlain_view_get_keep_center_on_resize)
+  _WRAP_METHOD(bool get_zoom_on_double_click() const, champlain_view_get_zoom_on_double_click)
+  _WRAP_METHOD(bool get_animate_zoom() const, champlain_view_get_animate_zoom)
+  _WRAP_METHOD(State get_state() const, champlain_view_get_state)
+  _WRAP_METHOD(Glib::RefPtr<Clutter::Content> get_background_pattern(), 
champlain_view_get_background_pattern)
+  _WRAP_METHOD(Glib::RefPtr<const Clutter::Content> get_background_pattern() const, 
champlain_view_get_background_pattern, constversion)
+
+  _WRAP_METHOD(void reload_tiles(), champlain_view_reload_tiles)
+
+  _WRAP_METHOD(double x_to_longitude(double x) const, champlain_view_x_to_longitude)
+  _WRAP_METHOD(double y_to_latitude(double x) const, champlain_view_y_to_latitude)
+  _WRAP_METHOD(double longitude_to_x(double longitude) const, champlain_view_longitude_to_x)
+  _WRAP_METHOD(double latitude_to_y(double latitude) const, champlain_view_latitude_to_y)
+
+// TODO
+//  _WRAP_METHOD(void get_viewport_origin(int
+
+// TODO
+//  _WRAP_METHOD(void bin_layout_add(), champlain_view_bin_layout_add, deprecated)
+
+  _WRAP_METHOD(Glib::RefPtr<License> get_license_actor(), champlain_view_get_license_actor)
+  _WRAP_METHOD(Glib::RefPtr<const License> get_license_actor() const, champlain_view_get_license_actor, 
constversion)
+
+  _WRAP_METHOD(BoundingBox get_bounding_box() const, champlain_view_get_bounding_box)
+  _WRAP_METHOD(BoundingBox get_bounding_box_for_zoom_level(guint zoom_level) const, 
champlain_view_get_bounding_box_for_zoom_level)
 
   _WRAP_PROPERTY("longitude", double)
   _WRAP_PROPERTY("latitude", double)
@@ -112,14 +115,19 @@ public:
   _WRAP_PROPERTY("min-zoom-level", int)
   _WRAP_PROPERTY("max-zoom-level", int)
   _WRAP_PROPERTY("map-source", Glib::RefPtr<MapSource>)
-  _WRAP_PROPERTY("decel-rate", double)
+  _WRAP_PROPERTY("kinetic-mode", bool)
+  _WRAP_PROPERTY("deceleration", double)
   _WRAP_PROPERTY("keep-center-on-resize", bool)
-  _WRAP_PROPERTY("show-license", bool)
   _WRAP_PROPERTY("zoom-on-double-click", bool)
+  _WRAP_PROPERTY("animate-zoom", bool)
   _WRAP_PROPERTY("state", State)
+  _WRAP_PROPERTY("background-pattern", Glib::RefPtr<Clutter::Actor>)
+  _WRAP_PROPERTY("goto-animation-mode", Clutter::AnimationMode)
+  _WRAP_PROPERTY("goto-animation-duration", guint)
 
-  _WRAP_SIGNAL(void animation_completed(), "animation_completed",
-               no_default_handler)
+// animation_completed is a detailed signal
+//  _WRAP_SIGNAL(void animation_completed(), "animation_completed", no_default_handler)
+  _WRAP_SIGNAL(void layer_relocated(), "layer_relocated", no_default_handler)
 };
 
 } // namespace Champlain
diff --git a/tools/m4/convert.m4 b/tools/m4/convert.m4
index aac5f4c..9a89928 100644
--- a/tools/m4/convert.m4
+++ b/tools/m4/convert.m4
@@ -2,5 +2,6 @@ dnl Include gmmproc type conversion definitions:
 m4_include(`convert_base.m4')
 m4_include(`convert_glib.m4')
 m4_include(`convert_pango.m4')
+m4_include(`convert_clutter.m4')
 m4_include(`convert_libchamplain.m4')
 m4_include(`class_gtkobject.m4')
diff --git a/tools/m4/convert_clutter.m4 b/tools/m4/convert_clutter.m4
new file mode 100644
index 0000000..8a2d70a
--- /dev/null
+++ b/tools/m4/convert_clutter.m4
@@ -0,0 +1,3 @@
+_CONVERSION(`const Glib::RefPtr<Clutter::Content>&',`ClutterContent*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`ClutterContent*',`Glib::RefPtr<Clutter::Content>',`Glib::wrap($3)')
+_CONVERSION(`ClutterContent*',`Glib::RefPtr<const Clutter::Content>',`Glib::wrap($3)')


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