]> Pileus Git - grits/commitdiff
Split gis-object.{c,h} -> gis-{object,marker,callback}.{c,h}
authorAndy Spencer <andy753421@gmail.com>
Wed, 3 Feb 2010 12:10:54 +0000 (12:10 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 3 Feb 2010 12:16:16 +0000 (12:16 +0000)
12 files changed:
src/gis-opengl.c
src/gis-util.h
src/gis.h
src/objects/Makefile.am
src/objects/gis-callback.c [new file with mode: 0644]
src/objects/gis-callback.h [new file with mode: 0644]
src/objects/gis-marker.c [new file with mode: 0644]
src/objects/gis-marker.h [new file with mode: 0644]
src/objects/gis-object.c
src/objects/gis-object.h
src/objects/gis-tile.c
src/objects/gis-tile.h

index f420e759394ffcac758b0dde1b28ad73180d60c3..f0b89f03145735f42b4a759dcd1dc933b1a0e8c4 100644 (file)
 
 #include "gis-opengl.h"
 #include "gis-util.h"
-#include "gis-object.h"
 #include "roam.h"
 
+#include "gis-object.h"
+#include "gis-marker.h"
+#include "gis-callback.h"
+
 #define FOV_DIST   2000.0
 #define MPPX(dist) (4*dist/FOV_DIST)
 
index b2457b093d3f0d7bd23b1f85db70dfff265c3a8c..3bc4d660013eb20a93faae07b5ae5825fb987e04 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef __GIS_UTIL_H__
 #define __GIS_UTIL_H__
 
+#include <glib.h>
+
 #define EARTH_R (6371000)
 #define EARTH_C (2*G_PI*EARTH_R)
 #define NORTH  90
index fdc083e861089236568934b4827d2af3e36051c2..462abbfcfca133948eb332b93c7585ebe9d02767 100644 (file)
--- a/src/gis.h
+++ b/src/gis.h
 #include "gis-viewer.h"
 #include "gis-opengl.h"
 #include "gis-prefs.h"
-
-/* GIS helprs */
 #include "gis-util.h"
+
+/* GIS objects */
+#include "gis-object.h"
 #include "gis-tile.h"
+#include "gis-marker.h"
+#include "gis-callback.h"
+
+/* GIS data */
 #include "gis-wms.h"
 #include "gis-data.h"
 
index eb7fe2147cab429a2a9a3f701291cf2a994ffab1..9cf5b6ac59b2e164e73a5041b21ce3d88860e3d8 100644 (file)
@@ -8,8 +8,10 @@ gis_include_HEADERS = \
 
 noinst_LTLIBRARIES = libgis-objects.la
 libgis_objects_la_SOURCES = \
-       gis-object.c gis-object.h \
-       gis-tile.c   gis-tile.h
+       gis-object.c   gis-object.h \
+       gis-marker.c   gis-marker.h \
+       gis-callback.c gis-callback.h \
+       gis-tile.c     gis-tile.h
 libgis_objects_la_LDFLAGS = -static
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/objects/gis-callback.c b/src/objects/gis-callback.c
new file mode 100644 (file)
index 0000000..b739159
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include "gis-callback.h"
+
+/* GisCallback */
+G_DEFINE_TYPE(GisCallback, gis_callback, GIS_TYPE_OBJECT);
+static void gis_callback_init(GisCallback *self) { }
+static void gis_callback_class_init(GisCallbackClass *klass) { }
+
+GisCallback *gis_callback_new(GisCallbackFunc callback, gpointer user_data)
+{
+       GisCallback *self = g_object_new(GIS_TYPE_CALLBACK, NULL);
+       self->callback  = callback;
+       self->user_data = user_data;
+       return self;
+}
diff --git a/src/objects/gis-callback.h b/src/objects/gis-callback.h
new file mode 100644 (file)
index 0000000..8677fa6
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIS_CALLBACK_H__
+#define __GIS_CALLBACK_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include "gis-object.h"
+
+/* GisCallback */
+#define GIS_TYPE_CALLBACK (gis_callback_get_type())
+
+GOBJECT_HEAD(
+       GIS, CALLBACK,
+       Gis, Callback,
+       gis, callback);
+
+typedef gpointer (*GisCallbackFunc)(GisCallback *callback, gpointer user_data);
+
+struct _GisCallback {
+       GisObject       parent;
+       GisCallbackFunc callback;
+       gpointer        user_data;
+};
+
+struct _GisCallbackClass {
+       GisObjectClass parent_class;
+};
+
+GisCallback *gis_callback_new(GisCallbackFunc callback, gpointer user_data);
+
+#endif
diff --git a/src/objects/gis-marker.c b/src/objects/gis-marker.c
new file mode 100644 (file)
index 0000000..0033080
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include "gis-marker.h"
+
+/* GisMarker */
+G_DEFINE_TYPE(GisMarker, gis_marker, GIS_TYPE_OBJECT);
+static void gis_marker_init(GisMarker *self) { }
+
+static void gis_marker_finalize(GObject *_self);
+static void gis_marker_class_init(GisMarkerClass *klass)
+{
+       G_OBJECT_CLASS(klass)->finalize = gis_marker_finalize;
+}
+
+GisMarker *gis_marker_new(const gchar *label)
+{
+       static const int RADIUS =   4;
+       static const int WIDTH  = 100;
+       static const int HEIGHT =  20;
+
+       GisMarker *self = g_object_new(GIS_TYPE_MARKER, NULL);
+       self->xoff  = RADIUS;
+       self->yoff  = HEIGHT-RADIUS;
+       self->label = g_strdup(label);
+       self->cairo = cairo_create(cairo_image_surface_create(
+                               CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT));
+       cairo_set_source_rgba(self->cairo, 1, 1, 1, 1);
+       cairo_arc(self->cairo, self->xoff, self->yoff, RADIUS, 0, 2*G_PI);
+       cairo_fill(self->cairo);
+       cairo_move_to(self->cairo, self->xoff+4, self->yoff-8);
+       cairo_set_font_size(self->cairo, 10);
+       cairo_show_text(self->cairo, self->label);
+       return self;
+}
+
+static void gis_marker_finalize(GObject *_self)
+{
+       GisMarker *self = GIS_MARKER(_self);
+       cairo_surface_destroy(cairo_get_target(self->cairo));
+       cairo_destroy(self->cairo);
+       g_free(self->label);
+       g_free(self);
+}
diff --git a/src/objects/gis-marker.h b/src/objects/gis-marker.h
new file mode 100644 (file)
index 0000000..c712759
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIS_MARKER_H__
+#define __GIS_MARKER_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <cairo.h>
+#include "gis-object.h"
+
+/* GisMarker */
+#define GIS_TYPE_MARKER (gis_marker_get_type())
+
+GOBJECT_HEAD(
+       GIS, MARKER,
+       Gis, Marker,
+       gis, marker);
+
+struct _GisMarker {
+       GisObject  parent_instance;
+       gint       xoff, yoff;
+       gchar     *label;
+       cairo_t   *cairo;
+       guint      tex;
+};
+
+struct _GisMarkerClass {
+       GisObjectClass parent_class;
+};
+
+GisMarker *gis_marker_new(const gchar *label);
+
+#endif
index fe51eb13b0e91c2c39afa4d7bb0a71767d93d09a..b86933705375b86a07fe3da1f48fa40f953ca55d 100644 (file)
@@ -15,9 +15,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <glib.h>
-#include <GL/glu.h>
-
+#include <config.h>
 #include "gis-object.h"
 
 /* GisPoint */
@@ -43,58 +41,3 @@ void gis_point_free(GisPoint *self)
 G_DEFINE_TYPE(GisObject, gis_object, G_TYPE_OBJECT);
 static void gis_object_init(GisObject *self) { }
 static void gis_object_class_init(GisObjectClass *klass) { }
-
-
-/* GisMarker */
-G_DEFINE_TYPE(GisMarker, gis_marker, GIS_TYPE_OBJECT);
-static void gis_marker_init(GisMarker *self) { }
-
-static void gis_marker_finalize(GObject *_self);
-static void gis_marker_class_init(GisMarkerClass *klass)
-{
-       G_OBJECT_CLASS(klass)->finalize = gis_marker_finalize;
-}
-
-GisMarker *gis_marker_new(const gchar *label)
-{
-       static const int RADIUS =   4;
-       static const int WIDTH  = 100;
-       static const int HEIGHT =  20;
-
-       GisMarker *self = g_object_new(GIS_TYPE_MARKER, NULL);
-       self->xoff  = RADIUS;
-       self->yoff  = HEIGHT-RADIUS;
-       self->label = g_strdup(label);
-       self->cairo = cairo_create(cairo_image_surface_create(
-                               CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT));
-       cairo_set_source_rgba(self->cairo, 1, 1, 1, 1);
-       cairo_arc(self->cairo, self->xoff, self->yoff, RADIUS, 0, 2*G_PI);
-       cairo_fill(self->cairo);
-       cairo_move_to(self->cairo, self->xoff+4, self->yoff-8);
-       cairo_set_font_size(self->cairo, 10);
-       cairo_show_text(self->cairo, self->label);
-       return self;
-}
-
-static void gis_marker_finalize(GObject *_self)
-{
-       GisMarker *self = GIS_MARKER(_self);
-       cairo_surface_destroy(cairo_get_target(self->cairo));
-       cairo_destroy(self->cairo);
-       g_free(self->label);
-       g_free(self);
-}
-
-
-/* GisCallback */
-G_DEFINE_TYPE(GisCallback, gis_callback, GIS_TYPE_OBJECT);
-static void gis_callback_init(GisCallback *self) { }
-static void gis_callback_class_init(GisCallbackClass *klass) { }
-
-GisCallback *gis_callback_new(GisCallbackFunc callback, gpointer user_data)
-{
-       GisCallback *self = g_object_new(GIS_TYPE_CALLBACK, NULL);
-       self->callback  = callback;
-       self->user_data = user_data;
-       return self;
-}
index acc425506451c0f876c58db9178bbc32405cfd3f..baf21db9cb7f4bb1e99163bd922ffdf1ed31130c 100644 (file)
@@ -20,8 +20,6 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <cairo.h>
-
 
 /* Take that GLib boilerplate! */
 #define GOBJECT_HEAD( \
@@ -97,50 +95,4 @@ static inline GisPoint *gis_object_center(GisObject *object)
        return &GIS_OBJECT(object)->center;
 }
 
-
-/* GisMarker */
-#define GIS_TYPE_MARKER (gis_marker_get_type())
-
-GOBJECT_HEAD(
-       GIS, MARKER,
-       Gis, Marker,
-       gis, marker);
-
-struct _GisMarker {
-       GisObject  parent_instance;
-       gint       xoff, yoff;
-       gchar     *label;
-       cairo_t   *cairo;
-       guint      tex;
-};
-
-struct _GisMarkerClass {
-       GisObjectClass parent_class;
-};
-
-GisMarker *gis_marker_new(const gchar *label);
-
-
-/* GisCallback */
-#define GIS_TYPE_CALLBACK (gis_callback_get_type())
-
-GOBJECT_HEAD(
-       GIS, CALLBACK,
-       Gis, Callback,
-       gis, callback);
-
-typedef gpointer (*GisCallbackFunc)(GisCallback *callback, gpointer user_data);
-
-struct _GisCallback {
-       GisObject       parent;
-       GisCallbackFunc callback;
-       gpointer        user_data;
-};
-
-struct _GisCallbackClass {
-       GisObjectClass parent_class;
-};
-
-GisCallback *gis_callback_new(GisCallbackFunc callback, gpointer user_data);
-
 #endif
index cf3f85777743042923693282ada0e6d9d9dc3b96..d11af4f3f72f8f51ebc3be6c30fcac259de97a5c 100644 (file)
  */
 
 #include <config.h>
-#include <glib.h>
-
-#include "gis-tile.h"
 #include "gis-util.h"
+#include "gis-tile.h"
 
 gchar *gis_tile_path_table[2][2] = {
        {"00.", "01."},
index b7e912336aee50663daad59a8e91acbff7b2bc2b..698c0c42952d518e413bae1a397fa004fe6cc697 100644 (file)
@@ -19,6 +19,7 @@
 #define __GIS_TILE_H__
 
 #include <glib.h>
+#include <glib-object.h>
 #include "gis-object.h"
 
 #define GIS_TYPE_TILE (gis_tile_get_type())