]> Pileus Git - grits/blob - src/gis_test.c
Markers as individual textures
[grits] / src / gis_test.c
1 /*
2  * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #include <config.h>
19 #include <gtk/gtk.h>
20 #include <gdk/gdkkeysyms.h>
21
22 #include "gis.h"
23
24 /*************
25  * Callbacks *
26  *************/
27 static gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer _)
28 {
29         g_debug("GisTest: on_key_press - key=%x, state=%x",
30                         event->keyval, event->state);
31         switch (event->keyval) {
32         case GDK_q:
33                 gtk_widget_destroy(widget);
34                 return TRUE;
35         }
36         return FALSE;
37 }
38
39 /***********
40  * Methods *
41  ***********/
42 int main(int argc, char **argv)
43 {
44         g_thread_init(NULL);
45         gdk_threads_init();
46         gtk_init(&argc, &argv);
47
48         GisPrefs   *prefs   = gis_prefs_new(NULL, NULL);
49         GisPlugins *plugins = gis_plugins_new(NULL);
50         GisViewer  *viewer  = gis_opengl_new(plugins);
51
52         gdk_threads_enter();
53         GtkWidget  *window  = gtk_window_new(GTK_WINDOW_TOPLEVEL);
54         g_signal_connect(window,  "destroy",         G_CALLBACK(gtk_main_quit), NULL);
55         g_signal_connect(window,  "key-press-event", G_CALLBACK(on_key_press),  NULL);
56         gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(viewer));
57         gtk_widget_show_all(window);
58         gdk_threads_leave();
59
60         gis_plugins_load(plugins, "bmng", viewer, prefs);
61         //gis_plugins_load(plugins, "srtm", viewer, prefs);
62         gis_plugins_load(plugins, "test", viewer, prefs);
63
64         gis_viewer_set_site(viewer, "KLSX");
65
66         gdk_threads_enter();
67         gtk_main();
68
69         g_object_unref(prefs);
70         g_object_unref(viewer);
71         gis_plugins_free(plugins);
72         gdk_threads_leave();
73         return 0;
74 }